fix (qodana) fix condlicts

This commit is contained in:
FLIO 2023-02-01 23:38:49 +01:00
commit 0080b0a80f
2929 changed files with 80743 additions and 47800 deletions

25
.github/workflows/code_quality.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: Qodana
on:
schedule:
- cron: "0 20 * * *"
workflow_dispatch:
branches:
- develop
# push:
# branches:
# - develop
jobs:
qodana:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
#php-version: '7.1'
- name: 'Qodana Scan'
uses: JetBrains/qodana-action@v2022.3.2
#with:
# php-version: '7.1'
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}

View File

@ -0,0 +1,38 @@
# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: Doxygen
on:
schedule:
- cron: "0 15 * * *"
workflow_dispatch:
branches:
- develop
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Build
uses: DenverCoder1/doxygen-github-pages-action@v1.2.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: build/html
config_file: build/doxygen/dolibarr-doxygen.doxyfile
# - name: Deploy
# uses: JamesIves/github-pages-deploy-action@v4
# with:
# branch: gh-pages
# folder: build/html # The folder the action should deploy.
# target-folder: docs/html2
#jobs:
# doxygen:
# runs-on: ubuntu-latest
# steps:
# - name: 'Doxygen'
# uses: mattnotmitt/doxygen-action@1.9.5
# with:
# doxyfile-path: build/doxygen

View File

@ -4,6 +4,9 @@ name: "Exakat analysis"
on: on:
schedule: schedule:
- cron: "0 20 * * *" - cron: "0 20 * * *"
workflow_dispatch:
branches:
- develop
permissions: permissions:
contents: read contents: read
@ -13,6 +16,8 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Exakat - name: Exakat
uses: docker://exakat/exakat-ga uses: docker://exakat/exakat-ga
with: with:

View File

@ -6,6 +6,7 @@ on:
- cron: "0 21 * * *" - cron: "0 21 * * *"
issue_comment: issue_comment:
types: [created] types: [created]
workflow_dispatch:
permissions: {} # none permissions: {} # none

1
.gitignore vendored
View File

@ -14,7 +14,6 @@ default.properties
/.pydevproject /.pydevproject
/.vscode /.vscode
.DS_Store .DS_Store
.idea
*.iml *.iml
*.orig *.orig
Thumbs.db Thumbs.db

5
.idea/php.xml Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="7.0">
<component name="PhpProjectSharedConfiguration" php_language_level="7.0" />
</project>

View File

@ -8,21 +8,24 @@ build:
override: override:
- command: php-scrutinizer-run - command: php-scrutinizer-run
idle_timeout: 8000 idle_timeout: 8000
#- php-scrutinizer-run --sub-project-dir=htdocs/admin
imports: imports:
- javascript
- php - php
filter: filter:
excluded_paths: excluded_paths:
- build/* - build/
- dev/* - dev/
- doc/* - doc/
- documents/* - documents/
- node_modules/* - node_modules/
- test/* - test/
dependency_paths: - htdocs/custom/
- htdocs/includes/* - htdocs/includes/
- htdocs/install/doctemplates/
#dependency_paths:
# - htdocs/includes/
paths: paths:
- htdocs/* - htdocs/*
- scripts/* - scripts/*
@ -33,21 +36,23 @@ tools:
enabled: true enabled: true
extensions: extensions:
- php - php
dependency_paths: #dependency_paths:
- htdocs/includes/ # - htdocs/includes/
filter: filter:
excluded_paths: excluded_paths:
- build/* - build/
- dev/* - dev/
- doc/* - doc/
- documents/* - documents/
- htdocs/includes/* - htdocs/custom/
- htdocs/includes/
- htdocs/install/doctemplates/
- htdocs/core/class/lessc.class.php - htdocs/core/class/lessc.class.php
- node_modules/* - node_modules/
- test/* - test/
paths: paths:
- htdocs/ - htdocs/*
- scripts/ - scripts/*
config: config:
parameter_reference_check: parameter_reference_check:
enabled: true enabled: true
@ -156,73 +161,73 @@ tools:
# To use specific config for a specific path, use path_configs: (see example on page https://scrutinizer-ci.com/docs/configuration/tool_config_structure) # 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_depend
php_pdepend: #php_pdepend:
enabled: false # enabled: false
configuration_file: null # configuration_file: null
suffixes: # suffixes:
- php # - php
excluded_dirs: { } # excluded_dirs: { }
filter: # filter:
excluded_paths: # excluded_paths:
- 'build/*' # - 'build/*'
- 'dev/*' # - 'dev/*'
- 'doc/*' # - 'doc/*'
- 'test/*' # - 'test/*'
- 'htdocs/includes/*' # - 'htdocs/includes/*'
paths: { } # paths: { }
# change tracking # change tracking
php_changetracking: #php_changetracking:
enabled: false # enabled: false
bug_patterns: # bug_patterns:
- '\bfix(?:es|ed)?\b' # - '\bfix(?:es|ed)?\b'
feature_patterns: # feature_patterns:
- '\badd(?:s|ed)?\b' # - '\badd(?:s|ed)?\b'
- '\bimplement(?:s|ed)?\b' # - '\bimplement(?:s|ed)?\b'
filter: # filter:
excluded_paths: # excluded_paths:
- 'build/*' # - 'build/*'
- 'dev/*' # - 'dev/*'
- 'doc/*' # - 'doc/*'
- 'documents/*' # - 'documents/*'
- 'htdocs/includes/*' # - 'htdocs/includes/*'
- 'node_modules/*' # - 'node_modules/*'
- 'test/*' # - 'test/*'
paths: { } # paths: { }
# Similar code detection # Similar code detection
php_sim: #php_sim:
enabled: false # enabled: false
min_mass: 30 # min_mass: 30
filter: # filter:
excluded_paths: # excluded_paths:
- 'build/*' # - 'build/*'
- 'dev/*' # - 'dev/*'
- 'doc/*' # - 'doc/*'
- 'documents/*' # - 'documents/*'
- 'htdocs/includes/*' # - 'htdocs/includes/*'
- 'node_modules/*' # - 'node_modules/*'
- 'test/*' # - 'test/*'
paths: { } # paths: { }
# Coding-Style / Bug Detection # Coding-Style / Bug Detection
js_hint: #js_hint:
enabled: false # enabled: false
use_native_config: true # use_native_config: true
extensions: # extensions:
- js # - js
filter: # filter:
excluded_paths: # excluded_paths:
- 'build/*' # - 'build/*'
- 'dev/*' # - 'dev/*'
- 'doc/*' # - 'doc/*'
- 'documents/*' # - 'documents/*'
- 'htdocs/includes/*' # - 'htdocs/includes/*'
- 'node_modules/*' # - 'node_modules/*'
- 'test/*' # - 'test/*'
paths: { } # paths: { }
config: { } # config: { }
path_configs: { } # path_configs: { }
before_commands: { } before_commands: { }

View File

@ -95,19 +95,20 @@ notifications:
install: install:
- | - |
echo "Updating Composer" echo "Updating Composer config"
rm $TRAVIS_BUILD_DIR/composer.json
rm $TRAVIS_BUILD_DIR/composer.lock
composer -V composer -V
composer self-update #rm $TRAVIS_BUILD_DIR/composer.json
composer -n init #rm $TRAVIS_BUILD_DIR/composer.lock
composer -n config vendor-dir htdocs/includes #composer -n init
#composer -n config vendor-dir htdocs/includes
composer -n config -g vendor-dir htdocs/includes composer -n config -g vendor-dir htdocs/includes
echo echo
- | - |
echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer, PHP Vardump check - for $TRAVIS_PHP_VERSION" echo "Update Composer version and Install tools - PHP Unit, Parallel Lint, PHP CodeSniffer, PHP Vardump check - for $TRAVIS_PHP_VERSION"
echo "(version 2.5 is bugged and generate phpunit error Exception: Serialization of 'Closure' is not allowed)"
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then
composer self-update 2.2.18
composer -n require phpunit/phpunit ^6 \ composer -n require phpunit/phpunit ^6 \
php-parallel-lint/php-parallel-lint ^1 \ php-parallel-lint/php-parallel-lint ^1 \
php-parallel-lint/php-console-highlighter ^0 \ php-parallel-lint/php-console-highlighter ^0 \
@ -115,6 +116,7 @@ install:
squizlabs/php_codesniffer ^3 squizlabs/php_codesniffer ^3
fi fi
if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ]; then if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ]; then
composer self-update 2.2.18
composer -n require phpunit/phpunit ^7 \ composer -n require phpunit/phpunit ^7 \
php-parallel-lint/php-parallel-lint ^1.2 \ php-parallel-lint/php-parallel-lint ^1.2 \
php-parallel-lint/php-console-highlighter ^0 \ php-parallel-lint/php-console-highlighter ^0 \
@ -123,12 +125,15 @@ install:
fi fi
# phpunit 9 is required for php 8 # phpunit 9 is required for php 8
if [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then if [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
composer self-update 2.4.4
composer -n require --ignore-platform-reqs phpunit/phpunit ^8 \ composer -n require --ignore-platform-reqs phpunit/phpunit ^8 \
php-parallel-lint/php-parallel-lint ^1.2 \ php-parallel-lint/php-parallel-lint ^1.2 \
php-parallel-lint/php-console-highlighter ^0 \ php-parallel-lint/php-console-highlighter ^0 \
php-parallel-lint/php-var-dump-check ~0.4 \ php-parallel-lint/php-var-dump-check ~0.4 \
squizlabs/php_codesniffer ^3 squizlabs/php_codesniffer ^3
fi fi
# Remove non expected files
rm -fr /home/travis/build/Dolibarr/dolibarr/htdocs/includes/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js
echo echo
- | - |
@ -450,6 +455,9 @@ script:
php upgrade.php 16.0.0 17.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade16001700.log php upgrade.php 16.0.0 17.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade16001700.log
php upgrade2.php 16.0.0 17.0.0 > $TRAVIS_BUILD_DIR/upgrade16001700-2.log php upgrade2.php 16.0.0 17.0.0 > $TRAVIS_BUILD_DIR/upgrade16001700-2.log
php step5.php 16.0.0 17.0.0 > $TRAVIS_BUILD_DIR/upgrade16001700-3.log php step5.php 16.0.0 17.0.0 > $TRAVIS_BUILD_DIR/upgrade16001700-3.log
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
ls -alrt $TRAVIS_BUILD_DIR/ ls -alrt $TRAVIS_BUILD_DIR/
- | - |

292
ChangeLog
View File

@ -5,11 +5,16 @@ English Dolibarr ChangeLog
***** ChangeLog for 18.0.0 compared to 17.0.0 ***** ***** ChangeLog for 18.0.0 compared to 17.0.0 *****
NEW: PHP 8.2 compatibility:
WARNING: WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* The deprecated method escapeunderscore() of database handlers has been removed. You must use escapeforlike instead. * The deprecated method "escapeunderscore()" of database handlers has been removed. You must use "escapeforlike()" instead.
* The method "nb_expedition()" has been renamed into "countNbOfShipments()"
* Revert default type of hooks. Default is now 'addreplace' hooks (and exception become 'output' hooks, that become deprecated).
* Deprecated property libelle removed from entrepot class.
@ -19,10 +24,10 @@ For users:
--------------- ---------------
NEW: Minimal PHP version is now PHP 7.0 instead of PHP 5.6 NEW: Minimal PHP version is now PHP 7.0 instead of PHP 5.6
NEW: #21780 Add pid field to Cronjob class and store PID on job execution
NEW: #19680 Add option PRODUCT_ALLOW_EXTERNAL_DOWNLOAD to automatically have uploaded files shared publicly by a link NEW: #19680 Add option PRODUCT_ALLOW_EXTERNAL_DOWNLOAD to automatically have uploaded files shared publicly by a link
NEW: #20650 can move the checkbox column on left (experimental option) NEW: #20650 can move the checkbox column on left (experimental option MAIN_CHECKBOX_LEFT_COLUMN)
NEW: #21000 Added columns 'alias_name' on project, supplier invoice, supplier order, supplier proposals and task list NEW: #21000 Added columns 'alias_name' on project, supplier invoice, supplier order, supplier proposals and task list
NEW: #21780 Add pid field to Cronjob class and store PID on job execution
NEW: #21395 Added option for dark theme mode in display - color and theme NEW: #21395 Added option for dark theme mode in display - color and theme
NEW: #21397 added option to auto define barcode numbers for third-parties in barcode module setup NEW: #21397 added option to auto define barcode numbers for third-parties in barcode module setup
NEW: #21399 NEW: #21399
@ -41,166 +46,180 @@ NEW: #22676 massaction for updating product prices
NEW: #22735 Massaction to affect users on projects NEW: #22735 Massaction to affect users on projects
NEW: #25594 can chose if VAT ID is unique or not for third parties NEW: #25594 can chose if VAT ID is unique or not for third parties
NEW: #4482 adding js to hide/show advanced option on the export data page NEW: #4482 adding js to hide/show advanced option on the export data page
NEW: Accountancy - Add a graphic option to enable lettering function - FPC21
NEW: Accountancy - Add a way to clean some words when you generate thirdparty accounting account
NEW: Accountancy - Added an option during export to export or not the lettering FPC21
NEW: Accountancy - Manage supplier deposit with specific account
NEW: Accountancy - Model Digitaria - Add a way to clean some words when you generate thirdparty accounting account FPC22
NEW: Add a button "Test collect" in email collector
NEW: Add a constant to disallow modification of the product reference. NEW: Add a constant to disallow modification of the product reference.
NEW: Add a method doAutoRenewContracts that can be used as a cron task.
NEW: Add " as enclosure by default for CSV export. Keep removing CR/LF.
NEW: add attached file in presend email form of thirdparty card NEW: add attached file in presend email form of thirdparty card
NEW: Add a way to enter LICENSE file content in property of website NEW: Add a way to enter LICENSE file content in property of website
NEW: Add badge in admin extrafields setup
NEW: add constant PROPAL_BYPASS_VALIDATED_STATUS
NEW: Add date event (!= date project) and location on event organization
NEW: Add employment anniversary in birthday box NEW: Add employment anniversary in birthday box
NEW: Add extrafield type "IP" to store IP addresses
NEW: Add fail2ban rules examples to limit access to /public pages
NEW: Add filter "Product subject to lot/Serial" in stock per lot/serial
NEW: Add hidden option MAIN_EMAIL_SUPPORT_ACK to restore Email ack checkbox (feature abandonned by mailers) NEW: Add hidden option MAIN_EMAIL_SUPPORT_ACK to restore Email ack checkbox (feature abandonned by mailers)
NEW: Add IMAP port setting on email collector module
NEW: Adding JAPAN Chart-of-Account and regions/departments
NEW: Adding NIF verification for Algeria
NEW: Add link to create an element from the category page NEW: Add link to create an element from the category page
NEW: add margin infos to takepos invoice lines
NEW: Add max size send for "backup and link to mail" option NEW: Add max size send for "backup and link to mail" option
NEW: Add method httponly_accessforbidden() NEW: Add method httponly_accessforbidden()
NEW: Add more advices into the Setup security page NEW: Add more advices into the Setup security page
NEW: Add new global variable for keeping the previous signature information on proposale (case of reopen a proposale) NEW: Add new global variable for keeping the previous signature information on proposale (case of reopen a proposale)
NEW: Add objectLink on expedition NEW: Add objectLink on expedition
NEW: Add oldcopy to Ticket so triggers intercepting TICKET_MODIFY have access to old values of the updated properties NEW: Add oldcopy to Ticket so triggers intercepting TICKET_MODIFY have access to old values of the updated properties
NEW: Add option FICHINTER_ALLOW_EXTERNAL_DOWNLOAD
NEW: Add option --force on CLI cron_run_jobs.php NEW: Add option --force on CLI cron_run_jobs.php
NEW: Add option "Show price on the generated documents for receptions" NEW: Add option "Show price on the generated documents for receptions"
NEW: Add performance index (name for company and contact) and llx_bank_url(url_id)
NEW: Add picto property on sub-module for password generation
NEW: add redirect on action confirm addconsumedline and addproduceline
NEW: Add a new advanced permission "read price"
NEW: Add substitution key __SENDEREMAIL_SIGNATURE__
NEW: Add the referrer-policy to "same-origin" by default on all public pages.
NEW: Add the SMTP header References on ticket email created by email
NEW: Add the thirdparty column to the time list (projet/tasks/time.php)
NEW: Add trigger to record the event of sending an email from a project #20912
NEW: Allow download link option in module configuration (propal,invoice,supplier proposal, order)
NEW: Bank - Add salaries & vat in tab planned entries
NEW: Bulk action to remove a category in list/search website pages
NEW: Can copy/paste images into emails sent.
NEW: Can edit label of an emailing even once sent
NEW: Can edit property css, cssview, csslist on extrafields
NEW: Can enter the unit price including the vat
NEW: Can invoice task time per different services
NEW: Can join several files by default on email form
NEW: Can send an email on scheduled job error
NEW: Can set a commercial discount by entering amount including VAT
NEW: Can set a monthly frequency (or multiple) in cron tasks.
NEW: Can set start and end dates and comment on button "Activate all services"
NEW: can sort and preselected best supplier price
NEW: Can use products categories to make inventory
NEW: Change filter type on tickets list into a multiselect combo
NEW: conf TIMESPENT_ALWAYS_UPDATE_THM, when it's on we always check current thm of user to update it in task time line
NEW: constant PROPAL_NEW_AS_SIGNED
NEW: show date delivery planned on orders linked to company and product
NEW: Default template of contract is not mandatory
NEW: Default values in extrafields are not more limited to 255 char.
NEW: display currency in takepos menu
NEW: Enable online signature for interventions
NEW: Encrypt all sensitive constants in llx_const
NEW: extrafield price with currency
NEW: filter on reception dates (from / to) in cheque paiement card
NEW: Members: default_lang for members
NEW: Members: Table of membership types
NEW: Members: add free membership amounts at the membership type level
NEW: TakePOS: Header Scroll in TakePOS
NEW: TakePOS: add price to product box in TakePOS
NEW: TakePOS: add setup parameters, can setup terminal name
NEW: TakePOS: support of Stripe Terminal with TakePOS
NEW: TakePOS: Receipt preview in TakePOS setup
NEW: TakePOS: different product list on smartphone
NEW: Website: can delete a whole website if disabled
NEW: Website: can remove a website template
NEW: Website: can set header "Strict-Transport-Security" in web sites.
NEW: Website: can switch status of website and page from the website toolbar
NEW: Website: Templates of websites are now directories and not zip into core repo
NEW: Website: add 4 other templates in website module
NEW: If we select another view list mode, we keep it
NEW: Init module bookcal
NEW: Introduce dolEncrypt and dolDecrypt to be able to encrypt data in db
NEW: Invoice - Add french mention on pdf when vat debit option is on
NEW: invoice export : add accounting affectation NEW: invoice export : add accounting affectation
NEW: label on products categories filter NEW: label on products categories filter
NEW: The link "add to bookmark" is always on top in the bookmark popup
NEW: MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS const to show category customer filter
NEW: Make module WebservicesClient deprecated. Use module WebHook instead.
NEW: manage no email with thirdparties (better for GDPR) NEW: manage no email with thirdparties (better for GDPR)
NEW: Manage Position (Rank) on Contract Lines
NEW: Manage VAT on all lines on purchases cycle NEW: Manage VAT on all lines on purchases cycle
NEW: manage virtual stock at a future date
NEW: On a bank reconciled line, we can modify the bank receipt NEW: On a bank reconciled line, we can modify the bank receipt
NEW: On a form to send an email, we show all emails of all contacts of object
NEW: Option PRODUCTBATCH_SHOW_WAREHOUSE_ON_SHIPMENT showing wh on PDF
NEW: Option PRODUIT_DESC_IN_FORM accept (desktop only or +smartphone)
NEW: Page for mass stock transfer can be used with no source stock
NEW: parent company column and filter in invoice and order list NEW: parent company column and filter in invoice and order list
NEW: Add show "Sales rep" option for PDF
NEW: Picto for shared link is clickable
NEW: possibility to select scopes with checkbox for Oauth tokens NEW: possibility to select scopes with checkbox for Oauth tokens
NEW: private and public note on user, thirdparty and contact list NEW: private and public note on user, thirdparty and contact list
NEW: product categories filter on inventory list
NEW: Product supplier price: autofill default supplier VAT
NEW: Project - Add author on list
NEW: Public counters feature NEW: Public counters feature
NEW: Reception - Add a from/to on search on date field
NEW: Start a simple support of recurrent events on agenda
NEW: Resize parent company column in order list
NEW: Saved token of OAUTH module are now encrypted into llx_oauth_token NEW: Saved token of OAUTH module are now encrypted into llx_oauth_token
NEW: Save one click to select on delivery ack, on emails. NEW: Save one click to select on delivery ack, on emails.
NEW: scheduled job to send unpaid invoice reminder can now use the cc and bcc from email template NEW: scheduled job to send unpaid invoice reminder can now use the cc and bcc from email template
NEW: set thirdparty type with company modify trigger NEW: experimental SMTP using PhpImap allowing OAuth2 authentication (need to add option MAIN_IMAP_USE_PHPIMAP)
NEW: Show also scheduled task never finished in scheduled task widget
NEW: show badge with number of extrafields in setup
NEW: show category tree in sellist and chkbxlst for common object
NEW: Show picto and color into combo for selection of tags
NEW: show product label on inventory
NEW: show sell-by and eat-by dates only if not empty
NEW: show SellBy/EatBy dates for each batch product in shipment card
NEW: skip accept/refuse process for proposals (option PROPAL_SKIP_ACCEPT_REFUSE)
NEW: SMTP using oauth2 authentication
NEW: can substitue project title in mail template NEW: can substitue project title in mail template
NEW: Supplier order list - Add column private and public note
NEW: Support IP type in extrafields
NEW: The purge of files can purge only if older than a number of seconds NEW: The purge of files can purge only if older than a number of seconds
NEW: Update ActionComm type_code on email message ticket NEW: Update ActionComm type_code on email message ticket
NEW: VAT - Admin - Add information on deadline day for submission of VAT declaration NEW: Finance - VAT - Admin - Add information on deadline day for submission of VAT declaration
NEW: expand/collapse permissions on user permission page
NEW: Show delivery mode on PDF for proposals
NEW: Add the target to select attendees of event for emailings NEW: Add the target to select attendees of event for emailings
NEW: add redirect on action confirm addconsumedline and addproduceline
NEW: Add the referrer-policy to "same-origin" by default on all public pages.
NEW: Add trigger to record the event of sending an email from a project #20912
NEW: Allow download link option in module configuration (propal, order, invoice, supplier proposal)
NEW: Can enter the unit price including the VAT
NEW: Can invoice task time per different services
NEW: Can set a commercial discount by entering amount including VAT
NEW: Can set start and end dates and comment on button "Activate all services"
NEW: can sort and preselected best supplier price
NEW: show date delivery planned on orders linked to company and product
NEW: filter on reception dates (from / to) in cheque paiement card
NEW: Accountancy - Add a graphic option to enable lettering function - FPC21
NEW: Accountancy - Add a way to clean some words when you generate thirdparty accounting account
NEW: Accountancy - Added an option during export to export or not the lettering FPC21
NEW: Accountancy - Manage supplier deposit with specific account
NEW: Accountancy - Model Digitaria - Add a way to clean some words when you generate thirdparty accounting account FPC22
NEW: Agenda - start a simple support of recurrent events on agenda
NEW: Bank - add salaries & VAT in tab planned entries
NEW: Contracts - add a method doAutoRenewContracts that can be used as a cron task
NEW: Contracts - default template of contract is not mandatory
NEW: Contracts - Manage Position (Rank) on Contract Lines
NEW: EMail - can copy/paste images into emails sent
NEW: EMail - can edit label of an emailing even once sent
NEW: EMail - can join several files by default on email form
NEW: EMail - can send an email on scheduled job error
NEW: EMail - on a form to send an email, we show all emails of all contacts of object
NEW: EMail - add the SMTP header References on ticket email created by email
NEW: EMail - add substitution key __SENDEREMAIL_SIGNATURE__
NEW: EMail-Collector - add IMAP port setting
NEW: EMail-Collector - add a button "Test collect"
NEW: Export - Add " as enclosure by default for CSV export. Keep removing CR/LF.
NEW: Event-Organization - add date event (!= date project) and location on event organization
NEW: Extrafields - add badge in admin extrafields setup
NEW: Extrafields - can edit property css, cssview, csslist on extrafields
NEW: Extrafields - default values in extrafields are not more limited to 255 char.
NEW: Extrafields - field price with currency
NEW: Extrafields - support IP type to store IP addresses
NEW: Interventions - enable online signature for interventions
NEW: Invoice - Add french mention on pdf when vat debit option is on
NEW: Members - default_lang for members
NEW: Members - Table of membership types
NEW: Members - add free membership amounts at the membership type level
NEW: Orders - resize parent company column in order list
NEW: Products supplier price - autofill default supplier VAT
NEW: Projects - add author on list
NEW: Projects - add thirdparty column to the time list (projet/tasks/time.php)
NEW: Proposals - show delivery mode on PDF for proposals
NEW: Proposals - skip accept/refuse process for proposals (option PROPAL_SKIP_ACCEPT_REFUSE)
NEW: Reception - add a from/to on search on date field
NEW: Stock - page for mass stock transfer can be used with no source stock
NEW: Stock - product categories filter on inventory list
NEW: Stock - show product label on inventory
NEW: Stock - manage virtual stock at a future date
NEW: Stock Inventory - add filter "Product subject to lot/Serial" in stock per lot/serial
NEW: Stock Inventory - can use products categories to make inventory
NEW: Supplier Order List - add column private and public note
NEW: TakePOS - add margin infos to TakePOS invoice lines
NEW: TakePOS - add price to product box in TakePOS
NEW: TakePOS - add setup parameters, can setup terminal name
NEW: TakePOS - different product list on smartphone
NEW: TakePOS - display currency in TakePOS menu
NEW: TakePOS - Header Scroll in TakePOS
NEW: TakePOS - Receipt preview in TakePOS setup
NEW: TakePOS - support of Stripe Terminal with TakePOS
NEW: Thirdparty - set thirdparty type with company modify trigger
NEW: Tickets - change filter type on tickets list into a multiselect combo
NEW: Website - can delete a whole website if disabled
NEW: Website - can remove a website template
NEW: Website - can set header "Strict-Transport-Security" in web sites.
NEW: Website - can switch status of website and page from the website toolbar
NEW: Website - Templates of websites are now directories and not zip into core repo
NEW: Website - add 4 other templates in website module
General:
NEW: Actions: Bulk action to remove a category in list/search website pages
NEW: Cronjobs: can set a monthly frequency (or multiple) in cron tasks
NEW: Database: Encrypt all sensitive constants in llx_const
NEW: Database: Add performance index (name for company and contact) and llx_bank_url(url_id)
NEW: Database: Introduce dolEncrypt and dolDecrypt to be able to encrypt data in db
NEW: GUI: If we select another view list mode, we keep it
NEW: GUI: the link "add to bookmark" is always on top in the bookmark popup
NEW: GUI: Picto for shared link is clickable
NEW: GUI: add picto property on sub-module for password generation
NEW: GUI: show also scheduled task never finished in scheduled task widget
NEW: GUI: show badge with number of extrafields in setup
NEW: GUI: show category tree in sellist and chkbxlst for common object
NEW: GUI: show picto and color into combo for selection of tags
NEW: GUI: show sell-by and eat-by dates only if not empty
NEW: GUI: show SellBy/EatBy dates for each batch product in shipment card
NEW: GUI/Permissions: expand/collapse permissions on user permission page
NEW: Permissions: add a new advanced permission "read price"
NEW: Print: add show "Sales rep" option for PDF
NEW: Security: add fail2ban rules examples to limit access to /public pages
Option / Const for System:
NEW: FICHINTER_ALLOW_EXTERNAL_DOWNLOAD
NEW: MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS - const to show category customer filter
NEW: PRODUCTBATCH_SHOW_WAREHOUSE_ON_SHIPMENT - showing warehouse on PDF
NEW: PRODUIT_DESC_IN_FORM accept - desktop only or +smartphone
NEW: PROPAL_BYPASS_VALIDATED_STATUS
NEW: PROPAL_NEW_AS_SIGNED
NEW: TIMESPENT_ALWAYS_UPDATE_THM - when it's on we always check current thm of user to update it in task time line
Localisation:
NEW: adding JAPAN Chart-of-Account and regions/departments
NEW: adding NIF verification for Algeria
Modules Modules
NEW: Experimental module Asset NEW: Experimental module Asset
NEW: Init module bookcal
NEW: Make module WebservicesClient deprecated. Use module WebHook instead.
For developers or integrators: For developers or integrators:
------------------------------ ------------------------------
NEW: ModuleBuilder can generate code of class from an existing SQL table NEW: ModuleBuilder can generate code of class from an existing SQL table
NEW: #22370 Modulebuilder supports 'alwayseditable' (like extrafields)
NEW: #20912 Add trigger to record the event of sending an email from a project NEW: #20912 Add trigger to record the event of sending an email from a project
NEW: #21750 Added "Get lines and Post lines from BOM" at the REST Service NEW: #21750 Added "Get lines and Post lines from BOM" at the REST Service
NEW: Removed completely the need for the library adodbtime NEW: #22370 Modulebuilder supports 'alwayseditable' (like extrafields)
NEW: hook on agenda pages
NEW: hook to complete payment in TakePOS
NEW: hook "changeHelpURL" to modify target of the help button
NEW: hook formConfirm on action comm card
NEW: hook to modify supplier product html select
NEW: Add new hook for show virtual stock details on product stock card
NEW: Add new hooks for actioncomm
NEW: conf->global->SYSLOG_FILE_ONEPERSESSION accept a string NEW: conf->global->SYSLOG_FILE_ONEPERSESSION accept a string
NEW: translate for contact type API, setup/ticket API, shipping method API
NEW: All ajax pages have now a top_httphead() NEW: All ajax pages have now a top_httphead()
NEW: support multilang in Civilities API
API:
NEW: Add API for the partnership module NEW: Add API for the partnership module
NEW: Add "Get lines and Post lines from BOM" in the API NEW: Add "Get lines and Post lines from BOM" in the API
NEW: translate for contact type API, setup/ticket API, shipping method API
NEW: support multilang in Civilities API
Hooks:
NEW: Actioncomm - add new hooks for actioncomm
NEW: Actioncomm - hook formConfirm on actioncomm card
NEW: Agenda - hook on agenda pages
NEW: Help - hook "changeHelpURL" to modify target of the help button
NEW: Product - add hook to show virtual stock details on product stock card
NEW: Product - add hook to modify supplier product html select
NEW: TakePOS - add hook to complete payment in TakePOS
NEW: Removed completely the need for the library adodbtime
NEW: Replace fk_categories_product with categories_product in inventory NEW: Replace fk_categories_product with categories_product in inventory
NEW: Rewrite of SQL request. Removed the join on category (for filter on categ), replaced with a EXISTS/NOT NEW: Rewrite of SQL request. Removed the join on category (for filter on categ), replaced with a EXISTS/NOT
@ -219,6 +238,39 @@ Following changes may create regressions for some external modules, but were nec
* Rename the substitution for project label instead of project title in substitution variables * Rename the substitution for project label instead of project title in substitution variables
***** ChangeLog for 16.0.4 compared to 16.0.2 *****
FIX: Amount of localtax1 and 2 not correctly save on purchase order (the rate was saved instead)
FIX: #20415
FIX: #21280
FIX: #23008
FIX: #22271
FIX: #22837
FIX: #23019 Impossible to add task times to an existing draft invoice
FIX: #23072
FIX: #23087
FIX: #23115
FIX: #23116
FIX: #23281
FIX: bad selection of barcode numbering module
FIX: Can't see all time spent by all user
FIX: CI
FIX: CommonObject - showOptionals - Display blank td when MAIN_VIEW_LINE_NUMBER is enabled and action is confirm_valid
FIX: Documents API inconsistency
FIX: #23075
FIX: #23117
FIX: get multicurrency infos of propal when create order from propal with "WORKFLOW_PROPAL_AUTOCREATE_ORDER" conf
FIX: Give predictable order to inventory lines
FIX: include class multicurrency
FIX: methods declaration (backport fix 67b9a7dc07d708231d12b5e58800334d4a01ef98)
FIX: multicurrency_tx and not currency_tx
FIX: PGSQL Integer type does not have a free length
FIX: Product list in setup.php in new Module
FIX: propal and order stats broken on Tag+User(retricted customer list)
FIX: saving of numbering module for jobs
FIX: Stickler
FIX: travis
***** ChangeLog for 16.0.3 compared to 16.0.2 ***** ***** ChangeLog for 16.0.3 compared to 16.0.2 *****
FIX: $sign is useless FIX: $sign is useless

View File

@ -53,16 +53,17 @@ ONLY vulnerabilities discovered, when the following setup on test platform is us
* $dolibarr_nocsrfcheck must be kept to the value 0 into conf.php (this is the default value) * $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. * $dolibarr_main_force_https must be set to something else than 0.
* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 3 into backoffice menu Home - Setup - Other (this protection should be set to 3 soon by default) * The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 3 into backoffice menu Home - Setup - Other (this protection should be set to 3 soon by default)
* The module DebugBar and ModuleBuilder must NOT be enabled (by default, these modules are not enabled. They are developer tools)
* ONLY security reports on modules provided by default and with the "stable" status are valid (troubles into "experimental", "developement" or external modules are not valid vulnerabilities). * ONLY security reports on modules provided by default and with the "stable" status are valid (troubles into "experimental", "developement" or external modules are not valid vulnerabilities).
* The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer). * The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer).
* The web server setup must be done so that only the documents directory is in write mode. The root directory called htdocs must be read-only. * The web server setup must be done so that only the documents directory is in write mode. The root directory called htdocs must be read-only.
* CSRF attacks are accepted but double check that you have set MAIN_SECURITY_CSRF_WITH_TOKEN to value 3. * CSRF attacks are accepted but double check that you have set MAIN_SECURITY_CSRF_WITH_TOKEN to value 3.
* The module DebugBar and ModuleBuilder must NOT be enabled (by default, these modules are not enabled. They are developer tools)
* Ability for a high level user to edit web site pages into the CMS by including HTML or Javascript is an expected feature. Vulnerabilities into the website module are validated only if HTML or Javascript injection can be done by a non allowed user. * Ability for a high level user to edit web site pages into the CMS by including HTML or Javascript is an expected feature. Vulnerabilities into the website module are validated only if HTML or Javascript injection can be done by a non allowed user.
* Fail2ban rules for rate limit on the login page,password forgotten page and all public pages (/public/*) must be installed as recommendend into the section "About - Admin tools - Section Access limits and mitigation".
Scope is the web application (back office) and the APIs. Scope is the web application (back office) and the APIs.
## Qualifying vulnerabilities for reporting ## Example of vulnerabilities Qualified for reporting.
* Remote code execution (RCE) * Remote code execution (RCE)
* Local files access and manipulation (LFI, RFI, XXE, SSRF, XSPA) * Local files access and manipulation (LFI, RFI, XXE, SSRF, XSPA)
@ -78,7 +79,7 @@ Scope is the web application (back office) and the APIs.
* Software version disclosure (for non admin users only) * Software version disclosure (for non admin users only)
* Stack traces or path disclosure (for non admin users only) * Stack traces or path disclosure (for non admin users only)
## Non-qualifying vulnerabilities for reporting ## Example of vulnerabilities non Non-qualified for reporting.
* "Self" XSS * "Self" XSS
* SSL/TLS best practices * SSL/TLS best practices
@ -95,3 +96,4 @@ Scope is the web application (back office) and the APIs.
* Software version or private IP disclosure when logged user is admin * Software version or private IP disclosure when logged user is admin
* Stack traces or path disclosure when logged user is admin * Stack traces or path disclosure when logged user is admin
* Any vulnerabilities due to a configuration different than the one defined into chapter "Scope for qualified vulnerabilities". * Any vulnerabilities due to a configuration different than the one defined into chapter "Scope for qualified vulnerabilities".
* Brute force attacks on login page, password forgotten page or any public pages (/public/*) are not qualified if the fail2ban recommended fail2ban rules were not installed.

View File

@ -1,4 +1,4 @@
FROM php:7.3-apache FROM php:8.1-apache-bullseye
ENV PHP_INI_DATE_TIMEZONE 'UTC' ENV PHP_INI_DATE_TIMEZONE 'UTC'
ENV PHP_INI_MEMORY_LIMIT 256M ENV PHP_INI_MEMORY_LIMIT 256M
@ -25,7 +25,7 @@ RUN apt-get update -y \
mailutils \ mailutils \
&& apt-get autoremove -y \ && apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \ && docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) calendar intl mysqli pdo_mysql gd soap zip \ && docker-php-ext-install -j$(nproc) calendar intl mysqli pdo_mysql gd soap zip \
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
&& docker-php-ext-install -j$(nproc) ldap && \ && docker-php-ext-install -j$(nproc) ldap && \

View File

@ -34,6 +34,8 @@ services:
build: . build: .
environment: environment:
HOST_USER_ID: $HOST_USER_ID HOST_USER_ID: $HOST_USER_ID
PHP_INI_DATE_TIMEZONE: $PHP_INI_DATE_TIMEZONE
PHP_INI_MEMORY_LIMIT: $PHP_INI_MEMORY_LIMIT
volumes: volumes:
- ../../htdocs:/var/www/html/ - ../../htdocs:/var/www/html/
- ../../documents:/var/documents - ../../documents:/var/documents

View File

@ -15,10 +15,10 @@ fi
echo "[docker-run] => Set Permission to www-data for /var/documents" echo "[docker-run] => Set Permission to www-data for /var/documents"
chown -R www-data:www-data /var/documents chown -R www-data:www-data /var/documents
if [ ! -f /usr/local/etc/php/php.ini ]; then echo "[docker-run] => update ${PHP_INI_DIR}/conf.d/dolibarr-php.ini"
cat <<EOF > /usr/local/etc/php/php.ini cat <<EOF > ${PHP_INI_DIR}/conf.d/dolibarr-php.ini
date.timezone = $PHP_INI_DATE_TIMEZONE date.timezone = ${PHP_INI_DATE_TIMEZONE:-UTC}
memory_limit = ${PHP_INI_MEMORY_LIMIT:-256M}
EOF EOF
fi
exec apache2-foreground exec apache2-foreground

View File

@ -17,9 +17,9 @@ use Cwd;
my $dir = getcwd; my $dir = getcwd;
print "Current dir is: $dir\n"; print "Current dir is: $dir\n";
print "Running dir for doxygen must be: $DIR\n"; #print "Running dir for doxygen must be: $DIR\n";
if (! -s $CONFFILE) if (! -s "build/doxygen/$CONFFILE")
{ {
print "Error: current directory for building Dolibarr doxygen documentation is not correct.\n"; print "Error: current directory for building Dolibarr doxygen documentation is not correct.\n";
print "\n"; print "\n";
@ -30,7 +30,7 @@ if (! -s $CONFFILE)
exit 1; exit 1;
} }
$SOURCE="../.."; $SOURCE=".";
# Get version $MAJOR, $MINOR and $BUILD # Get version $MAJOR, $MINOR and $BUILD
$result = open( IN, "< " . $SOURCE . "/htdocs/filefunc.inc.php" ); $result = open( IN, "< " . $SOURCE . "/htdocs/filefunc.inc.php" );
@ -47,8 +47,8 @@ $version=$MAJOR.".".$MINOR.".".$BUILD;
print "Running doxygen for version ".$version.", please wait...\n"; print "Running doxygen for version ".$version.", please wait...\n";
print "cat $CONFFILE | sed -e 's/x\.y\.z/".$version."/' | doxygen $OPTIONS - 2>&1\n"; print "cat build/doxygen/$CONFFILE | sed -e 's/x\.y\.z/".$version."/' | doxygen $OPTIONS - 2>&1\n";
$result=`cat $CONFFILE | sed -e 's/x\.y\.z/$version/' | doxygen $OPTIONS - 2>&1`; $result=`cat build/doxygen/$CONFFILE | sed -e 's/x\.y\.z/$version/' | doxygen $OPTIONS - 2>&1`;
print $result; print $result;

View File

@ -1,14 +1,17 @@
# Doxyfile 1.7.3 # Doxyfile 1.8.16
# This file describes the settings to be used by the documentation system # This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project # doxygen (www.doxygen.org) for a project.
# #
# All text after a hash (#) is considered a comment and will be ignored # All text after a double hash (##) is considered a comment and is placed in
# front of the TAG it is preceding.
#
# All text after a single hash (#) is considered a comment and will be ignored.
# The format is: # The format is:
# TAG = value [value, ...] # TAG = value [value, ...]
# For lists items can also be appended using: # For lists, items can also be appended using:
# TAG += value [value, ...] # TAG += value [value, ...]
# Values that contain spaces should be placed between quotes (" ") # Values that contain spaces should be placed between quotes (\" \").
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Project related configuration options # Project related configuration options
@ -38,7 +41,7 @@ PROJECT_NUMBER = x.y.z
# If a relative path is entered, it will be relative to the location # If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used. # where doxygen was started. If left blank the current directory will be used.
OUTPUT_DIRECTORY = ../../build OUTPUT_DIRECTORY = build
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
# 4096 sub-directories (in 2 levels) under the output directory of each output # 4096 sub-directories (in 2 levels) under the output directory of each output
@ -114,7 +117,7 @@ FULL_PATH_NAMES = YES
# If left blank the directory from which doxygen is run is used as the # If left blank the directory from which doxygen is run is used as the
# path to strip. # path to strip.
STRIP_FROM_PATH = "../.." STRIP_FROM_PATH = "/home/dolibarr/doxygen.dolibarr.org/"
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
# the path mentioned in the documentation of a class, which tells # the path mentioned in the documentation of a class, which tells
@ -287,7 +290,7 @@ TYPEDEF_HIDES_STRUCT = NO
# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
# corresponding to a cache size of 2^16 = 65536 symbols # corresponding to a cache size of 2^16 = 65536 symbols
SYMBOL_CACHE_SIZE = 0 #SYMBOL_CACHE_SIZE = 0
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Build related configuration options # Build related configuration options
@ -448,7 +451,7 @@ GENERATE_TODOLIST = NO
# disable (NO) the test list. This list is created by putting \test # disable (NO) the test list. This list is created by putting \test
# commands in the documentation. # commands in the documentation.
GENERATE_TESTLIST = YES GENERATE_TESTLIST = NO
# The GENERATE_BUGLIST tag can be used to enable (YES) or # The GENERATE_BUGLIST tag can be used to enable (YES) or
# disable (NO) the bug list. This list is created by putting \bug # disable (NO) the bug list. This list is created by putting \bug
@ -487,7 +490,7 @@ SHOW_USED_FILES = YES
# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
# in the documentation. The default is NO. # in the documentation. The default is NO.
SHOW_DIRECTORIES = YES #SHOW_DIRECTORIES = YES
# Set the SHOW_FILES tag to NO to disable the generation of the Files page. # Set the SHOW_FILES tag to NO to disable the generation of the Files page.
# This will remove the Files entry from the Quick Index and from the # This will remove the Files entry from the Quick Index and from the
@ -571,7 +574,7 @@ WARN_FORMAT = "$file:$line: $text"
# and error messages should be written. If left blank the output is written # and error messages should be written. If left blank the output is written
# to stderr. # to stderr.
WARN_LOGFILE = doxygen_warnings.log WARN_LOGFILE = build/html/doxygen_warnings.log
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to the input files # configuration options related to the input files
@ -582,7 +585,7 @@ WARN_LOGFILE = doxygen_warnings.log
# directories like "/usr/src/myproject". Separate the files or directories # directories like "/usr/src/myproject". Separate the files or directories
# with spaces. # with spaces.
INPUT = ../../htdocs ../../scripts INPUT = htdocs scripts
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
@ -611,7 +614,7 @@ RECURSIVE = YES
# excluded from the INPUT source files. This way you can easily exclude a # excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag. # subdirectory from a directory tree whose root is specified with the INPUT tag.
EXCLUDE = ../../build ../../dev ../../doc ../../document ../../documents ../../htdocs/conf/conf.php ../../htdocs/custom ../../htdocs/document ../../htdocs/documents ../../htdocs/includes EXCLUDE = build dev doc document documents htdocs/conf/conf.php htdocs/custom htdocs/document htdocs/documents htdocs/includes htdocs/install/doctemplates
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or # The EXCLUDE_SYMLINKS tag can be used select whether or not files or
# directories that are symbolic links (a Unix filesystem feature) are excluded # directories that are symbolic links (a Unix filesystem feature) are excluded
@ -625,7 +628,7 @@ EXCLUDE_SYMLINKS = YES
# against the file with absolute path, so to exclude all test directories # against the file with absolute path, so to exclude all test directories
# for example use the pattern */test/* # for example use the pattern */test/*
EXCLUDE_PATTERNS = */CVS/* *google* *pibarcode* EXCLUDE_PATTERNS = */CVS/*
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the # (namespaces, classes, functions, etc.) that should be excluded from the
@ -639,27 +642,27 @@ EXCLUDE_SYMBOLS =
# directories that contain example code fragments that are included (see # directories that contain example code fragments that are included (see
# the \include command). # the \include command).
EXAMPLE_PATH = ../../htdocs/modulebuilder/template #EXAMPLE_PATH = htdocs/modulebuilder/template
# If the value of the EXAMPLE_PATH tag contains directories, you can use the # If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
# and *.h) to filter out the source-files in the directories. If left # and *.h) to filter out the source-files in the directories. If left
# blank all files are included. # blank all files are included.
EXAMPLE_PATTERNS = *.php #EXAMPLE_PATTERNS = *.php
# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
# searched for input files to be used with the \include or \dontinclude # searched for input files to be used with the \include or \dontinclude
# commands irrespective of the value of the RECURSIVE tag. # commands irrespective of the value of the RECURSIVE tag.
# Possible values are YES and NO. If left blank NO is used. # Possible values are YES and NO. If left blank NO is used.
EXAMPLE_RECURSIVE = NO #EXAMPLE_RECURSIVE = NO
# The IMAGE_PATH tag can be used to specify one or more files or # The IMAGE_PATH tag can be used to specify one or more files or
# directories that contain image that are included in the documentation (see # directories that contain image that are included in the documentation (see
# the \image command). # the \image command).
IMAGE_PATH = ../../doc/images IMAGE_PATH = doc/images
# The INPUT_FILTER tag can be used to specify a program that doxygen should # The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program # invoke to filter for each input file. Doxygen will invoke the filter program
@ -762,7 +765,7 @@ ALPHABETICAL_INDEX = YES
# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
# in which this list will be split (can be a number in the range [1..20]) # in which this list will be split (can be a number in the range [1..20])
COLS_IN_ALPHA_INDEX = 5 #COLS_IN_ALPHA_INDEX = 5
# In case all classes in a project start with a common prefix, all # In case all classes in a project start with a common prefix, all
# classes will be put under the same header in the alphabetical index. # classes will be put under the same header in the alphabetical index.
@ -775,14 +778,16 @@ IGNORE_PREFIX =
# configuration options related to the HTML output # configuration options related to the HTML output
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# If the GENERATE_HTML tag is set to YES (the default) Doxygen will # If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
# generate HTML output. # The default value is: YES.
GENERATE_HTML = YES GENERATE_HTML = YES
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
# If a relative path is entered the value of OUTPUT_DIRECTORY will be # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
# put in front of it. If left blank `html' will be used as the default path. # it.
# The default directory is: html.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_OUTPUT = html HTML_OUTPUT = html
@ -797,14 +802,14 @@ HTML_FILE_EXTENSION = .html
# standard header. # standard header.
# Does not work with 1.7.3 # Does not work with 1.7.3
#HTML_HEADER = doxygen_header.html #HTML_HEADER = build/doxygen/doxygen_header.html
# The HTML_FOOTER tag can be used to specify a personal HTML footer for # The HTML_FOOTER tag can be used to specify a personal HTML footer for
# each generated HTML page. If it is left blank doxygen will generate a # each generated HTML page. If it is left blank doxygen will generate a
# standard footer. # standard footer.
# Does not work with 1.7.3 # Does not work with 1.7.3
HTML_FOOTER = doxygen_footer.html HTML_FOOTER = build/doxygen/doxygen_footer.html
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading # The HTML_STYLESHEET tag can be used to specify a user-defined cascading
# style sheet that is used by each HTML page. It can be used to # style sheet that is used by each HTML page. It can be used to
@ -850,7 +855,18 @@ HTML_TIMESTAMP = YES
# files or namespaces will be aligned in HTML using tables. If set to # files or namespaces will be aligned in HTML using tables. If set to
# NO a bullet list will be used. # NO a bullet list will be used.
HTML_ALIGN_MEMBERS = YES #HTML_ALIGN_MEMBERS = YES
# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
# documentation will contain a main index with vertical navigation menus that
# are dynamically created via Javascript. If disabled, the navigation index will
# consists of multiple levels of tabs that are statically embedded in every HTML
# page. Disable this option to support browsers that do not have Javascript,
# like the Qt help browser.
# The default value is: YES.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_DYNAMIC_MENUS = NO
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
# documentation will contain sections that can be hidden and shown after the # documentation will contain sections that can be hidden and shown after the
@ -858,7 +874,7 @@ HTML_ALIGN_MEMBERS = YES
# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
HTML_DYNAMIC_SECTIONS = YES HTML_DYNAMIC_SECTIONS = NO
# If the GENERATE_DOCSET tag is set to YES, additional index files # If the GENERATE_DOCSET tag is set to YES, additional index files
# will be generated that can be used as input for Apple's Xcode 3 # will be generated that can be used as input for Apple's Xcode 3
@ -1003,7 +1019,7 @@ QHG_LOCATION =
# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
# the help appears. # the help appears.
GENERATE_ECLIPSEHELP = YES GENERATE_ECLIPSEHELP = NO
# A unique identifier for the eclipse help plugin. When installing the plugin # A unique identifier for the eclipse help plugin. When installing the plugin
# the directory name containing the HTML and XML files should also have # the directory name containing the HTML and XML files should also have
@ -1035,7 +1051,7 @@ GENERATE_TREEVIEW = NO
# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
# and Class Hierarchy pages using a tree view instead of an ordered list. # and Class Hierarchy pages using a tree view instead of an ordered list.
USE_INLINE_TREES = NO #USE_INLINE_TREES = NO
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
# used to set the initial width (in pixels) of the frame in which the tree # used to set the initial width (in pixels) of the frame in which the tree
@ -1072,7 +1088,7 @@ FORMULA_TRANSPARENT = YES
# typically be disabled. For large projects the javascript based search engine # typically be disabled. For large projects the javascript based search engine
# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
SEARCHENGINE = NO SEARCHENGINE = YES
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be # When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a PHP enabled web server instead of at the web client # implemented using a PHP enabled web server instead of at the web client
@ -1082,7 +1098,7 @@ SEARCHENGINE = NO
# full text search. The disadvances is that it is more difficult to setup # full text search. The disadvances is that it is more difficult to setup
# and does not have live searching capabilities. # and does not have live searching capabilities.
SERVER_BASED_SEARCH = NO SERVER_BASED_SEARCH = YES
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to the LaTeX output # configuration options related to the LaTeX output
@ -1260,13 +1276,13 @@ XML_OUTPUT = xml
# which can be used by a validating XML parser to check the # which can be used by a validating XML parser to check the
# syntax of the XML files. # syntax of the XML files.
XML_SCHEMA = #XML_SCHEMA =
# The XML_DTD tag can be used to specify an XML DTD, # The XML_DTD tag can be used to specify an XML DTD,
# which can be used by a validating XML parser to check the # which can be used by a validating XML parser to check the
# syntax of the XML files. # syntax of the XML files.
XML_DTD = #XML_DTD =
# If the XML_PROGRAMLISTING tag is set to YES Doxygen will # If the XML_PROGRAMLISTING tag is set to YES Doxygen will
# dump the program listings (including syntax highlighting # dump the program listings (including syntax highlighting
@ -1431,7 +1447,7 @@ EXTERNAL_GROUPS = YES
# The PERL_PATH should be the absolute path and name of the perl script # The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of `which perl'). # interpreter (i.e. the result of `which perl').
PERL_PATH = /usr/bin/perl #PERL_PATH = /usr/bin/perl
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to the dot tool # Configuration options related to the dot tool
@ -1453,7 +1469,7 @@ CLASS_DIAGRAMS = NO
# the mscgen tool resides. If left empty the tool is assumed to be found in the # the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path. # default search path.
MSCGEN_PATH = #MSCGEN_PATH =
# If set to YES, the inheritance and collaboration graphs will hide # If set to YES, the inheritance and collaboration graphs will hide
# inheritance and usage relations if the target is undocumented # inheritance and usage relations if the target is undocumented
@ -1485,7 +1501,7 @@ DOT_NUM_THREADS = 0
# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
# containing the font. # containing the font.
DOT_FONTNAME = FreeSans.ttf #DOT_FONTNAME = FreeSans.ttf
# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
# The default size is 10pt. # The default size is 10pt.
@ -1634,3 +1650,7 @@ GENERATE_LEGEND = YES
# the various graphs. # the various graphs.
DOT_CLEANUP = YES DOT_CLEANUP = YES
FULL_SIDEBAR = NO
HTML_EXTRA_STYLESHEET = build/doxygen/doxygen-awesome.css

File diff suppressed because it is too large Load Diff

View File

@ -209,6 +209,11 @@ with
with with
foreach ($value[1] as $k => $v) { foreach ($value[1] as $k => $v) {
* Fix by replacing
if ($res[0] == PDF_TYPE_OBJECT)
with
if ($res && $res[0] == PDF_TYPE_OBJECT)
JSGANTT: JSGANTT:

View File

@ -10,8 +10,7 @@ Signification des chiffres.
- 1 chiffre pour la somme de controle - 1 chiffre pour la somme de controle
Cette regle subit de nombreuses entorses pour ameliorer l'usage des chiffres disponibles. Cette regle subit de nombreuses entorses pour ameliorer l'usage des chiffres disponibles.
Voici la liste des codes pays ou systeme : Voici la liste des codes pays ou systeme, les préfixes qui ne sont pas explicitement mentionnés sont réservés par GS1 :
EN EN
@ -25,105 +24,139 @@ Meaning of the numbers:
This rule has been twisted many times to improve the use of the available numbers. This rule has been twisted many times to improve the use of the available numbers.
Here is the list of country codes or system: Here is the list of country codes or system, prefixes not explicitly listed are reserved by GS1:
List List (https://www.gs1.org/prefixes)
==== ===================================
00 - 13 UCC (U.S.A / États-Unis & Canada) 0000000 Flag for internal numbering / Codification interne en magasin
20 - 29 Flag for internal numbering / Codification interne en magasin 00001–01999 GS1 US (U.S.A / États-Unis & Canada)
30 - 37 GENCOD-EAN France 020-029 Restricted / Restreint
380 BCCI (Bulgaria) 030-039 GS1 US (U.S.A / États-Unis & Canada)
383 SANA (Slovenia) 040-049 Flag for internal numbering / Codification interne en magasin
385 CRO-EAN (Croatia) 050-059 GS1 US (U.S.A / États-Unis & Canada)
387 EAN-BIH (Bosnia-Herzegovina) 060-139 GS1 US (U.S.A / États-Unis & Canada)
400-440 CCG (DE/Germany/Allemagne) 300-379 GS1 France
45 + 49 Distribution Code Center - DCC (Japan) 380 GS1 Bulgaria
460-469 UNISCAN - EAN Russia (Federation de Russie) 383 GS1 Slovenija
471 CAN Taiwan 385 GS1 Croatia
474 EAN Estonia 387 GS1 BIH (Bosnia-Herzegovina)
475 EAN Latvia 389 GS1 Montenegro
476 EAN Azerbaijan 400-440 GS1 Germany
477 EAN Lithuania 450-459 GS1 Japan
478 EAN Uzbekistan 460-469 GS1 Russia
479 EAN Sri Lanka 470 GS1 Kyrgyzstan
480 PANC Philippines 471 GS1 Chinese Taipei
481 EAN Belarus 474 GS1 Estonia
482 EAN Ukraine 475 GS1 Latvia
484 EAN Moldova 476 GS1 Azerbaijan
485 EAN Armenia 477 GS1 Lithuania
486 EAN Georgia 478 GS1 Uzbekistan
487 EAN Kazakhstan 479 GS1 Sri Lanka
489 HKANA Hong Kong 480 GS1 Philippines
50 E Centre UK - United Kingdom 481 GS1 Belarus
520 HELLCAN-EAN HELLAS - Greece 482 GS1 Ukraine
528 EAN Lebanon 483 GS1 Turkmenistan
529 EAN Cyprus 484 GS1 Moldova
531 EAN-MAC (FYR Macedonia) 485 GS1 Armenia
535 EAN Malta 486 GS1 Georgia
539 EAN Ireland 487 GS1 Kazakstan
54 ICODIF/EAN Belgium & Luxembourg 488 GS1 Tajikistan
560 CODIPOR (Portugal) 489 GS1 Hong Kong, China
569 EAN Iceland/Islande 490-499 GS1 Japan
57 EAN Denmark 500-509 GS1 UK
590 EAN Poland 520-521 GS1 Association Greece
594 EAN Romania 528 GS1 Lebanon
599 H.A.P.M.H. (Hungary) 529 GS1 Cyprus
600-601 EAN South Africa 530 GS1 Albania
609 EAN Mauritius Island 531 GS1 Macedonia
611 EAN Morocco 535 GS1 Malta
613 EAN Algeria 539 GS1 Ireland
619 Tunicode (Tunisia) 540-549 GS1 Belgium & Luxembourg
621 EAN Syria 560 GS1 Portugal
622 EAN Egypt 569 GS1 Iceland
625 EAN Jordan/Jordanie 570-579 GS1 Denmark
626 EAN Iran 590 GS1 Poland
628 EAN Saudi Arabia 594 GS1 Romania
64 EAN Finland 599 GS1 Hungary
690-693 ANCC - Article Numbering Centre of China 600-601 GS1 South Africa
70 EAN Norge (Norvege) 603 GS1 Ghana
729 Israeli Bar Code Association - EAN Israel 604 GS1 Senegal
73 EAN Suede 607 GS1 Oman
740 EAN Guatemala 608 GS1 Bahrain
741 EAN El Salvador 609 GS1 Mauritius
742 ICCC (Honduras) 611 GS1 Morocco
743 EAN Nicaragua 613 GS1 Algeria
744 EAN Costa Rica Panama 615 GS1 Nigeria
746 746 EAN Republique Dominicaine 616 GS1 Kenya
750 AMECE (Mexique) 617 GS1 Cameroon
759 EAN Venezuela 618 GS1 Côte d'Ivoire
76 EAN (Schweiz, Suisse, Svizzera) 619 GS1 Tunisia
770 IAC (Colombie) 620 GS1 Tanzania
773 EAN Uruguay 621 GS1 Syria
775 APC - EAN Peru (Perou) 622 GS1 Egypt
777 EAN Bolivie 624 GS1 Libya
779 CODIGO - EAN Argentine 625 GS1 Jordan
780 EAN Chili 626 GS1 Iran
784 EAN Paraguay 627 GS1 Kuwait
786 ECOP (Equateur) 628 GS1 Saudi Arabia
789 EAN Bresil 629 GS1 Emirates
80 - 83 INDICOD (Italy) 630 GS1 Qatar
84 AECOC (Espagne) 631 GS1 Namibia
850 Camera de Comercio de la Republica de Cuba (Cuba) 640-649 GS1 Finland
858 EAN Slovaquie 690-699 GS1 China
859 EAN Republique Tcheque 700-709 GS1 Norway
860 EAN YU (Yougoslavie) 729 GS1 Israel
867 EAN DPR Korea (Coree du Nord) 730-739 GS1 Sweden
869 Union of Chambers of Commerce of Turkey (Turquie) 740 GS1 Guatemala
87 EAN Nederland (Hollande) 741 GS1 El Salvador
880 EAN Korea (Coree du Sud) 742 GS1 Honduras
885 EAN Thailande 743 GS1 Nicaragua
888 SANC (Singapour) 744 GS1 Costa Rica
890 EAN Inde 745 GS1 Panama
893 EAN Vietnam 746 GS1 Republica Dominicana
899 EAN Indonesie 750 GS1 Mexico
90 - 91 EAN Autriche 754-755 GS1 Canada
93 EAN Australie 759 GS1 Venezuela
94 EAN Nouvelle Zelande 760-769 GS1 Schweiz, Suisse, Svizzera
955 Malaysian Article Numbering Council (MANC) - Malaisie 770-771 GS1 Colombia
977 Publications sirielles (ISSN) 773 GS1 Uruguay
978 - 979 Livres (ISBN) 775 GS1 Peru
980 Refus de remboursement 777 GS1 Bolivia
981 - 982 Coupons (monnaie courante) 778-779 GS1 Argentina
99 Coupons 780 GS1 Chile
784 GS1 Paraguay
786 GS1 Ecuador
789-790 GS1 Brasil
800-839 GS1 Italy
840-849 GS1 Spain
850 GS1 Cuba
858 GS1 Slovakia
859 GS1 Czech
860 GS1 Serbia
865 GS1 Mongolia
867 GS1 North Korea
868-869 GS1 Türkiye
870-879 GS1 Netherlands
880 GS1 South Korea
883 GS1 Myanmar
884 GS1 Cambodia
885 GS1 Thailand
888 GS1 Singapore
890 GS1 India
893 GS1 Vietnam
896 GS1 Pakistan
899 GS1 Indonesia
900-919 GS1 Austria
930-939 GS1 Australia
940-949 GS1 New Zealand
950 GS1 Global Office
955 GS1 Malaysia
958 GS1 Macao, China
960-969 Global Office - GTIN-8
977 Serial publications / Publications en série (ISSN)
978-979 Bookland / Livres (ISBN)
980 Refund receipts / Remboursements
981-983 GS1 Coupons
99 GS1 Coupons

View File

@ -0,0 +1,14 @@
QODANA TUTO
-----------
This README explains how to use qodana to generate static analytics reports on the code
Install docker
Install qodana
To run inspection on CLI
cd ~/git/dirtoscan
sudo qodana scan --show-report

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 KiB

After

Width:  |  Height:  |  Size: 154 KiB

View File

@ -47,6 +47,7 @@ $search_label = GETPOST('search_label', 'alpha');
$search_labelshort = GETPOST('search_labelshort', 'alpha'); $search_labelshort = GETPOST('search_labelshort', 'alpha');
$search_accountparent = GETPOST('search_accountparent', 'alpha'); $search_accountparent = GETPOST('search_accountparent', 'alpha');
$search_pcgtype = GETPOST('search_pcgtype', 'alpha'); $search_pcgtype = GETPOST('search_pcgtype', 'alpha');
$search_import_key = GETPOST('search_import_key', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
@ -83,16 +84,19 @@ if (!$sortorder) {
} }
$arrayfields = array( $arrayfields = array(
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1), 'aa.account_number'=>array('label'=>"AccountNumber", 'checked'=>1),
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), 'aa.label'=>array('label'=>"Label", 'checked'=>1),
'aa.labelshort'=>array('label'=>$langs->trans("LabelToShow"), 'checked'=>1), 'aa.labelshort'=>array('label'=>"LabelToShow", 'checked'=>1),
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1), 'aa.account_parent'=>array('label'=>"Accountparent", 'checked'=>1),
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'), 'aa.pcg_type'=>array('label'=>"Pcgtype", 'checked'=>1, 'help'=>'PcgtypeDesc'),
'aa.reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1), 'categories'=>array('label'=>"AccountingCategories", 'checked'=>-1, 'help'=>'AccountingCategoriesDesc'),
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1) 'aa.reconcilable'=>array('label'=>"Reconcilable", 'checked'=>1),
'aa.active'=>array('label'=>"Activated", 'checked'=>1),
'aa.import_key'=>array('label'=>"ImportId", 'checked'=>-1)
); );
if ($conf->global->MAIN_FEATURES_LEVEL < 2) { if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
unset($arrayfields['categories']);
unset($arrayfields['aa.reconcilable']); unset($arrayfields['aa.reconcilable']);
} }
@ -226,15 +230,12 @@ if ($action == 'delete') {
$pcgver = $conf->global->CHARTOFACCOUNTS; $pcgver = $conf->global->CHARTOFACCOUNTS;
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.account_number, aa.account_parent , aa.label, aa.labelshort, aa.reconcilable, aa.active, "; $sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.account_number, aa.account_parent, aa.label, aa.labelshort, aa.fk_accounting_category,";
$sql .= " aa.reconcilable, aa.active, aa.import_key,";
$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2"; $sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".((int) $conf->entity);
if ($db->type == 'pgsql') { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".((int) $conf->entity);
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".$conf->entity;
} else {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".$conf->entity;
}
$sql .= " WHERE asy.rowid = ".((int) $pcgver); $sql .= " WHERE asy.rowid = ".((int) $pcgver);
//print $sql; //print $sql;
if (strlen(trim($search_account))) { if (strlen(trim($search_account))) {
@ -337,6 +338,9 @@ if ($resql) {
if ($search_pcgtype) { if ($search_pcgtype) {
$param .= '&search_pcgtype='.urlencode($search_pcgtype); $param .= '&search_pcgtype='.urlencode($search_pcgtype);
} }
if ($optioncss != '') {
$param .= '&search_import_key='.urlencode($search_import_key);
}
if ($optioncss != '') { if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss); $param .= '&optioncss='.urlencode($optioncss);
} }
@ -399,7 +403,7 @@ if ($resql) {
} }
print "</select>"; print "</select>";
print ajax_combobox("chartofaccounts"); print ajax_combobox("chartofaccounts");
print '<input type="'.(empty($conf->use_javascript_ajax) ? 'submit' : 'button').'" class="button button-edit" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">'; print '<input type="'.(empty($conf->use_javascript_ajax) ? 'submit' : 'button').'" class="button button-edit small" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
print '<br>'; print '<br>';
@ -436,11 +440,20 @@ if ($resql) {
} }
if (!empty($arrayfields['aa.account_parent']['checked'])) { if (!empty($arrayfields['aa.account_parent']['checked'])) {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print $formaccounting->select_account($search_accountparent, 'search_accountparent', 2); print $formaccounting->select_account($search_accountparent, 'search_accountparent', 2, array(), 0, 0, 'maxwidth150');
print '</td>'; print '</td>';
} }
// Predefined group
if (!empty($arrayfields['aa.pcg_type']['checked'])) { if (!empty($arrayfields['aa.pcg_type']['checked'])) {
print '<td class="liste_titre"><input type="text" class="flat width100" name="search_pcgtype" value="'.$search_pcgtype.'"></td>'; print '<td class="liste_titre"><input type="text" class="flat width75" name="search_pcgtype" value="'.$search_pcgtype.'"></td>';
}
// Custom groups
if (!empty($arrayfields['categories']['checked'])) {
print '<td class="liste_titre"></td>';
}
// Import key
if (!empty($arrayfields['aa.import_key']['checked'])) {
print '<td class="liste_titre"><input type="text" class="flat width75" name="search_import_key" value="'.$search_import_key.'"></td>';
} }
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
if (!empty($arrayfields['aa.reconcilable']['checked'])) { if (!empty($arrayfields['aa.reconcilable']['checked'])) {
@ -471,6 +484,12 @@ if ($resql) {
if (!empty($arrayfields['aa.pcg_type']['checked'])) { if (!empty($arrayfields['aa.pcg_type']['checked'])) {
print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type,aa.account_number', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help'], 1); print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type,aa.account_number', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help'], 1);
} }
if (!empty($arrayfields['categories']['checked'])) {
print_liste_field_titre($arrayfields['categories']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '', $arrayfields['categories']['help'], 1);
}
if (!empty($arrayfields['aa.import_key']['checked'])) {
print_liste_field_titre($arrayfields['aa.import_key']['label'], $_SERVER["PHP_SELF"], 'aa.import_key', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.import_key']['help'], 1);
}
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
if (!empty($arrayfields['aa.reconcilable']['checked'])) { if (!empty($arrayfields['aa.reconcilable']['checked'])) {
print_liste_field_titre($arrayfields['aa.reconcilable']['label'], $_SERVER["PHP_SELF"], 'aa.reconcilable', '', $param, '', $sortfield, $sortorder); print_liste_field_titre($arrayfields['aa.reconcilable']['label'], $_SERVER["PHP_SELF"], 'aa.reconcilable', '', $param, '', $sortfield, $sortorder);
@ -505,7 +524,7 @@ if ($resql) {
// Account label // Account label
if (!empty($arrayfields['aa.label']['checked'])) { if (!empty($arrayfields['aa.label']['checked'])) {
print "<td>"; print "<td>";
print $obj->label; print dol_escape_htmltag($obj->label);
print "</td>\n"; print "</td>\n";
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
@ -515,7 +534,7 @@ if ($resql) {
// Account label to show (label short) // Account label to show (label short)
if (!empty($arrayfields['aa.labelshort']['checked'])) { if (!empty($arrayfields['aa.labelshort']['checked'])) {
print "<td>"; print "<td>";
print $obj->labelshort; print dol_escape_htmltag($obj->labelshort);
print "</td>\n"; print "</td>\n";
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
@ -549,10 +568,30 @@ if ($resql) {
} }
} }
// Chart of accounts type // Predefined group (deprecated)
if (!empty($arrayfields['aa.pcg_type']['checked'])) { if (!empty($arrayfields['aa.pcg_type']['checked'])) {
print "<td>"; print "<td>";
print $obj->pcg_type; print dol_escape_htmltag($obj->pcg_type);
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Custom accounts
if (!empty($arrayfields['categories']['checked'])) {
print "<td>";
// TODO Get all custom groups labels the account is in
print dol_escape_htmltag($obj->fk_accounting_category);
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Import id
if (!empty($arrayfields['aa.import_key']['checked'])) {
print "<td>";
print dol_escape_htmltag($obj->import_key);
print "</td>\n"; print "</td>\n";
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;

View File

@ -640,7 +640,8 @@ if ($id) {
foreach ($fieldlist as $field => $value) { foreach ($fieldlist as $field => $value) {
$showfield = 1; $showfield = 1;
$class = "left"; $class = "left";
$valuetoshow = $obj->{$fieldlist[$field]}; $tmpvar = $fieldlist[$field];
$valuetoshow = $obj->$tmpvar;
if ($value == 'type_template') { if ($value == 'type_template') {
$valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow; $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
} }

View File

@ -282,7 +282,7 @@ if ($action == 'create') {
print $form->textwithpicto($langs->trans("AccountingCategory"), $langs->transnoentitiesnoconv("AccountingAccountGroupsDesc")); print $form->textwithpicto($langs->trans("AccountingCategory"), $langs->transnoentitiesnoconv("AccountingAccountGroupsDesc"));
print '</td>'; print '</td>';
print '<td>'; print '<td>';
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1); print $formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1);
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
@ -329,7 +329,8 @@ if ($action == 'create') {
// Account parent // Account parent
print '<tr><td>'.$langs->trans("Accountparent").'</td>'; print '<tr><td>'.$langs->trans("Accountparent").'</td>';
print '<td>'; print '<td>';
print $formaccounting->select_account($object->account_parent, 'account_parent', 1); // Note: We accept disabled account as parent account so we can build a hierarchy and use only childs
print $formaccounting->select_account($object->account_parent, 'account_parent', 1, array(), 0, 0, 'minwidth100 maxwidth300 maxwidthonsmartphone', 1, '');
print '</td></tr>'; print '</td></tr>';
// Chart of accounts type // Chart of accounts type
@ -358,7 +359,7 @@ if ($action == 'create') {
print $form->textwithpicto($langs->trans("AccountingCategory"), $langs->transnoentitiesnoconv("AccountingAccountGroupsDesc")); print $form->textwithpicto($langs->trans("AccountingCategory"), $langs->transnoentitiesnoconv("AccountingAccountGroupsDesc"));
print '</td>'; print '</td>';
print '<td>'; print '<td>';
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1); print $formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro> /* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
* Copyright (C) 2017-2022 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2017-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2022 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -31,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
$error = 0; $error = 0;
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("bills", "accountancy")); $langs->loadLangs(array("bills", "accountancy", "compta"));
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$cancel = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
@ -44,6 +45,26 @@ if ($cat_id == 0) {
$cat_id = null; $cat_id = null;
} }
// Load variable for pagination
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
}
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (empty($sortfield)) {
$sortfield = 'account_number';
}
if (empty($sortorder)) {
$sortorder = 'ASC';
}
// Security check // Security check
if (!$user->hasRight('accounting', 'chartofaccount')) { if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden(); accessforbidden();
@ -110,18 +131,22 @@ print '<table class="border centpercent">';
// Select the category // Select the category
print '<tr><td class="titlefield">'.$langs->trans("AccountingCategory").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("AccountingCategory").'</td>';
print '<td>'; print '<td>';
$formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 1); print $formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 0);
print '<input type="submit" class="button" value="'.$langs->trans("Select").'">'; print '<input type="submit" class="button small" value="'.$langs->trans("Select").'">';
print '</td></tr>'; print '</td></tr>';
print '</table>';
print dol_get_fiche_end();
// Select the accounts // Select the accounts
if (!empty($cat_id)) { if (!empty($cat_id)) {
$return = $accountingcategory->getAccountsWithNoCategory($cat_id); $return = $accountingcategory->getAccountsWithNoCategory($cat_id);
if ($return < 0) { if ($return < 0) {
setEventMessages(null, $accountingcategory->errors, 'errors'); setEventMessages(null, $accountingcategory->errors, 'errors');
} }
print '<tr><td>'.$langs->trans("AddAccountFromBookKeepingWithNoCategories").'</td>'; print '<br>';
print '<td>';
$arraykeyvalue = array(); $arraykeyvalue = array();
foreach ($accountingcategory->lines_cptbk as $key => $val) { foreach ($accountingcategory->lines_cptbk as $key => $val) {
@ -130,33 +155,25 @@ if (!empty($cat_id)) {
} }
if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) { if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) {
print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, null, null, "90%"); print img_picto($langs->trans("AccountingAccount"), 'accounting_account', 'class="pictofixedwith"');
print '<br>'; print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, '', 0, "80%", '', '', $langs->transnoentitiesnoconv("AddAccountFromBookKeepingWithNoCategories"));
/*print '<select class="flat minwidth200" size="8" name="cpt_bk[]" multiple>'; print '<input type="submit" class="button button-add small" id="" class="action-delete" value="'.$langs->trans("Add").'"> ';
foreach ( $accountingcategory->lines_cptbk as $cpt ) {
print '<option value="' . length_accountg($cpt->numero_compte) . '">' . length_accountg($cpt->numero_compte) . ' (' . $cpt->label_compte . ' ' . $cpt->doc_ref . ')</option>';
} }
print '</select><br>';
print ajax_combobox('cpt_bk');
*/
print '<input type="submit" class="button button-add" id="" class="action-delete" value="'.$langs->trans("Add").'"> ';
} }
print '</td></tr>';
}
print '</table>';
print dol_get_fiche_end();
print '</form>'; print '</form>';
if ($action == 'display' || $action == 'delete') { if ((empty($action) || $action == 'display' || $action == 'delete') && $cat_id > 0) {
print "<table class='noborder' width='100%'>\n"; $param = 'account_category='.((int) $cat_id);
print '<br>';
print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">'.$langs->trans("AccountAccounting")."</td>"; print getTitleFieldOfList('AccountAccounting', 0, $_SERVER['PHP_SELF'], 'account_number', '', $param, '', $sortfield, $sortorder, '')."\n";
print '<td class="liste_titre" colspan="2">'.$langs->trans("Label")."</td>"; print getTitleFieldOfList('Label', 0, $_SERVER['PHP_SELF'], 'label', '', $param, '', $sortfield, $sortorder, '')."\n";
print "</tr>\n"; print getTitleFieldOfList('', 0, $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, '')."\n";
print '</tr>'."\n";
if (!empty($cat_id)) { if (!empty($cat_id)) {
$return = $accountingcategory->display($cat_id); // This load ->lines_display $return = $accountingcategory->display($cat_id); // This load ->lines_display
@ -165,6 +182,8 @@ if ($action == 'display' || $action == 'delete') {
} }
if (is_array($accountingcategory->lines_display) && count($accountingcategory->lines_display) > 0) { if (is_array($accountingcategory->lines_display) && count($accountingcategory->lines_display) > 0) {
$accountingcategory->lines_display = dol_sort_array($accountingcategory->lines_display, $sortfield, $sortorder, -1, 0, 1);
foreach ($accountingcategory->lines_display as $cpt) { foreach ($accountingcategory->lines_display as $cpt) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.length_accountg($cpt->account_number).'</td>'; print '<td>'.length_accountg($cpt->account_number).'</td>';
@ -177,6 +196,8 @@ if ($action == 'display' || $action == 'delete') {
print "</td>"; print "</td>";
print "</tr>\n"; print "</tr>\n";
} }
} else {
print '<tr><td colspan="3"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
} }
} }

View File

@ -190,7 +190,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors'); setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
} }
} }
if (!is_numeric(GETPOST('position', 'alpha'))) { if (GETPOST('position') && !is_numeric(GETPOST('position', 'alpha'))) {
$langs->loadLangs(array("errors")); $langs->loadLangs(array("errors"));
$ok = 0; $ok = 0;
setEventMessages($langs->transnoentities('ErrorFieldMustBeANumeric', $langs->transnoentities("Position")), null, 'errors'); setEventMessages($langs->transnoentities('ErrorFieldMustBeANumeric', $langs->transnoentities("Position")), null, 'errors');
@ -444,15 +444,37 @@ if ($search_country_id > 0) {
if ($sortfield == 'country') { if ($sortfield == 'country') {
$sortfield = 'country_code'; $sortfield = 'country_code';
} }
if (empty($sortfield)) {
$sortfield = 'position';
}
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($listlimit + 1, $offset); $sql .= $db->plimit($listlimit + 1, $offset);
//print $sql; //print $sql;
$fieldlist = explode(',', $tabfield[$id]); $fieldlist = explode(',', $tabfield[$id]);
$param = '&id='.$id;
if ($search_country_id > 0) {
$param .= '&search_country_id='.urlencode($search_country_id);
}
$paramwithsearch = $param;
if ($sortorder) {
$paramwithsearch .= '&sortorder='.urlencode($sortorder);
}
if ($sortfield) {
$paramwithsearch .= '&sortfield='.urlencode($sortfield);
}
if (GETPOST('from', 'alpha')) {
$paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha'));
}
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">'; print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">'; print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
print '<input type="hidden" name="sortfield" value="'.dol_escape_htmltag($sortfield).'">';
print '<input type="hidden" name="sortorder" value="'.dol_escape_htmltag($sortorder).'">';
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
@ -571,20 +593,6 @@ if ($resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
$param = '&id='.$id;
if ($search_country_id > 0) {
$param .= '&search_country_id='.urlencode($search_country_id);
}
$paramwithsearch = $param;
if ($sortorder) {
$paramwithsearch .= '&sortorder='.$sortorder;
}
if ($sortfield) {
$paramwithsearch .= '&sortfield='.$sortfield;
}
if (GETPOST('from', 'alpha')) {
$paramwithsearch .= '&from='.GETPOST('from', 'alpha');
}
// There is several pages // There is several pages
if ($num > $listlimit) { if ($num > $listlimit) {
print '<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).'">'; print '<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).'">';
@ -605,7 +613,7 @@ if ($resql) {
if ($showfield) { if ($showfield) {
if ($value == 'country') { if ($value == 'country') {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone'); print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth150 maxwidthonsmartphone');
print '</td>'; print '</td>';
$filterfound++; $filterfound++;
} else { } else {
@ -725,11 +733,11 @@ if ($resql) {
print '<td></td>'; print '<td></td>';
print '<td></td>'; print '<td></td>';
print '<td class="center">'; print '<td class="center">';
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">'; print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button button-edit" name="actionmodify" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button button-edit smallpaddingimp" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>'; print '<input type="submit" class="button button-cancel smallpaddingimp" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>'; print '</td>';
print '<td></td>'; print '<td></td>';
} else { } else {
@ -743,7 +751,8 @@ if ($resql) {
foreach ($fieldlist as $field => $value) { foreach ($fieldlist as $field => $value) {
$showfield = 1; $showfield = 1;
$class = "left"; $class = "left";
$valuetoshow = $obj->{$fieldlist[$field]}; $tmpvar = $fieldlist[$field];
$valuetoshow = $obj->$tmpvar;
if ($value == 'category_type') { if ($value == 'category_type') {
$valuetoshow = yn($valuetoshow); $valuetoshow = yn($valuetoshow);
} elseif ($valuetoshow == 'all') { } elseif ($valuetoshow == 'all') {
@ -822,7 +831,7 @@ if ($resql) {
} }
// Link to setup the group // Link to setup the group
print '<td class="center">'; print '<td>';
if (empty($obj->formula)) { if (empty($obj->formula)) {
print '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories.php?action=display&save_lastsearch_values=1&account_category='.$obj->rowid.'">'; print '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories.php?action=display&save_lastsearch_values=1&account_category='.$obj->rowid.'">';
print $langs->trans("ListOfAccounts"); print $langs->trans("ListOfAccounts");
@ -887,10 +896,10 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co
if ($context == 'add') { if ($context == 'add') {
$fieldname = 'country_id'; $fieldname = 'country_id';
$preselectcountrycode = GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : $mysoc->country_code; $preselectcountrycode = GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : $mysoc->country_code;
print $form->select_country($preselectcountrycode, $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); print $form->select_country($preselectcountrycode, $fieldname, '', 28, 'maxwidth150 maxwidthonsmartphone');
} else { } else {
$preselectcountrycode = (empty($obj->country_code) ? (empty($obj->country) ? $mysoc->country_code : $obj->country) : $obj->country_code); $preselectcountrycode = (empty($obj->country_code) ? (empty($obj->country) ? $mysoc->country_code : $obj->country) : $obj->country_code);
print $form->select_country($preselectcountrycode, $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); print $form->select_country($preselectcountrycode, $fieldname, '', 28, 'maxwidth150 maxwidthonsmartphone');
} }
print '</td>'; print '</td>';
} elseif ($fieldlist[$field] == 'country_id') { } elseif ($fieldlist[$field] == 'country_id') {

View File

@ -84,6 +84,9 @@ $list_account[] = 'ACCOUNTING_VAT_PAY_ACCOUNT';
if (isModEnabled('banque')) { if (isModEnabled('banque')) {
$list_account[] = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH'; $list_account[] = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
} }
if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
$list_account[] = 'ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY';
}
if (isModEnabled('don')) { if (isModEnabled('don')) {
$list_account[] = 'DONATION_ACCOUNTINGACCOUNT'; $list_account[] = 'DONATION_ACCOUNTINGACCOUNT';
} }

View File

@ -261,6 +261,20 @@ if ($action == 'setenablelettering') {
} }
} }
if ($action == 'setenableautolettering') {
$setenableautolettering = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_AUTOLETTERING", $setenableautolettering, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
/* /*
* View * View
@ -430,7 +444,7 @@ foreach ($list_binding as $key) {
print $form->selectDate((!empty($conf->global->$key) ? $db->idate($conf->global->$key) : -1), $key, 0, 0, 1); print $form->selectDate((!empty($conf->global->$key) ? $db->idate($conf->global->$key) : -1), $key, 0, 0, 1);
} elseif ($key == 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER') { } elseif ($key == 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER') {
$array = array(0=>$langs->trans("PreviousMonth"), 1=>$langs->trans("CurrentMonth"), 2=>$langs->trans("Fiscalyear")); $array = array(0=>$langs->trans("PreviousMonth"), 1=>$langs->trans("CurrentMonth"), 2=>$langs->trans("Fiscalyear"));
print $form->selectarray($key, $array, (isset($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER) ? $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER : 0)); print $form->selectarray($key, $array, (isset($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER) ? $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER : 0), 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage');
} else { } else {
print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">'; print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
} }
@ -479,6 +493,7 @@ if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) {
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
print '<br>';
// Lettering params // Lettering params
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
@ -499,6 +514,21 @@ if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
} }
print '</tr>'; print '</tr>';
if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
print '<tr class="oddeven">';
print '<td>' . $langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING") . '</td>';
if (!empty($conf->global->ACCOUNTING_ENABLE_AUTOLETTERING)) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenableautolettering&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenableautolettering&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
}
print '</table>'; print '</table>';
print '<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans('Modify').'"></div>'; print '<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans('Modify').'"></div>';

View File

@ -587,7 +587,8 @@ if ($id) {
foreach ($fieldlist as $field => $value) { foreach ($fieldlist as $field => $value) {
$showfield = 1; $showfield = 1;
$class = "left"; $class = "left";
$valuetoshow = $obj->{$fieldlist[$field]}; $tmpvar = $fieldlist[$field];
$valuetoshow = $obj->$tmpvar;
if ($valuetoshow == 'all') { if ($valuetoshow == 'all') {
$valuetoshow = $langs->trans('All'); $valuetoshow = $langs->trans('All');
} elseif ($fieldlist[$field] == 'nature' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') { } elseif ($fieldlist[$field] == 'nature' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') {

View File

@ -25,11 +25,12 @@
// Load Dolibarr environment // Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "admin", "accountancy", "salaries", "hrm", "errors")); $langs->loadLangs(array("accountancy", "admin", "bills", "compta", "errors", "hrm", "salaries"));
$mesg = ''; $mesg = '';
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
@ -81,6 +82,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
unset($arrayfields['reconcilable']); unset($arrayfields['reconcilable']);
} }
/* /*
* Actions * Actions
*/ */
@ -120,11 +122,13 @@ if (empty($reshook)) {
$form = new Form($db); $form = new Form($db);
$help_url = '';
$title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger');
// Page Header
$help_url = 'EN:Module_Double_Entry_Accounting#Setup';
$title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger');
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
// Customer // Customer
$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '1' as type, sa.entity"; $sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '1' as type, sa.entity";
$sql .= " FROM ".MAIN_DB_PREFIX."societe sa"; $sql .= " FROM ".MAIN_DB_PREFIX."societe sa";
@ -219,7 +223,7 @@ if (!empty($search_type) && $search_type >= 0) {
$sql .= " HAVING type LIKE '".$db->escape($search_type)."'"; $sql .= " HAVING type LIKE '".$db->escape($search_type)."'";
} }
// User // User - Employee
$sql .= " UNION "; $sql .= " UNION ";
$sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '3' as type, u.entity FROM ".MAIN_DB_PREFIX."user u"; $sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '3' as type, u.entity FROM ".MAIN_DB_PREFIX."user u";
$sql .= " WHERE u.entity IN (".getEntity('user').")"; $sql .= " WHERE u.entity IN (".getEntity('user').")";
@ -400,6 +404,7 @@ if ($resql) {
if (!empty($arrayfields['type']['checked'])) { if (!empty($arrayfields['type']['checked'])) {
print '<td class="center">'; print '<td class="center">';
$s = ''; $s = '';
// Customer // Customer
if ($obj->type == 1) { if ($obj->type == 1) {
$s .= '<a class="customer-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->rowid.'">'.$langs->trans("Customer").'</a>'; $s .= '<a class="customer-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->rowid.'">'.$langs->trans("Customer").'</a>';
@ -407,8 +412,8 @@ if ($resql) {
// Supplier // Supplier
$s .= '<a class="vendor-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->rowid.'">'.$langs->trans("Supplier").'</a>'; $s .= '<a class="vendor-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->rowid.'">'.$langs->trans("Supplier").'</a>';
} elseif ($obj->type == 3) { } elseif ($obj->type == 3) {
// User // User - Employee
$s .= '<a class="user-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->id.'">'.$langs->trans("Employee").'</a>'; $s .= '<a class="user-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->rowid.'">'.$langs->trans("Employee").'</a>';
} }
print $s; print $s;
print '</td>'; print '</td>';
@ -440,6 +445,7 @@ if ($resql) {
// Action // Action
print '<td class="center">'; print '<td class="center">';
$e = ''; $e = '';
// Customer // Customer
if ($obj->type == 1) { if ($obj->type == 1) {
$e .= '<a class="editfielda" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&token='.newToken().'&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>'; $e .= '<a class="editfielda" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&token='.newToken().'&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
@ -447,7 +453,7 @@ if ($resql) {
// Supplier // Supplier
$e .= '<a class="editfielda" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&token='.newToken().'&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>'; $e .= '<a class="editfielda" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&token='.newToken().'&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
} elseif ($obj->type == 3) { } elseif ($obj->type == 3) {
// User // User - Employee
$e .= '<a class="editfielda" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?action=edit&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>'; $e .= '<a class="editfielda" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?action=edit&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
} }
print $e; print $e;

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016-2022 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2016-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -42,22 +42,13 @@ $langs->loadLangs(array("accountancy", "compta"));
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ09'); $type = GETPOST('type', 'alpha');
if ($type == 'sub') {
// Load variable for pagination $context_default = 'balancesubaccountlist';
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; } else {
$sortfield = GETPOST('sortfield', 'aZ09comma'); $context_default = 'balancelist';
$sortorder = GETPOST('sortorder', 'aZ09comma'); }
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : $context_default;
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
$page = 0;
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
//if (! $sortfield) $sortfield="p.date_fin";
//if (! $sortorder) $sortorder="DESC";
$show_subgroup = GETPOST('show_subgroup', 'alpha'); $show_subgroup = GETPOST('show_subgroup', 'alpha');
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); $search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
$search_date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); $search_date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
@ -70,10 +61,29 @@ $search_accountancy_code_end = GETPOST('search_accountancy_code_end', 'alpha');
if ($search_accountancy_code_end == - 1) { if ($search_accountancy_code_end == - 1) {
$search_accountancy_code_end = ''; $search_accountancy_code_end = '';
} }
$search_not_reconciled = GETPOST('search_not_reconciled', 'alpha');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
$page = 0;
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if ($sortorder == "") {
$sortorder = "ASC";
}
if ($sortfield == "") {
$sortfield = "t.numero_compte";
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new BookKeeping($db); $object = new BookKeeping($db);
$hookmanager->initHooks(array('balancelist')); // Note that conf->hooks_modules contains array $hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
$formother = new FormOther($db); $formother = new FormOther($db);
@ -84,6 +94,7 @@ if (empty($search_date_start) && !GETPOSTISSET('formfilteraction')) {
$sql .= " WHERE date_start < '".$db->idate(dol_now())."' AND date_end > '".$db->idate(dol_now())."'"; $sql .= " WHERE date_start < '".$db->idate(dol_now())."' AND date_end > '".$db->idate(dol_now())."'";
$sql .= $db->plimit(1); $sql .= $db->plimit(1);
$res = $db->query($sql); $res = $db->query($sql);
if ($res->num_rows > 0) { if ($res->num_rows > 0) {
$fiscalYear = $db->fetch_object($res); $fiscalYear = $db->fetch_object($res);
$search_date_start = strtotime($fiscalYear->date_start); $search_date_start = strtotime($fiscalYear->date_start);
@ -104,45 +115,6 @@ if (empty($search_date_start) && !GETPOSTISSET('formfilteraction')) {
$search_date_end = dol_get_last_day($year_end, $month_end); $search_date_end = dol_get_last_day($year_end, $month_end);
} }
} }
if ($sortorder == "") {
$sortorder = "ASC";
}
if ($sortfield == "") {
$sortfield = "t.numero_compte";
}
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
$filter = array();
if (!empty($search_date_start)) {
$filter['t.doc_date>='] = $search_date_start;
$param .= '&date_startmonth='.GETPOST('date_startmonth', 'int').'&date_startday='.GETPOST('date_startday', 'int').'&date_startyear='.GETPOST('date_startyear', 'int');
}
if (!empty($search_date_end)) {
$filter['t.doc_date<='] = $search_date_end;
$param .= '&date_endmonth='.GETPOST('date_endmonth', 'int').'&date_endday='.GETPOST('date_endday', 'int').'&date_endyear='.GETPOST('date_endyear', 'int');
}
if (!empty($search_accountancy_code_start)) {
$filter['t.numero_compte>='] = $search_accountancy_code_start;
$param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
}
if (!empty($search_accountancy_code_end)) {
$filter['t.numero_compte<='] = $search_accountancy_code_end;
$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
}
if (!empty($search_ledger_code)) {
$filter['t.code_journal'] = $search_ledger_code;
foreach ($search_ledger_code as $code) {
$param .= '&search_ledger_code[]='.urlencode($code);
}
}
if (!isModEnabled('accounting')) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
@ -154,14 +126,13 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }
/* /*
* Action * Action
*/ */
$parameters = array(); $param = '';
$arrayfields = array();
$parameters = array('socid'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) { if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -172,16 +143,67 @@ if (empty($reshook)) {
$show_subgroup = ''; $show_subgroup = '';
$search_date_start = ''; $search_date_start = '';
$search_date_end = ''; $search_date_end = '';
$search_date_startyear = '';
$search_date_startmonth = '';
$search_date_startday = '';
$search_date_endyear = '';
$search_date_endmonth = '';
$search_date_endday = '';
$search_accountancy_code_start = ''; $search_accountancy_code_start = '';
$search_accountancy_code_end = ''; $search_accountancy_code_end = '';
$search_not_reconciled = '';
$search_ledger_code = array(); $search_ledger_code = array();
$filter = array(); $filter = array();
} }
// Must be after the remove filter action, before the export.
$filter = array();
if (!empty($search_date_start)) {
$filter['t.doc_date>='] = $search_date_start;
$param .= '&amp;date_startmonth=' . GETPOST('date_startmonth', 'int') . '&amp;date_startday=' . GETPOST('date_startday', 'int') . '&amp;date_startyear=' . GETPOST('date_startyear', 'int');
}
if (!empty($search_date_end)) {
$filter['t.doc_date<='] = $search_date_end;
$param .= '&amp;date_endmonth=' . GETPOST('date_endmonth', 'int') . '&amp;date_endday=' . GETPOST('date_endday', 'int') . '&amp;date_endyear=' . GETPOST('date_endyear', 'int');
}
if (!empty($search_doc_date)) {
$filter['t.doc_date'] = $search_doc_date;
$param .= '&doc_datemonth=' . GETPOST('doc_datemonth', 'int') . '&doc_dateday=' . GETPOST('doc_dateday', 'int') . '&doc_dateyear=' . GETPOST('doc_dateyear', 'int');
}
if (!empty($search_accountancy_code_start)) {
if ($type == 'sub') {
$filter['t.subledger_account>='] = $search_accountancy_code_start;
} else {
$filter['t.numero_compte>='] = $search_accountancy_code_start;
}
$param .= '&amp;search_accountancy_code_start=' . urlencode($search_accountancy_code_start);
}
if (!empty($search_accountancy_code_end)) {
if ($type == 'sub') {
$filter['t.subledger_account<='] = $search_accountancy_code_end;
} else {
$filter['t.numero_compte<='] = $search_accountancy_code_end;
}
$param .= '&amp;search_accountancy_code_end=' . urlencode($search_accountancy_code_end);
}
if (!empty($search_ledger_code)) {
$filter['t.code_journal'] = $search_ledger_code;
foreach ($search_ledger_code as $code) {
$param .= '&search_ledger_code[]=' . urlencode($code);
}
}
if (!empty($search_not_reconciled)) {
$filter['t.reconciled_option'] = $search_not_reconciled;
$param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
} }
/* // param with type of list
* View $url_param = substr($param, 1); // remove first "&"
*/ if (!empty($type)) {
$param = '&type=' . $type . $param;
}
}
if ($action == 'export_csv') { if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
@ -190,14 +212,23 @@ if ($action == 'export_csv') {
$type_export = 'balance'; $type_export = 'balance';
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php'; include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
if ($type == 'sub') {
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter, 'AND', 1);
} else {
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter); $result = $object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter);
}
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
foreach ($object->lines as $line) { foreach ($object->lines as $line) {
if ($type == 'sub') {
print '"' . length_accounta($line->subledger_account) . '"' . $sep;
print '"' . $line->subledger_label . '"' . $sep;
} else {
print '"' . length_accountg($line->numero_compte) . '"' . $sep; print '"' . length_accountg($line->numero_compte) . '"' . $sep;
print '"' . $object->get_compte_desc($line->numero_compte) . '"' . $sep; print '"' . $object->get_compte_desc($line->numero_compte) . '"' . $sep;
}
print '"'.price($line->debit).'"'.$sep; print '"'.price($line->debit).'"'.$sep;
print '"'.price($line->credit).'"'.$sep; print '"'.price($line->credit).'"'.$sep;
print '"'.price($line->debit - $line->credit).'"'.$sep; print '"'.price($line->debit - $line->credit).'"'.$sep;
@ -207,8 +238,15 @@ if ($action == 'export_csv') {
exit; exit;
} }
/*
* View
*/
if ($type == 'sub') {
$title_page = $langs->trans("AccountBalanceSubAccount");
} else {
$title_page = $langs->trans("AccountBalance"); $title_page = $langs->trans("AccountBalance");
}
llxHeader('', $title_page); llxHeader('', $title_page);
@ -217,39 +255,52 @@ if ($action != 'export_csv') {
// List // List
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
if ($type == 'sub') {
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter, 'AND', 1);
} else {
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter); $nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
}
if ($nbtotalofrecords < 0) { if ($nbtotalofrecords < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
if ($type == 'sub') {
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 1);
} else {
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter); $result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter);
}
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" id="action" value="list">';
if ($optioncss != '') { if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
} }
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" id="action" value="list">'; print '<input type="hidden" name="type" value="'.$type.'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) { if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
} }
$button = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint; $newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
if (empty($reshook)) { if (empty($reshook)) {
$button .= '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />'; $newcardbutton = '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
print '<script type="text/javascript"> print '<script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
@ -262,12 +313,32 @@ if ($action != 'export_csv') {
}); });
}); });
</script>'; </script>';
if ($type == 'sub') {
$newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
$newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
} else {
$newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
}
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
} }
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
$selectedfields = ''; $selectedfields = '';
// Warning to explain why list of record is not consistent with the other list view (missing a lot of lines)
if ($type == 'sub') {
print info_admin($langs->trans("WarningRecordWithoutSubledgerAreExcluded"));
}
$moreforfilter = ''; $moreforfilter = '';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
@ -275,18 +346,38 @@ if ($action != 'export_csv') {
$moreforfilter .= $form->selectDate($search_date_start ? $search_date_start : -1, 'date_start', 0, 0, 1, '', 1, 0); $moreforfilter .= $form->selectDate($search_date_start ? $search_date_start : -1, 'date_start', 0, 0, 1, '', 1, 0);
$moreforfilter .= $langs->trans('DateEnd').': '; $moreforfilter .= $langs->trans('DateEnd').': ';
$moreforfilter .= $form->selectDate($search_date_end ? $search_date_end : -1, 'date_end', 0, 0, 1, '', 1, 0); $moreforfilter .= $form->selectDate($search_date_end ? $search_date_end : -1, 'date_end', 0, 0, 1, '', 1, 0);
$moreforfilter .= ' - ';
$moreforfilter .= '<label for="show_subgroup">'.$langs->trans('ShowSubtotalByGroup').'</label>: ';
$moreforfilter .= '<input type="checkbox" name="show_subgroup" id="show_subgroup" value="show_subgroup"'.($show_subgroup == 'show_subgroup' ? ' checked' : '').'>';
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= '<label for="show_subgroup">'.$langs->trans('ShowSubtotalByGroup').'</label>: ';
$moreforfilter .= '<input type="checkbox" name="show_subgroup" id="show_subgroup" value="show_subgroup"'.($show_subgroup == 'show_subgroup' ? ' checked' : '').'>';
$moreforfilter .= '</div>';
$moreforfilter .= $langs->trans("Journal"); $moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans("Journals").': ';
$moreforfilter .= $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1); $moreforfilter .= $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1);
$moreforfilter .= '</div>';
$moreforfilter .= '</br>';
$moreforfilter .= '<div class="divsearchfield">';
// Accountancy account
$moreforfilter .= $langs->trans('AccountAccounting').': ';
if ($type == 'sub') {
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), 'maxwidth200');
} else {
$moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, 'maxwidth200', 'accounts');
}
$moreforfilter .= ' ';
if ($type == 'sub') {
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), 'maxwidth200');
} else {
$moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, 'maxwidth200', 'accounts');
}
$moreforfilter .= '</div>';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= '<label for="notreconciled">'.$langs->trans('NotReconciled').'</label>: ';
$moreforfilter .= '<input type="checkbox" name="search_not_reconciled" id="notreconciled" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>';
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
if (!empty($moreforfilter)) { if (!empty($moreforfilter)) {
@ -305,9 +396,6 @@ if ($action != 'export_csv') {
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
print '<td class="liste_titre" colspan="'.$colspan.'">'; print '<td class="liste_titre" colspan="'.$colspan.'">';
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, '', 'accounts');
print ' ';
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, '', 'accounts');
print '</td>'; print '</td>';
// Fields from hook // Fields from hook
@ -324,6 +412,10 @@ if ($action != 'export_csv') {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
// TODO : Retrieve the type of third party: Customer / Supplier / Employee
//if ($type == 'sub') {
// print_liste_field_titre("Type", $_SERVER['PHP_SELF'], "t.type", "", $param, "", $sortfield, $sortorder);
//}
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) { if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
print_liste_field_titre("OpeningBalance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder); print_liste_field_titre("OpeningBalance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder);
} }
@ -359,7 +451,7 @@ if ($action != 'export_csv') {
$sql .= " GROUP BY t.numero_compte"; $sql .= " GROUP BY t.numero_compte";
$resql = $db->query($sql); $resql = $db->query($sql);
$nrows = $db->num_rows($resql); $nrows = $resql->num_rows;
$opening_balances = array(); $opening_balances = array();
for ($i = 0; $i < $nrows; $i++) { for ($i = 0; $i < $nrows; $i++) {
$arr = $resql->fetch_array(); $arr = $resql->fetch_array();
@ -372,12 +464,14 @@ if ($action != 'export_csv') {
$accountingaccountstatic->id = 0; $accountingaccountstatic->id = 0;
$accountingaccountstatic->account_number = ''; $accountingaccountstatic->account_number = '';
if ($type != 'sub') {
$accountingaccountstatic->fetch(null, $line->numero_compte, true); $accountingaccountstatic->fetch(null, $line->numero_compte, true);
if (!empty($accountingaccountstatic->account_number)) { if (!empty($accountingaccountstatic->account_number)) {
$accounting_account = $accountingaccountstatic->getNomUrl(0, 1, 0, '', 0, -1, 0, 'accountcard'); $accounting_account = $accountingaccountstatic->getNomUrl(0, 1, 1);
} else { } else {
$accounting_account = length_accountg($line->numero_compte); $accounting_account = length_accountg($line->numero_compte);
} }
}
$link = ''; $link = '';
$total_debit += $line->debit; $total_debit += $line->debit;
@ -427,7 +521,7 @@ if ($action != 'export_csv') {
// Show first line of a break // Show first line of a break
print '<tr class="trforbreak">'; print '<tr class="trforbreak">';
print '<td colspan="'.($colspan+1).'" class="tdforbreak">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>'; print '<td colspan="'.($colspan+1).'" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
print '</tr>'; print '</tr>';
$displayed_account = $root_account_number; $displayed_account = $root_account_number;
@ -438,12 +532,35 @@ if ($action != 'export_csv') {
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Accounting account
if ($type == 'sub') {
print '<td>'.$line->subledger_account.' <span class="opacitymedium">('.$line->subledger_label.')</span></td>';
} else {
print '<td>'.$accounting_account.'</td>'; print '<td>'.$accounting_account.'</td>';
}
// Type
// TODO Retrieve the type of third party: Customer / Supplier / Employee
//if ($type == 'sub') {
// print '<td></td>';
//}
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) { if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
print '<td class="right nowraponall amount">'.price(price2num($opening_balance, 'MT')).'</td>'; print '<td class="right nowraponall amount">'.price(price2num($opening_balance, 'MT')).'</td>';
} }
$urlzoom = ''; $urlzoom = '';
if ($type == 'sub') {
if ($line->subledger_account) {
$urlzoom = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?type=sub&search_accountancy_code_start=' . urlencode($line->subledger_account) . '&search_accountancy_code_end=' . urlencode($line->subledger_account);
if (GETPOSTISSET('date_startmonth')) {
$urlzoom .= '&search_date_startmonth=' . GETPOST('date_startmonth', 'int') . '&search_date_startday=' . GETPOST('date_startday', 'int') . '&search_date_startyear=' . GETPOST('date_startyear', 'int');
}
if (GETPOSTISSET('date_endmonth')) {
$urlzoom .= '&search_date_endmonth=' . GETPOST('date_endmonth', 'int') . '&search_date_endday=' . GETPOST('date_endday', 'int') . '&search_date_endyear=' . GETPOST('date_endyear', 'int');
}
}
} else {
if ($line->numero_compte) { if ($line->numero_compte) {
$urlzoom = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start=' . urlencode($line->numero_compte) . '&search_accountancy_code_end=' . urlencode($line->numero_compte); $urlzoom = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start=' . urlencode($line->numero_compte) . '&search_accountancy_code_end=' . urlencode($line->numero_compte);
if (GETPOSTISSET('date_startmonth')) { if (GETPOSTISSET('date_startmonth')) {
@ -453,6 +570,7 @@ if ($action != 'export_csv') {
$urlzoom .= '&search_date_endmonth=' . GETPOST('date_endmonth', 'int') . '&search_date_endday=' . GETPOST('date_endday', 'int') . '&search_date_endyear=' . GETPOST('date_endyear', 'int'); $urlzoom .= '&search_date_endmonth=' . GETPOST('date_endmonth', 'int') . '&search_date_endday=' . GETPOST('date_endday', 'int') . '&search_date_endyear=' . GETPOST('date_endyear', 'int');
} }
} }
}
// Debit // Debit
print '<td class="right nowraponall amount"><a href="'.$urlzoom.'">'.price(price2num($line->debit, 'MT')).'</a></td>'; print '<td class="right nowraponall amount"><a href="'.$urlzoom.'">'.price(price2num($line->debit, 'MT')).'</a></td>';
// Credit // Credit

View File

@ -4,6 +4,7 @@
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022 Waël Almoman <info@almoman.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -44,7 +45,7 @@ $cancel = GETPOST('cancel', 'aZ09');
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$id = GETPOST('id', 'int'); // id of record $id = GETPOST('id', 'int'); // id of record
$mode = GETPOST('mode', 'aZ09'); // '' or '_tmp' $mode = $mode = $action == 'create' ? "_tmp" : GETPOST('mode', 'aZ09'); // '' or '_tmp'
$piece_num = GETPOST("piece_num", 'int'); // id of transaction (several lines share the same transaction id) $piece_num = GETPOST("piece_num", 'int'); // id of transaction (several lines share the same transaction id)
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
@ -54,10 +55,15 @@ $accountingaccount_number = GETPOST('accountingaccount_number', 'alphanohtml');
$accountingaccount->fetch(null, $accountingaccount_number, true); $accountingaccount->fetch(null, $accountingaccount_number, true);
$accountingaccount_label = $accountingaccount->label; $accountingaccount_label = $accountingaccount->label;
$journal_code = GETPOST('code_journal', 'alpha'); $journal_code = GETPOST('code_journal', 'alpha') ? GETPOST('code_journal', 'alpha') : "NULL";
$accountingjournal->fetch(null, $journal_code); $accountingjournal->fetch(null, $journal_code);
$journal_label = $accountingjournal->label; $journal_label = $accountingjournal->label;
$next_num_mvt = (int) GETPOST('next_num_mvt', 'alpha');
$doc_ref = (string) GETPOST('doc_ref', 'alpha');
$doc_date = (string) GETPOST('doc_date', 'alpha');
$doc_date = $doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
$subledger_account = GETPOST('subledger_account', 'alphanohtml'); $subledger_account = GETPOST('subledger_account', 'alphanohtml');
if ($subledger_account == -1) { if ($subledger_account == -1) {
$subledger_account = null; $subledger_account = null;
@ -72,6 +78,10 @@ $save = GETPOST('save', 'alpha');
if (!empty($save)) { if (!empty($save)) {
$action = 'add'; $action = 'add';
} }
$valid = GETPOST('validate', 'alpha');
if (!empty($valid)) {
$action = 'valid';
}
$update = GETPOST('update', 'alpha'); $update = GETPOST('update', 'alpha');
if (!empty($update)) { if (!empty($update)) {
$action = 'confirm_update'; $action = 'confirm_update';
@ -156,15 +166,29 @@ if ($action == "confirm_update") {
} }
} }
} }
} elseif ($action == "add") { } elseif ($action == 'add' || $action == 'valid') {
$error = 0; $error = 0;
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) { if (array_sum($debit) != array_sum($credit)) {
$action = 'add';
}
foreach ($accountingaccount_number as $key => $value) {
$accountingaccount->fetch(null, $accountingaccount_number[$key], true);
$accountingaccount_label[$key] = $accountingaccount->label[$key];
// if one added row is empty remove it before continue
if ($key < 1 && (empty($accountingaccount_number[$key]) || $accountingaccount_number[$key] == '-1') || (floatval($debit[$key]) == 0.0) && (floatval($credit[$key]) == 0.0)) {
continue;
}
if ((floatval($debit[$key]) != 0.0) && (floatval($credit[$key]) != 0.0)) {
$error++; $error++;
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
$action = ''; $action = '';
} }
if (empty($accountingaccount_number) || $accountingaccount_number == '-1') {
if (empty($accountingaccount_number[$key]) || $accountingaccount_number[$key] == '-1') {
$error++; $error++;
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
$action = ''; $action = '';
@ -172,48 +196,49 @@ if ($action == "confirm_update") {
if (!$error) { if (!$error) {
$object = new BookKeeping($db); $object = new BookKeeping($db);
$object->numero_compte = $accountingaccount_number[$key];
$object->numero_compte = $accountingaccount_number; $object->subledger_account = $subledger_account[$key];
$object->subledger_account = $subledger_account; $object->subledger_label = $subledger_label[$key];
$object->subledger_label = $subledger_label; $object->label_compte = $accountingaccount_label[$key];
$object->label_compte = $accountingaccount_label; $object->label_operation = $label_operation[$key];
$object->label_operation = $label_operation; $object->debit = price2num($debit[$key]);
$object->debit = $debit; $object->credit = price2num($credit[$key]);
$object->credit = $credit; $object->doc_date = $doc_date;
$object->doc_date = (string) GETPOST('doc_date', 'alpha');
$object->doc_type = (string) GETPOST('doc_type', 'alpha'); $object->doc_type = (string) GETPOST('doc_type', 'alpha');
$object->piece_num = $piece_num; $object->piece_num = $piece_num;
$object->doc_ref = (string) GETPOST('doc_ref', 'alpha'); $object->doc_ref = $doc_ref;
$object->code_journal = $journal_code; $object->code_journal = $journal_code;
$object->journal_label = $journal_label; $object->journal_label = $journal_label;
$object->fk_doc = GETPOSTINT('fk_doc'); $object->fk_doc = GETPOSTINT('fk_doc');
$object->fk_docdet = GETPOSTINT('fk_docdet'); $object->fk_docdet = GETPOSTINT('fk_docdet');
if (floatval($debit) != 0.0) { if (floatval($debit[$key]) != 0.0) {
$object->montant = $debit; // deprecated $object->montant = $object->debit; // deprecated
$object->amount = $debit; $object->amount = $object->debit;
$object->sens = 'D'; $object->sens = 'D';
} }
if (floatval($credit) != 0.0) { if (floatval($credit[$key]) != 0.0) {
$object->montant = $credit; // deprecated $object->montant = $object->credit; // deprecated
$object->amount = $credit; $object->amount = $object->credit;
$object->sens = 'C'; $object->sens = 'C';
} }
$result = $object->createStd($user, false, $mode); $result = $object->createStd($user, false, $mode);
if ($result < 0) { if ($result < 0) {
$error++;
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} else { }
}
}
if (empty($error)) {
if ($mode != '_tmp') { if ($mode != '_tmp') {
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
} }
$debit = 0; $debit = 0;
$credit = 0; $credit = 0;
$action = ''; $action = $action == 'add' ? '' : $action ; // stay in valid mode when not adding line
}
} }
} elseif ($action == "confirm_delete") { } elseif ($action == "confirm_delete") {
$object = new BookKeeping($db); $object = new BookKeeping($db);
@ -230,17 +255,28 @@ if ($action == "confirm_update") {
} }
} }
$action = ''; $action = '';
} elseif ($action == "confirm_create") { } elseif ($action == 'create') {
$error = 0; $error = 0;
$object = new BookKeeping($db); $object = new BookKeeping($db);
$next_num_mvt = !empty($next_num_mvt) ? $next_num_mvt : $object->getNextNumMvt('_tmp');
$doc_ref = !empty($doc_ref) ? $doc_ref : $next_num_mvt;
if (empty($doc_date)) {
$tmp_date = dol_getdate(dol_now());
$_POST['doc_dateday'] = $tmp_date['mday'];
$_POST['doc_datemonth'] = $tmp_date['mon'];
$_POST['doc_dateyear'] = $tmp_date['year'];
unset($tmp_date);
}
if (!$journal_code || $journal_code == '-1') { if (!$journal_code || $journal_code == '-1') {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors');
$action = 'create'; $action = 'create';
$error++; $error++;
} }
if (!GETPOST('doc_ref', 'alpha')) { if (empty($doc_ref)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Piece")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Piece")), null, 'errors');
$action = 'create'; $action = 'create';
$error++; $error++;
@ -252,8 +288,8 @@ if ($action == "confirm_update") {
$object->credit = 0; $object->credit = 0;
$object->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int')); $object->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
$object->doc_type = GETPOST('doc_type', 'alpha'); $object->doc_type = GETPOST('doc_type', 'alpha');
$object->piece_num = GETPOST('next_num_mvt', 'alpha'); $object->piece_num = $next_num_mvt;
$object->doc_ref = GETPOST('doc_ref', 'alpha'); $object->doc_ref = $doc_ref;
$object->code_journal = $journal_code; $object->code_journal = $journal_code;
$object->journal_label = $journal_label; $object->journal_label = $journal_label;
$object->fk_doc = 0; $object->fk_doc = 0;
@ -302,7 +338,7 @@ if ($action == 'setjournal') {
} }
if ($action == 'setdocref') { if ($action == 'setdocref') {
$refdoc = GETPOST('doc_ref', 'alpha'); $refdoc = $doc_ref;
$result = $object->updateByMvt($piece_num, 'doc_ref', $refdoc, $mode); $result = $object->updateByMvt($piece_num, 'doc_ref', $refdoc, $mode);
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
@ -333,7 +369,7 @@ if ($action == 'valid') {
$html = new Form($db); $html = new Form($db);
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
$title = $langs->trans("CreateMvts"); $title = $langs->trans($mode =="_tmp" ? "CreateMvts": "UpdateMvts");
llxHeader('', $title); llxHeader('', $title);
@ -343,66 +379,7 @@ if ($action == 'delete') {
print $formconfirm; print $formconfirm;
} }
if ($action == 'create') {
print load_fiche_titre($title);
$object = new BookKeeping($db);
$next_num_mvt = $object->getNextNumMvt('_tmp');
if (empty($next_num_mvt)) {
dol_print_error('', 'Failed to get next piece number');
}
print '<form action="'.$_SERVER["PHP_SELF"].'" name="create_mvt" method="POST">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="confirm_create">'."\n";
print '<input type="hidden" name="next_num_mvt" value="'.$next_num_mvt.'">'."\n";
print '<input type="hidden" name="mode" value="_tmp">'."\n";
print dol_get_fiche_head();
print '<table class="border centpercent">';
/*print '<tr>';
print '<td class="titlefieldcreate fieldrequired">' . $langs->trans("NumPiece") . '</td>';
print '<td>' . $next_num_mvt . '</td>';
print '</tr>';*/
print '<tr>';
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Docdate").'</td>';
print '<td>';
print $html->selectDate('', 'doc_date', '', '', '', "create_mvt", 1, 1);
print '</td>';
print '</tr>';
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans("Codejournal").'</td>';
print '<td>'.$formaccounting->select_journal($journal_code, 'code_journal', 0, 0, 1, 1).'</td>';
print '</tr>';
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans("Piece").'</td>';
print '<td><input type="text" class="minwidth200" name="doc_ref" value="'.GETPOST('doc_ref', 'alpha').'"></td>';
print '</tr>';
/*
print '<tr>';
print '<td>' . $langs->trans("Doctype") . '</td>';
print '<td><input type="text" class="minwidth200 name="doc_type" value=""/></td>';
print '</tr>';
*/
print '</table>';
print dol_get_fiche_end();
print $form->buttonsSaveCancel("Create");
print '</form>';
} else {
$object = new BookKeeping($db); $object = new BookKeeping($db);
$result = $object->fetchPerMvt($piece_num, $mode); $result = $object->fetchPerMvt($piece_num, $mode);
if ($result < 0) { if ($result < 0) {
@ -412,8 +389,11 @@ if ($action == 'create') {
if (!empty($object->piece_num)) { if (!empty($object->piece_num)) {
$backlink = '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?restore_lastsearch_values=1">'.$langs->trans('BackToList').'</a>'; $backlink = '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?restore_lastsearch_values=1">'.$langs->trans('BackToList').'</a>';
print load_fiche_titre($langs->trans("UpdateMvts"), $backlink); print load_fiche_titre($langs->trans($mode =="_tmp" ? "CreateMvts": "UpdateMvts"), $backlink);
print '<form action="'.$_SERVER["PHP_SELF"].'?piece_num='.$object->piece_num.'" method="post">'; if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'" />';
}
$head = array(); $head = array();
$h = 0; $h = 0;
$head[$h][0] = $_SERVER['PHP_SELF'].'?piece_num='.$object->piece_num.($mode ? '&mode='.$mode : ''); $head[$h][0] = $_SERVER['PHP_SELF'].'?piece_num='.$object->piece_num.($mode ? '&mode='.$mode : '');
@ -431,93 +411,35 @@ if ($action == 'create') {
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">'; print '<table class="border tableforfield" width="100%">';
// Account movement /*print '<tr>';
print '<td class="titlefieldcreate fieldrequired">' . $langs->trans("NumPiece") . '</td>';
print '<td>' . $next_num_mvt . '</td>';
print '</tr>';*/
print '<tr>'; print '<tr>';
print '<td class="titlefield">'.$langs->trans("NumMvts").'</td>'; print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Docdate").'</td>';
print '<td>'.($mode == '_tmp' ? '<span class="opacitymedium" title="Id tmp '.$object->piece_num.'">'.$langs->trans("Draft").'</span>' : $object->piece_num).'</td>'; print '<td>';
print '</tr>'; print $html->selectDate($doc_date, 'doc_date', '', '', '', "create_mvt", 1, 1);
// Date
print '<tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('Docdate');
print '</td>';
if ($action != 'editdate') {
print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdate&token='.newToken().'&piece_num='.urlencode($object->piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'editdate') {
print '<form name="setdate" action="'.$_SERVER["PHP_SELF"].'?piece_num='.$object->piece_num.'" method="post">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setdate">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print $form->selectDate($object->doc_date ? $object->doc_date : - 1, 'doc_date', '', '', '', "setdate");
print '<input type="submit" class="button button-edit" value="'.$langs->trans('Modify').'">';
print '</form>';
} else {
print $object->doc_date ? dol_print_date($object->doc_date, 'day') : '&nbsp;';
}
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Journal print '<tr>';
print '<tr><td>'; print '<td class="fieldrequired">'.$langs->trans("Codejournal").'</td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<td>'.$formaccounting->select_journal($journal_code, 'code_journal', 0, 0, 1, 1).'</td>';
print $langs->trans('Codejournal');
print '</td>';
if ($action != 'editjournal') {
print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editjournal&token='.newToken().'&piece_num='.urlencode($object->piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td>';
if ($action == 'editjournal') {
print '<form name="setjournal" action="'.$_SERVER["PHP_SELF"].'?piece_num='.$object->piece_num.'" method="post">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setjournal">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print $formaccounting->select_journal($object->code_journal, 'code_journal', 0, 0, array(), 1, 1);
print '<input type="submit" class="button button-edit" value="'.$langs->trans('Modify').'">';
print '</form>';
} else {
print $object->code_journal;
}
print '</td>';
print '</tr>'; print '</tr>';
// Ref document print '<tr>';
print '<tr><td>'; print '<td class="fieldrequired">'.$langs->trans("Piece").'</td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<td><input type="text" class="minwidth200" name="doc_ref" value="'.$doc_ref.'" /></td>';
print $langs->trans('Piece');
print '</td>';
if ($action != 'editdocref') {
print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdocref&token='.newToken().'&piece_num='.urlencode($object->piece_num).'&mode='.urlencode($mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td>';
if ($action == 'editdocref') {
print '<form name="setdocref" action="'.$_SERVER["PHP_SELF"].'?piece_num='.$object->piece_num.'" method="post">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setdocref">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print '<input type="text" size="20" name="doc_ref" value="'.dol_escape_htmltag($object->doc_ref).'">';
print '<input type="submit" class="button button-edit" value="'.$langs->trans('Modify').'">';
print '</form>';
} else {
print $object->doc_ref;
}
print '</td>';
print '</tr>'; print '</tr>';
/*
print '<tr>';
print '<td>' . $langs->trans("Doctype") . '</td>';
print '<td><input type="text" class="minwidth200 name="doc_type" value="" /></td>';
print '</tr>';
*/
print '</table>'; print '</table>';
print '</div>'; print '</div>';
@ -561,7 +483,6 @@ if ($action == 'create') {
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
// Validate // Validate
/* /*
print '<tr>'; print '<tr>';
@ -584,8 +505,7 @@ if ($action == 'create') {
/* /*
print '<tr>'; print '<tr>';
print '<td class="titlefield">' . $langs->trans("Control") . '</td>'; print '<td class="titlefield">' . $langs->trans("Control") . '</td>';
if ($object->doc_type == 'customer_invoice') if ($object->doc_type == 'customer_invoice') {
{
$sqlmid = 'SELECT rowid as ref'; $sqlmid = 'SELECT rowid as ref';
$sqlmid .= " FROM ".MAIN_DB_PREFIX."facture as fac"; $sqlmid .= " FROM ".MAIN_DB_PREFIX."facture as fac";
$sqlmid .= " WHERE fac.rowid=" . ((int) $object->fk_doc); $sqlmid .= " WHERE fac.rowid=" . ((int) $object->fk_doc);
@ -596,16 +516,15 @@ if ($action == 'create') {
$invoicestatic = new Facture($db); $invoicestatic = new Facture($db);
$invoicestatic->fetch($objmid->ref); $invoicestatic->fetch($objmid->ref);
$ref=$langs->trans("Invoice").' '.$invoicestatic->getNomUrl(1); $ref=$langs->trans("Invoice").' '.$invoicestatic->getNomUrl(1);
} else {
dol_print_error($db);
} }
else dol_print_error($db);
} }
print '<td>' . $ref .'</td>'; print '<td>' . $ref .'</td>';
print '</tr>'; print '</tr>';
*/ */
print "</table>\n"; print "</table>\n";
print '</div>';
print dol_get_fiche_end(); print dol_get_fiche_end();
print '<div style="clear:both"></div>'; print '<div style="clear:both"></div>';
@ -613,25 +532,21 @@ if ($action == 'create') {
print '<br>'; print '<br>';
$result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt $result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} else { } else {
// List of movements // List of movements
print load_fiche_titre($langs->trans("ListeMvts"), '', ''); print load_fiche_titre($langs->trans("ListeMvts"), '', '');
print '<form action="'.$_SERVER["PHP_SELF"].'?piece_num='.$object->piece_num.'" method="post">';
if ($optioncss != '') { if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; print '<input type="hidden" name="optioncss" value="'.$optioncss.'" />';
} }
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="doc_date" value="'.$object->doc_date.'">'."\n"; print '<input type="hidden" name="token" value="'.newToken().'" />';
print '<input type="hidden" name="doc_type" value="'.$object->doc_type.'">'."\n"; print '<input type="hidden" name="doc_type" value="'.$object->doc_type.'" />'."\n";
print '<input type="hidden" name="doc_ref" value="'.$object->doc_ref.'">'."\n"; print '<input type="hidden" name="fk_doc" value="'.$object->fk_doc.'" />'."\n";
print '<input type="hidden" name="code_journal" value="'.$object->code_journal.'">'."\n"; print '<input type="hidden" name="fk_docdet" value="'.$object->fk_docdet.'" />'."\n";
print '<input type="hidden" name="fk_doc" value="'.$object->fk_doc.'">'."\n"; print '<input type="hidden" name="mode" value="'.$mode.'" />'."\n";
print '<input type="hidden" name="fk_docdet" value="'.$object->fk_docdet.'">'."\n";
print '<input type="hidden" name="mode" value="'.$mode.'">'."\n";
if (count($object->linesmvt) > 0) { if (count($object->linesmvt) > 0) {
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
@ -640,6 +555,25 @@ if ($action == 'create') {
$total_debit = 0; $total_debit = 0;
$total_credit = 0; $total_credit = 0;
// Don't show in tmp mode, inevitably empty
if ($mode != "_tmp") {
// Date document export
print '<tr>';
print '<td class="titlefield">' . $langs->trans("DateExport") . '</td>';
print '<td>';
print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : '&nbsp;';
print '</td>';
print '</tr>';
// Date document validation
print '<tr>';
print '<td class="titlefield">' . $langs->trans("DateValidation") . '</td>';
print '<td>';
print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : '&nbsp;';
print '</td>';
print '</tr>';
}
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("AccountAccountingShort"); print_liste_field_titre("AccountAccountingShort");
@ -655,16 +589,25 @@ if ($action == 'create') {
print "</tr>\n"; print "</tr>\n";
// Add an empty line if there is not yet // In _tmp mode the first line is empty so we remove it
if (!empty($object->linesmvt[0])) { if ($mode == "_tmp") {
$tmpline = $object->linesmvt[0]; array_shift($object->linesmvt);
if (!empty($tmpline->numero_compte)) { }
// Add an empty line at the end to be able to add transaction
$line = new BookKeepingLine();
$object->linesmvt[] = $line;
// Add a second line empty line if there is not yet
if (empty($object->linesmvt[1])) {
$line = new BookKeepingLine(); $line = new BookKeepingLine();
$object->linesmvt[] = $line; $object->linesmvt[] = $line;
} }
}
foreach ($object->linesmvt as $line) { $count_line = count($object->linesmvt);
$num_line = 0;
foreach ($object->linesmvt as $key => $line) {
$num_line++;
print '<tr class="oddeven" data-lineid="'.((int) $line->id).'">'; print '<tr class="oddeven" data-lineid="'.((int) $line->id).'">';
$total_debit += $line->debit; $total_debit += $line->debit;
$total_credit += $line->credit; $total_credit += $line->credit;
@ -672,7 +615,7 @@ if ($action == 'create') {
if ($action == 'update' && $line->id == $id) { if ($action == 'update' && $line->id == $id) {
print '<!-- td columns in edit mode -->'; print '<!-- td columns in edit mode -->';
print '<td>'; print '<td>';
print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500'); print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, '');
print '</td>'; print '</td>';
print '<td>'; print '<td>';
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because: // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because:
@ -682,23 +625,23 @@ if ($action == 'create') {
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1, 'maxwidth250', '', 'subledger_label');
} else { } else {
print '<input type="text" class="maxwidth150" name="subledger_account" value="'.(GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">'; print '<input type="text" class="maxwidth150" name="subledger_account" value="'.(GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'" />';
} }
// Add also input for subledger label // Add also input for subledger label
print '<br><input type="text" class="maxwidth150" name="subledger_label" value="'.(GETPOSTISSET("subledger_label") ? GETPOST("subledger_label", "alpha") : $line->subledger_label).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccountLabel")).'">'; print '<br><input type="text" class="maxwidth150" name="subledger_label" value="'.(GETPOSTISSET("subledger_label") ? GETPOST("subledger_label", "alpha") : $line->subledger_label).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccountLabel")).'" />';
print '</td>'; print '</td>';
print '<td><input type="text" class="minwidth200" name="label_operation" value="'.(GETPOSTISSET("label_operation") ? GETPOST("label_operation", "alpha") : $line->label_operation).'"></td>'; print '<td><input type="text" class="minwidth200" name="label_operation" value="'.(GETPOSTISSET("label_operation") ? GETPOST("label_operation", "alpha") : $line->label_operation).'" /></td>';
print '<td class="right"><input type="text" size="6" class="right" name="debit" value="'.(GETPOSTISSET("debit") ? GETPOST("debit", "alpha") : price($line->debit)).'"></td>'; print '<td class="right"><input type="text" size="6" class="right" name="debit" value="'.(GETPOSTISSET("debit") ? GETPOST("debit", "alpha") : price($line->debit)).'" /></td>';
print '<td class="right"><input type="text" size="6" class="right" name="credit" value="'.(GETPOSTISSET("credit") ? GETPOST("credit", "alpha") : price($line->credit)).'"></td>'; print '<td class="right"><input type="text" size="6" class="right" name="credit" value="'.(GETPOSTISSET("credit") ? GETPOST("credit", "alpha") : price($line->credit)).'" /></td>';
print '<td>'; print '<td>';
print '<input type="hidden" name="id" value="'.$line->id.'">'."\n"; print '<input type="hidden" name="id" value="'.$line->id.'" />'."\n";
print '<input type="submit" class="button" name="update" value="'.$langs->trans("Update").'">'; print '<input type="submit" class="button" name="update" value="'.$langs->trans("Update").'" />';
print '</td>'; print '</td>';
} elseif (empty($line->numero_compte) || (empty($line->debit) && empty($line->credit))) { } elseif (empty($line->numero_compte) || (empty($line->debit) && empty($line->credit))) {
if ($action == "" || $action == 'add') { if ($action == "" || $action == 'add') {
print '<!-- td columns in add mode -->'; print '<!-- td columns in add mode -->';
print '<td>'; print '<td>';
print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500'); print $formaccounting->select_account((is_array($accountingaccount_number) ? $accountingaccount_number[$key] : $accountingaccount_number ), 'accountingaccount_number['.$key.']', 1, array(), 1, 1, '');
print '</td>'; print '</td>';
print '<td>'; print '<td>';
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because: // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because:
@ -706,16 +649,21 @@ if ($action == 'create') {
// Also, it is not possible to use a value that is not in the list. // Also, it is not possible to use a value that is not in the list.
// Also, the label is not automatically filled when a value is selected. // Also, the label is not automatically filled when a value is selected.
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
print $formaccounting->select_auxaccount('', 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); print $formaccounting->select_auxaccount((is_array($subledger_account) ? $subledger_account[$key] : $subledger_account ), 'subledger_account['.$key.']', 1, 'maxwidth250', '', 'subledger_label');
} else { } else {
print '<input type="text" class="maxwidth150" name="subledger_account" value="" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccount")) . '">'; print '<input type="text" class="maxwidth150" name="subledger_account['.$key.']" value="' . (is_array($subledger_account) ? $subledger_account[$key] : $subledger_account ) . '" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccount")) . '" />';
} }
print '<br><input type="text" class="maxwidth150" name="subledger_label" value="" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccountLabel")) . '">'; print '<br><input type="text" class="maxwidth150" name="subledger_label['.$key.']" value="' . (is_array($subledger_label) ? $subledger_label[$key] : $subledger_label ) . '" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccountLabel")) . '" />';
print '</td>'; print '</td>';
print '<td><input type="text" class="minwidth200" name="label_operation" value="' . $label_operation . '"/></td>'; print '<td><input type="text" class="minwidth200" name="label_operation['.$key.']" value="' . (is_array($label_operation) ? $label_operation[$key] : $label_operation ) . '"/></td>';
print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>'; print '<td class="right"><input type="text" size="6" class="right" name="debit['.$key.']" value="' . (is_array($debit) ? $debit[$key] : $debit ) . '" /></td>';
print '<td class="right"><input type="text" size="6" class="right" name="credit" value=""/></td>'; print '<td class="right"><input type="text" size="6" class="right" name="credit['.$key.']" value="' . (is_array($credit) ? $credit[$key] : $credit ) . '" /></td>';
print '<td class="center"><input type="submit" class="button small" name="save" value="' . $langs->trans("Add") . '"></td>'; // Add button should not appear twice
if ($num_line === $count_line) {
print '<td><input type="submit" class="button small" name="save" value="' . $langs->trans("Add") . '" /></td>';
} else {
print '<td class="right"></td>';
}
} }
} else { } else {
print '<!-- td columns in display mode -->'; print '<!-- td columns in display mode -->';
@ -781,9 +729,9 @@ if ($action == 'create') {
print '<br>'; print '<br>';
print '<div class="center">'; print '<div class="center">';
if ($total_debit == $total_credit) { if ($total_debit == $total_credit) {
print '<a class="button" href="'.$_SERVER["PHP_SELF"].'?piece_num='.$object->piece_num.'&action=valid">'.$langs->trans("ValidTransaction").'</a>'; print '<input type="submit" class="button" name="validate" value="' . $langs->trans("ValidTransaction") . '" />';
} else { } else {
print '<input type="submit" class="button" disabled="disabled" href="#" title="'.dol_escape_htmltag($langs->trans("MvtNotCorrectlyBalanced", $debit, $credit)).'" value="'.dol_escape_htmltag($langs->trans("ValidTransaction")).'">'; print '<input type="submit" class="button" disabled="disabled" href="#" title="'.dol_escape_htmltag($langs->trans("MvtNotCorrectlyBalanced", $debit, $credit)).'" value="'.dol_escape_htmltag($langs->trans("ValidTransaction")).'" />';
} }
print ' &nbsp; '; print ' &nbsp; ';
@ -798,7 +746,6 @@ if ($action == 'create') {
} else { } else {
print load_fiche_titre($langs->trans("NoRecords")); print load_fiche_titre($langs->trans("NoRecords"));
} }
}
print dol_get_fiche_end(); print dol_get_fiche_end();

View File

@ -2,8 +2,10 @@
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2022 Lionel Vessiller <lvessiller@open-dsi.fr>
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022 Progiseize <a.bisotti@progiseize.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -102,7 +104,9 @@ if (GETPOST("button_export_file_x") || GETPOST("button_export_file.x") || GETPOS
$action = 'export_file'; $action = 'export_file';
} }
$search_accountancy_code = GETPOST("search_accountancy_code"); $search_account_category = GETPOST('search_account_category', 'int');
$search_accountancy_code = GETPOST("search_accountancy_code", 'alpha');
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha'); $search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
if ($search_accountancy_code_start == - 1) { if ($search_accountancy_code_start == - 1) {
$search_accountancy_code_start = ''; $search_accountancy_code_start = '';
@ -253,6 +257,7 @@ if (empty($reshook)) {
$search_doc_type = ''; $search_doc_type = '';
$search_doc_ref = ''; $search_doc_ref = '';
$search_doc_date = ''; $search_doc_date = '';
$search_account_category = '';
$search_accountancy_code = ''; $search_accountancy_code = '';
$search_accountancy_code_start = ''; $search_accountancy_code_start = '';
$search_accountancy_code_end = ''; $search_accountancy_code_end = '';
@ -335,6 +340,20 @@ if (empty($reshook)) {
$filter['t.doc_ref'] = $search_doc_ref; $filter['t.doc_ref'] = $search_doc_ref;
$param .= '&search_doc_ref='.urlencode($search_doc_ref); $param .= '&search_doc_ref='.urlencode($search_doc_ref);
} }
if ($search_account_category != '-1' && !empty($search_account_category)) {
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php';
$accountingcategory = new AccountancyCategory($db);
$listofaccountsforgroup = $accountingcategory->getCptsCat(0, 'fk_accounting_category = '.((int) $search_account_category));
$listofaccountsforgroup2 = array();
if (is_array($listofaccountsforgroup)) {
foreach ($listofaccountsforgroup as $tmpval) {
$listofaccountsforgroup2[] = "'".$db->escape($tmpval['id'])."'";
}
}
$filter['t.search_accounting_code_in'] = join(',', $listofaccountsforgroup2);
$param .= '&search_account_category='.urlencode($search_account_category);
}
if (!empty($search_accountancy_code)) { if (!empty($search_accountancy_code)) {
$filter['t.numero_compte'] = $search_accountancy_code; $filter['t.numero_compte'] = $search_accountancy_code;
$param .= '&search_accountancy_code='.urlencode($search_accountancy_code); $param .= '&search_accountancy_code='.urlencode($search_accountancy_code);
@ -474,7 +493,7 @@ if (empty($reshook)) {
if ($conf->global->ACCOUNTING_REEXPORT == 1) { if ($conf->global->ACCOUNTING_REEXPORT == 1) {
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs'); setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'mesgs'); setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'warnings');
} }
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
@ -642,6 +661,9 @@ $sql .= " t.tms as date_modification,";
$sql .= " t.date_export,"; $sql .= " t.date_export,";
$sql .= " t.date_validated as date_validation,"; $sql .= " t.date_validated as date_validation,";
$sql .= " t.import_key"; $sql .= " t.import_key";
$sqlfields = $sql; // $sql fields to remove for count total
$sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t'; $sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t';
// Manage filter // Manage filter
$sqlwhere = array(); $sqlwhere = array();
@ -672,7 +694,13 @@ if (count($filter) > 0) {
} elseif ($key == 't.reconciled_option') { } elseif ($key == 't.reconciled_option') {
$sqlwhere[] = 't.lettering_code IS NULL'; $sqlwhere[] = 't.lettering_code IS NULL';
} elseif ($key == 't.code_journal' && !empty($value)) { } elseif ($key == 't.code_journal' && !empty($value)) {
if (is_array($value)) {
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1); $sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
} else {
$sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
}
} elseif ($key == 't.search_accounting_code_in' && !empty($value)) {
$sqlwhere[] = 't.numero_compte IN ('.$db->sanitize($value, 1).')';
} else { } else {
$sqlwhere[] = natural_search($key, $value, 0, 1); $sqlwhere[] = natural_search($key, $value, 0, 1);
} }
@ -685,9 +713,6 @@ if (empty($conf->global->ACCOUNTING_REEXPORT)) {
if (count($sqlwhere) > 0) { if (count($sqlwhere) > 0) {
$sql .= ' AND '.implode(' AND ', $sqlwhere); $sql .= ' AND '.implode(' AND ', $sqlwhere);
} }
if (!empty($sortfield)) {
$sql .= $db->order($sortfield, $sortorder);
}
//print $sql; //print $sql;
@ -715,24 +740,22 @@ if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements
} }
} }
$mimetype = $accountancyexport->getMimeType($formatexportset);
top_httphead($mimetype, 1);
// Output data on screen
$accountancyexport->export($object->lines, $formatexportset);
$notifiedexportdate = GETPOST('notifiedexportdate', 'alpha'); $notifiedexportdate = GETPOST('notifiedexportdate', 'alpha');
$notifiedvalidationdate = GETPOST('notifiedvalidationdate', 'alpha'); $notifiedvalidationdate = GETPOST('notifiedvalidationdate', 'alpha');
$withAttachment = !empty(trim(GETPOST('notifiedexportfull', 'alphanohtml'))) ? 1 : 0;
// Output data on screen or download
$result = $accountancyexport->export($object->lines, $formatexportset, $withAttachment);
if (!empty($accountancyexport->errors)) {
dol_print_error('', '', $accountancyexport->errors);
} elseif (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) {
// Specify as export : update field date_export or date_validated
$error = 0; $error = 0;
if ($result < 0) {
$error++;
} else {
if (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) {
if (is_array($object->lines)) {
// Specify as export : update field date_export or date_validated
$db->begin(); $db->begin();
if (is_array($object->lines)) {
foreach ($object->lines as $movement) { foreach ($object->lines as $movement) {
$now = dol_now(); $now = dol_now();
@ -756,17 +779,23 @@ if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements
break; break;
} }
} }
}
if (!$error) { if (!$error) {
$db->commit(); $db->commit();
} else { } else {
$error++; $error++;
$accountancyexport->errors[] = $langs->trans('NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated');
$db->rollback(); $db->rollback();
dol_print_error('', $langs->trans("NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated"));
} }
} }
exit; }
}
if ($error) {
setEventMessages('', $accountancyexport->errors, 'errors');
header('Location: '.$_SERVER['PHP_SELF']);
}
exit(); // download or show errors
} }
} }
@ -783,18 +812,29 @@ $title_page = $langs->trans("Operations").' - '.$langs->trans("Journals");
// Count total nb of records // Count total nb of records
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$resql = $db->query($sql); /* The fast and low memory method to get and count full list converts the sql into a sql count */
$nbtotalofrecords = $db->num_rows($resql); $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
$resql = $db->query($sqlforcount);
if ($resql) {
$objforcount = $db->fetch_object($resql);
$nbtotalofrecords = $objforcount->nbtotalofrecords;
} else {
dol_print_error($db);
}
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
$page = 0; $page = 0;
$offset = 0; $offset = 0;
} }
$db->free($resql);
} }
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { // Complete request and execute it with limit
$num = $nbtotalofrecords; $sql .= $db->order($sortfield, $sortorder);
} else { if ($limit) {
$sql .= $db->plimit($limit + 1, $offset); $sql .= $db->plimit($limit + 1, $offset);
}
$resql = $db->query($sql); $resql = $db->query($sql);
if (!$resql) { if (!$resql) {
@ -803,7 +843,6 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) {
} }
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
}
$arrayofselected = is_array($toselect) ? $toselect : array(); $arrayofselected = is_array($toselect) ? $toselect : array();
@ -854,7 +893,17 @@ if ($action == 'export_file') {
$form_question['separator3'] = array('name'=>'separator3', 'type'=>'separator'); $form_question['separator3'] = array('name'=>'separator3', 'type'=>'separator');
} }
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 350, 600); // add documents in an archive for accountancy export (Quadratus)
if (getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV') == AccountancyExport::$EXPORT_TYPE_QUADRATUS) {
$form_question['notifiedexportfull'] = array(
'name' => 'notifiedexportfull',
'type' => 'checkbox',
'label' => $langs->trans('NotifiedExportFull'),
'value' => 'false',
);
}
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 400, 600);
} }
//if ($action == 'delbookkeepingyear') { //if ($action == 'delbookkeepingyear') {
@ -953,11 +1002,14 @@ $newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
if (empty($reshook)) { if (empty($reshook)) {
// Button re-export // Button re-export
if (!empty($conf->global->ACCOUNTING_REEXPORT)) { if (!empty($conf->global->ACCOUNTING_REEXPORT)) {
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Activated"), 'switch_on').'</a> '; $newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("ClickToHideAlreadyExportedLines"), 'switch_off', 'class="small size15x valignmiddle"');
$newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("ClickToHideAlreadyExportedLines").'</span>';
$newcardbutton .= '</a>';
} else { } else {
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> '; $newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("DocsAlreadyExportedAreExcluded"), 'switch_on', 'class="warning size15x valignmiddle"').'';
$newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("DocsAlreadyExportedAreExcluded").'</span>';
$newcardbutton .= '</a>';
} }
$newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>';
if ($user->hasRight('accounting', 'mouvements', 'export')) { if ($user->hasRight('accounting', 'mouvements', 'export')) {
$newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : ''), $user->hasRight('accounting', 'mouvements', 'export')); $newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : ''), $user->hasRight('accounting', 'mouvements', 'export'));
@ -991,23 +1043,33 @@ if ($massaction == 'preunletteringauto') {
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
if ($massactionbutton && $contextpage != 'poslist') { if ($massactionbutton && $contextpage != 'poslist') {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1); $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
} }
$moreforfilter = ''; $moreforfilter = '';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('AccountingCategory').': ';
$moreforfilter .= '<div class="nowrap inline-block">';
$moreforfilter .= $formaccounting->select_accounting_category($search_account_category, 'search_account_category', 1, 0, 0, 0);
$moreforfilter .= '</div>';
$moreforfilter .= '</div>';
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) { if (empty($reshook)) {
$moreforfilter .= $hookmanager->resPrint; $moreforfilter .= $hookmanager->resPrint;
} else { } else {
$moreforfilter = $hookmanager->resPrint; $moreforfilter = $hookmanager->resPrint;
} }
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
print '</div>';
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste centpercent">'; print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">';
// Filters lines // Filters lines
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
@ -1163,8 +1225,7 @@ print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');}
}
if (!empty($arrayfields['t.piece_num']['checked'])) { if (!empty($arrayfields['t.piece_num']['checked'])) {
print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder); print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
} }
@ -1511,6 +1572,16 @@ while ($i < min($num, $limit)) {
// Show total line // Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0) {
$colspan = 1;
foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
$colspan++;
}
}
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook

View File

@ -79,7 +79,8 @@ $search_date_validation_start = dol_mktime(0, 0, 0, $search_date_validation_star
$search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear); $search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear);
$search_import_key = GETPOST("search_import_key", 'alpha'); $search_import_key = GETPOST("search_import_key", 'alpha');
$search_accountancy_code = GETPOST("search_accountancy_code"); $search_account_category = GETPOST('search_account_category', 'int');
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha'); $search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
if ($search_accountancy_code_start == - 1) { if ($search_accountancy_code_start == - 1) {
$search_accountancy_code_start = ''; $search_accountancy_code_start = '';
@ -198,6 +199,8 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }
$error = 0;
/* /*
* Action * Action
@ -224,7 +227,7 @@ if (empty($reshook)) {
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$search_doc_date = ''; $search_doc_date = '';
$search_accountancy_code = ''; $search_account_category = '';
$search_accountancy_code_start = ''; $search_accountancy_code_start = '';
$search_accountancy_code_end = ''; $search_accountancy_code_end = '';
$search_label_account = ''; $search_label_account = '';
@ -280,6 +283,20 @@ if (empty($reshook)) {
$filter['t.doc_date'] = $search_doc_date; $filter['t.doc_date'] = $search_doc_date;
$param .= '&doc_datemonth='.GETPOST('doc_datemonth', 'int').'&doc_dateday='.GETPOST('doc_dateday', 'int').'&doc_dateyear='.GETPOST('doc_dateyear', 'int'); $param .= '&doc_datemonth='.GETPOST('doc_datemonth', 'int').'&doc_dateday='.GETPOST('doc_dateday', 'int').'&doc_dateyear='.GETPOST('doc_dateyear', 'int');
} }
if ($search_account_category != '-1' && !empty($search_account_category)) {
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php';
$accountingcategory = new AccountancyCategory($db);
$listofaccountsforgroup = $accountingcategory->getCptsCat(0, 'fk_accounting_category = '.((int) $search_account_category));
$listofaccountsforgroup2 = array();
if (is_array($listofaccountsforgroup)) {
foreach ($listofaccountsforgroup as $tmpval) {
$listofaccountsforgroup2[] = "'".$db->escape($tmpval['id'])."'";
}
}
$filter['t.search_accounting_code_in'] = join(',', $listofaccountsforgroup2);
$param .= '&search_account_category='.urlencode($search_account_category);
}
if (!empty($search_accountancy_code_start)) { if (!empty($search_accountancy_code_start)) {
if ($type == 'sub') { if ($type == 'sub') {
$filter['t.subledger_account>='] = $search_accountancy_code_start; $filter['t.subledger_account>='] = $search_accountancy_code_start;
@ -358,7 +375,6 @@ if (empty($reshook)) {
$filter['t.import_key'] = $search_import_key; $filter['t.import_key'] = $search_import_key;
$param .= '&search_import_key='.urlencode($search_import_key); $param .= '&search_import_key='.urlencode($search_import_key);
} }
// param with type of list // param with type of list
$url_param = substr($param, 1); // remove first "&" $url_param = substr($param, 1); // remove first "&"
if (!empty($type)) { if (!empty($type)) {
@ -544,26 +560,30 @@ llxHeader('', $title_page);
// List // List
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
// TODO Perf Replace this by a count
if ($type == 'sub') { if ($type == 'sub') {
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 1); $nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 1, 1);
} else { } else {
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter); $nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 0, 1);
} }
if ($nbtotalofrecords < 0) { if ($nbtotalofrecords < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$error++;
} }
} }
if (!$error) {
if ($type == 'sub') { if ($type == 'sub') {
$result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 1); $result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 1);
} else { } else {
$result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter); $result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 0);
} }
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
}
$arrayofselected = is_array($toselect) ? $toselect : array(); $arrayofselected = is_array($toselect) ? $toselect : array();
@ -711,7 +731,7 @@ if ($type == 'sub') {
$moreforfilter = ''; $moreforfilter = '';
// Accountancy account // Search on accountancy custom groups or account
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('AccountAccounting').': '; $moreforfilter .= $langs->trans('AccountAccounting').': ';
$moreforfilter .= '<div class="nowrap inline-block">'; $moreforfilter .= '<div class="nowrap inline-block">';
@ -729,6 +749,13 @@ if ($type == 'sub') {
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('AccountingCategory').': ';
$moreforfilter .= '<div class="nowrap inline-block">';
$moreforfilter .= $formaccounting->select_accounting_category($search_account_category, 'search_account_category', 1, 0, 0, 0);
$moreforfilter .= '</div>';
$moreforfilter .= '</div>';
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) { if (empty($reshook)) {
@ -935,8 +962,8 @@ while ($i < min($num, $limit)) {
} else { } else {
print '<td class="right" colspan="' . $colspan . '">' . $langs->trans("TotalForAccount") . ' ' . length_accountg($displayed_account_number) . ':</td>'; print '<td class="right" colspan="' . $colspan . '">' . $langs->trans("TotalForAccount") . ' ' . length_accountg($displayed_account_number) . ':</td>';
} }
print '<td class="nowrap right">'.price($sous_total_debit).'</td>'; print '<td class="nowrap right">'.price(price2num($sous_total_debit, 'MT')).'</td>';
print '<td class="nowrap right">'.price($sous_total_credit).'</td>'; print '<td class="nowrap right">'.price(price2num($sous_total_credit, 'MT')).'</td>';
print '<td colspan="'.$colspanend.'"></td>'; print '<td colspan="'.$colspanend.'"></td>';
print '</tr>'; print '</tr>';
// Show balance of last shown account // Show balance of last shown account
@ -945,13 +972,13 @@ while ($i < min($num, $limit)) {
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>'; print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
if ($balance > 0) { if ($balance > 0) {
print '<td class="nowraponall right">'; print '<td class="nowraponall right">';
print price($sous_total_debit - $sous_total_credit); print price(price2num($sous_total_debit - $sous_total_credit, 'MT'));
print '</td>'; print '</td>';
print '<td></td>'; print '<td></td>';
} else { } else {
print '<td></td>'; print '<td></td>';
print '<td class="nowraponall right">'; print '<td class="nowraponall right">';
print price($sous_total_credit - $sous_total_debit); print price(price2num($sous_total_credit - $sous_total_debit, 'MT'));
print '</td>'; print '</td>';
} }
print '<td colspan="'.$colspanend.'"></td>'; print '<td colspan="'.$colspanend.'"></td>';
@ -1206,8 +1233,8 @@ while ($i < min($num, $limit)) {
if ($num > 0 && $colspan > 0) { if ($num > 0 && $colspan > 0) {
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>'; print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>';
print '<td class="nowrap right">'.price($sous_total_debit).'</td>'; print '<td class="nowrap right">'.price(price2num($sous_total_debit, 'MT')).'</td>';
print '<td class="nowrap right">'.price($sous_total_credit).'</td>'; print '<td class="nowrap right">'.price(price2num($sous_total_credit, 'MT')).'</td>';
print '<td colspan="'.$colspanend.'"></td>'; print '<td colspan="'.$colspanend.'"></td>';
print '</tr>'; print '</tr>';
// Show balance of last shown account // Show balance of last shown account
@ -1216,22 +1243,42 @@ if ($num > 0 && $colspan > 0) {
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>'; print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
if ($balance > 0) { if ($balance > 0) {
print '<td class="nowraponall right">'; print '<td class="nowraponall right">';
print price($sous_total_debit - $sous_total_credit); print price(price2num($sous_total_debit - $sous_total_credit, 'MT'));
print '</td>'; print '</td>';
print '<td></td>'; print '<td></td>';
} else { } else {
print '<td></td>'; print '<td></td>';
print '<td class="nowraponall right">'; print '<td class="nowraponall right">';
print price($sous_total_credit - $sous_total_debit); print price(price2num($sous_total_credit - $sous_total_debit, 'MT'));
print '</td>'; print '</td>';
} }
print '<td colspan="'.$colspanend.'"></td>'; print '<td colspan="'.$colspanend.'"></td>';
print '</tr>'; print '</tr>';
} }
// Clean total values to round them
if (!empty($totalarray['val']['totaldebit'])) {
$totalarray['val']['totaldebit'] = price2num($totalarray['val']['totaldebit'], 'MT');
}
if (!empty($totalarray['val']['totalcredit'])) {
$totalarray['val']['totalcredit'] = price2num($totalarray['val']['totalcredit'], 'MT');
}
// Show total line // Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0) {
$colspan = 1;
foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
$colspan++;
}
}
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook

View File

@ -353,7 +353,7 @@ class AccountancyCategory // extends CommonObject
$sql .= " formula=".(isset($this->formula) ? "'".$this->db->escape($this->formula)."'" : "null").","; $sql .= " formula=".(isset($this->formula) ? "'".$this->db->escape($this->formula)."'" : "null").",";
$sql .= " position=".(isset($this->position) ? $this->position : "null").","; $sql .= " position=".(isset($this->position) ? $this->position : "null").",";
$sql .= " fk_country=".(isset($this->fk_country) ? $this->fk_country : "null").","; $sql .= " fk_country=".(isset($this->fk_country) ? $this->fk_country : "null").",";
$sql .= " active=".(isset($this->active) ? $this->active : "null").""; $sql .= " active=".(isset($this->active) ? $this->active : "null");
$sql .= " WHERE rowid=".((int) $this->id); $sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin(); $this->db->begin();
@ -446,7 +446,7 @@ class AccountancyCategory // extends CommonObject
} else { } else {
$this->error = "Error ".$this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
$this->errors[] = $this->error; $this->errors[] = $this->error;
dol_syslog(__METHOD__." ".implode(','.$this->errors), LOG_ERR); dol_syslog(__METHOD__." ".implode(',', $this->errors), LOG_ERR);
return -1; return -1;
} }
@ -488,7 +488,7 @@ class AccountancyCategory // extends CommonObject
} else { } else {
$this->error = "Error ".$this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
$this->errors[] = $this->error; $this->errors[] = $this->error;
dol_syslog(__METHOD__." ".implode(','.$this->errors), LOG_ERR); dol_syslog(__METHOD__." ".implode(',', $this->errors), LOG_ERR);
return -1; return -1;
} }
@ -605,60 +605,6 @@ class AccountancyCategory // extends CommonObject
} }
} }
/**
* Function to know all custom groupd from an accounting account
*
* @return array|integer Result in table (array), -1 if KO
*/
public function getCatsCpts()
{
global $mysoc, $conf;
if (empty($mysoc->country_id)) {
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
exit();
}
$sql = "SELECT t.rowid, t.account_number, t.label as account_label, cat.code, cat.position, cat.label as name_cat, cat.sens ";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t, ".MAIN_DB_PREFIX."c_accounting_category as cat";
$sql .= " WHERE t.fk_accounting_category IN ( SELECT c.rowid ";
$sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
$sql .= " WHERE c.active = 1";
$sql .= " AND c.entity = ".$conf->entity;
$sql .= " AND (c.fk_country = ".((int) $mysoc->country_id)." OR c.fk_country = 0)";
$sql .= " AND cat.rowid = t.fk_accounting_category";
$sql .= " AND t.entity = ".$conf->entity;
$sql .= " ORDER BY cat.position ASC";
$resql = $this->db->query($sql);
if ($resql) {
$i = 0;
$obj = '';
$num = $this->db->num_rows($resql);
$data = array();
if ($num) {
while ($obj = $this->db->fetch_object($resql)) {
$name_cat = $obj->name_cat;
$data[$name_cat][$i] = array(
'id' => $obj->rowid,
'code' => $obj->code,
'position' => $obj->position,
'account_number' => $obj->account_number,
'account_label' => $obj->account_label,
'sens' => $obj->sens
);
$i++;
}
}
return $data;
} else {
$this->error = "Error ".$this->db->lasterror();
dol_syslog(__METHOD__." ".$this->error, LOG_ERR);
return -1;
}
}
/** /**
* Function to show result of an accounting account from the ledger with a direction and a period * Function to show result of an accounting account from the ledger with a direction and a period
* *
@ -678,6 +624,22 @@ class AccountancyCategory // extends CommonObject
$this->sdc = 0; $this->sdc = 0;
$this->sdcpermonth = array(); $this->sdcpermonth = array();
if (is_array($cpt)) {
$listofaccount = '';
foreach ($cpt as $cptcursor) {
if (! is_null($cptcursor)) {
if ($listofaccount) {
$listofaccount .= ",";
}
$listofaccount .= "'".$cptcursor."'";
}
}
if (empty($listofaccount)) {
// List of account is empty, so we do no try sql request, we can say result is empty.
return 0;
}
}
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit"; $sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
if (is_array($cpt)) { if (is_array($cpt)) {
$sql .= ", t.numero_compte as accountancy_account"; $sql .= ", t.numero_compte as accountancy_account";
@ -686,13 +648,6 @@ class AccountancyCategory // extends CommonObject
//if (in_array($this->db->type, array('mysql', 'mysqli'))) $sql.=' USE INDEX idx_accounting_bookkeeping_doc_date'; //if (in_array($this->db->type, array('mysql', 'mysqli'))) $sql.=' USE INDEX idx_accounting_bookkeeping_doc_date';
$sql .= " WHERE t.entity = ".$conf->entity; $sql .= " WHERE t.entity = ".$conf->entity;
if (is_array($cpt)) { if (is_array($cpt)) {
$listofaccount = '';
foreach ($cpt as $cptcursor) {
if ($listofaccount) {
$listofaccount .= ",";
}
$listofaccount .= "'".$cptcursor."'";
}
$sql .= " AND t.numero_compte IN (".$this->db->sanitize($listofaccount, 1).")"; $sql .= " AND t.numero_compte IN (".$this->db->sanitize($listofaccount, 1).")";
} else { } else {
$sql .= " AND t.numero_compte = '".$this->db->escape($cpt)."'"; $sql .= " AND t.numero_compte = '".$this->db->escape($cpt)."'";
@ -709,13 +664,15 @@ class AccountancyCategory // extends CommonObject
if (is_array($cpt)) { if (is_array($cpt)) {
$sql .= " GROUP BY t.numero_compte"; $sql .= " GROUP BY t.numero_compte";
} }
//print $sql;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
if ($num) { if ($num) {
$i = 0;
while ($i < $num) {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
if ($obj) {
if ($sens == 1) { if ($sens == 1) {
$this->sdc = $obj->debit - $obj->credit; $this->sdc = $obj->debit - $obj->credit;
} else { } else {
@ -725,6 +682,10 @@ class AccountancyCategory // extends CommonObject
$this->sdcperaccount[$obj->accountancy_account] = $this->sdc; $this->sdcperaccount[$obj->accountancy_account] = $this->sdc;
} }
} }
$i++;
}
}
return $num; return $num;
} else { } else {
$this->error = "Error ".$this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
@ -734,12 +695,75 @@ class AccountancyCategory // extends CommonObject
} }
} }
/**
* Function to get an array of all active custom groups (llx_c_accunting_categories) with their accounts from the chart of account (ll_accounting_acount)
*
* @param int $catid Custom group ID
* @return array|integer Result in table (array), -1 if KO
* @see getCats(), getCptsCat()
*/
public function getCatsCpts($catid = 0)
{
global $mysoc, $conf;
if (empty($mysoc->country_id)) {
$this->error = "Error ".$this->db->lasterror();
dol_syslog(__METHOD__." ".$this->error, LOG_ERR);
return -1;
}
$sql = "SELECT t.rowid, t.account_number, t.label as account_label,";
$sql .= " cat.code, cat.position, cat.label as name_cat, cat.sens, cat.category_type, cat.formula";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t, ".MAIN_DB_PREFIX."c_accounting_category as cat";
$sql .= " WHERE t.fk_accounting_category IN (SELECT c.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
$sql .= " WHERE c.active = 1";
$sql .= " AND c.entity = ".$conf->entity;
$sql .= " AND (c.fk_country = ".((int) $mysoc->country_id)." OR c.fk_country = 0)";
$sql .= " AND cat.rowid = t.fk_accounting_category";
$sql .= " AND t.entity = ".$conf->entity;
if ($catid > 0) {
$sql .= " AND cat.rowid = ".((int) $catid);
}
$sql .= " ORDER BY cat.position ASC";
$resql = $this->db->query($sql);
if ($resql) {
$obj = '';
$num = $this->db->num_rows($resql);
$data = array();
if ($num) {
while ($obj = $this->db->fetch_object($resql)) {
$name_cat = $obj->name_cat;
$data[$name_cat][$obj->rowid] = array(
'id' => $obj->rowid,
'code' => $obj->code,
'label' => $obj->label,
'position' => $obj->position,
'category_type' => $obj->category_type,
'formula' => $obj->formula,
'sens' => $obj->sens,
'account_number' => $obj->account_number,
'account_label' => $obj->account_label
);
}
}
return $data;
} else {
$this->error = "Error ".$this->db->lasterror();
dol_syslog(__METHOD__." ".$this->error, LOG_ERR);
return -1;
}
}
/** /**
* Return list of custom groups. * Return list of custom groups.
* For list + detail of accounting account, see getCatsCpt()
* *
* @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups * @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups
* @param int $active 1= active, 0=not active * @param int $active 1= active, 0=not active
* @return array|int Array of groups or -1 if error * @return array|int Array of groups or -1 if error
* @see getCatsCpts(), getCptsCat()
*/ */
public function getCats($categorytype = -1, $active = 1) public function getCats($categorytype = -1, $active = 1)
{ {
@ -774,9 +798,10 @@ class AccountancyCategory // extends CommonObject
'rowid' => $obj->rowid, 'rowid' => $obj->rowid,
'code' => $obj->code, 'code' => $obj->code,
'label' => $obj->label, 'label' => $obj->label,
'formula' => $obj->formula,
'position' => $obj->position, 'position' => $obj->position,
'category_type' => $obj->category_type, 'category_type' => $obj->category_type,
'formula' => $obj->formula,
'sens' => $obj->sens,
'bc' => $obj->sens 'bc' => $obj->sens
); );
$i++; $i++;
@ -794,12 +819,15 @@ class AccountancyCategory // extends CommonObject
/** /**
* Get all accounting account of a custom group (or a list of custom groups). * Get all accounting account of a given custom group (or a list of custom groups).
* You must choose between first parameter (personalized group) or the second (free criteria filter) * You must choose between first parameter (personalized group) or the second (free criteria filter)
* *
* @param int $cat_id Id if personalized accounting group/category * @param int $cat_id Id if personalized accounting group/category
* @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts. This value must not come from an input of a user. * @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts. This value must be sanitized and not come from an input of a user.
* Example: "pcg_type = 'EXPENSE' AND fk_pcg_version = 'xx'"
* Example: "fk_accounting_category = 99"
* @return array|int Array of accounting accounts or -1 if error * @return array|int Array of accounting accounts or -1 if error
* @see getCats(), getCatsCpts()
*/ */
public function getCptsCat($cat_id, $predefinedgroupwhere = '') public function getCptsCat($cat_id, $predefinedgroupwhere = '')
{ {

View File

@ -5,13 +5,15 @@
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr> * Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
* Copyright (C) 2016-2021 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2016-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2022 Lionel Vessiller <lvessiller@open-dsi.fr>
* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com> * Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com>
* Copyright (C) 2017-2019 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2017-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2017 André Schild <a.schild@aarboard.ch> * Copyright (C) 2017 André Schild <a.schild@aarboard.ch>
* Copyright (C) 2020 Guillaume Alexandre <guillaume@tag-info.fr> * Copyright (C) 2020 Guillaume Alexandre <guillaume@tag-info.fr>
* Copyright (C) 2022 Joachim Kueter <jkueter@gmx.de> * Copyright (C) 2022 Joachim Kueter <jkueter@gmx.de>
* Copyright (C) 2022 Progiseize <a.bisotti@progiseize.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -36,6 +38,7 @@
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
/** /**
@ -200,7 +203,7 @@ class AccountancyExport
'ACCOUNTING_EXPORT_FORMAT' => empty($conf->global->ACCOUNTING_EXPORT_FORMAT) ? 'txt' : $conf->global->ACCOUNTING_EXPORT_FORMAT, 'ACCOUNTING_EXPORT_FORMAT' => empty($conf->global->ACCOUNTING_EXPORT_FORMAT) ? 'txt' : $conf->global->ACCOUNTING_EXPORT_FORMAT,
'ACCOUNTING_EXPORT_SEPARATORCSV' => empty($conf->global->ACCOUNTING_EXPORT_SEPARATORCSV) ? ',' : $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV, 'ACCOUNTING_EXPORT_SEPARATORCSV' => empty($conf->global->ACCOUNTING_EXPORT_SEPARATORCSV) ? ',' : $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV,
'ACCOUNTING_EXPORT_ENDLINE' => empty($conf->global->ACCOUNTING_EXPORT_ENDLINE) ? 1 : $conf->global->ACCOUNTING_EXPORT_ENDLINE, 'ACCOUNTING_EXPORT_ENDLINE' => empty($conf->global->ACCOUNTING_EXPORT_ENDLINE) ? 1 : $conf->global->ACCOUNTING_EXPORT_ENDLINE,
'ACCOUNTING_EXPORT_DATE' => empty($conf->global->ACCOUNTING_EXPORT_DATE) ? '%d%m%Y' : $conf->global->ACCOUNTING_EXPORT_DATE, 'ACCOUNTING_EXPORT_DATE' => getDolGlobalString('ACCOUNTING_EXPORT_DATE', '%Y-%m-%d'),
), ),
self::$EXPORT_TYPE_CEGID => array( self::$EXPORT_TYPE_CEGID => array(
'label' => $langs->trans('Modelcsv_CEGID'), 'label' => $langs->trans('Modelcsv_CEGID'),
@ -313,9 +316,10 @@ class AccountancyExport
* *
* @param array $TData Array with data * @param array $TData Array with data
* @param int $formatexportset Id of export format * @param int $formatexportset Id of export format
* @return void * @param int $withAttachment [=0] Not add files or 1 to have attached in an archive (ex : Quadratus)
* @return int <0 if KO, >0 OK
*/ */
public function export(&$TData, $formatexportset) public function export(&$TData, $formatexportset, $withAttachment = 0)
{ {
global $conf, $langs; global $conf, $langs;
global $search_date_end; // Used into /accountancy/tpl/export_journal.tpl.php global $search_date_end; // Used into /accountancy/tpl/export_journal.tpl.php
@ -325,8 +329,44 @@ class AccountancyExport
$type_export = 'general_ledger'; $type_export = 'general_ledger';
global $db; // The tpl file use $db global $db; // The tpl file use $db
$completefilename = '';
$exportFile = null;
$exportFileName = '';
$exportFilePath = '';
$archiveFileList = array();
if ($withAttachment == 1) {
// PHP ZIP extension must be enabled
if (!extension_loaded('zip')) {
$langs->load('install');
$this->errors[] = $langs->trans('ErrorPHPDoesNotSupport', 'ZIP');
return -1;
}
} else {
$mimetype = $this->getMimeType($formatexportset);
top_httphead($mimetype, 1);
}
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php'; include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
if ($withAttachment == 1 && !empty($completefilename)) {
// create export file
$tmpDir = !empty($conf->accounting->multidir_temp[$conf->entity]) ? $conf->accounting->multidir_temp[$conf->entity] : $conf->accounting->dir_temp;
$exportFileFullName = $completefilename;
$exportFileBaseName = basename($exportFileFullName);
$exportFileName = pathinfo($exportFileBaseName, PATHINFO_FILENAME);
$exportFilePath = $tmpDir.'/'.$exportFileFullName;
$exportFile = fopen($exportFilePath, 'w');
if (!$exportFile) {
$this->errors[] = $langs->trans('ErrorFileNotFound', $exportFilePath);
return -1;
}
$archiveFileList[0] = array(
'path' => $exportFilePath,
'name' => $exportFileFullName,
);
// archive name and path
$archiveFullName = $exportFileName.'.zip';
$archivePath = $tmpDir.'/'.$archiveFullName;
}
switch ($formatexportset) { switch ($formatexportset) {
case self::$EXPORT_TYPE_CONFIGURABLE: case self::$EXPORT_TYPE_CONFIGURABLE:
@ -345,7 +385,7 @@ class AccountancyExport
$this->exportCiel($TData); $this->exportCiel($TData);
break; break;
case self::$EXPORT_TYPE_QUADRATUS: case self::$EXPORT_TYPE_QUADRATUS:
$this->exportQuadratus($TData); $archiveFileList = $this->exportQuadratus($TData, $exportFile, $archiveFileList, $withAttachment);
break; break;
case self::$EXPORT_TYPE_WINFIC: case self::$EXPORT_TYPE_WINFIC:
$this->exportWinfic($TData); $this->exportWinfic($TData);
@ -399,6 +439,69 @@ class AccountancyExport
} }
break; break;
} }
// create and download export file or archive
if ($withAttachment == 1) {
$error = 0;
// close export file
if ($exportFile) {
fclose($exportFile);
}
if (!empty($archiveFullName) && !empty($archivePath) && !empty($archiveFileList)) {
// archive files
$downloadFileMimeType = 'application/zip';
$downloadFileFullName = $archiveFullName;
$downloadFilePath = $archivePath;
// create archive
$archive = new ZipArchive();
$res = $archive->open($archivePath, ZipArchive::OVERWRITE | ZipArchive::CREATE);
if ($res !== true) {
$error++;
$this->errors[] = $langs->trans('ErrorFileNotFound', $archivePath);
}
if (!$error) {
// add files
foreach ($archiveFileList as $archiveFileArr) {
$res = $archive->addFile($archiveFileArr['path'], $archiveFileArr['name']);
if (!$res) {
$error++;
$this->errors[] = $langs->trans('ErrorArchiveAddFile', $archiveFileArr['name']);
break;
}
}
}
if (!$error) {
// close archive
$archive->close();
}
} elseif (!empty($exportFileFullName) && !empty($exportFilePath)) {
// only one file to download
$downloadFileMimeType = 'text/csv';
$downloadFileFullName = $exportFileFullName;
$downloadFilePath = $exportFilePath;
}
if (!$error) {
// download export file
if (!empty($downloadFileMimeType) && !empty($downloadFileFullName) && !empty($downloadFilePath)) {
header('Content-Type: '.$downloadFileMimeType);
header('Content-Disposition: attachment; filename='.$downloadFileFullName);
header('Cache-Control: Public, must-revalidate');
header('Pragma: public');
header('Content-Length: '.dol_filesize($downloadFilePath));
readfileLowMemory($downloadFilePath);
}
}
if ($error) {
return -1;
}
}
return 1;
} }
@ -444,14 +547,14 @@ class AccountancyExport
print $date.$separator; print $date.$separator;
print $line->piece_num.$separator; print $line->piece_num.$separator;
print length_accountg($line->numero_compte).$separator; print length_accountg($line->numero_compte).$separator;
print ''.$separator; print $separator;
print $line->label_operation.$separator; print $line->label_operation.$separator;
print $date.$separator; print $date.$separator;
if ($line->sens == 'D') { if ($line->sens == 'D') {
print price($line->debit).$separator; print price($line->debit).$separator;
print ''.$separator; print $separator;
} elseif ($line->sens == 'C') { } elseif ($line->sens == 'C') {
print ''.$separator; print $separator;
print price($line->credit).$separator; print price($line->credit).$separator;
} }
print $line->doc_ref.$separator; print $line->doc_ref.$separator;
@ -579,15 +682,18 @@ class AccountancyExport
/** /**
* Export format : Quadratus (Format ASCII) * Export format : Quadratus (Format ASCII)
* Format since 2015 compatible QuadraCOMPTA * Format since 2015 compatible QuadraCOMPTA
* Last review for this format : 2021/09/13 Alexandre Spangaro (aspangaro@open-dsi.fr) * Last review for this format : 2023/01/28 Alexandre Spangaro (aspangaro@open-dsi.fr)
* *
* Help : https://docplayer.fr/20769649-Fichier-d-entree-ascii-dans-quadracompta.html * Help : https://docplayer.fr/20769649-Fichier-d-entree-ascii-dans-quadracompta.html
* In QuadraCompta | Use menu : "Outils" > "Suivi des dossiers" > "Import ASCII(Compta)" * In QuadraCompta | Use menu : "Outils" > "Suivi des dossiers" > "Import ASCII(Compta)"
* *
* @param array $TData data * @param array $TData Data
* @return void * @param resource $exportFile [=null] File resource to export or print if null
* @param array $archiveFileList [=array()] Archive file list : array of ['path', 'name']
* @param bool $withAttachment [=0] Not add files or 1 to have attached in an archive
* @return array Archive file list : array of ['path', 'name']
*/ */
public function exportQuadratus(&$TData) public function exportQuadratus(&$TData, $exportFile = null, $archiveFileList = array(), $withAttachment = 0)
{ {
global $conf, $db; global $conf, $db;
@ -597,6 +703,14 @@ class AccountancyExport
// $date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy // $date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
// $date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy // $date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
foreach ($TData as $data) { foreach ($TData as $data) {
// Clean some data
$data->doc_ref = dol_string_unaccent($data->doc_ref);
$data->label_operation = dol_string_unaccent($data->label_operation);
$data->numero_compte = dol_string_unaccent($data->numero_compte);
$data->label_compte = dol_string_unaccent($data->label_compte);
$data->subledger_account = dol_string_unaccent($data->subledger_account);
$data->subledger_label = dol_string_unaccent($data->subledger_label);
$code_compta = $data->numero_compte; $code_compta = $data->numero_compte;
if (!empty($data->subledger_account)) { if (!empty($data->subledger_account)) {
$code_compta = $data->subledger_account; $code_compta = $data->subledger_account;
@ -628,17 +742,21 @@ class AccountancyExport
if ($data->doc_type == 'customer_invoice') { if ($data->doc_type == 'customer_invoice') {
$Tab['type_compte'] = 'C'; $Tab['type_compte'] = 'C';
} elseif ($data->doc_type == 'supplier_invoice') { } elseif ($data->doc_type == 'supplier_invoice') {
$Tab['coll_compte'] = 'F'; $Tab['type_compte'] = 'F';
} else { } else {
$Tab['coll_compte'] = 'G'; $Tab['type_compte'] = 'G';
} }
$Tab['filler3'] = str_repeat(' ', 235); $Tab['filler3'] = str_repeat(' ', 235);
$Tab['end_line'] = $end_line; $Tab['end_line'] = $end_line;
if ($exportFile) {
fwrite($exportFile, implode($Tab));
} else {
print implode($Tab); print implode($Tab);
} }
}
$Tab = array(); $Tab = array();
$Tab['type_ligne'] = 'M'; $Tab['type_ligne'] = 'M';
@ -651,7 +769,7 @@ class AccountancyExport
//$Tab['date_ecriture'] = $date_ecriture; //$Tab['date_ecriture'] = $date_ecriture;
$Tab['date_ecriture'] = dol_print_date($data->doc_date, '%d%m%y'); $Tab['date_ecriture'] = dol_print_date($data->doc_date, '%d%m%y');
$Tab['filler'] = ' '; $Tab['filler'] = ' ';
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 20), 20); $Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref.' '.$data->label_operation, 20), 20);
// Credit invoice - invert sens // Credit invoice - invert sens
/* /*
@ -701,21 +819,72 @@ class AccountancyExport
// TODO: we should filter more than only accent to avoid wrong line size // TODO: we should filter more than only accent to avoid wrong line size
// TODO: remove invoice number doc_ref in libelle, // TODO: remove invoice number doc_ref in libelle,
// TODO: we should offer an option for customer to build the libelle using invoice number / name / date in accounting software // TODO: we should offer an option for customer to build the libelle using invoice number / name / date in accounting software
//$Tab['libelle_ecriture2'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref) . ' ' . dol_string_unaccent($data->label_operation), 30), 30); //$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_operation, 30), 30);
$Tab['libelle_ecriture2'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 30), 30); $Tab['libelle_ecriture2'] = str_pad(self::trunc($data->label_operation, 30), 30);
$Tab['codetva'] = str_repeat(' ', 2); $Tab['codetva'] = str_repeat(' ', 2);
// We need to keep the 10 lastest number of invoice doc_ref not the beginning part that is the unusefull almost same part // We need to keep the 10 lastest number of invoice doc_ref not the beginning part that is the unusefull almost same part
// $Tab['num_piece3'] = str_pad(self::trunc($data->piece_num, 10), 10); // $Tab['num_piece3'] = str_pad(self::trunc($data->piece_num, 10), 10);
$Tab['num_piece3'] = substr(self::trunc($data->doc_ref, 20), -10); $Tab['num_piece3'] = substr(self::trunc($data->doc_ref, 20), -10);
$Tab['filler4'] = str_repeat(' ', 73); $Tab['reserved'] = str_repeat(' ', 10); // position 159
$Tab['currency_amount'] = str_repeat(' ', 13); // position 169
// get document file
$attachmentFileName = '';
if ($withAttachment == 1) {
$attachmentFileKey = trim($data->piece_num);
if (!isset($archiveFileList[$attachmentFileKey])) {
$objectDirPath = '';
$objectFileName = dol_sanitizeFileName($data->doc_ref);
if ($data->doc_type == 'customer_invoice') {
$objectDirPath = !empty($conf->facture->multidir_output[$conf->entity]) ? $conf->facture->multidir_output[$conf->entity] : $conf->facture->dir_output;
} elseif ($data->doc_type == 'expense_report') {
$objectDirPath = !empty($conf->expensereport->multidir_output[$conf->entity]) ? $conf->expensereport->multidir_output[$conf->entity] : $conf->factureexpensereport->dir_output;
} elseif ($data->doc_type == 'supplier_invoice') {
$objectDirPath = !empty($conf->fournisseur->facture->multidir_output[$conf->entity]) ? $conf->fournisseur->facture->multidir_output[$conf->entity] : $conf->fournisseur->facture->dir_output;
}
$arrayofinclusion = array();
$arrayofinclusion[] = '^'.preg_quote($objectFileName, '/').'\.pdf$';
$fileFoundList = dol_dir_list($objectDirPath.'/'.$objectFileName, 'files', 0, implode('|', $arrayofinclusion), '(\.meta|_preview.*\.png)$', 'date', SORT_DESC, 0, true);
if (!empty($fileFoundList)) {
$attachmentFileNameTrunc = str_pad(self::trunc($data->piece_num, 8), 8, '0', STR_PAD_LEFT);
foreach ($fileFoundList as $fileFound) {
if (strstr($fileFound['name'], $objectFileName)) {
$fileFoundPath = $objectDirPath.'/'.$objectFileName.'/'.$fileFound['name'];
if (file_exists($fileFoundPath)) {
$archiveFileList[$attachmentFileKey] = array(
'path' => $fileFoundPath,
'name' => $attachmentFileNameTrunc.'.pdf',
);
break;
}
}
}
}
}
if (isset($archiveFileList[$attachmentFileKey])) {
$attachmentFileName = $archiveFileList[$attachmentFileKey]['name'];
}
}
if (dol_strlen($attachmentFileName) == 12) {
$Tab['attachment'] = $attachmentFileName; // position 182
} else {
$Tab['attachment'] = str_repeat(' ', 12); // position 182
}
$Tab['filler4'] = str_repeat(' ', 38);
$Tab['end_line'] = $end_line; $Tab['end_line'] = $end_line;
if ($exportFile) {
fwrite($exportFile, implode($Tab));
} else {
print implode($Tab); print implode($Tab);
} }
} }
return $archiveFileList;
}
/** /**
* Export format : WinFic - eWinfic - WinSis Compta * Export format : WinFic - eWinfic - WinSis Compta
* Last review for this format : 2022-11-01 Alexandre Spangaro (aspangaro@open-dsi.fr) * Last review for this format : 2022-11-01 Alexandre Spangaro (aspangaro@open-dsi.fr)

View File

@ -723,7 +723,7 @@ class AccountingAccount extends CommonObject
} }
/** /**
* Return Suggest accounting accounts to bind * Return a suggested account (from chart of accounts) to bind
* *
* @param Societe $buyer Object buyer * @param Societe $buyer Object buyer
* @param Societe $seller Object seller * @param Societe $seller Object seller
@ -733,6 +733,8 @@ class AccountingAccount extends CommonObject
* @param array $accountingAccount Array of Accounting account * @param array $accountingAccount Array of Accounting account
* @param string $type Customer / Supplier * @param string $type Customer / Supplier
* @return array|int Accounting accounts suggested or < 0 if technical error. * @return array|int Accounting accounts suggested or < 0 if technical error.
* 'suggestedaccountingaccountbydefaultfor'=>Will be used for the label to show on tooltip for account by default on any product
* 'suggestedaccountingaccountfor'=>Is the account suggested for this product
*/ */
public function getAccountingCodeToBind(Societe $buyer, Societe $seller, Product $product, $facture, $factureDet, $accountingAccount = array(), $type = '') public function getAccountingCodeToBind(Societe $buyer, Societe $seller, Product $product, $facture, $factureDet, $accountingAccount = array(), $type = '')
{ {

View File

@ -454,27 +454,12 @@ class AccountingJournal extends CommonObject
} }
$sql = ""; $sql = "";
// FIXME sql error with Mysql 5.7
/*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
$sql .= "WITH in_accounting_bookkeeping(fk_docdet) AS (";
$sql .= " SELECT DISTINCT fk_docdet";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
$sql .= " WHERE doc_type = 'asset'";
$sql .= ") ";
}*/
$sql .= "SELECT ad.fk_asset AS rowid, a.ref AS asset_ref, a.label AS asset_label, a.acquisition_value_ht AS asset_acquisition_value_ht"; $sql .= "SELECT ad.fk_asset AS rowid, a.ref AS asset_ref, a.label AS asset_label, a.acquisition_value_ht AS asset_acquisition_value_ht";
$sql .= ", a.disposal_date AS asset_disposal_date, a.disposal_amount_ht AS asset_disposal_amount_ht, a.disposal_subject_to_vat AS asset_disposal_subject_to_vat"; $sql .= ", a.disposal_date AS asset_disposal_date, a.disposal_amount_ht AS asset_disposal_amount_ht, a.disposal_subject_to_vat AS asset_disposal_subject_to_vat";
$sql .= ", ad.rowid AS depreciation_id, ad.depreciation_mode, ad.ref AS depreciation_ref, ad.depreciation_date, ad.depreciation_ht, ad.accountancy_code_debit, ad.accountancy_code_credit"; $sql .= ", ad.rowid AS depreciation_id, ad.depreciation_mode, ad.ref AS depreciation_ref, ad.depreciation_date, ad.depreciation_ht, ad.accountancy_code_debit, ad.accountancy_code_credit";
$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation as ad"; $sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation as ad";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "asset as a ON a.rowid = ad.fk_asset"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "asset as a ON a.rowid = ad.fk_asset";
// FIXME sql error with Mysql 5.7
/*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
$sql .= " LEFT JOIN in_accounting_bookkeeping as iab ON iab.fk_docdet = ad.rowid";
}*/
$sql .= " WHERE a.entity IN (" . getEntity('asset', 0) . ')'; // We don't share object for accountancy, we use source object sharing $sql .= " WHERE a.entity IN (" . getEntity('asset', 0) . ')'; // We don't share object for accountancy, we use source object sharing
// Compatibility with Mysql 5.7
if ($in_bookkeeping == 'already') { if ($in_bookkeeping == 'already') {
$sql .= " AND EXISTS (SELECT iab.fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')"; $sql .= " AND EXISTS (SELECT iab.fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')";
} elseif ($in_bookkeeping == 'notyet') { } elseif ($in_bookkeeping == 'notyet') {
@ -488,11 +473,6 @@ class AccountingJournal extends CommonObject
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) { if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
$sql .= " AND ad.depreciation_date >= '" . $this->db->idate($conf->global->ACCOUNTING_DATE_START_BINDING) . "'"; $sql .= " AND ad.depreciation_date >= '" . $this->db->idate($conf->global->ACCOUNTING_DATE_START_BINDING) . "'";
} }
// Already in bookkeeping or not
// FIXME sql error with Mysql 5.7
/*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
$sql .= " AND iab.fk_docdet IS" . ($in_bookkeeping == 'already' ? " NOT" : "") . " NULL";
}*/
$sql .= " ORDER BY ad.depreciation_date"; $sql .= " ORDER BY ad.depreciation_date";
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
@ -755,7 +735,7 @@ class AccountingJournal extends CommonObject
} }
} }
$journal_data[$pre_data_id] = $element; $journal_data[(int) $pre_data_id] = $element;
} }
unset($pre_data); unset($pre_data);

View File

@ -817,7 +817,7 @@ class BookKeeping extends CommonObject
/** /**
* Load object in memory from the database * Load object in memory from the database in ->lines. Or just make a simple count if $countonly=1.
* *
* @param string $sortorder Sort Order * @param string $sortorder Sort Order
* @param string $sortfield Sort field * @param string $sortfield Sort field
@ -826,18 +826,22 @@ class BookKeeping extends CommonObject
* @param array $filter filter array * @param array $filter filter array
* @param string $filtermode filter mode (AND or OR) * @param string $filtermode filter mode (AND or OR)
* @param int $option option (0: general account or 1: subaccount) * @param int $option option (0: general account or 1: subaccount)
* * @param int $countonly Do not fill the $object->lines, return only the count.
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, Number of lines if OK
*/ */
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $option = 0) public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $option = 0, $countonly = 0)
{ {
global $conf; global $conf;
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$this->lines = array(); $this->lines = array();
$num = 0;
$sql = 'SELECT'; $sql = 'SELECT';
if ($countonly) {
$sql .= ' COUNT(t.rowid) as nb';
} else {
$sql .= ' t.rowid,'; $sql .= ' t.rowid,';
$sql .= " t.doc_date,"; $sql .= " t.doc_date,";
$sql .= " t.doc_type,"; $sql .= " t.doc_type,";
@ -867,6 +871,7 @@ class BookKeeping extends CommonObject
$sql .= " t.date_export,"; $sql .= " t.date_export,";
$sql .= " t.date_validated as date_validation,"; $sql .= " t.date_validated as date_validation,";
$sql .= " t.import_key"; $sql .= " t.import_key";
}
// Manage filter // Manage filter
$sqlwhere = array(); $sqlwhere = array();
if (count($filter) > 0) { if (count($filter) > 0) {
@ -880,7 +885,7 @@ class BookKeeping extends CommonObject
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') { } elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
$sqlwhere[] = $key.'='.$value; $sqlwhere[] = $key.'='.$value;
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') { } elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
$sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\''; $sqlwhere[] = $key.' LIKE \''.$this->db->escapeforlike($this->db->escape($value)).'%\'';
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') { } elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\''; $sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') { } elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
@ -897,18 +902,19 @@ class BookKeeping extends CommonObject
} else { } else {
$sqlwhere[] = natural_search("t.code_journal", $value, 3, 1); $sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
} }
} elseif ($key == 't.search_accounting_code_in' && !empty($value)) {
$sqlwhere[] = 't.numero_compte IN ('.$this->db->sanitize($value, 1).')';
} else { } else {
$sqlwhere[] = natural_search($key, $value, 0, 1); $sqlwhere[] = natural_search($key, $value, 0, 1);
} }
} }
} }
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
$sql .= ' WHERE 1 = 1'; $sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
if (count($sqlwhere) > 0) { if (count($sqlwhere) > 0) {
$sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere); $sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere);
} }
// Affichage par compte comptable // Filter by ledger account or subledger account
if (!empty($option)) { if (!empty($option)) {
$sql .= " AND t.subledger_account IS NOT NULL"; $sql .= " AND t.subledger_account IS NOT NULL";
$sql .= " AND t.subledger_account <> ''"; $sql .= " AND t.subledger_account <> ''";
@ -919,13 +925,21 @@ class BookKeeping extends CommonObject
$sortorder = 'ASC'.($sortorder ? ','.$sortorder : ''); $sortorder = 'ASC'.($sortorder ? ','.$sortorder : '');
} }
if (!$countonly) {
$sql .= $this->db->order($sortfield, $sortorder); $sql .= $this->db->order($sortfield, $sortorder);
if (!empty($limit)) { if (!empty($limit)) {
$sql .= $this->db->plimit($limit + 1, $offset); $sql .= $this->db->plimit($limit + 1, $offset);
} }
}
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
if ($countonly) {
$obj = $this->db->fetch_object($resql);
if ($obj) {
$num = $obj->nb;
}
} else {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
@ -968,6 +982,7 @@ class BookKeeping extends CommonObject
$i++; $i++;
} }
}
$this->db->free($resql); $this->db->free($resql);
return $num; return $num;
@ -1139,9 +1154,10 @@ class BookKeeping extends CommonObject
* @param int $offset offset limit * @param int $offset offset limit
* @param array $filter filter array * @param array $filter filter array
* @param string $filtermode filter mode (AND or OR) * @param string $filtermode filter mode (AND or OR)
* @param int $option option (0: general account or 1: subaccount)
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $option = 0)
{ {
global $conf; global $conf;
@ -1151,6 +1167,11 @@ class BookKeeping extends CommonObject
$sql = 'SELECT'; $sql = 'SELECT';
$sql .= " t.numero_compte,"; $sql .= " t.numero_compte,";
$sql .= " t.label_compte,";
if (!empty($option)) {
$sql .= " t.subledger_account,";
$sql .= " t.subledger_label,";
}
$sql .= " SUM(t.debit) as debit,"; $sql .= " SUM(t.debit) as debit,";
$sql .= " SUM(t.credit) as credit"; $sql .= " SUM(t.credit) as credit";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
@ -1176,6 +1197,8 @@ class BookKeeping extends CommonObject
} else { } else {
$sqlwhere[] = natural_search("t.code_journal", $value, 3, 1); $sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
} }
} elseif ($key == 't.reconciled_option') {
$sqlwhere[] = 't.lettering_code IS NULL';
} else { } else {
$sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'"; $sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
} }
@ -1186,7 +1209,17 @@ class BookKeeping extends CommonObject
$sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere); $sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere);
} }
$sql .= ' GROUP BY t.numero_compte'; if (!empty($option)) {
$sql .= ' AND t.subledger_account IS NOT NULL';
$sql .= ' AND t.subledger_account != ""';
$sql .= ' GROUP BY t.numero_compte, t.label_compte, t.subledger_account, t.subledger_label';
$sortfield = 't.subledger_account'.($sortfield ? ','.$sortfield : '');
$sortorder = 'ASC'.($sortfield ? ','.$sortfield : '');
} else {
$sql .= ' GROUP BY t.numero_compte, t.label_compte';
$sortfield = 't.numero_compte'.($sortfield ? ','.$sortfield : '');
$sortorder = 'ASC'.($sortorder ? ','.$sortorder : '');
}
if (!empty($sortfield)) { if (!empty($sortfield)) {
$sql .= $this->db->order($sortfield, $sortorder); $sql .= $this->db->order($sortfield, $sortorder);
@ -1204,6 +1237,9 @@ class BookKeeping extends CommonObject
$line = new BookKeepingLine(); $line = new BookKeepingLine();
$line->numero_compte = $obj->numero_compte; $line->numero_compte = $obj->numero_compte;
$line->label_compte = $obj->label_compte;
$line->subledger_account = $obj->subledger_account;
$line->subledger_label = $obj->subledger_label;
$line->debit = $obj->debit; $line->debit = $obj->debit;
$line->credit = $obj->credit; $line->credit = $obj->credit;

View File

@ -121,26 +121,12 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('acc
if ($action == 'validatehistory') { if ($action == 'validatehistory') {
$error = 0; $error = 0;
$nbbinddone = 0; $nbbinddone = 0;
$nbbindfailed = 0;
$notpossible = 0; $notpossible = 0;
$db->begin(); $db->begin();
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind // Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
/*if ($db->type == 'pgsql') {
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
$sql1 .= " WHERE " . MAIN_DB_PREFIX . "facturedet.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity);
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
$sql1 .= " AND " . MAIN_DB_PREFIX . "facturedet.fk_code_ventilation = 0";
} else {
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity);
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
$sql1 .= " AND fd.fk_code_ventilation = 0";
}*/
// Customer Invoice lines (must be same request than into page list.php for manual binding) // Customer Invoice lines (must be same request than into page list.php for manual binding)
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype, f.fk_facture_source,"; $sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype, f.fk_facture_source,";
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; $sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
@ -281,12 +267,14 @@ if ($action == 'validatehistory') {
if (!$resqlupdate) { if (!$resqlupdate) {
$error++; $error++;
setEventMessages($db->lasterror(), null, 'errors'); setEventMessages($db->lasterror(), null, 'errors');
$nbbindfailed++;
break; break;
} else { } else {
$nbbinddone++; $nbbinddone++;
} }
} else { } else {
$notpossible++; $notpossible++;
$nbbindfailed++;
} }
$i++; $i++;
@ -300,7 +288,10 @@ if ($action == 'validatehistory') {
$db->rollback(); $db->rollback();
} else { } else {
$db->commit(); $db->commit();
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs'); setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
if ($nbbindfailed) {
setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings');
}
} }
} }
@ -324,7 +315,7 @@ print '</span><br>';
$y = $year_current; $y = $year_current;
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.$langs->trans("ValidateHistory").'</a>'; $buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.img_picto($langs->trans("ValidateHistory"), 'link', 'class="pictofixedwidth fa-color-unset"').$langs->trans("ValidateHistory").'</a>';
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1); print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); //print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
@ -405,7 +396,17 @@ if ($resql) {
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if ($row[0] == 'tobind') { if ($row[0] == 'tobind') {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind")); $startmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1);
if ($startmonth > 12) {
$startmonth -= 12;
}
$startyear = ($startmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
$endmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + 11;
if ($endmonth > 12) {
$endmonth -= 12;
}
$endyear = ($endmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_date_startday=1&search_date_startmonth='.((int) $startmonth).'&search_date_startyear='.((int) $startyear).'&search_date_endday=&search_date_endmonth='.((int) $endmonth).'&search_date_endyear='.((int) $endyear), $langs->transnoentitiesnoconv("ToBind"));
} else { } else {
print $row[1]; print $row[1];
} }
@ -420,6 +421,12 @@ if ($resql) {
print '<td class="right nowraponall amount">'; print '<td class="right nowraponall amount">';
print price($row[$i]); print price($row[$i]);
// Add link to make binding
if (!empty(price2num($row[$i]))) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&year='.$y.'&validatemonth='.((int) $cursormonth).'&validateyear='.((int) $cursoryear).'&token='.newToken().'">';
print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"');
print '</a>';
}
print '</td>'; print '</td>';
} }
print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>'; print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
@ -558,7 +565,7 @@ print "</table>\n";
print '</div>'; print '</div>';
if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange. Why showing a report that should rely on result of this step ? if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This part of code looks strange. Why showing a report that should rely on result of this step ?
print '<br>'; print '<br>';
print '<br>'; print '<br>';

View File

@ -529,6 +529,10 @@ if ($result) {
print '</tr>'; print '</tr>';
$i++; $i++;
} }
if ($num_lines == 0) {
print '<tr><td colspan="12"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print '</table>'; print '</table>';
print "</div>"; print "</div>";

View File

@ -43,10 +43,11 @@ $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other",
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancycustomerlist'; // To manage different context of search
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$default_account = GETPOST('default_account', 'int'); $default_account = GETPOST('default_account', 'int');
// Select Box // Select Box
@ -73,8 +74,6 @@ $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_en
$search_country = GETPOST('search_country', 'alpha'); $search_country = GETPOST('search_country', 'alpha');
$search_tvaintra = GETPOST('search_tvaintra', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
$btn_ventil = GETPOST('ventil', 'alpha');
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
@ -520,8 +519,8 @@ if ($result) {
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall '); print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall ');
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center '); print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
$checkpicto = ''; $checkpicto = '';
if ($massactionbutton) { if ($massactionbutton) {
$checkpicto = $form->showCheckAddButtons('checkforselect', 1); $checkpicto = $form->showCheckAddButtons('checkforselect', 1);
@ -640,7 +639,7 @@ if ($result) {
print '<td class="center">'.dol_print_date($facture_static->date, 'day').'</td>'; print '<td class="center">'.dol_print_date($facture_static->date, 'day').'</td>';
// Ref Product // Ref Product
print '<td class="tdoverflowmax150">'; print '<td class="tdoverflowmax100">';
if ($product_static->id > 0) { if ($product_static->id > 0) {
print $product_static->getNomUrl(1); print $product_static->getNomUrl(1);
} }
@ -649,7 +648,7 @@ if ($result) {
} }
print '</td>'; print '</td>';
// Description // Description of line
print '<td class="tdoverflowonsmartphone small">'; print '<td class="tdoverflowonsmartphone small">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facture_static_det->desc, 1)); $text = dolGetFirstLineOfText(dol_string_nohtmltag($facture_static_det->desc, 1));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
@ -683,15 +682,22 @@ if ($result) {
// Found accounts // Found accounts
print '<td class="small">'; print '<td class="small">';
// First show default account for any products
$s = '1. '.(($facture_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; $s = '1. '.(($facture_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
$shelp = ''; $shelp = ''; $ttype = 'help';
if ($suggestedaccountingaccountbydefaultfor == 'eec') { if ($suggestedaccountingaccountbydefaultfor == 'eec') {
$shelp .= $langs->trans("SaleEEC"); $shelp .= $langs->trans("SaleEEC");
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') {
$shelp = $langs->trans("SaleEECWithVAT");
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithoutvatnumber') {
$shelp = $langs->trans("SaleEECWithoutVATNumber");
$ttype = 'warning';
} elseif ($suggestedaccountingaccountbydefaultfor == 'export') { } elseif ($suggestedaccountingaccountbydefaultfor == 'export') {
$shelp .= $langs->trans("SaleExport"); $shelp .= $langs->trans("SaleExport");
} }
$s .= ($code_sell_l > 0 ? length_accountg($code_sell_l) : '<span style="'.$code_sell_p_notset.'">'.$langs->trans("NotDefined").'</span>'); $s .= ($code_sell_l > 0 ? length_accountg($code_sell_l) : '<span style="'.$code_sell_p_notset.'">'.$langs->trans("NotDefined").'</span>');
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
// Now show account for product
if ($product_static->id > 0) { if ($product_static->id > 0) {
print '<br>'; print '<br>';
$s = '2. '.(($facture_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; $s = '2. '.(($facture_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
@ -749,6 +755,10 @@ if ($result) {
print '</tr>'; print '</tr>';
$i++; $i++;
} }
if ($num_lines == 0) {
print '<tr><td colspan="13"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print '</table>'; print '</table>';
print "</div>"; print "</div>";

View File

@ -58,6 +58,8 @@ $year_current = $year_start;
// Validate History // Validate History
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
// Security check // Security check
if (!isModEnabled('accounting')) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
@ -65,7 +67,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }
@ -74,7 +76,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
* Actions * Actions
*/ */
if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accounting->bind->write) { if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('accounting', 'bind', 'write')) {
// Clean database // Clean database
$db->begin(); $db->begin();
$sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det as erd"; $sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det as erd";
@ -101,6 +103,7 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
if ($action == 'validatehistory') { if ($action == 'validatehistory') {
$error = 0; $error = 0;
$nbbinddone = 0; $nbbinddone = 0;
$nbbindfailed = 0;
$notpossible = 0; $notpossible = 0;
$db->begin(); $db->begin();
@ -109,8 +112,7 @@ if ($action == 'validatehistory') {
$sql1 = "SELECT erd.rowid, accnt.rowid as suggestedid"; $sql1 = "SELECT erd.rowid, accnt.rowid as suggestedid";
$sql1 .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd"; $sql1 .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as t ON erd.fk_c_type_fees = t.id"; $sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as t ON erd.fk_c_type_fees = t.id";
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as accnt ON t.accountancy_code = accnt.account_number AND accnt.active = 1 AND accnt.entity =".((int) $conf->entity); $sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as accnt ON t.accountancy_code = accnt.account_number AND accnt.active = 1 AND accnt.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND accnt.entity =".((int) $conf->entity);
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as syst ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND syst.active = 1,';
$sql1 .= " ".MAIN_DB_PREFIX."expensereport as er"; $sql1 .= " ".MAIN_DB_PREFIX."expensereport as er";
$sql1 .= " WHERE erd.fk_expensereport = er.rowid AND er.entity = ".((int) $conf->entity); $sql1 .= " WHERE erd.fk_expensereport = er.rowid AND er.entity = ".((int) $conf->entity);
$sql1 .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0"; $sql1 .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0";
@ -143,12 +145,14 @@ if ($action == 'validatehistory') {
if (!$resqlupdate) { if (!$resqlupdate) {
$error++; $error++;
setEventMessages($db->lasterror(), null, 'errors'); setEventMessages($db->lasterror(), null, 'errors');
$nbbindfailed++;
break; break;
} else { } else {
$nbbinddone++; $nbbinddone++;
} }
} else { } else {
$notpossible++; $notpossible++;
$nbbindfailed++;
} }
$i++; $i++;
@ -162,7 +166,10 @@ if ($action == 'validatehistory') {
$db->rollback(); $db->rollback();
} else { } else {
$db->commit(); $db->commit();
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs'); setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
if ($nbbindfailed) {
setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings');
}
} }
} }
@ -176,6 +183,7 @@ llxHeader('', $langs->trans("ExpenseReportsVentilation"));
$textprevyear = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current - 1).'">'.img_previous().'</a>'; $textprevyear = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current - 1).'">'.img_previous().'</a>';
$textnextyear = '&nbsp;<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>'; $textnextyear = '&nbsp;<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>';
print load_fiche_titre($langs->trans("ExpenseReportsVentilation")."&nbsp;".$textprevyear."&nbsp;".$langs->trans("Year")."&nbsp;".$year_start."&nbsp;".$textnextyear, '', 'title_accountancy'); print load_fiche_titre($langs->trans("ExpenseReportsVentilation")."&nbsp;".$textprevyear."&nbsp;".$langs->trans("Year")."&nbsp;".$year_start."&nbsp;".$textnextyear, '', 'title_accountancy');
print '<span class="opacitymedium">'.$langs->trans("DescVentilExpenseReport").'</span><br>'; print '<span class="opacitymedium">'.$langs->trans("DescVentilExpenseReport").'</span><br>';
@ -185,7 +193,7 @@ print '</span><br>';
$y = $year_current; $y = $year_current;
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'&year='.$year_current.'">'.$langs->trans("ValidateHistory").'</a>'; $buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'&year='.$year_current.'">'.img_picto('', 'link', 'class="paddingright fa-color-unset"').$langs->trans("ValidateHistory").'</a>';
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1); print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
@ -247,7 +255,7 @@ $sql .= " AND aa.account_number IS NULL";
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label"; $sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
$sql .= ' ORDER BY aa.account_number'; $sql .= ' ORDER BY aa.account_number';
dol_syslog('/accountancy/expensereport/index.php:: sql='.$sql); dol_syslog('/accountancy/expensereport/index.php', LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
@ -263,20 +271,49 @@ if ($resql) {
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if ($row[0] == 'tobind') { if ($row[0] == 'tobind') {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind")); $startmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1);
if ($startmonth > 12) {
$startmonth -= 12;
}
$startyear = ($startmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
$endmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + 11;
if ($endmonth > 12) {
$endmonth -= 12;
}
$endyear = ($endmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_date_startday=1&search_date_startmonth='.((int) $startmonth).'&search_date_startyear='.((int) $startyear).'&search_date_endday=&search_date_endmonth='.((int) $endmonth).'&search_date_endyear='.((int) $endyear), $langs->transnoentitiesnoconv("ToBind"));
} else { } else {
print $row[1]; print $row[1];
} }
print '</td>'; print '</td>';
for ($i = 2; $i <= 13; $i++) { for ($i = 2; $i <= 13; $i++) {
$cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2);
if ($cursormonth > 12) {
$cursormonth -= 12;
}
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
print '<td class="right nowraponall amount">'; print '<td class="right nowraponall amount">';
print price($row[$i]); print price($row[$i]);
// Add link to make binding
if (!empty(price2num($row[$i]))) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&year='.$y.'&validatemonth='.((int) $cursormonth).'&validateyear='.((int) $cursoryear).'&token='.newToken().'">';
print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"');
print '</a>';
}
print '</td>'; print '</td>';
} }
print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>'; print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
print '</tr>'; print '</tr>';
} }
$db->free($resql); $db->free($resql);
if ($num == 0) {
print '<tr class="oddeven"><td colspan="16">';
print '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>';
print '</td></tr>';
}
} else { } else {
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
@ -359,6 +396,12 @@ if ($resql) {
print '</tr>'; print '</tr>';
} }
$db->free($resql); $db->free($resql);
if ($num == 0) {
print '<tr class="oddeven"><td colspan="16">';
print '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>';
print '</td></tr>';
}
} else { } else {
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
@ -367,7 +410,7 @@ print '</div>';
if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange. Why showing a report where results depends on next step (so not yet available) ? if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This part of code looks strange. Why showing a report that should rely on result of this step ?
print '<br>'; print '<br>';
print '<br>'; print '<br>';

View File

@ -427,6 +427,13 @@ if ($result) {
print "</tr>"; print "</tr>";
$i++; $i++;
} }
if ($num_lines == 0) {
$colspan=10;
if (!empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
$colspan++;
}
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print "</table>"; print "</table>";
print "</div>"; print "</div>";

View File

@ -40,10 +40,9 @@ $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other",
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'expensereportlist'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancyexpensereportlist'; // To manage different context of search
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
@ -419,8 +418,8 @@ if ($result) {
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 '); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall '); print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall ');
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', ''); print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', '');
$checkpicto = ''; $checkpicto = '';
if ($massactionbutton) { if ($massactionbutton) {
$checkpicto = $form->showCheckAddButtons('checkforselect', 1); $checkpicto = $form->showCheckAddButtons('checkforselect', 1);
@ -443,7 +442,6 @@ if ($result) {
$expensereport_static->id = $objp->erid; $expensereport_static->id = $objp->erid;
$userstatic->id = $objp->userid; $userstatic->id = $objp->userid;
$userstatic->ref = $objp->label;
$userstatic->login = $objp->login; $userstatic->login = $objp->login;
$userstatic->statut = $objp->statut; $userstatic->statut = $objp->statut;
$userstatic->email = $objp->email; $userstatic->email = $objp->email;
@ -513,6 +511,9 @@ if ($result) {
print "</tr>"; print "</tr>";
$i++; $i++;
} }
if ($num_lines == 0) {
print '<tr><td colspan="13"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print '</table>'; print '</table>';
print "</div>"; print "</div>";

View File

@ -349,8 +349,12 @@ if ($result) {
$societestatic->email = $tabcompany[$obj->rowid]['email']; $societestatic->email = $tabcompany[$obj->rowid]['email'];
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
if ($compta_soc) { if ($compta_soc) {
if (empty($tabtp[$obj->rowid][$compta_soc])) {
$tabtp[$obj->rowid][$compta_soc] = $amounttouse;
} else {
$tabtp[$obj->rowid][$compta_soc] += $amounttouse; $tabtp[$obj->rowid][$compta_soc] += $amounttouse;
} }
}
} elseif ($links[$key]['type'] == 'user') { } elseif ($links[$key]['type'] == 'user') {
$userstatic->id = $links[$key]['url_id']; $userstatic->id = $links[$key]['url_id'];
$userstatic->name = $links[$key]['label']; $userstatic->name = $links[$key]['label'];
@ -510,7 +514,11 @@ if ($result) {
} }
} }
if (empty($tabbq[$obj->rowid][$compta_bank])) {
$tabbq[$obj->rowid][$compta_bank] = $amounttouse;
} else {
$tabbq[$obj->rowid][$compta_bank] += $amounttouse; $tabbq[$obj->rowid][$compta_bank] += $amounttouse;
}
// If no links were found to know the amount on thirdparty, we try to guess it. // If no links were found to know the amount on thirdparty, we try to guess it.
// This may happens on bank entries without the links lines to 'company'. // This may happens on bank entries without the links lines to 'company'.
@ -793,7 +801,7 @@ if (!$error && $action == 'writebookkeeping') {
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
} }
} else { } else {
if ($lettering && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) { if ($lettering && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) {
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
$lettering_static = new Lettering($db); $lettering_static = new Lettering($db);
$nb_lettering = $lettering_static->bookkeepingLetteringAll(array($bookkeeping->id)); $nb_lettering = $lettering_static->bookkeepingLetteringAll(array($bookkeeping->id));

View File

@ -376,7 +376,7 @@ if ($action == 'writebookkeeping') {
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
} }
} else { } else {
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) { if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) {
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
$lettering_static = new Lettering($db); $lettering_static = new Lettering($db);
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id)); $nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
@ -106,7 +106,7 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
} }
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code,"; $sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code, f.retained_warranty,";
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,"; $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur,"; $sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur,";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
@ -168,6 +168,7 @@ if ($result) {
$tabht = array(); $tabht = array();
$tabtva = array(); $tabtva = array();
$def_tva = array(); $def_tva = array();
$tabwarranty = array();
$tabttc = array(); $tabttc = array();
$tablocaltax1 = array(); $tablocaltax1 = array();
$tablocaltax2 = array(); $tablocaltax2 = array();
@ -248,7 +249,13 @@ if ($result) {
$tablocaltax2[$obj->rowid][$compta_localtax2] = 0; $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
} }
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc * $situation_ratio; $total_ttc = $obj->total_ttc * $situation_ratio;
if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY) && $obj->retained_warranty > 0) {
$retained_warranty = (double) price2num($total_ttc * $obj->retained_warranty / 100, 'MT');
$tabwarranty[$obj->rowid][$compta_soc] += $retained_warranty;
$total_ttc -= $retained_warranty;
}
$tabttc[$obj->rowid][$compta_soc] += $total_ttc;
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio; $tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
if (empty($line->tva_npr)) { if (empty($line->tva_npr)) {
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio; // We ignore line if VAT is a NPR $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio; // We ignore line if VAT is a NPR
@ -300,6 +307,10 @@ if ($action == 'writebookkeeping') {
$accountingaccountcustomer->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true); $accountingaccountcustomer->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
$accountingaccountcustomerwarranty = new AccountingAccount($db);
$accountingaccountcustomerwarranty->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY, true);
foreach ($tabfac as $key => $val) { // Loop on each invoice foreach ($tabfac as $key => $val) { // Loop on each invoice
$errorforline = 0; $errorforline = 0;
@ -344,6 +355,55 @@ if ($action == 'writebookkeeping') {
setEventMessages($langs->trans('ErrorInvoiceContainsLinesNotYetBounded', $val['ref']), null, 'errors'); setEventMessages($langs->trans('ErrorInvoiceContainsLinesNotYetBounded', $val['ref']), null, 'errors');
} }
// Warranty
if (!$errorforline) {
foreach ($tabwarranty[$key] as $k => $mt) {
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'customer_invoice';
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_client;
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY;
$bookkeeping->label_compte = $accountingaccountcustomerwarranty->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("Retainedwarranty");
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
$bookkeeping->credit = ($mt < 0) ? -$mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity;
$totaldebit += $bookkeeping->debit;
$totalcredit += $bookkeeping->credit;
$result = $bookkeeping->create($user);
if ($result < 0) {
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { // Already exists
$error++;
$errorforline++;
$errorforinvoice[$key] = 'alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
} else {
$error++;
$errorforline++;
$errorforinvoice[$key] = 'other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
}
}
// Thirdparty // Thirdparty
if (!$errorforline) { if (!$errorforline) {
foreach ($tabttc[$key] as $k => $mt) { foreach ($tabttc[$key] as $k => $mt) {
@ -390,7 +450,7 @@ if ($action == 'writebookkeeping') {
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
} }
} else { } else {
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) { if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) {
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
$lettering_static = new Lettering($db); $lettering_static = new Lettering($db);
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id)); $nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
@ -624,6 +684,25 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
continue; continue;
} }
// Warranty
foreach ($tabwarranty[$key] as $k => $mt) {
//if ($mt) {
print '"'.$key.'"'.$sep;
print '"'.$date.'"'.$sep;
print '"'.$val["ref"].'"'.$sep;
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY).'"'.$sep;
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
print '"'.$langs->trans("Thirdparty").'"'.$sep;
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("Retainedwarranty").'"'.$sep;
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
print '"'.$journal.'"';
print "\n";
//}
}
// Third party // Third party
foreach ($tabttc[$key] as $k => $mt) { foreach ($tabttc[$key] as $k => $mt) {
//if ($mt) { //if ($mt) {
@ -849,6 +928,36 @@ if (empty($action) || $action == 'view') {
print "</tr>"; print "</tr>";
} }
// Warranty
foreach ($tabwarranty[$key] as $k => $mt) {
print '<tr class="oddeven">';
print "<!-- Thirdparty warranty -->";
print "<td>".$date."</td>";
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
// Account
print "<td>";
$accountoshow = length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY);
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
} else {
print $accountoshow;
}
print '</td>';
// Subledger account
print "<td>";
$accountoshow = length_accounta($k);
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
} else {
print $accountoshow;
}
print '</td>';
print "<td>".$companystatic->getNomUrl(0, 'customer', 16).' - '.$invoicestatic->ref.' - '.$langs->trans("Retainedwarranty")."</td>";
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print "</tr>";
}
// Third party // Third party
foreach ($tabttc[$key] as $k => $mt) { foreach ($tabttc[$key] as $k => $mt) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';

View File

@ -119,26 +119,12 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
if ($action == 'validatehistory') { if ($action == 'validatehistory') {
$error = 0; $error = 0;
$nbbinddone = 0; $nbbinddone = 0;
$nbbindfailed = 0;
$notpossible = 0; $notpossible = 0;
$db->begin(); $db->begin();
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind // Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
/*if ($db->type == 'pgsql') {
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
$sql1 .= " WHERE " . MAIN_DB_PREFIX . "facture_fourn_det.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.$conf->entity;
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
$sql1 .= " AND " . MAIN_DB_PREFIX . "facture_fourn_det.fk_code_ventilation = 0";
} else {
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.$conf->entity;
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
$sql1 .= " AND fd.fk_code_ventilation = 0";
}*/
// Supplier Invoice Lines (must be same request than into page list.php for manual binding) // Supplier Invoice Lines (must be same request than into page list.php for manual binding)
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype, f.fk_facture_source,"; $sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype, f.fk_facture_source,";
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; $sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
@ -279,12 +265,14 @@ if ($action == 'validatehistory') {
if (!$resqlupdate) { if (!$resqlupdate) {
$error++; $error++;
setEventMessages($db->lasterror(), null, 'errors'); setEventMessages($db->lasterror(), null, 'errors');
$nbbindfailed++;
break; break;
} else { } else {
$nbbinddone++; $nbbinddone++;
} }
} else { } else {
$notpossible++; $notpossible++;
$nbbindfailed++;
} }
$i++; $i++;
@ -298,7 +286,10 @@ if ($action == 'validatehistory') {
$db->rollback(); $db->rollback();
} else { } else {
$db->commit(); $db->commit();
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs'); setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
if ($nbbindfailed) {
setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings');
}
} }
} }
@ -320,7 +311,7 @@ print '</span><br>';
$y = $year_current; $y = $year_current;
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.$langs->trans("ValidateHistory").'</a>'; $buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.img_picto('', 'link', 'class="paddingright fa-color-unset"').$langs->trans("ValidateHistory").'</a>';
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1); print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
@ -402,14 +393,37 @@ if ($resql) {
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if ($row[0] == 'tobind') { if ($row[0] == 'tobind') {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind")); $startmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1);
if ($startmonth > 12) {
$startmonth -= 12;
}
$startyear = ($startmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
$endmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + 11;
if ($endmonth > 12) {
$endmonth -= 12;
}
$endyear = ($endmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_date_startday=1&search_date_startmonth='.((int) $startmonth).'&search_date_startyear='.((int) $startyear).'&search_date_endday=&search_date_endmonth='.((int) $endmonth).'&search_date_endyear='.((int) $endyear), $langs->transnoentitiesnoconv("ToBind"));
} else { } else {
print $row[1]; print $row[1];
} }
print '</td>'; print '</td>';
for ($i = 2; $i <= 13; $i++) { for ($i = 2; $i <= 13; $i++) {
$cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2);
if ($cursormonth > 12) {
$cursormonth -= 12;
}
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
print '<td class="right nowraponall amount">'; print '<td class="right nowraponall amount">';
print price($row[$i]); print price($row[$i]);
// Add link to make binding
if (!empty(price2num($row[$i]))) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&year='.$y.'&validatemonth='.((int) $cursormonth).'&validateyear='.((int) $cursoryear).'&token='.newToken().'">';
print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"');
print '</a>';
}
print '</td>'; print '</td>';
} }
print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>'; print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
@ -541,7 +555,7 @@ print "</table>\n";
print '</div>'; print '</div>';
if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange. Why showing a report that should rely on result of this step ? if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This part of code looks strange. Why showing a report that should rely on result of this step ?
print '<br>'; print '<br>';
print '<br>'; print '<br>';

View File

@ -558,6 +558,10 @@ if ($result) {
print '</tr>'; print '</tr>';
$i++; $i++;
} }
if ($num_lines == 0) {
print '<tr><td colspan="13"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print '</table>'; print '</table>';
print "</div>"; print "</div>";

View File

@ -44,10 +44,11 @@ $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other",
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancysupplierlist'; // To manage different context of search
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$default_account = GETPOST('default_account', 'int'); $default_account = GETPOST('default_account', 'int');
// Select Box // Select Box
@ -75,8 +76,6 @@ $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_en
$search_country = GETPOST('search_country', 'alpha'); $search_country = GETPOST('search_country', 'alpha');
$search_tvaintra = GETPOST('search_tvaintra', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
$btn_ventil = GETPOST('ventil', 'alpha');
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
@ -112,7 +111,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }
@ -532,8 +531,8 @@ if ($result) {
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall '); print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall ');
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center '); print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
$checkpicto = ''; $checkpicto = '';
if ($massactionbutton) { if ($massactionbutton) {
$checkpicto = $form->showCheckAddButtons('checkforselect', 1); $checkpicto = $form->showCheckAddButtons('checkforselect', 1);
@ -712,14 +711,19 @@ if ($result) {
// Found accounts // Found accounts
print '<td class="small">'; print '<td class="small">';
$s = '1. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; $s = '1. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
$shelp = ''; $shelp = ''; $ttype = 'help';
if ($suggestedaccountingaccountbydefaultfor == 'eec') { if ($suggestedaccountingaccountbydefaultfor == 'eec') {
$shelp .= $langs->trans("SaleEEC"); $shelp .= $langs->trans("SaleEEC");
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') {
$shelp = $langs->trans("SaleEECWithVAT");
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithoutvatnumber') {
$shelp = $langs->trans("SaleEECWithoutVATNumber");
$ttype = 'warning';
} elseif ($suggestedaccountingaccountbydefaultfor == 'export') { } elseif ($suggestedaccountingaccountbydefaultfor == 'export') {
$shelp .= $langs->trans("SaleExport"); $shelp .= $langs->trans("SaleExport");
} }
$s .= ($code_buy_l > 0 ? length_accountg($code_buy_l) : '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>'); $s .= ($code_buy_l > 0 ? length_accountg($code_buy_l) : '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>');
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
if ($product_static->id > 0) { if ($product_static->id > 0) {
print '<br>'; print '<br>';
$s = '2. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; $s = '2. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
@ -777,6 +781,9 @@ if ($result) {
print '</tr>'; print '</tr>';
$i++; $i++;
} }
if ($num_lines == 0) {
print '<tr><td colspan="14"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print '</table>'; print '</table>';
print "</div>"; print "</div>";

View File

@ -1,6 +1,8 @@
<?php <?php
/* Copyright (C) 2015-2022 Alexandre Spangaro <aspangaro@open-dsi.fr> /* Copyright (C) 2015-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2022 Lionel Vessiller <lvessiller@open-dsi.fr>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com> * Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2022 Progiseize <a.bisotti@progiseize.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -33,7 +35,9 @@ $siren = getDolGlobalString('MAIN_INFO_SIREN');
$date_export = "_".dol_print_date(dol_now(), '%Y%m%d%H%M%S'); $date_export = "_".dol_print_date(dol_now(), '%Y%m%d%H%M%S');
$endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d'); $endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d');
if (empty($withAttachment)) {
header('Content-Type: text/csv'); header('Content-Type: text/csv');
}
include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php'; include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
$accountancyexport = new AccountancyExport($db); $accountancyexport = new AccountancyExport($db);
@ -66,4 +70,6 @@ if (($accountancyexport->getFormatCode($formatexportset) == 'fec' || $accountanc
$completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format; $completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format;
} }
if (empty($withAttachment)) {
header('Content-Disposition: attachment;filename=' . $completefilename); header('Content-Disposition: attachment;filename=' . $completefilename);
}

View File

@ -152,10 +152,13 @@ if ($action == 'set_default') {
setEventMessages('RecordModifiedSuccessfully', null, 'mesgs'); setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
$db->commit(); $db->commit();
} }
} elseif ($action == 'setcodemember') {
$result = dolibarr_set_const($db, "MEMBER_CODEMEMBER_ADDON", $value, 'chaine', 0, '', $conf->entity);
if ($result <= 0) {
dol_print_error($db);
} }
} elseif ($action == 'update' || $action == 'add') {
// Action to update or add a constant // Action to update or add a constant
if ($action == 'update' || $action == 'add') {
$constname = GETPOST('constname', 'alpha'); $constname = GETPOST('constname', 'alpha');
$constvalue = (GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue')); $constvalue = (GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue'));
@ -223,6 +226,97 @@ $head = member_admin_prepare_head();
print dol_get_fiche_head($head, 'general', $langs->trans("Members"), -1, 'user'); print dol_get_fiche_head($head, 'general', $langs->trans("Members"), -1, 'user');
$dirModMember = array_merge(array('/core/modules/member/'), $conf->modules_parts['member']);
foreach ($conf->modules_parts['models'] as $mo) {
//Add more models
$dirModMember[] = $mo.'core/modules/member/';
}
// Module to manage customer/supplier code
print load_fiche_titre($langs->trans("MemberCodeChecker"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre">'."\n";
print ' <td>'.$langs->trans("Name").'</td>';
print ' <td>'.$langs->trans("Description").'</td>';
print ' <td>'.$langs->trans("Example").'</td>';
print ' <td class="center" width="80">'.$langs->trans("Status").'</td>';
print ' <td class="center" width="60">'.$langs->trans("ShortInfo").'</td>';
print "</tr>\n";
$arrayofmodules = array();
foreach ($dirModMember as $dirroot) {
$dir = dol_buildpath($dirroot, 0);
$handle = @opendir($dir);
if (is_resource($handle)) {
// Loop on each module find in opened directory
while (($file = readdir($handle)) !== false) {
// module filename has to start with mod_member_
if (substr($file, 0, 11) == 'mod_member_' && substr($file, -3) == 'php') {
$file = substr($file, 0, dol_strlen($file) - 4);
try {
dol_include_once($dirroot.$file.'.php');
} catch (Exception $e) {
dol_syslog($e->getMessage(), LOG_ERR);
continue;
}
$modCodeMember = new $file;
// Show modules according to features level
if ($modCodeMember->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
continue;
}
if ($modCodeMember->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
continue;
}
$arrayofmodules[$file] = $modCodeMember;
}
}
closedir($handle);
}
}
$arrayofmodules = dol_sort_array($arrayofmodules, 'position');
foreach ($arrayofmodules as $file => $modCodeMember) {
print '<tr class="oddeven">'."\n";
print '<td width="140">'.$modCodeMember->name.'</td>'."\n";
print '<td>'.$modCodeMember->info($langs).'</td>'."\n";
print '<td class="nowrap">'.$modCodeMember->getExample($langs).'</td>'."\n";
if (getDolGlobalString('MEMBER_CODEMEMBER_ADDON') == "$file") {
print '<td class="center">'."\n";
print img_picto($langs->trans("Activated"), 'switch_on');
print "</td>\n";
} else {
$disabled = (isModEnabled('multicompany') && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity) ? true : false);
print '<td class="center">';
if (!$disabled) {
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setcodemember&token='.newToken().'&value='.urlencode($file).'">';
}
print img_picto($langs->trans("Disabled"), 'switch_off');
if (!$disabled) {
print '</a>';
}
print '</td>';
}
print '<td class="center">';
$s = $modCodeMember->getToolTip($langs, null, -1);
print $form->textwithpicto('', $s, 1);
print '</td>';
print '</tr>';
}
print '</table>';
print '</div>';
print "<br>";
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="updatemainoptions">'; print '<input type="hidden" name="action" value="updatemainoptions">';

View File

@ -178,7 +178,7 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
//print $langs->trans('FollowingLinksArePublic').'<br>'; //print $langs->trans('FollowingLinksArePublic').'<br>';
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>'; print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>';
if (isModEnabled('multicompany')) { if (isModEnabled('multicompany')) {
$entity_qr = '?entity='.$conf->entity; $entity_qr = '?entity='.((int) $conf->entity);
} else { } else {
$entity_qr = ''; $entity_qr = '';
} }

View File

@ -64,7 +64,7 @@ if (GETPOST('actioncode', 'array')) {
$actioncode = '0'; $actioncode = '0';
} }
} else { } else {
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
} }
$search_agenda_label = GETPOST('search_agenda_label'); $search_agenda_label = GETPOST('search_agenda_label');

View File

@ -112,34 +112,9 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
$this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1); $this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1);
} else { } else {
// Confirm delete contact // Confirm delete contact
if ($action == 'delete' && $user->rights->adherent->supprimer) { if ($action == 'delete' && $user->hasRight('adherent', 'supprimer')) {
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteAdherent"), $langs->trans("ConfirmDeleteAdherent"), "confirm_delete", '', 0, 1); $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteAdherent"), $langs->trans("ConfirmDeleteAdherent"), "confirm_delete", '', 0, 1);
} }
} }
if ($action == 'list') {
$this->LoadListDatas($limit, $offset, $sortfield, $sortorder);
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Fetch datas list and save into ->list_datas
*
* @param int $limit Limit number of responses
* @param int $offset Offset for first response
* @param string $sortfield Sort field
* @param string $sortorder Sort order ('ASC' or 'DESC')
* @return void
*/
public function LoadListDatas($limit, $offset, $sortfield, $sortorder)
{
// phpcs:enable
global $conf, $langs;
//$this->getFieldList();
$this->list_datas = array();
} }
} }

View File

@ -128,12 +128,12 @@ if (empty($user->socid)) {
echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=edit&token='.newToken().'&canvas='.$canvas.'">'.$langs->trans('Modify').'</a>'; echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=edit&token='.newToken().'&canvas='.$canvas.'">'.$langs->trans('Modify').'</a>';
} }
if (!$this->control->tpl['user_id'] && $user->rights->user->user->creer) { if (!$this->control->tpl['user_id'] && $user->hasRight('user', 'user', 'creer')) {
echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=create_user&token='.newToken().'&canvas='.$canvas.'">'.$langs->trans("CreateDolibarrLogin").'</a>'; echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=create_user&token='.newToken().'&canvas='.$canvas.'">'.$langs->trans("CreateDolibarrLogin").'</a>';
} }
if ($user->rights->adherent->supprimer) { if ($user->hasRight('adherent', 'supprimer')) {
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=delete&token='.newToken().'&canvas='.$canvas, 'delete', $user->rights->adherent->supprimer); print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=delete&token='.newToken().'&canvas='.$canvas, 'delete', $user->hasRight('adherent', 'supprimer'));
} }
echo '</div><br>'; echo '</div><br>';

View File

@ -6,7 +6,7 @@
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2020 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2012-2020 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015-2018 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2015-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Waël Almoman <info@almoman.com> * Copyright (C) 2021 Waël Almoman <info@almoman.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -313,10 +313,6 @@ if (empty($reshook)) {
$object->socialnetworks[$key] = trim(GETPOST($key, 'alphanohtml')); $object->socialnetworks[$key] = trim(GETPOST($key, 'alphanohtml'));
} }
} }
//$object->skype = trim(GETPOST("skype", 'alpha'));
//$object->twitter = trim(GETPOST("twitter", 'alpha'));
//$object->facebook = trim(GETPOST("facebook", 'alpha'));
//$object->linkedin = trim(GETPOST("linkedin", 'alpha'));
$object->birth = $birthdate; $object->birth = $birthdate;
$object->default_lang = GETPOST('default_lang', 'alpha'); $object->default_lang = GETPOST('default_lang', 'alpha');
$object->typeid = GETPOST("typeid", 'int'); $object->typeid = GETPOST("typeid", 'int');
@ -342,7 +338,7 @@ if (empty($reshook)) {
// Check if we need to also synchronize user information // Check if we need to also synchronize user information
$nosyncuser = 0; $nosyncuser = 0;
if ($object->user_id) { // If linked to a user if ($object->user_id) { // If linked to a user
if ($user->id != $object->user_id && empty($user->rights->user->user->creer)) { if ($user->id != $object->user_id && !$user->hasRight('user', 'user', 'creer')) {
$nosyncuser = 1; // Disable synchronizing $nosyncuser = 1; // Disable synchronizing
} }
} }
@ -350,7 +346,7 @@ if (empty($reshook)) {
// Check if we need to also synchronize password information // Check if we need to also synchronize password information
$nosyncuserpass = 0; $nosyncuserpass = 0;
if ($object->user_id) { // If linked to a user if ($object->user_id) { // If linked to a user
if ($user->id != $object->user_id && empty($user->rights->user->user->password)) { if ($user->id != $object->user_id && !$user->hasRight('user', 'user', 'password')) {
$nosyncuserpass = 1; // Disable synchronizing $nosyncuserpass = 1; // Disable synchronizing
} }
} }
@ -488,11 +484,6 @@ if (empty($reshook)) {
} }
} }
// $object->skype = $skype;
// $object->twitter = $twitter;
// $object->facebook = $facebook;
// $object->linkedin = $linkedin;
$object->email = $email; $object->email = $email;
$object->url = $url; $object->url = $url;
$object->login = $login; $object->login = $login;
@ -565,7 +556,7 @@ if (empty($reshook)) {
} }
if (!empty($object->url) && !isValidUrl($object->url)) { if (!empty($object->url) && !isValidUrl($object->url)) {
$langs->load("errors"); $langs->load("errors");
setEventMessages('', $langs->trans("ErrorBadUrl", $object->url), 'errors'); setEventMessages($langs->trans("ErrorBadUrl", $object->url), null, 'errors');
} }
$public = 0; $public = 0;
if (isset($public)) { if (isset($public)) {
@ -659,7 +650,7 @@ if (empty($reshook)) {
$outputlangs->loadLangs(array("main", "members", "companies", "install", "other")); $outputlangs->loadLangs(array("main", "members", "companies", "install", "other"));
// Get email content from template // Get email content from template
$arraydefaultmessage = null; $arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION; $labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION');
if (!empty($labeltouse)) { if (!empty($labeltouse)) {
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
@ -731,7 +722,7 @@ if (empty($reshook)) {
$outputlangs->loadLangs(array("main", "members", "companies", "install", "other")); $outputlangs->loadLangs(array("main", "members", "companies", "install", "other"));
// Get email content from template // Get email content from template
$arraydefaultmessage = null; $arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION; $labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_CANCELATION');
if (!empty($labeltouse)) { if (!empty($labeltouse)) {
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
@ -802,7 +793,7 @@ if (empty($reshook)) {
$outputlangs->loadLangs(array("main", "members", "companies", "install", "other")); $outputlangs->loadLangs(array("main", "members", "companies", "install", "other"));
// Get email content from template // Get email content from template
$arraydefaultmessage = null; $arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_EXCLUSION; $labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_EXCLUSION');
if (!empty($labeltouse)) { if (!empty($labeltouse)) {
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
@ -1046,7 +1037,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Website // Website
print '<tr><td>'.$form->editfieldkey('Web', 'member_url', GETPOST('member_url', 'alpha'), $object, 0).'</td>'; print '<tr><td>'.$form->editfieldkey('Web', 'member_url', GETPOST('member_url', 'alpha'), $object, 0).'</td>';
print '<td>'.img_picto('', 'globe').' <input type="text" class="maxwidth500 widthcentpercentminusx" name="member_url" id="member_url" value="'.(GETPOSTISSET('member_url', 'alpha') ? GETPOST('member_url', 'alpha') : $object->url).'"></td></tr>'; print '<td>'.img_picto('', 'globe').' <input type="text" class="maxwidth500 widthcentpercentminusx" name="member_url" id="member_url" value="'.(GETPOSTISSET('member_url') ? GETPOST('member_url', 'alpha') : $object->url).'"></td></tr>';
// Address // Address
print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>'; print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>';
@ -1533,10 +1524,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs); $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
$tmp = $langs->trans("SendingAnEMailToMember"); $tmp = $langs->trans("SendingAnEMailToMember");
$tmp .= '<br>'.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, '; $tmp .= '<br>'.$langs->trans("MailFrom").': <b>'.getDolGlobalString('ADHERENT_MAIL_FROM').'</b>, ';
$tmp .= '<br>'.$langs->trans("MailRecipient").': <b>'.$object->email.'</b>'; $tmp .= '<br>'.$langs->trans("MailRecipient").': <b>'.$object->email.'</b>';
$helpcontent = ''; $helpcontent = '';
$helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n"; $helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.getDolGlobalString('ADHERENT_MAIL_FROM').'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n"; $helpcontent .= '<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("Subject").'</b>:<br>'."\n"; $helpcontent .= '<b>'.$langs->trans("Subject").'</b>:<br>'."\n";
$helpcontent .= $subjecttosend."\n"; $helpcontent .= $subjecttosend."\n";
@ -1596,10 +1587,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs); $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs);
$tmp = $langs->trans("SendingAnEMailToMember"); $tmp = $langs->trans("SendingAnEMailToMember");
$tmp .= '<br>('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, '; $tmp .= '<br>('.$langs->trans("MailFrom").': <b>'.getDolGlobalString('ADHERENT_MAIL_FROM').'</b>, ';
$tmp .= $langs->trans("MailRecipient").': <b>'.$object->email.'</b>)'; $tmp .= $langs->trans("MailRecipient").': <b>'.$object->email.'</b>)';
$helpcontent = ''; $helpcontent = '';
$helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n"; $helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.getDolGlobalString('ADHERENT_MAIL_FROM').'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n"; $helpcontent .= '<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("Subject").'</b>:<br>'."\n"; $helpcontent .= '<b>'.$langs->trans("Subject").'</b>:<br>'."\n";
$helpcontent .= $subjecttosend."\n"; $helpcontent .= $subjecttosend."\n";
@ -1639,7 +1630,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$outputlangs->loadLangs(array("main", "members")); $outputlangs->loadLangs(array("main", "members"));
// Get email content from template // Get email content from template
$arraydefaultmessage = null; $arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_EXCLUSION; $labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_EXCLUSION');
if (!empty($labeltouse)) { if (!empty($labeltouse)) {
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
@ -1656,10 +1647,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnExclude()), $substitutionarray, $outputlangs); $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnExclude()), $substitutionarray, $outputlangs);
$tmp = $langs->trans("SendingAnEMailToMember"); $tmp = $langs->trans("SendingAnEMailToMember");
$tmp .= '<br>('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, '; $tmp .= '<br>('.$langs->trans("MailFrom").': <b>'.getDolGlobalString('ADHERENT_MAIL_FROM').'</b>, ';
$tmp .= $langs->trans("MailRecipient").': <b>'.$object->email.'</b>)'; $tmp .= $langs->trans("MailRecipient").': <b>'.$object->email.'</b>)';
$helpcontent = ''; $helpcontent = '';
$helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n"; $helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.getDolGlobalString('ADHERENT_MAIL_FROM').'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n"; $helpcontent .= '<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("Subject").'</b>:<br>'."\n"; $helpcontent .= '<b>'.$langs->trans("Subject").'</b>:<br>'."\n";
$helpcontent .= $subjecttosend."\n"; $helpcontent .= $subjecttosend."\n";

View File

@ -307,7 +307,7 @@ foreach (array_keys($_Avery_Labels) as $codecards) {
} }
asort($arrayoflabels); asort($arrayoflabels);
print $form->selectarray('model', $arrayoflabels, (GETPOST('model') ?GETPOST('model') : (empty($conf->global->ADHERENT_CARD_TYPE) ? '' : $conf->global->ADHERENT_CARD_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1); print $form->selectarray('model', $arrayoflabels, (GETPOST('model') ?GETPOST('model') : (empty($conf->global->ADHERENT_CARD_TYPE) ? '' : $conf->global->ADHERENT_CARD_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1);
print '<br>'.$langs->trans("Login").': <input size="10" type="text" name="foruserlogin" value="'.GETPOST('foruserlogin').'">'; print '<br>'.$langs->trans("Login").': <input class="with100" type="text" name="foruserlogin" value="'.GETPOST('foruserlogin').'">';
print '<br><input type="submit" class="button small" value="'.$langs->trans("BuildDoc").'">'; print '<br><input type="submit" class="button small" value="'.$langs->trans("BuildDoc").'">';
print '</form>'; print '</form>';

View File

@ -7,7 +7,7 @@
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014-2018 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2014-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015-2022 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2015-2023 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net> * Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net>
@ -89,9 +89,22 @@ class Adherent extends CommonObject
*/ */
public $pass_indatabase_crypted; public $pass_indatabase_crypted;
/**
* @var string fullname
*/
public $fullname;
/**
* @var string The civility code, not an integer
*/
public $civility_id;
public $civility_code;
public $civility;
/** /**
* @var string company name * @var string company name
* @deprecated * @deprecated
* @see $company
*/ */
public $societe; public $societe;
@ -102,8 +115,14 @@ class Adherent extends CommonObject
/** /**
* @var int Thirdparty ID * @var int Thirdparty ID
* @deprecated
* @see $socid
*/ */
public $fk_soc; public $fk_soc;
/**
* @var int socid
*/
public $socid; public $socid;
/** /**
@ -154,24 +173,28 @@ class Adherent extends CommonObject
/** /**
* @var string skype account * @var string skype account
* @deprecated * @deprecated
* @see $socialnetworks
*/ */
public $skype; public $skype;
/** /**
* @var string twitter account * @var string twitter account
* @deprecated * @deprecated
* @see $socialnetworks
*/ */
public $twitter; public $twitter;
/** /**
* @var string facebook account * @var string facebook account
* @deprecated * @deprecated
* @see $socialnetworks
*/ */
public $facebook; public $facebook;
/** /**
* @var string linkedin account * @var string linkedin account
* @deprecated * @deprecated
* @see $socialnetworks
*/ */
public $linkedin; public $linkedin;
@ -259,10 +282,19 @@ class Adherent extends CommonObject
*/ */
public $type; public $type;
/**
* @var int need_subscription
*/
public $need_subscription; public $need_subscription;
/**
* @var int user_id
*/
public $user_id; public $user_id;
/**
* @var string user_login
*/
public $user_login; public $user_login;
public $datefin; public $datefin;
@ -272,6 +304,10 @@ class Adherent extends CommonObject
public $first_subscription_date; public $first_subscription_date;
public $first_subscription_date_start;
public $first_subscription_date_end;
public $first_subscription_amount; public $first_subscription_amount;
public $last_subscription_date; public $last_subscription_date;
@ -284,6 +320,10 @@ class Adherent extends CommonObject
public $subscriptions = array(); public $subscriptions = array();
/**
* @var string ip
*/
public $ip;
// Fields loaded by fetchPartnerships() from partnership table // Fields loaded by fetchPartnerships() from partnership table
@ -425,8 +465,8 @@ class Adherent extends CommonObject
// Envoi mail confirmation // Envoi mail confirmation
$from = $conf->email_from; $from = $conf->email_from;
if (!empty($conf->global->ADHERENT_MAIL_FROM)) { if (!empty(getDolGlobalString('ADHERENT_MAIL_FROM'))) {
$from = $conf->global->ADHERENT_MAIL_FROM; $from = getDolGlobalString('ADHERENT_MAIL_FROM');
} }
$trackid = 'mem'.$this->id; $trackid = 'mem'.$this->id;
@ -576,7 +616,7 @@ class Adherent extends CommonObject
*/ */
public function create($user, $notrigger = 0) public function create($user, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs, $mysoc;
$error = 0; $error = 0;
@ -624,7 +664,22 @@ class Adherent extends CommonObject
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent"); $id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent");
if ($id > 0) { if ($id > 0) {
$this->id = $id; $this->id = $id;
if (getDolGlobalString('MEMBER_CODEMEMBER_ADDON') == '') {
// keep old numbering
$this->ref = (string) $id; $this->ref = (string) $id;
} else {
// auto code
$modfile = dol_buildpath('core/modules/member/'.getDolGlobalString('MEMBER_CODEMEMBER_ADDON').'.php', 0);
try {
require_once $modfile;
$modname = getDolGlobalString('MEMBER_CODEMEMBER_ADDON');
$modCodeMember = new $modname;
$this->ref = $modCodeMember->getNextValue($mysoc, $this);
} catch (Exception $e) {
dol_syslog($e->getMessage(), LOG_ERR);
$error++;
}
}
// Update minor fields // Update minor fields
$result = $this->update($user, 1, 1, 0, 0, 'add'); // nosync is 1 to avoid update data of user $result = $this->update($user, 1, 1, 0, 0, 'add'); // nosync is 1 to avoid update data of user
@ -1505,7 +1560,7 @@ class Adherent extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
$sql = "SELECT c.rowid, c.fk_adherent, c.fk_type, c.subscription, c.note, c.fk_bank,"; $sql = "SELECT c.rowid, c.fk_adherent, c.fk_type, c.subscription, c.note as note_public, c.fk_bank,";
$sql .= " c.tms as datem,"; $sql .= " c.tms as datem,";
$sql .= " c.datec as datec,"; $sql .= " c.datec as datec,";
$sql .= " c.dateadh as dateh,"; $sql .= " c.dateadh as dateh,";
@ -1537,7 +1592,8 @@ class Adherent extends CommonObject
$subscription->fk_adherent = $obj->fk_adherent; $subscription->fk_adherent = $obj->fk_adherent;
$subscription->fk_type = $obj->fk_type; $subscription->fk_type = $obj->fk_type;
$subscription->amount = $obj->subscription; $subscription->amount = $obj->subscription;
$subscription->note = $obj->note; $subscription->note = $obj->note_public;
$subscription->note_public = $obj->note_public;
$subscription->fk_bank = $obj->fk_bank; $subscription->fk_bank = $obj->fk_bank;
$subscription->datem = $this->db->jdate($obj->datem); $subscription->datem = $this->db->jdate($obj->datem);
$subscription->datec = $this->db->jdate($obj->datec); $subscription->datec = $this->db->jdate($obj->datec);
@ -2872,7 +2928,7 @@ class Adherent extends CommonObject
* Existing categories are left untouch. * Existing categories are left untouch.
* *
* @param int[]|int $categories Category or categories IDs * @param int[]|int $categories Category or categories IDs
* @return void * @return int <0 if KO, >0 if OK
*/ */
public function setCategories($categories) public function setCategories($categories)
{ {
@ -3015,7 +3071,7 @@ class Adherent extends CommonObject
$subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs); $subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs);
$msg = make_substitutions($arraydefaultmessage->content, $substitutionarray, $outputlangs); $msg = make_substitutions($arraydefaultmessage->content, $substitutionarray, $outputlangs);
$from = $conf->global->ADHERENT_MAIL_FROM; $from = getDolGlobalString('ADHERENT_MAIL_FROM');
$to = $adherent->email; $to = $adherent->email;
$trackid = 'mem'.$adherent->id; $trackid = 'mem'.$adherent->id;
@ -3167,4 +3223,41 @@ class Adherent extends CommonObject
return $nbko; return $nbko;
} }
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @param array $arraydata Array of data
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '', $arraydata = null)
{
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
if (property_exists($this, 'photo') || !empty($this->photo)) {
$return.= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1);
} else {
$return .= img_picto('', 'user');
}
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
if (property_exists($this, 'type')) {
$return .= '<br><span class="info-box-label opacitymedium">'.$this->type.'</span>';
}
if (method_exists($this, 'getmorphylib')) {
$return .= '<br><span class="info-box-label">'.$this->getmorphylib('', 2).'</span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
} }

View File

@ -129,6 +129,19 @@ class AdherentType extends CommonObject
/** @var string string other */ /** @var string string other */
public $other = array(); public $other = array();
/**
* @var string description
*/
public $description;
/**
* @var string email
*/
public $email;
/**
* @var array multilangs
*/
public $multilangs = array(); public $multilangs = array();
@ -472,7 +485,7 @@ class AdherentType extends CommonObject
} }
/** /**
* Function that retrieves the status of the member * Function that retrieves the properties of a membership type
* *
* @param int $rowid Id of member type to load * @param int $rowid Id of member type to load
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
@ -626,7 +639,7 @@ class AdherentType extends CommonObject
$sql .= ' AND ('.$excludefilter.')'; $sql .= ' AND ('.$excludefilter.')';
} }
dol_syslog(get_class($this)."::listUsersForGroup", LOG_DEBUG); dol_syslog(get_class($this)."::listMembersForMemberType", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {
@ -927,4 +940,47 @@ class AdherentType extends CommonObject
return ''; return '';
} }
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @param array $arraydata Array of data
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '', $arraydata = null)
{
global $langs,$user;
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
if ($user->rights->adherent->configurer) {
$return .= '<span class="right paddingleft"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$this->ref.'">'.img_edit().'</a></span>';
} else {
$return .= '<span class="right">&nbsp;</span>';
}
if (property_exists($this, 'vote')) {
$return .= '<br><span class="info-box-label opacitymedium">'.$langs->trans("VoteAllowed").' : '.yn($this->vote).'</span>';
}
if (property_exists($this, 'amount')) {
if (is_null($this->amount) || $this->amount === '') {
$return .= '<br>';
} else {
$return .= '<br><span class="info-box-label opacitymedium">'.$langs->trans("Amount").'</span>';
$return .= '<span class="amount"> : '.price($this->amount).'</span>';
}
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(5).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
} }

View File

@ -55,7 +55,7 @@ class AdherentStats extends Stats
*/ */
public function __construct($db, $socid = 0, $userid = 0) public function __construct($db, $socid = 0, $userid = 0)
{ {
global $user, $conf; global $conf;
$this->db = $db; $this->db = $db;
$this->socid = $socid; $this->socid = $socid;
@ -87,8 +87,6 @@ class AdherentStats extends Stats
*/ */
public function getNbByMonth($year, $format = 0) public function getNbByMonth($year, $format = 0)
{ {
global $user;
$sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)"; $sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)";
$sql .= " FROM ".$this->from; $sql .= " FROM ".$this->from;
//if (empty($user->rights->societe->client->voir) && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; //if (empty($user->rights->societe->client->voir) && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -107,8 +105,6 @@ class AdherentStats extends Stats
*/ */
public function getNbByYear() public function getNbByYear()
{ {
global $user;
$sql = "SELECT date_format(p.dateadh,'%Y') as dm, count(*)"; $sql = "SELECT date_format(p.dateadh,'%Y') as dm, count(*)";
$sql .= " FROM ".$this->from; $sql .= " FROM ".$this->from;
//if (empty($user->rights->societe->client->voir) && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; //if (empty($user->rights->societe->client->voir) && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -128,8 +124,6 @@ class AdherentStats extends Stats
*/ */
public function getAmountByMonth($year, $format = 0) public function getAmountByMonth($year, $format = 0)
{ {
global $user;
$sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")"; $sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")";
$sql .= " FROM ".$this->from; $sql .= " FROM ".$this->from;
//if (empty($user->rights->societe->client->voir) && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; //if (empty($user->rights->societe->client->voir) && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -149,8 +143,6 @@ class AdherentStats extends Stats
*/ */
public function getAverageByMonth($year) public function getAverageByMonth($year)
{ {
global $user;
$sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")"; $sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")";
$sql .= " FROM ".$this->from; $sql .= " FROM ".$this->from;
//if (empty($user->rights->societe->client->voir) && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; //if (empty($user->rights->societe->client->voir) && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -170,8 +162,6 @@ class AdherentStats extends Stats
*/ */
public function getAllByYear() public function getAllByYear()
{ {
global $user;
$sql = "SELECT date_format(p.dateadh,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg"; $sql = "SELECT date_format(p.dateadh,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg";
$sql .= " FROM ".$this->from; $sql .= " FROM ".$this->from;
//if (empty($user->rights->societe->client->voir) && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; //if (empty($user->rights->societe->client->voir) && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -181,4 +171,82 @@ class AdherentStats extends Stats
return $this->_getAllByYear($sql); return $this->_getAllByYear($sql);
} }
/**
* Return count of member by status group by adh type, total and average
*
* @param int $numberYears Years to scan
* @return array Array with total of draft, pending, uptodate, expired, resiliated for each member tag
*/
public function countMembersByTagAndStatus($numberYears = 2)
{
global $user;
$now = dol_now();
$endYear = date('Y');
$startYear = $endYear - $numberYears;
$sql = "SELECT c.rowid as fk_categorie, c.label as label";
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_DRAFT, "'members_draft'", 'NULL').") as members_draft";
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin IS NULL AND t.subscription = '1')", "'members_pending'", 'NULL').") as members_pending";
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin >= '".$this->db->idate($now)."' OR t.subscription = 0)", "'members_uptodate'", 'NULL').") as members_uptodate";
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin < '".$this->db->idate($now)."' AND t.subscription = 1)", "'members_expired'", 'NULL').") as members_expired";
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_EXCLUDED, "'members_excluded'", 'NULL').") as members_excluded";
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_RESILIATED, "'members_resiliated'", 'NULL').") as members_resiliated";
$sql .= " FROM ".MAIN_DB_PREFIX."categorie as c";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_member as ct ON c.rowid = ct.fk_categorie";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d ON d.rowid = ct.fk_member";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_type as t ON t.rowid = d.fk_adherent_type";
$sql .= " WHERE c.entity IN (".getEntity('member_type').")";
$sql .= " AND d.entity IN (" . getEntity('adherent') . ")";
$sql .= " AND t.entity IN (" . getEntity('adherent') . ")";
$sql .= " AND d.datefin > '".$this->db->idate(dol_get_first_day($startYear))."'";
$sql .= " AND c.fk_parent = 0";
$sql .= " GROUP BY c.rowid";
dol_syslog("box_members_by_type::select nb of members per type", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$i = 0;
$MembersCountArray = [];
$totalstatus = array(
'label' => 'Total',
'members_draft' => 0,
'members_pending' => 0,
'members_uptodate' => 0,
'members_expired' => 0,
'members_excluded' => 0,
'members_resiliated' => 0
);
while ($i < $num) {
$objp = $this->db->fetch_object($result);
$MembersCountArray[$objp->fk_categorie] = array(
'label' => $objp->label,
'members_draft' => (int) $objp->members_draft,
'members_pending' => (int) $objp->members_pending,
'members_uptodate' => (int) $objp->members_uptodate,
'members_expired' => (int) $objp->members_expired,
'members_excluded' => (int) $objp->members_excluded,
'members_resiliated' => (int) $objp->members_resiliated
);
$totalrow = 0;
foreach ($MembersCountArray[$objp->fk_categorie] as $key=>$nb) {
if ($key!='label') {
$totalrow += $nb;
$totalstatus[$key] += $nb;
}
}
$MembersCountArray[$objp->fk_categorie]['total_adhtype'] = $totalrow;
$i++;
}
$this->db->free($result);
$MembersCountArray['total'] = $totalstatus;
$MembersCountArray['total']['all'] = array_sum($totalstatus);
}
return $MembersCountArray;
}
} }

View File

@ -62,7 +62,7 @@ class Members extends DolibarrApi
*/ */
public function get($id) public function get($id)
{ {
if (!DolibarrApiAccess::$user->rights->adherent->lire) { if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
throw new RestException(401); throw new RestException(401);
} }
@ -99,7 +99,7 @@ class Members extends DolibarrApi
*/ */
public function getByThirdparty($thirdparty) public function getByThirdparty($thirdparty)
{ {
if (!DolibarrApiAccess::$user->rights->adherent->lire) { if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
throw new RestException(401); throw new RestException(401);
} }
@ -132,7 +132,7 @@ class Members extends DolibarrApi
*/ */
public function getByThirdpartyEmail($email) public function getByThirdpartyEmail($email)
{ {
if (!DolibarrApiAccess::$user->rights->adherent->lire) { if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
throw new RestException(401); throw new RestException(401);
} }
@ -171,7 +171,7 @@ class Members extends DolibarrApi
*/ */
public function getByThirdpartyBarcode($barcode) public function getByThirdpartyBarcode($barcode)
{ {
if (!DolibarrApiAccess::$user->rights->adherent->lire) { if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
throw new RestException(401); throw new RestException(401);
} }
@ -217,7 +217,7 @@ class Members extends DolibarrApi
$obj_ret = array(); $obj_ret = array();
if (!DolibarrApiAccess::$user->rights->adherent->lire) { if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
throw new RestException(401); throw new RestException(401);
} }
@ -370,7 +370,7 @@ class Members extends DolibarrApi
*/ */
public function delete($id) public function delete($id)
{ {
if (!DolibarrApiAccess::$user->rights->adherent->supprimer) { if (!DolibarrApiAccess::$user->hasRight('adherent', 'supprimer')) {
throw new RestException(401); throw new RestException(401);
} }
$member = new Adherent($this->db); $member = new Adherent($this->db);
@ -464,7 +464,7 @@ class Members extends DolibarrApi
{ {
$obj_ret = array(); $obj_ret = array();
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->lire) { if (!DolibarrApiAccess::$user->hasRight('adherent', 'cotisation', 'lire')) {
throw new RestException(401); throw new RestException(401);
} }
@ -495,7 +495,7 @@ class Members extends DolibarrApi
*/ */
public function createSubscription($id, $start_date, $end_date, $amount, $label = '') public function createSubscription($id, $start_date, $end_date, $amount, $label = '')
{ {
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->creer) { if (!DolibarrApiAccess::$user->hasRight('adherent', 'cotisation', 'creer')) {
throw new RestException(401); throw new RestException(401);
} }

View File

@ -55,7 +55,7 @@ class MembersTypes extends DolibarrApi
*/ */
public function get($id) public function get($id)
{ {
if (!DolibarrApiAccess::$user->rights->adherent->lire) { if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
throw new RestException(401); throw new RestException(401);
} }
@ -92,7 +92,7 @@ class MembersTypes extends DolibarrApi
$obj_ret = array(); $obj_ret = array();
if (!DolibarrApiAccess::$user->rights->adherent->lire) { if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
throw new RestException(401); throw new RestException(401);
} }
@ -151,7 +151,7 @@ class MembersTypes extends DolibarrApi
*/ */
public function post($request_data = null) public function post($request_data = null)
{ {
if (!DolibarrApiAccess::$user->rights->adherent->configurer) { if (!DolibarrApiAccess::$user->hasRight('adherent', 'configurer')) {
throw new RestException(401); throw new RestException(401);
} }
// Check mandatory fields // Check mandatory fields
@ -176,7 +176,7 @@ class MembersTypes extends DolibarrApi
*/ */
public function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if (!DolibarrApiAccess::$user->rights->adherent->configurer) { if (!DolibarrApiAccess::$user->hasRight('adherent', 'configurer')) {
throw new RestException(401); throw new RestException(401);
} }
@ -216,7 +216,7 @@ class MembersTypes extends DolibarrApi
*/ */
public function delete($id) public function delete($id)
{ {
if (!DolibarrApiAccess::$user->rights->adherent->configurer) { if (!DolibarrApiAccess::$user->hasRight('adherent', 'configurer')) {
throw new RestException(401); throw new RestException(401);
} }
$membertype = new AdherentType($this->db); $membertype = new AdherentType($this->db);

View File

@ -58,7 +58,7 @@ class Subscriptions extends DolibarrApi
*/ */
public function get($id) public function get($id)
{ {
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->lire) { if (!DolibarrApiAccess::$user->hasRight('adherent', 'cotisation', 'lire')) {
throw new RestException(401); throw new RestException(401);
} }
@ -91,7 +91,7 @@ class Subscriptions extends DolibarrApi
$obj_ret = array(); $obj_ret = array();
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->lire) { if (!DolibarrApiAccess::$user->hasRight('adherent', 'cotisation', 'lire')) {
throw new RestException(401); throw new RestException(401);
} }
@ -148,7 +148,7 @@ class Subscriptions extends DolibarrApi
*/ */
public function post($request_data = null) public function post($request_data = null)
{ {
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->creer) { if (!DolibarrApiAccess::$user->hasRight('adherent', 'cotisation', 'creer')) {
throw new RestException(401); throw new RestException(401);
} }
// Check mandatory fields // Check mandatory fields
@ -206,7 +206,7 @@ class Subscriptions extends DolibarrApi
public function delete($id) public function delete($id)
{ {
// The right to delete a subscription comes with the right to create one. // The right to delete a subscription comes with the right to create one.
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->creer) { if (!DolibarrApiAccess::$user->hasRight('adherent', 'cotisation', 'creer')) {
throw new RestException(401); throw new RestException(401);
} }
$subscription = new Subscription($this->db); $subscription = new Subscription($this->db);

View File

@ -505,4 +505,37 @@ class Subscription extends CommonObject
dol_print_error($this->db); dol_print_error($this->db);
} }
} }
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @param array $arraydata Array of data
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '', $arraydata = null)
{
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(property_exists($this, 'fk_adherent')? $this->fk_adherent: $this->ref ).'</span>';
if (property_exists($this, 'dateh') || property_exists($this, 'datef')) {
$return .= '<br><span class="info-box-status opacitymedium">'.dol_print_date($this->dateh, 'day').' - '.dol_print_date($this->datef, 'day').'</span>';
}
if (property_exists($this, 'fk_bank')) {
$return .= '<br><span class="info-box-label ">'.$this->fk_bank.'</span>';
}
if (property_exists($this, 'amount')) {
$return .= '<br><div class="info-box-label margintoponly amount">'.price($this->amount).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
} }

View File

@ -80,7 +80,7 @@ if ($id > 0 || !empty($ref)) {
// Define variables to know what current user can do on properties of user linked to edited member // Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id) { if ($object->user_id) {
// $User is the user who edits, $object->user_id is the id of the related user in the edited member // $User is the user who edits, $object->user_id is the id of the related user in the edited member
$caneditfielduser = ((($user->id == $object->user_id) && $$user->hasRight('user', 'self', 'creer')) $caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'creer'))
|| (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer'))); || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer')));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'password')) $caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'password'))
|| (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password'))); || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password')));

View File

@ -37,7 +37,7 @@ $sortorder = GETPOST('sortorder', 'aZ09');
if (!isModEnabled('adherent')) { if (!isModEnabled('adherent')) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->adherent->export)) { if (!$user->hasRight('adherent', 'export')) {
accessforbidden(); accessforbidden();
} }

View File

@ -51,14 +51,14 @@ if ($id > 0 || !empty($ref)) {
$result = $object->fetch($id, $ref); $result = $object->fetch($id, $ref);
// Define variables to know what current user can do on users // Define variables to know what current user can do on users
$canadduser = (!empty($user->admin) || !empty($user->rights->user->user->creer)); $canadduser = (!empty($user->admin) || $user->hasRight('user', 'user', 'creer'));
// Define variables to know what current user can do on properties of user linked to edited member // Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id) { if ($object->user_id) {
// $User is the user who edits, $object->user_id is the id of the related user in the edited member // $User is the user who edits, $object->user_id is the id of the related user in the edited member
$caneditfielduser = ((($user->id == $object->user_id) && !empty($user->rights->user->self->creer)) $caneditfielduser = ((($user->id == $object->user_id) && !empty($user->rights->user->self->creer))
|| (($user->id != $object->user_id) && !empty($user->rights->user->user->creer))); || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer')));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password) $caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|| (($user->id != $object->user_id) && !empty($user->rights->user->user->password))); || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password')));
} }
} }

View File

@ -30,9 +30,9 @@
// Load Dolibarr environment // Load Dolibarr environment
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@ -45,9 +45,12 @@ $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int'); $show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$optioncss = GETPOST('optioncss', 'aZ');
$mode = GETPOST('mode', 'alpha');
// Search fields // Search fields
$search = GETPOST("search", 'alpha'); $search = GETPOST("search", 'alpha');
@ -61,7 +64,7 @@ $search_login = GETPOST("search_login", 'alpha');
$search_address = GETPOST("search_address", 'alpha'); $search_address = GETPOST("search_address", 'alpha');
$search_zip = GETPOST("search_zip", 'alpha'); $search_zip = GETPOST("search_zip", 'alpha');
$search_town = GETPOST("search_town", 'alpha'); $search_town = GETPOST("search_town", 'alpha');
$search_state = GETPOST("search_state", 'alpha'); $search_state = GETPOST("search_state", 'alpha'); // county / departement / federal state
$search_country = GETPOST("search_country", 'alpha'); $search_country = GETPOST("search_country", 'alpha');
$search_phone = GETPOST("search_phone", 'alpha'); $search_phone = GETPOST("search_phone", 'alpha');
$search_phone_perso = GETPOST("search_phone_perso", 'alpha'); $search_phone_perso = GETPOST("search_phone_perso", 'alpha');
@ -69,18 +72,20 @@ $search_phone_mobile = GETPOST("search_phone_mobile", 'alpha');
$search_type = GETPOST("search_type", 'alpha'); $search_type = GETPOST("search_type", 'alpha');
$search_email = GETPOST("search_email", 'alpha'); $search_email = GETPOST("search_email", 'alpha');
$search_categ = GETPOST("search_categ", 'int'); $search_categ = GETPOST("search_categ", 'int');
$search_filter = GETPOST("search_filter", 'alpha');
$search_status = GETPOST("search_status", 'intcomma');
$search_morphy = GETPOST("search_morphy", 'alpha'); $search_morphy = GETPOST("search_morphy", 'alpha');
$search_import_key = trim(GETPOST("search_import_key", "alpha")); $search_import_key = trim(GETPOST("search_import_key", 'alpha'));
$catid = GETPOST("catid", 'int'); $catid = GETPOST("catid", 'int');
$optioncss = GETPOST('optioncss', 'alpha');
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
$search_filter = GETPOST("search_filter", 'alpha');
$search_status = GETPOST("search_status", 'intcomma'); // statut
$filter = GETPOST("filter", 'alpha'); $filter = GETPOST("filter", 'alpha');
if ($filter) { if ($filter) {
$search_filter = $filter; // For backward compatibility $search_filter = $filter; // For backward compatibility
} }
$statut = GETPOST("statut", 'alpha'); $statut = GETPOST("statut", 'alpha');
if ($statut != '') { if ($statut != '') {
$search_status = $statut; // For backward compatibility $search_status = $statut; // For backward compatibility
@ -92,6 +97,7 @@ if ($search_status < -2) {
$search_status = ''; $search_status = '';
} }
// Pagination parameters
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma');
@ -126,7 +132,6 @@ $fieldstosearchall = array(
'd.login'=>'Login', 'd.login'=>'Login',
'd.lastname'=>'Lastname', 'd.lastname'=>'Lastname',
'd.firstname'=>'Firstname', 'd.firstname'=>'Firstname',
'd.login'=>'Login',
'd.societe'=>"Company", 'd.societe'=>"Company",
'd.email'=>'EMail', 'd.email'=>'EMail',
'd.address'=>'Address', 'd.address'=>'Address',
@ -141,6 +146,7 @@ $fieldstosearchall = array(
if ($db->type == 'pgsql') { if ($db->type == 'pgsql') {
unset($fieldstosearchall['d.rowid']); unset($fieldstosearchall['d.rowid']);
} }
$arrayfields = array( $arrayfields = array(
'd.ref'=>array('label'=>"Ref", 'checked'=>1), 'd.ref'=>array('label'=>"Ref", 'checked'=>1),
'd.civility'=>array('label'=>"Civility", 'checked'=>0), 'd.civility'=>array('label'=>"Civility", 'checked'=>0),
@ -169,6 +175,7 @@ $arrayfields = array(
'd.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), 'd.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
'd.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100), 'd.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100),
); );
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@ -262,7 +269,7 @@ if (empty($reshook)) {
} }
// Create external user // Create external user
if ($massaction == 'createexternaluser' && $user->hasRight('adherent', 'creer') && $user->rights->user->user->creer) { if ($massaction == 'createexternaluser' && $user->hasRight('adherent', 'creer') && $user->hasRight('user', 'user', 'creer')) {
$tmpmember = new Adherent($db); $tmpmember = new Adherent($db);
$error = 0; $error = 0;
$nbcreated = 0; $nbcreated = 0;
@ -317,7 +324,11 @@ $formother = new FormOther($db);
$membertypestatic = new AdherentType($db); $membertypestatic = new AdherentType($db);
$memberstatic = new Adherent($db); $memberstatic = new Adherent($db);
$title = $langs->trans("Members"); // Page Header
$title = $langs->trans("Members")." - ".$langs->trans("List");;
$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder';
llxHeader('', $title, $help_url);
$now = dol_now(); $now = dol_now();
@ -335,12 +346,14 @@ $sql .= " s.nom,";
$sql .= " ".$db->ifsql("d.societe IS NULL", "s.nom", "d.societe")." as companyname,"; $sql .= " ".$db->ifsql("d.societe IS NULL", "s.nom", "d.societe")." as companyname,";
$sql .= " t.libelle as type, t.subscription,"; $sql .= " t.libelle as type, t.subscription,";
$sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " state.code_departement as state_code, state.nom as state_name,";
// Add fields from extrafields // Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) { if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key." as options_".$key.', ' : ''); $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key." as options_".$key.', ' : '');
} }
} }
// Add fields from hooks // Add fields from hooks
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
@ -349,13 +362,16 @@ $sql = preg_replace('/,\s*$/', '', $sql);
$sqlfields = $sql; // $sql fields to remove for count total $sqlfields = $sql; // $sql fields to remove for count total
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; // SQL Aliase adherent
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; // maybe better to use ad (adh) instead od d
if (!empty($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { if (!empty($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)";
} }
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = d.country)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = d.country)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = d.state_id)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = d.state_id)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on (s.rowid = d.fk_soc)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on (s.rowid = d.fk_soc)";
// SQL Aliase adherent_type
$sql .= ", ".MAIN_DB_PREFIX."adherent_type as t"; $sql .= ", ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE d.fk_adherent_type = t.rowid"; $sql .= " WHERE d.fk_adherent_type = t.rowid";
@ -525,8 +541,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
exit; exit;
} }
$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
llxHeader('', $title, $help_url);
if ($search_type > 0) { if ($search_type > 0) {
$membertype = new AdherentType($db); $membertype = new AdherentType($db);
@ -534,7 +548,11 @@ if ($search_type > 0) {
$title .= " (".$membertype->label.")"; $title .= " (".$membertype->label.")";
} }
// $parameters
$param = ''; $param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
@ -610,6 +628,7 @@ if ($search_type > 0) {
if ($optioncss != '') { if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss); $param .= '&optioncss='.urlencode($optioncss);
} }
// Add $param from extra fields // Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@ -636,6 +655,8 @@ if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'pr
$massactionbutton = $form->selectMassAction('', $arrayofmassactions); $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$newcardbutton = ''; $newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
if ($user->hasRight('adherent', 'creer')) { if ($user->hasRight('adherent', 'creer')) {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create'); $newcardbutton .= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create');
} }
@ -650,6 +671,8 @@ print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -698,6 +721,7 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
// Line for filters fields // Line for filters fields
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
// Action column // Action column
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="liste_titre middle">'; print '<td class="liste_titre middle">';
@ -705,6 +729,7 @@ if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
} }
// Line numbering // Line numbering
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
@ -716,32 +741,45 @@ if (!empty($arrayfields['d.ref']['checked'])) {
print '<input class="flat maxwidth75imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">'; print '<input class="flat maxwidth75imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>'; print '</td>';
} }
// Civility
if (!empty($arrayfields['d.civility']['checked'])) { if (!empty($arrayfields['d.civility']['checked'])) {
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth50imp" type="text" name="search_civility" value="'.dol_escape_htmltag($search_civility).'"></td>'; print '<input class="flat maxwidth50imp" type="text" name="search_civility" value="'.dol_escape_htmltag($search_civility).'"></td>';
} }
// First Name
if (!empty($arrayfields['d.firstname']['checked'])) { if (!empty($arrayfields['d.firstname']['checked'])) {
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'"></td>'; print '<input class="flat maxwidth75imp" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'"></td>';
} }
// Last Name
if (!empty($arrayfields['d.lastname']['checked'])) { if (!empty($arrayfields['d.lastname']['checked'])) {
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>'; print '<input class="flat maxwidth75imp" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>';
} }
// Gender
if (!empty($arrayfields['d.gender']['checked'])) { if (!empty($arrayfields['d.gender']['checked'])) {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"), 'other'=>$langs->trans("Genderother")); $arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"), 'other'=>$langs->trans("Genderother"));
print $form->selectarray('search_gender', $arraygender, $search_gender, 1); print $form->selectarray('search_gender', $arraygender, $search_gender, 1);
print '</td>'; print '</td>';
} }
// Company
if (!empty($arrayfields['d.company']['checked'])) { if (!empty($arrayfields['d.company']['checked'])) {
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).'"></td>'; print '<input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).'"></td>';
} }
// Login
if (!empty($arrayfields['d.login']['checked'])) { if (!empty($arrayfields['d.login']['checked'])) {
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>'; print '<input class="flat maxwidth75imp" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>';
} }
// Nature // Nature
if (!empty($arrayfields['d.morphy']['checked'])) { if (!empty($arrayfields['d.morphy']['checked'])) {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
@ -749,6 +787,8 @@ if (!empty($arrayfields['d.morphy']['checked'])) {
print $form->selectarray('search_morphy', $arraymorphy, $search_morphy, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100'); print $form->selectarray('search_morphy', $arraymorphy, $search_morphy, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
print '</td>'; print '</td>';
} }
// Member Type
if (!empty($arrayfields['t.libelle']['checked'])) { if (!empty($arrayfields['t.libelle']['checked'])) {
print '</td>'; print '</td>';
} }
@ -759,51 +799,62 @@ if (!empty($arrayfields['t.libelle']['checked'])) {
print '</td>'; print '</td>';
} }
// Address - Street
if (!empty($arrayfields['d.address']['checked'])) { if (!empty($arrayfields['d.address']['checked'])) {
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).'"></td>'; print '<input class="flat maxwidth75imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).'"></td>';
} }
// ZIP
if (!empty($arrayfields['d.zip']['checked'])) { if (!empty($arrayfields['d.zip']['checked'])) {
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).'"></td>'; print '<input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).'"></td>';
} }
// Town/City
if (!empty($arrayfields['d.town']['checked'])) { if (!empty($arrayfields['d.town']['checked'])) {
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'"></td>'; print '<input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'"></td>';
} }
// State
// State / County / Departement
if (!empty($arrayfields['state.nom']['checked'])) { if (!empty($arrayfields['state.nom']['checked'])) {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat searchstring maxwidth75imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">'; print '<input class="flat searchstring maxwidth75imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
print '</td>'; print '</td>';
} }
// Country // Country
if (!empty($arrayfields['country.code_iso']['checked'])) { if (!empty($arrayfields['country.code_iso']['checked'])) {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100'); print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
print '</td>'; print '</td>';
} }
// Phone pro // Phone pro
if (!empty($arrayfields['d.phone']['checked'])) { if (!empty($arrayfields['d.phone']['checked'])) {
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).'"></td>'; print '<input class="flat maxwidth75imp" type="text" name="search_phone" value="'.dol_escape_htmltag($search_phone).'"></td>';
} }
// Phone perso // Phone perso
if (!empty($arrayfields['d.phone_perso']['checked'])) { if (!empty($arrayfields['d.phone_perso']['checked'])) {
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth50" type="text" name="search_phone_perso" value="'.dol_escape_htmltag($search_phone_perso).'"></td>'; print '<input class="flat maxwidth75imp" type="text" name="search_phone_perso" value="'.dol_escape_htmltag($search_phone_perso).'"></td>';
} }
// Phone mobile // Phone mobile
if (!empty($arrayfields['d.phone_mobile']['checked'])) { if (!empty($arrayfields['d.phone_mobile']['checked'])) {
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_phone_mobile" value="'.dol_escape_htmltag($search_phone_mobile).'"></td>'; print '<input class="flat maxwidth75imp" type="text" name="search_phone_mobile" value="'.dol_escape_htmltag($search_phone_mobile).'"></td>';
} }
// Email // Email
if (!empty($arrayfields['d.email']['checked'])) { if (!empty($arrayfields['d.email']['checked'])) {
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth75imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'"></td>'; print '<input class="flat maxwidth75imp" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'"></td>';
} }
// End of subscription date // End of subscription date
if (!empty($arrayfields['d.datefin']['checked'])) { if (!empty($arrayfields['d.datefin']['checked'])) {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
@ -812,6 +863,7 @@ if (!empty($arrayfields['d.datefin']['checked'])) {
print $form->selectarray('search_filter', $selectarray, $search_filter); print $form->selectarray('search_filter', $selectarray, $search_filter);
print '</td>'; print '</td>';
} }
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
@ -819,38 +871,45 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
$parameters = array('arrayfields'=>$arrayfields); $parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Date creation // Date creation
if (!empty($arrayfields['d.datec']['checked'])) { if (!empty($arrayfields['d.datec']['checked'])) {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '</td>'; print '</td>';
} }
// Birthday // Birthday
if (!empty($arrayfields['d.birth']['checked'])) { if (!empty($arrayfields['d.birth']['checked'])) {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '</td>'; print '</td>';
} }
// Date modification // Date modification
if (!empty($arrayfields['d.tms']['checked'])) { if (!empty($arrayfields['d.tms']['checked'])) {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '</td>'; print '</td>';
} }
// Status // Status
if (!empty($arrayfields['d.statut']['checked'])) { if (!empty($arrayfields['d.statut']['checked'])) {
print '<td class="liste_titre right maxwidthonsmartphone">'; print '<td class="liste_titre right parentonrightofpage">';
$liststatus = array( $liststatus = array(
Adherent::STATUS_DRAFT => $langs->trans("Draft"), Adherent::STATUS_DRAFT => $langs->trans("Draft"),
Adherent::STATUS_VALIDATED => $langs->trans("Validated"), Adherent::STATUS_VALIDATED => $langs->trans("Validated"),
Adherent::STATUS_RESILIATED => $langs->trans("MemberStatusResiliatedShort"), Adherent::STATUS_RESILIATED => $langs->trans("MemberStatusResiliatedShort"),
Adherent::STATUS_EXCLUDED =>$langs->trans("MemberStatusExcludedShort") Adherent::STATUS_EXCLUDED =>$langs->trans("MemberStatusExcludedShort")
); );
print $form->selectarray('search_status', $liststatus, $search_status, -3, 0, 0, '', 0, 0, 0, '', 'onrightofpage'); print $form->selectarray('search_status', $liststatus, $search_status, -3, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage');
print '</td>'; print '</td>';
} }
// Import Key
if (!empty($arrayfields['d.import_key']['checked'])) { if (!empty($arrayfields['d.import_key']['checked'])) {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print '<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).'">'; print '<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).'">';
print '</td>'; print '</td>';
} }
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
// Action column // Action column
print '<td class="liste_titre middle">'; print '<td class="liste_titre middle">';
@ -931,6 +990,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (!empty($arrayfields['d.datec']['checked'])) { if (!empty($arrayfields['d.datec']['checked'])) {
print_liste_field_titre($arrayfields['d.datec']['label'], $_SERVER["PHP_SELF"], "d.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); print_liste_field_titre($arrayfields['d.datec']['label'], $_SERVER["PHP_SELF"], "d.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
} }
@ -988,6 +1048,22 @@ while ($i < min($num, $limit)) {
} }
$memberstatic->company = $companyname; $memberstatic->company = $companyname;
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
$membertypestatic->id = $obj->type_id;
$membertypestatic->label = $obj->type;
$memberstatic->type = $membertypestatic->label;
$memberstatic->photo = $obj->photo;
// Output Kanban
print $memberstatic->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Action column // Action column
@ -1002,14 +1078,13 @@ while ($i < min($num, $limit)) {
} }
print '</td>'; print '</td>';
} }
// Technical ID
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
print '<td class="center" data-key="id">'.$obj->rowid.'</td>'; print '<td class="center" data-key="id">'.$obj->rowid.'</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Ref // Ref
if (!empty($arrayfields['d.ref']['checked'])) { if (!empty($arrayfields['d.ref']['checked'])) {
print "<td>"; print "<td>";
@ -1119,7 +1194,7 @@ while ($i < min($num, $limit)) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// State // State / County / Departement
if (!empty($arrayfields['state.nom']['checked'])) { if (!empty($arrayfields['state.nom']['checked'])) {
print "<td>".$obj->state_name."</td>\n"; print "<td>".$obj->state_name."</td>\n";
if (!$i) { if (!$i) {
@ -1258,6 +1333,7 @@ while ($i < min($num, $limit)) {
} }
print '</tr>'."\n"; print '</tr>'."\n";
}
$i++; $i++;
} }

View File

@ -76,12 +76,12 @@ foreach ($object->fields as $key => $val) {
// Load object // Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
$permissiontoread = $user->rights->partnership->read; $permissiontoread = $user->hasRight('partnership', 'read');
$permissiontoadd = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontoadd = $user->hasRight('partnership', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->partnership->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); $permissiontodelete = $user->hasRight('partnership', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$permissionnote = $user->rights->partnership->write; // Used by the include of actions_setnotes.inc.php $permissionnote = $user->hasRight('partnership', 'write'); // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->partnership->write; // Used by the include of actions_dellink.inc.php $permissiondellink = $user->hasRight('partnership', 'write'); // Used by the include of actions_dellink.inc.php
$usercanclose = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $usercanclose = $user->hasRight('partnership', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1]; $upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1];

View File

@ -151,9 +151,9 @@ if (empty($reshook) && $action == 'confirm_create_thirdparty' && $confirm == 'ye
} }
} }
if (empty($reshook) && $action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer)) { if (empty($reshook) && $action == 'setuserid' && ($user->rights->user->self->creer || $user->hasRight('user', 'user', 'creer'))) {
$error = 0; $error = 0;
if (empty($user->rights->user->user->creer)) { // If can edit only itself user, we can link to itself only if (!$user->hasRight('user', 'user', 'creer')) { // If can edit only itself user, we can link to itself only
if (GETPOST("userid", 'int') != $user->id && GETPOST("userid", 'int') != $object->user_id) { if (GETPOST("userid", 'int') != $user->id && GETPOST("userid", 'int') != $object->user_id) {
$error++; $error++;
setEventMessages($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), null, 'errors'); setEventMessages($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), null, 'errors');
@ -201,7 +201,7 @@ if (empty($reshook) && $action == 'setsocid') {
} }
} }
if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !$cancel) { if ($user->hasRight('adherent', 'cotisation', 'creer') && $action == 'subscription' && !$cancel) {
$error = 0; $error = 0;
$langs->load("banks"); $langs->load("banks");
@ -674,7 +674,7 @@ if ($rowid > 0) {
*/ */
// Button to create a new subscription if member no draft (-1) neither resiliated (0) neither excluded (-2) // Button to create a new subscription if member no draft (-1) neither resiliated (0) neither excluded (-2)
if ($user->rights->adherent->cotisation->creer) { if ($user->hasRight('adherent', 'cotisation', 'creer')) {
if ($action != 'addsubscription' && $action != 'create_thirdparty') { if ($action != 'addsubscription' && $action != 'create_thirdparty') {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
@ -814,7 +814,7 @@ if ($rowid > 0) {
/* /*
* Add new subscription form * Add new subscription form
*/ */
if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->rights->adherent->cotisation->creer) { if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->hasRight('adherent', 'cotisation', 'creer')) {
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("NewCotisation")); print load_fiche_titre($langs->trans("NewCotisation"));
@ -1142,7 +1142,7 @@ if ($rowid > 0) {
$tmp = '<input name="sendmail" type="checkbox"'.(GETPOST('sendmail', 'alpha') ? ' checked' : (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? ' checked' : '')).'>'; $tmp = '<input name="sendmail" type="checkbox"'.(GETPOST('sendmail', 'alpha') ? ' checked' : (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? ' checked' : '')).'>';
$helpcontent = ''; $helpcontent = '';
$helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n"; $helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.getDolGlobalString('ADHERENT_MAIL_FROM').'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n"; $helpcontent .= '<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("MailTopic").'</b>:<br>'."\n"; $helpcontent .= '<b>'.$langs->trans("MailTopic").'</b>:<br>'."\n";
if ($subjecttosend) { if ($subjecttosend) {

View File

@ -49,13 +49,13 @@ $note = GETPOST('note', 'alpha');
$typeid = (int) GETPOST('typeid', 'int'); $typeid = (int) GETPOST('typeid', 'int');
$amount = price2num(GETPOST('amount', 'alpha'), 'MT'); $amount = price2num(GETPOST('amount', 'alpha'), 'MT');
if (empty($user->rights->adherent->cotisation->lire)) { if (!$user->hasRight('adherent', 'cotisation', 'lire')) {
accessforbidden(); accessforbidden();
} }
$permissionnote = $user->rights->adherent->cotisation->creer; // Used by the include of actions_setnotes.inc.php $permissionnote = $user->hasRight('adherent', 'cotisation', 'creer'); // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->adherent->cotisation->creer; // Used by the include of actions_dellink.inc.php $permissiondellink = $user->hasRight('adherent', 'cotisation', 'creer'); // Used by the include of actions_dellink.inc.php
$permissiontoedit = $user->rights->adherent->cotisation->creer; // Used by the include of actions_lineupdonw.inc.php $permissiontoedit = $user->hasRight('adherent', 'cotisation', 'creer'); // Used by the include of actions_lineupdonw.inc.php
$hookmanager->initHooks(array('subscriptioncard', 'globalcard')); $hookmanager->initHooks(array('subscriptioncard', 'globalcard'));
@ -78,7 +78,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, n
//include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cancel) { if ($user->hasRight('adherent', 'cotisation', 'creer') && $action == 'update' && !$cancel) {
// Load current object // Load current object
$result = $object->fetch($rowid); $result = $object->fetch($rowid);
if ($result > 0) { if ($result > 0) {
@ -109,8 +109,9 @@ if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cance
$object->dateh = dol_mktime(GETPOST('datesubhour', 'int'), GETPOST('datesubmin', 'int'), 0, GETPOST('datesubmonth', 'int'), GETPOST('datesubday', 'int'), GETPOST('datesubyear', 'int')); $object->dateh = dol_mktime(GETPOST('datesubhour', 'int'), GETPOST('datesubmin', 'int'), 0, GETPOST('datesubmonth', 'int'), GETPOST('datesubday', 'int'), GETPOST('datesubyear', 'int'));
$object->datef = dol_mktime(GETPOST('datesubendhour', 'int'), GETPOST('datesubendmin', 'int'), 0, GETPOST('datesubendmonth', 'int'), GETPOST('datesubendday', 'int'), GETPOST('datesubendyear', 'int')); $object->datef = dol_mktime(GETPOST('datesubendhour', 'int'), GETPOST('datesubendmin', 'int'), 0, GETPOST('datesubendmonth', 'int'), GETPOST('datesubendday', 'int'), GETPOST('datesubendyear', 'int'));
$object->fk_type = $typeid; $object->fk_type = $typeid;
$object->note = $note; $object->note_public = $note;
$object->note_private = $note; $object->note_private = $note;
$object->amount = $amount; $object->amount = $amount;
$result = $object->update($user); $result = $object->update($user);
@ -140,7 +141,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cance
} }
} }
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->adherent->cotisation->creer) { if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('adherent', 'cotisation', 'creer')) {
$result = $object->fetch($rowid); $result = $object->fetch($rowid);
$result = $object->delete($user); $result = $object->delete($user);
if ($result > 0) { if ($result > 0) {
@ -166,7 +167,7 @@ llxHeader('', $langs->trans("SubscriptionCard"), $help_url);
dol_htmloutput_errors($errmsg); dol_htmloutput_errors($errmsg);
if ($user->rights->adherent->cotisation->creer && $action == 'edit') { if ($user->hasRight('adherent', 'cotisation', 'creer') && $action == 'edit') {
/******************************************** /********************************************
* *
* Subscription card in edit mode * Subscription card in edit mode
@ -350,7 +351,7 @@ if ($rowid && $action != 'edit') {
*/ */
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($user->rights->adherent->cotisation->creer) { if ($user->hasRight('adherent', 'cotisation', 'creer')) {
if (!empty($bankline->rappro)) { if (!empty($bankline->rappro)) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?rowid=".$object->id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify")."</a></div>"; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?rowid=".$object->id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify")."</a></div>";
} else { } else {
@ -359,7 +360,7 @@ if ($rowid && $action != 'edit') {
} }
// Delete // Delete
if ($user->rights->adherent->cotisation->creer) { if ($user->hasRight('adherent', 'cotisation', 'creer')) {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"]."?rowid=".$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete")."</a></div>\n"; print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"]."?rowid=".$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete")."</a></div>\n";
} }

View File

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("companies", "members", "bills", "users")); $langs->loadLangs(array("companies", "members", "bills", "users"));
if (empty($user->rights->adherent->lire)) { if (!$user->hasRight('adherent', 'lire')) {
accessforbidden(); accessforbidden();
} }

View File

@ -37,6 +37,8 @@ $massaction = GETPOST('massaction', 'alpha');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'subscriptionlist'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'subscriptionlist'; // To manage different context of search
$mode = GETPOST('mode', 'alpha');
$statut = (GETPOSTISSET("statut") ?GETPOST("statut", "alpha") : 1); $statut = (GETPOSTISSET("statut") ?GETPOST("statut", "alpha") : 1);
$search_ref = GETPOST('search_ref', 'alpha'); $search_ref = GETPOST('search_ref', 'alpha');
@ -242,17 +244,20 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
exit; exit;
} }
$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros'; $title = $langs->trans("Subscriptions");
llxHeader('', $langs->trans("ListOfSubscriptions"), $help_url);
$i = 0;
$title = $langs->trans("ListOfSubscriptions");
if (!empty($date_select)) { if (!empty($date_select)) {
$title .= ' ('.$langs->trans("Year").' '.$date_select.')'; $title .= ' ('.$langs->trans("Year").' '.$date_select.')';
} }
$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
llxHeader('', $title, $help_url);
$i = 0;
$param = ''; $param = '';
if (!empty($mode)) {
$param .='&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
@ -291,14 +296,17 @@ $arrayofmassactions = array(
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
); );
//if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); //if ($user->hasRight('adherent', 'supprimer')) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
if (in_array($massaction, array('presend', 'predelete'))) { if (in_array($massaction, array('presend', 'predelete'))) {
$arrayofmassactions = array(); $arrayofmassactions = array();
} }
$massactionbutton = $form->selectMassAction('', $arrayofmassactions); $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$newcardbutton = ''; $newcardbutton = '';
if ($user->rights->adherent->cotisation->creer) { $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
if ($user->hasRight('adherent', 'cotisation', 'creer')) {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewSubscription'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/list.php?status=-1,1'); $newcardbutton .= dolGetButtonTitle($langs->trans('NewSubscription'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/list.php?status=-1,1');
} }
@ -313,6 +321,8 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="date_select" value="'.$date_select.'">'; print '<input type="hidden" name="date_select" value="'.$date_select.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $subscription->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $subscription->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -507,6 +517,28 @@ while ($i < min($num, $limit)) {
$adherent->need_subscription = $adht->subscription; $adherent->need_subscription = $adht->subscription;
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
//fetch informations needs on this mode
$subscription->fk_adherent = $adherent->getNomUrl(1);
$subscription->fk_type = $adht->getNomUrl(1);
$subscription->amount = $obj->subscription;
if ($obj->fk_account > 0) {
$accountstatic->id = $obj->fk_account;
$accountstatic->fetch($obj->fk_account);
$subscription->fk_bank = $accountstatic->getNomUrl(1);
}
// Output Kanban
print $subscription->getKanbanView('');
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Ref // Ref
@ -644,6 +676,7 @@ while ($i < min($num, $limit)) {
} }
print "</tr>\n"; print "</tr>\n";
}
$i++; $i++;
} }

View File

@ -39,7 +39,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
echo '<td class="center"></td>'; echo '<td class="center"></td>';
echo '<td class="center">'.dol_print_date($objectlink->dateh, 'day').'</td>'; echo '<td class="center">'.dol_print_date($objectlink->dateh, 'day').'</td>';
echo '<td class="right">'; echo '<td class="right">';
if ($user->rights->adherent->lire) { if ($user->hasRight('adherent', 'lire')) {
$total = $total + $objectlink->amount; $total = $total + $objectlink->amount;
echo price($objectlink->amount); echo price($objectlink->amount);
} }

View File

@ -44,6 +44,7 @@ $action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$mode = GETPOST('mode', 'alopha');
$sall = GETPOST("sall", "alpha"); $sall = GETPOST("sall", "alpha");
$filter = GETPOST("filter", 'alpha'); $filter = GETPOST("filter", 'alpha');
@ -171,7 +172,7 @@ if ($action == 'add' && $user->hasRight('adherent', 'configurer')) {
} }
} }
if ($action == 'update' && $user->rights->adherent->configurer) { if ($action == 'update' && $user->hasRight('adherent', 'configurer')) {
$object->fetch($rowid); $object->fetch($rowid);
$object->oldcopy = dol_clone($object); $object->oldcopy = dol_clone($object);
@ -207,7 +208,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) {
exit; exit;
} }
if ($action == 'confirm_delete' && !empty($user->rights->adherent->configurer)) { if ($action == 'confirm_delete' && $user->hasRight('adherent', 'configurer')) {
$object->fetch($rowid); $object->fetch($rowid);
$res = $object->delete(); $res = $object->delete();
@ -249,6 +250,9 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
$i = 0; $i = 0;
$param = ''; $param = '';
if (!empty($mode)) {
$param .= '&mode'.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.$contextpage; $param .= '&contextpage='.$contextpage;
} }
@ -257,7 +261,11 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
} }
$newcardbutton = ''; $newcardbutton = '';
if ($user->rights->adherent->configurer) {
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
if ($user->hasRight('adherent', 'configurer')) {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create'); $newcardbutton .= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create');
} }
@ -270,6 +278,8 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -292,7 +302,13 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
$membertype = new AdherentType($db); $membertype = new AdherentType($db);
while ($i < $num) { $i = 0;
/*$savnbfield = $totalarray['nbfield'];
$totalarray = array();
$totalarray['nbfield'] = 0;*/
$imaxinloop = ($limit ? min($num, $limit) : $num);
while ($i < $imaxinloop) {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$membertype->id = $objp->rowid; $membertype->id = $objp->rowid;
@ -303,6 +319,19 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
$membertype->amount = $objp->amount; $membertype->amount = $objp->amount;
$membertype->caneditamount = $objp->caneditamount; $membertype->caneditamount = $objp->caneditamount;
if ($mode == 'kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
}
//output kanban
$membertype->label = $objp->label;
print $membertype->getKanbanView('');
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowraponall">'; print '<td class="nowraponall">';
print $membertype->getNomUrl(1); print $membertype->getNomUrl(1);
@ -329,6 +358,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
} }
print "</tr>"; print "</tr>";
}
$i++; $i++;
} }

View File

@ -71,7 +71,7 @@ if ($action == 'delete' && GETPOST('langtodelete', 'alpha')) {
} }
// Add translation // Add translation
if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer) { if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->hasRight('adherent', 'configurer')) {
$object = new AdherentType($db); $object = new AdherentType($db);
$object->fetch($id); $object->fetch($id);
$current_lang = $langs->getDefaultLang(); $current_lang = $langs->getDefaultLang();
@ -99,7 +99,7 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->ad
} }
// Edit translation // Edit translation
if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer) { if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->hasRight('adherent', 'configurer')) {
$object = new AdherentType($db); $object = new AdherentType($db);
$object->fetch($id); $object->fetch($id);
$current_lang = $langs->getDefaultLang(); $current_lang = $langs->getDefaultLang();
@ -125,7 +125,7 @@ if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->rights->a
} }
// Delete translation // Delete translation
if ($action == 'vdelete' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer) { if ($action == 'vdelete' && $cancel != $langs->trans("Cancel") && $user->hasRight('adherent', 'configurer')) {
$object = new AdherentType($db); $object = new AdherentType($db);
$object->fetch($id); $object->fetch($id);
$langtodelete = GETPOST('langdel', 'alpha'); $langtodelete = GETPOST('langdel', 'alpha');

View File

@ -42,14 +42,14 @@ if ($id > 0 || !empty($ref)) {
$result = $object->fetch($id, $ref); $result = $object->fetch($id, $ref);
// Define variables to know what current user can do on users // Define variables to know what current user can do on users
$canadduser = ($user->admin || $user->rights->user->user->creer); $canadduser = ($user->admin || $user->hasRight('user', 'user', 'creer'));
// Define variables to know what current user can do on properties of user linked to edited member // Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id) { if ($object->user_id) {
// $User is the user who edits, $object->user_id is the id of the related user in the edited member // $User is the user who edits, $object->user_id is the id of the related user in the edited member
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer) $caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'creer'))
|| (($user->id != $object->user_id) && $user->rights->user->user->creer)); || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer')));
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password) $caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'password'))
|| (($user->id != $object->user_id) && $user->rights->user->user->password)); || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password')));
} }
} }
@ -122,7 +122,11 @@ if ($company->id) {
} elseif (empty(trim($object->email))) { } elseif (empty(trim($object->email))) {
// when adherent e-mail is empty, use only company e-mail // when adherent e-mail is empty, use only company e-mail
$v->setEmail($company->email); $v->setEmail($company->email);
} elseif (strtolower(end(explode("@", $object->email))) == strtolower(end(explode("@", $company->email)))) { } else {
$tmpobject = explode("@", trim($object->email));
$tmpcompany = explode("@", trim($company->email));
if (strtolower(end($tmpobject)) == strtolower(end($tmpcompany))) {
// when e-mail domain of adherent and company are the same, use adherent e-mail at first (and company e-mail at second) // when e-mail domain of adherent and company are the same, use adherent e-mail at first (and company e-mail at second)
$v->setEmail($object->email); $v->setEmail($object->email);
@ -135,6 +139,7 @@ if ($company->id) {
// support by Microsoft Outlook (2019 and possible earlier) // support by Microsoft Outlook (2019 and possible earlier)
$v->setEmail($object->email, 'INTERNET'); $v->setEmail($object->email, 'INTERNET');
} }
}
// Si adherent lie a un tiers non de type "particulier" // Si adherent lie a un tiers non de type "particulier"
if ($company->typent_code != 'TE_PRIVATE') { if ($company->typent_code != 'TE_PRIVATE') {

View File

@ -54,6 +54,9 @@ $type = 'action';
* Actions * Actions
*/ */
$error = 0;
$errors = array();
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
$reg = array(); $reg = array();
@ -193,10 +196,9 @@ print dol_get_fiche_head($head, 'other', $langs->trans("Agenda"), -1, 'action');
/* /*
* Documents models for supplier orders * Miscellaneous
*/ */
// Define array def of models // Define array def of models
$def = array(); $def = array();
@ -308,8 +310,11 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
} }
} }
print '</table><br>'; print '</table><br>';
print load_fiche_titre($langs->trans('MiscellaneousOptions'), '', '');
} }
print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">'; print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="set">'; print '<input type="hidden" name="action" value="set">';
@ -368,7 +373,7 @@ if (!is_array($result) && $result < 0) {
} elseif (count($result) > 0) { } elseif (count($result) > 0) {
$defval = reset($result)->value; $defval = reset($result)->value;
} }
$formactions->form_select_status_action('agenda', $defval, 1, "AGENDA_EVENT_DEFAULT_STATUS", 0, 1, 'maxwidth200'); $formactions->form_select_status_action('agenda', $defval, 1, "AGENDA_EVENT_DEFAULT_STATUS", 0, 1, 'maxwidth200 onrightofpage');
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// AGENDA_DEFAULT_FILTER_TYPE // AGENDA_DEFAULT_FILTER_TYPE
@ -395,13 +400,12 @@ print '</td></tr>'."\n";
print '</table>'; print '</table>';
print dol_get_fiche_end();
print $form->buttonsSaveCancel("Save", ''); print $form->buttonsSaveCancel("Save", '');
print '</form>'; print '</form>';
print "<br>";
print dol_get_fiche_end();
// End of page // End of page
llxFooter(); llxFooter();

View File

@ -150,7 +150,6 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_valu
print load_fiche_titre($langs->trans("AgendaSetup"), $linkback, 'title_setup'); print load_fiche_titre($langs->trans("AgendaSetup"), $linkback, 'title_setup');
$head = agenda_prepare_head(); $head = agenda_prepare_head();
print dol_get_fiche_head($head, 'reminders', $langs->trans("Agenda"), -1, 'action'); print dol_get_fiche_head($head, 'reminders', $langs->trans("Agenda"), -1, 'action');

View File

@ -52,7 +52,7 @@ if ($action == 'setbarcodeproducton') {
$barcodenumberingmodule = GETPOST('value', 'alpha'); $barcodenumberingmodule = GETPOST('value', 'alpha');
$res = dolibarr_set_const($db, "BARCODE_PRODUCT_ADDON_NUM", $barcodenumberingmodule, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BARCODE_PRODUCT_ADDON_NUM", $barcodenumberingmodule, 'chaine', 0, '', $conf->entity);
if ($barcodenumberingmodule == 'mod_barcode_product_standard' && empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK)) { if ($barcodenumberingmodule == 'mod_barcode_product_standard' && empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK)) {
$res = dolibarr_set_const($db, "BARCODE_STANDARD_PRODUCT_MASK", '020{000000000}', 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BARCODE_STANDARD_PRODUCT_MASK", '04{0000000000}', 'chaine', 0, '', $conf->entity);
} }
} elseif ($action == 'setbarcodeproductoff') { } elseif ($action == 'setbarcodeproductoff') {
$res = dolibarr_del_const($db, "BARCODE_PRODUCT_ADDON_NUM", $conf->entity); $res = dolibarr_del_const($db, "BARCODE_PRODUCT_ADDON_NUM", $conf->entity);
@ -62,7 +62,7 @@ if ($action == 'setbarcodethirdpartyon') {
$barcodenumberingmodule = GETPOST('value', 'alpha'); $barcodenumberingmodule = GETPOST('value', 'alpha');
$res = dolibarr_set_const($db, "BARCODE_THIRDPARTY_ADDON_NUM", $barcodenumberingmodule, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BARCODE_THIRDPARTY_ADDON_NUM", $barcodenumberingmodule, 'chaine', 0, '', $conf->entity);
if ($barcodenumberingmodule == 'mod_barcode_thirdparty_standard' && empty($conf->global->BARCODE_STANDARD_THIRDPARTY_MASK)) { if ($barcodenumberingmodule == 'mod_barcode_thirdparty_standard' && empty($conf->global->BARCODE_STANDARD_THIRDPARTY_MASK)) {
$res = dolibarr_set_const($db, "BARCODE_STANDARD_THIRDPARTY_MASK", '020{000000000}', 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BARCODE_STANDARD_THIRDPARTY_MASK", '04{0000000000}', 'chaine', 0, '', $conf->entity);
} }
} elseif ($action == 'setbarcodethirdpartyoff') { } elseif ($action == 'setbarcodethirdpartyoff') {
$res = dolibarr_del_const($db, "BARCODE_THIRDPARTY_ADDON_NUM", $conf->entity); $res = dolibarr_del_const($db, "BARCODE_THIRDPARTY_ADDON_NUM", $conf->entity);

View File

@ -51,10 +51,10 @@ $type = 'bom';
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask') { if ($action == 'updateMask') {
$maskconstbom = GETPOST('maskconstBom', 'alpha'); $maskconstbom = GETPOST('maskconstBom', 'aZ09');
$maskbom = GETPOST('maskBom', 'alpha'); $maskbom = GETPOST('maskBom', 'alpha');
if ($maskconstbom) { if ($maskconstbom && preg_match('/_MASK$/', $maskconstbom)) {
$res = dolibarr_set_const($db, $maskconstbom, $maskbom, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, $maskconstbom, $maskbom, 'chaine', 0, '', $conf->entity);
} }

View File

@ -54,9 +54,9 @@ if (empty($conf->global->CHEQUERECEIPTS_ADDON)) {
*/ */
if ($action == 'updateMask') { if ($action == 'updateMask') {
$maskconstchequereceipts = GETPOST('maskconstchequereceipts', 'alpha'); $maskconstchequereceipts = GETPOST('maskconstchequereceipts', 'aZ09');
$maskchequereceipts = GETPOST('maskchequereceipts', 'alpha'); $maskchequereceipts = GETPOST('maskchequereceipts', 'alpha');
if ($maskconstchequereceipts) { if ($maskconstchequereceipts && preg_match('/_MASK$/', $maskconstchequereceipts)) {
$res = dolibarr_set_const($db, $maskconstchequereceipts, $maskchequereceipts, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, $maskconstchequereceipts, $maskchequereceipts, 'chaine', 0, '', $conf->entity);
} }
@ -211,7 +211,7 @@ foreach ($dirmodels as $reldir) {
print '<td class="center">'; print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0); print $form->textwithpicto('', $htmltooltip, 1, 0);
if ($conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file) { // If module is the one used, we show existing errors if (getDolGlobalString('CHEQUERECEIPTS_ADDON').'.php' == $file) { // If module is the one used, we show existing errors
if (!empty($module->error)) { if (!empty($module->error)) {
dol_htmloutput_mesg($module->error, '', 'error', 1); dol_htmloutput_mesg($module->error, '', 'error', 1);
} }

View File

@ -61,10 +61,10 @@ $type = 'order';
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask') { if ($action == 'updateMask') {
$maskconstorder = GETPOST('maskconstorder', 'alpha'); $maskconstorder = GETPOST('maskconstorder', 'aZ09');
$maskorder = GETPOST('maskorder', 'alpha'); $maskorder = GETPOST('maskorder', 'alpha');
if ($maskconstorder) { if ($maskconstorder && preg_match('/_MASK$/', $maskconstorder)) {
$res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity);
} }
@ -117,7 +117,7 @@ if ($action == 'updateMask') {
} elseif ($action == 'del') { } elseif ($action == 'del') {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) { if ($ret > 0) {
if ($conf->global->COMMANDE_ADDON_PDF == "$value") { if (getDolGlobalString('COMMANDE_ADDON_PDF') == $value) {
dolibarr_del_const($db, 'COMMANDE_ADDON_PDF', $conf->entity); dolibarr_del_const($db, 'COMMANDE_ADDON_PDF', $conf->entity);
} }
} }
@ -461,7 +461,7 @@ foreach ($dirmodels as $reldir) {
// Default // Default
print '<td class="center">'; print '<td class="center">';
if ($conf->global->COMMANDE_ADDON_PDF == $name) { if (getDolGlobalString('COMMANDE_ADDON_PDF') == $name) {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} else { } else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';

View File

@ -195,7 +195,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
dolibarr_set_const($db, "MAIN_INFO_PROFID6", GETPOST("MAIN_INFO_PROFID6", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_PROFID6", GETPOST("MAIN_INFO_PROFID6", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT", GETPOST("object", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT", GETPOST("socialobject", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START", GETPOST("SOCIETE_FISCAL_MONTH_START", 'int'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START", GETPOST("SOCIETE_FISCAL_MONTH_START", 'int'), 'chaine', 0, '', $conf->entity);
@ -676,8 +676,8 @@ print '<input name="tva" id="intra_vat" class="minwidth200" value="'.dol_escape_
print '</td></tr>'; print '</td></tr>';
// Object of the company // Object of the company
print '<tr class="oddeven"><td><label for="object">'.$langs->trans("CompanyObject").'</label></td><td>'; print '<tr class="oddeven"><td><label for="socialobject">'.$langs->trans("CompanyObject").'</label></td><td>';
print '<textarea class="flat quatrevingtpercent" name="object" id="object" rows="'.ROWS_5.'">'.(!empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? $conf->global->MAIN_INFO_SOCIETE_OBJECT : '').'</textarea></td></tr>'; print '<textarea class="flat quatrevingtpercent" name="socialobject" id="socialobject" rows="'.ROWS_5.'">'.(!empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? $conf->global->MAIN_INFO_SOCIETE_OBJECT : '').'</textarea></td></tr>';
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';

View File

@ -84,6 +84,8 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))) {
* View * View
*/ */
$form = new Form($db);
$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; $wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
llxHeader('', $langs->trans("Setup"), $wikihelp); llxHeader('', $langs->trans("Setup"), $wikihelp);

View File

@ -58,9 +58,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
$error=0; $error=0;
if ($action == 'updateMask') { if ($action == 'updateMask') {
$maskconst = GETPOST('maskconstcontract', 'alpha'); $maskconst = GETPOST('maskconstcontract', 'aZ09');
$maskvalue = GETPOST('maskcontract', 'alpha'); $maskvalue = GETPOST('maskcontract', 'alpha');
if ($maskconst) { if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
} }

View File

@ -325,7 +325,7 @@ if (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METE
if (!empty($conf->global->MAIN_METEO_LEVEL0)) { if (!empty($conf->global->MAIN_METEO_LEVEL0)) {
$level0 = $conf->global->MAIN_METEO_LEVEL0; $level0 = $conf->global->MAIN_METEO_LEVEL0;
} }
$level1 = $offset + 1 * $cursor; $level1 = $offset + $cursor;
if (!empty($conf->global->MAIN_METEO_LEVEL1)) { if (!empty($conf->global->MAIN_METEO_LEVEL1)) {
$level1 = $conf->global->MAIN_METEO_LEVEL1; $level1 = $conf->global->MAIN_METEO_LEVEL1;
} }
@ -459,7 +459,7 @@ if ($action == 'edit') {
print '</form>'; print '</form>';
} else { } else {
print '<br><br><div class="tabsAction">'; print '<br><br><div class="tabsAction">';
print '<a class="butAction" href="delais.php?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>'; print '<a class="butAction reposition" href="delais.php?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
print '</div>'; print '</div>';
} }

View File

@ -90,9 +90,9 @@ if ($action == 'activate_delivery') {
} }
if ($action == 'updateMask') { if ($action == 'updateMask') {
$maskconstdelivery = GETPOST('maskconstdelivery', 'alpha'); $maskconstdelivery = GETPOST('maskconstdelivery', 'aZ09');
$maskdelivery = GETPOST('maskdelivery', 'alpha'); $maskdelivery = GETPOST('maskdelivery', 'alpha');
if ($maskconstdelivery) { if ($maskconstdelivery && preg_match('/_MASK$/', $maskconstdelivery)) {
$res = dolibarr_set_const($db, $maskconstdelivery, $maskdelivery, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, $maskconstdelivery, $maskdelivery, 'chaine', 0, '', $conf->entity);
} }

View File

@ -1944,7 +1944,7 @@ if ($id > 0) {
//var_dump($fieldlist); //var_dump($fieldlist);
$class = ''; $class = '';
$showfield = 1; $showfield = 1;
$valuetoshow = empty($obj->{$value}) ? '' : $obj->{$value}; $valuetoshow = empty($obj->$value) ? '' : $obj->$value;
$titletoshow = ''; $titletoshow = '';
if ($value == 'entity') { if ($value == 'entity') {
@ -1985,76 +1985,76 @@ if ($id > 0) {
} elseif ($value == 'libelle_facture') { } elseif ($value == 'libelle_facture') {
$langs->load("bills"); $langs->load("bills");
$key = $langs->trans("PaymentCondition".strtoupper($obj->code)); $key = $langs->trans("PaymentCondition".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "PaymentCondition".strtoupper($obj->code) ? $key : $obj->{$value}); $valuetoshow = ($obj->code && $key != "PaymentCondition".strtoupper($obj->code) ? $key : $obj->$value);
$valuetoshow = nl2br($valuetoshow); $valuetoshow = nl2br($valuetoshow);
} elseif ($value == 'label' && $tabname[$id] == 'c_country') { } elseif ($value == 'label' && $tabname[$id] == 'c_country') {
$key = $langs->trans("Country".strtoupper($obj->code)); $key = $langs->trans("Country".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->{$value}); $valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->$value);
} elseif ($value == 'label' && $tabname[$id] == 'c_availability') { } elseif ($value == 'label' && $tabname[$id] == 'c_availability') {
$langs->load("propal"); $langs->load("propal");
$key = $langs->trans("AvailabilityType".strtoupper($obj->code)); $key = $langs->trans("AvailabilityType".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "AvailabilityType".strtoupper($obj->code) ? $key : $obj->{$value}); $valuetoshow = ($obj->code && $key != "AvailabilityType".strtoupper($obj->code) ? $key : $obj->$value);
} elseif ($value == 'libelle' && $tabname[$id] == 'c_actioncomm') { } elseif ($value == 'libelle' && $tabname[$id] == 'c_actioncomm') {
$key = $langs->trans("Action".strtoupper($obj->code)); $key = $langs->trans("Action".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "Action".strtoupper($obj->code) ? $key : $obj->{$value}); $valuetoshow = ($obj->code && $key != "Action".strtoupper($obj->code) ? $key : $obj->$value);
} elseif (!empty($obj->code_iso) && $value == 'label' && $tabname[$id] == 'c_currencies') { } elseif (!empty($obj->code_iso) && $value == 'label' && $tabname[$id] == 'c_currencies') {
$key = $langs->trans("Currency".strtoupper($obj->code_iso)); $key = $langs->trans("Currency".strtoupper($obj->code_iso));
$valuetoshow = ($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso) ? $key : $obj->{$value}); $valuetoshow = ($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso) ? $key : $obj->$value);
} elseif ($value == 'libelle' && $tabname[$id] == 'c_typent') { } elseif ($value == 'libelle' && $tabname[$id] == 'c_typent') {
$key = $langs->trans(strtoupper($obj->code)); $key = $langs->trans(strtoupper($obj->code));
$valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->{$value}); $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->$value);
} elseif ($value == 'libelle' && $tabname[$id] == 'c_prospectlevel') { } elseif ($value == 'libelle' && $tabname[$id] == 'c_prospectlevel') {
$key = $langs->trans(strtoupper($obj->code)); $key = $langs->trans(strtoupper($obj->code));
$valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->{$value}); $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->$value);
} elseif ($value == 'label' && $tabname[$id] == 'c_civility') { } elseif ($value == 'label' && $tabname[$id] == 'c_civility') {
$key = $langs->trans("Civility".strtoupper($obj->code)); $key = $langs->trans("Civility".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "Civility".strtoupper($obj->code) ? $key : $obj->{$value}); $valuetoshow = ($obj->code && $key != "Civility".strtoupper($obj->code) ? $key : $obj->$value);
} elseif ($value == 'libelle' && $tabname[$id] == 'c_type_contact') { } elseif ($value == 'libelle' && $tabname[$id] == 'c_type_contact') {
$langs->load('agenda'); $langs->load('agenda');
$key = $langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)); $key = $langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code) ? $key : $obj->{$value}); $valuetoshow = ($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code) ? $key : $obj->$value);
} elseif ($value == 'libelle' && $tabname[$id] == 'c_payment_term') { } elseif ($value == 'libelle' && $tabname[$id] == 'c_payment_term') {
$langs->load("bills"); $langs->load("bills");
$key = $langs->trans("PaymentConditionShort".strtoupper($obj->code)); $key = $langs->trans("PaymentConditionShort".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code) ? $key : $obj->{$value}); $valuetoshow = ($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code) ? $key : $obj->$value);
} elseif ($value == 'libelle' && $tabname[$id] == 'c_paiement') { } elseif ($value == 'libelle' && $tabname[$id] == 'c_paiement') {
$langs->load("bills"); $langs->load("bills");
$key = $langs->trans("PaymentType".strtoupper($obj->code)); $key = $langs->trans("PaymentType".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "PaymentType".strtoupper($obj->code) ? $key : $obj->{$value}); $valuetoshow = ($obj->code && $key != "PaymentType".strtoupper($obj->code) ? $key : $obj->$value);
} elseif ($value == 'type' && $tabname[$id] == 'c_paiement') { } elseif ($value == 'type' && $tabname[$id] == 'c_paiement') {
$payment_type_list = array(0=>$langs->trans('PaymentTypeCustomer'), 1=>$langs->trans('PaymentTypeSupplier'), 2=>$langs->trans('PaymentTypeBoth')); $payment_type_list = array(0=>$langs->trans('PaymentTypeCustomer'), 1=>$langs->trans('PaymentTypeSupplier'), 2=>$langs->trans('PaymentTypeBoth'));
$valuetoshow = $payment_type_list[$valuetoshow]; $valuetoshow = $payment_type_list[$valuetoshow];
} elseif ($value == 'label' && $tabname[$id] == 'c_input_reason') { } elseif ($value == 'label' && $tabname[$id] == 'c_input_reason') {
$key = $langs->trans("DemandReasonType".strtoupper($obj->code)); $key = $langs->trans("DemandReasonType".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "DemandReasonType".strtoupper($obj->code) ? $key : $obj->{$value}); $valuetoshow = ($obj->code && $key != "DemandReasonType".strtoupper($obj->code) ? $key : $obj->$value);
} elseif ($value == 'libelle' && $tabname[$id] == 'c_input_method') { } elseif ($value == 'libelle' && $tabname[$id] == 'c_input_method') {
$langs->load("orders"); $langs->load("orders");
$key = $langs->trans($obj->code); $key = $langs->trans($obj->code);
$valuetoshow = ($obj->code && $key != $obj->code) ? $key : $obj->{$value}; $valuetoshow = ($obj->code && $key != $obj->code) ? $key : $obj->$value;
} elseif ($value == 'libelle' && $tabname[$id] == 'c_shipment_mode') { } elseif ($value == 'libelle' && $tabname[$id] == 'c_shipment_mode') {
$langs->load("sendings"); $langs->load("sendings");
$key = $langs->trans("SendingMethod".strtoupper($obj->code)); $key = $langs->trans("SendingMethod".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "SendingMethod".strtoupper($obj->code) ? $key : $obj->{$value}); $valuetoshow = ($obj->code && $key != "SendingMethod".strtoupper($obj->code) ? $key : $obj->$value);
} elseif ($value == 'libelle' && $tabname[$id] == 'c_paper_format') { } elseif ($value == 'libelle' && $tabname[$id] == 'c_paper_format') {
$key = $langs->trans('PaperFormat'.strtoupper($obj->code)); $key = $langs->trans('PaperFormat'.strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->{$value}); $valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->$value);
} elseif ($value == 'label' && $tabname[$id] == 'c_type_fees') { } elseif ($value == 'label' && $tabname[$id] == 'c_type_fees') {
$langs->load('trips'); $langs->load('trips');
$key = $langs->trans(strtoupper($obj->code)); $key = $langs->trans(strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->{$value}); $valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->$value);
} elseif ($value == 'region_id' || $value == 'country_id') { } elseif ($value == 'region_id' || $value == 'country_id') {
$showfield = 0; $showfield = 0;
} elseif ($value == 'unicode') { } elseif ($value == 'unicode') {
$valuetoshow = $langs->getCurrencySymbol($obj->code, 1); $valuetoshow = $langs->getCurrencySymbol($obj->code, 1);
} elseif ($value == 'label' && $tabname[GETPOST("id", 'int')] == 'c_units') { } elseif ($value == 'label' && $tabname[GETPOST("id", 'int')] == 'c_units') {
$langs->load("products"); $langs->load("products");
$valuetoshow = $langs->trans($obj->{$value}); $valuetoshow = $langs->trans($obj->$value);
} elseif ($value == 'short_label' && $tabname[GETPOST("id", 'int')] == 'c_units') { } elseif ($value == 'short_label' && $tabname[GETPOST("id", 'int')] == 'c_units') {
$langs->load("products"); $langs->load("products");
$valuetoshow = $langs->trans($obj->{$value}); $valuetoshow = $langs->trans($obj->$value);
} elseif (($value == 'unit') && ($tabname[$id] == 'c_paper_format')) { } elseif (($value == 'unit') && ($tabname[$id] == 'c_paper_format')) {
$key = $langs->trans('SizeUnit'.strtolower($obj->unit)); $key = $langs->trans('SizeUnit'.strtolower($obj->unit));
$valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->{$value}); $valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->$value);
} elseif ($value == 'localtax1' || $value == 'localtax2') { } elseif ($value == 'localtax1' || $value == 'localtax2') {
$class = "center"; $class = "center";
} elseif ($value == 'localtax1_type') { } elseif ($value == 'localtax1_type') {
@ -2357,7 +2357,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
foreach ($fieldlist as $field => $value) { foreach ($fieldlist as $field => $value) {
if ($value == 'entity') { if ($value == 'entity') {
$withentity = $obj->{$value}; $withentity = $obj->$value;
continue; continue;
} }
@ -2510,11 +2510,11 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print '</td>'; print '</td>';
} elseif ($value == 'block_if_negative') { } elseif ($value == 'block_if_negative') {
print '<td>'; print '<td>';
print $form->selectyesno("block_if_negative", (!empty($obj->{$value}) ? $obj->{$value}:''), 1); print $form->selectyesno("block_if_negative", (empty($obj->block_if_negative) ? '' : $obj->block_if_negative), 1);
print '</td>'; print '</td>';
} elseif ($value == 'type_duration') { } elseif ($value == 'type_duration') {
print '<td>'; print '<td>';
print $form->selectTypeDuration('', $obj->{$value}, array('i','h')); print $form->selectTypeDuration('', (empty($obj->type_duration) ? '' : $obj->type_duration), array('i','h'));
print '</td>'; print '</td>';
} else { } else {
$fieldValue = isset($obj->{$value}) ? $obj->{$value}: ''; $fieldValue = isset($obj->{$value}) ? $obj->{$value}: '';

View File

@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->load("admin"); $langs->load("admin");
$action = GETPOST('action', 'aZ09');
if (!$user->admin) { if (!$user->admin) {
accessforbidden(); accessforbidden();
} }
@ -41,6 +43,7 @@ if (!$user->admin) {
*/ */
// set // set
$reg = array();
if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
$code = $reg[1]; $code = $reg[1];
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) { if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) {
@ -67,6 +70,8 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
* View * View
*/ */
$form = new Form($db);
$help_url = ''; $help_url = '';
llxHeader('', $langs->trans("ECMSetup"), $help_url); llxHeader('', $langs->trans("ECMSetup"), $help_url);
@ -81,26 +86,21 @@ print dol_get_fiche_head($head, 'ecm', '', -1, '');
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Description").'</td>'; print '<td>'.$langs->trans("Description").'</td>';
print '<td class="center" width="20">&nbsp;</td>'; print '<td class="center" width="100px">'.$langs->trans("Value").'</td>'."\n";
print '<td class="center" width="100">'.$langs->trans("Value").'</td>'."\n";
print '</tr>'; print '</tr>';
$form = new Form($db);
// Mail required for members // Mail required for members
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("ECMAutoTree").'</td>'; print '<td>'.$langs->trans("ECMAutoTree").'</td>';
print '<td class="center" width="20">&nbsp;</td>'; print '<td class="center">';
print '<td class="center" width="100">';
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('ECM_AUTO_TREE_ENABLED'); print ajax_constantonoff('ECM_AUTO_TREE_HIDEN', null, null, 1);
} else { } else {
if (empty($conf->global->ECM_AUTO_TREE_ENABLED)) { if (empty($conf->global->ECM_AUTO_TREE_HIDEN)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_ECM_AUTO_TREE_ENABLED&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_ECM_AUTO_TREE_HIDEN&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} elseif (!empty($conf->global->USER_MAIL_REQUIRED)) { } else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_ECM_AUTO_TREE_ENABLED&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_ECM_AUTO_TREE_HIDEN&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
} }
print '</td></tr>'; print '</td></tr>';

View File

@ -387,7 +387,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$morehtmlref = '<div class="refidno">'; $morehtmlref = '<div class="refidno">';
$morehtmlref .= '</div>'; $morehtmlref .= '</div>';
$morehtml = $langs->trans("NbOfEmailsInInbox").' : '; $morehtml = '';
$sourcedir = $object->source_directory; $sourcedir = $object->source_directory;
$targetdir = ($object->target_directory ? $object->target_directory : ''); // Can be '[Gmail]/Trash' or 'mytag' $targetdir = ($object->target_directory ? $object->target_directory : ''); // Can be '[Gmail]/Trash' or 'mytag'
@ -404,6 +404,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$connectstringserver = $object->getConnectStringIMAP($usessl); $connectstringserver = $object->getConnectStringIMAP($usessl);
if ($action == 'scan') { if ($action == 'scan') {
$nbemail = '';
if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) { if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) {
if ($object->acces_type == 1) { if ($object->acces_type == 1) {
// Mode OAUth2 with PHP-IMAP // Mode OAUth2 with PHP-IMAP
@ -493,7 +494,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$f = $client->getFolders(false, $object->source_directory); $f = $client->getFolders(false, $object->source_directory);
$nbemail = $f[0]->examine()["exists"]; $nbemail = $f[0]->examine()["exists"];
$morehtml .= $nbemail;
} else { } else {
try { try {
if ($sourcedir) { if ($sourcedir) {
@ -525,15 +525,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
if (!$connection) { if (!$connection) {
$morehtml .= 'Failed to open IMAP connection '.$connectstringsource; $nbemail .= 'Failed to open IMAP connection '.$connectstringsource;
if (function_exists('imap_last_error')) { if (function_exists('imap_last_error')) {
$morehtml .= '<br>'.imap_last_error(); $nbemail .= '<br>'.imap_last_error();
} }
dol_syslog("Error ".$morehtml, LOG_WARNING); dol_syslog("Error ".$morehtml, LOG_WARNING);
//var_dump(imap_errors()) //var_dump(imap_errors())
} else { } else {
dol_syslog("Imap connected. Now we call imap_num_msg()"); dol_syslog("Imap connected. Now we call imap_num_msg()");
$morehtml .= imap_num_msg($connection); $nbemail .= imap_num_msg($connection);
} }
if ($connection) { if ($connection) {
@ -541,12 +541,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
imap_close($connection); imap_close($connection);
} }
} }
} else {
$morehtml .= '<a class="flat" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=scan&token='.newToken().'">'.img_picto('', 'refresh', 'class="paddingrightonly"').$langs->trans("Refresh").'</a>';
} }
$morehtml .= $form->textwithpicto('', 'connect string '.$connectstringserver); $morehtml .= $form->textwithpicto($langs->trans("NbOfEmailsInInbox"), 'connect string '.$connectstringserver).': ';
$morehtml .= ($nbemail != '' ? $nbemail : '?');
$morehtml .= ' &nbsp; <a class="flat paddingleft marginleftonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=scan&token='.newToken().'">'.img_picto('', 'refresh', 'class="paddingrightonly"').$langs->trans("Refresh").'</a>';
} else { } else {
$morehtml .= $langs->trans("NbOfEmailsInInbox").': ';
$morehtml .= 'IMAP functions not available on your PHP. '; $morehtml .= 'IMAP functions not available on your PHP. ';
} }
@ -668,6 +671,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$arrayoftypes = array( $arrayoftypes = array(
'loadthirdparty' => $langs->trans('LoadThirdPartyFromName', $langs->transnoentities("ThirdPartyName")), 'loadthirdparty' => $langs->trans('LoadThirdPartyFromName', $langs->transnoentities("ThirdPartyName")),
'loadandcreatethirdparty' => $langs->trans('LoadThirdPartyFromNameOrCreate', $langs->transnoentities("ThirdPartyName")), 'loadandcreatethirdparty' => $langs->trans('LoadThirdPartyFromNameOrCreate', $langs->transnoentities("ThirdPartyName")),
'loadandcreatecontact' => $langs->trans('LoadContactFromEmailOrCreate', $langs->transnoentities("Email")),
'recordjoinpiece' => 'AttachJoinedDocumentsToObject', 'recordjoinpiece' => 'AttachJoinedDocumentsToObject',
'recordevent' => 'RecordEvent' 'recordevent' => 'RecordEvent'
); );

View File

@ -601,13 +601,17 @@ while ($i < $imaxinloop) {
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : ''); print '<td'.($cssforfield ? ' class="'.$cssforfield.(preg_match('/tdoverflow/', $cssforfield) ? ' classfortooltip' : '').'"' : '');
if (preg_match('/tdoverflow/', $cssforfield)) { if (preg_match('/tdoverflow/', $cssforfield)) {
print ' title="'.dol_escape_htmltag($object->$key).'"'; print ' title="'.dol_escape_htmltag($object->$key).'"';
} }
print '>'; print '>';
if ($key == 'status') { if ($key == 'status') {
print $object->getLibStatut(5); print $object->getLibStatut(5);
} elseif ($key == 'lastresult') {
print '<div class="twolinesmax">';
print $object->showOutputField($val, $key, $object->$key, '');
print '</div>';
} elseif ($key == 'rowid') { } elseif ($key == 'rowid') {
print $object->showOutputField($val, $key, $object->id, ''); print $object->showOutputField($val, $key, $object->id, '');
} else { } else {

View File

@ -83,15 +83,13 @@ if ($cancel) {
$action =''; $action ='';
} }
if ((float) DOL_VERSION >= 6) {
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
}
if ($action == 'updateMask') { if ($action == 'updateMask') {
$maskconstorder = GETPOST('maskconstorder', 'alpha'); $maskconstorder = GETPOST('maskconstorder', 'aZ09');
$maskorder = GETPOST('maskorder', 'alpha'); $maskorder = GETPOST('maskorder', 'alpha');
if ($maskconstorder) { if ($maskconstorder && preg_match('/_MASK$/', $maskconstorder)) {
$res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) { if (!($res > 0)) {
$error++; $error++;

View File

@ -62,9 +62,9 @@ if (empty($conf->global->EXPEDITION_ADDON_NUMBER)) {
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask') { if ($action == 'updateMask') {
$maskconst = GETPOST('maskconstexpedition', 'alpha'); $maskconst = GETPOST('maskconstexpedition', 'aZ09');
$maskvalue = GETPOST('maskexpedition', 'alpha'); $maskvalue = GETPOST('maskexpedition', 'alpha');
if (!empty($maskconst)) { if (!empty($maskconst) && preg_match('/_MASK$/', $maskconst)) {
$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
} }

View File

@ -58,9 +58,9 @@ $type = 'expensereport';
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask') { if ($action == 'updateMask') {
$maskconst = GETPOST('maskconst', 'alpha'); $maskconst = GETPOST('maskconst', 'aZ09');
$maskvalue = GETPOST('maskvalue', 'alpha'); $maskvalue = GETPOST('maskvalue', 'alpha');
if ($maskconst) { if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
} }

Some files were not shown because too many files have changed in this diff Show More