Merge remote-tracking branch 'upstream/develop' into 18a2
This commit is contained in:
commit
6d26f242bb
25
.github/workflows/code_quality.yml
vendored
Normal file
25
.github/workflows/code_quality.yml
vendored
Normal 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.0
|
||||
#with:
|
||||
# php-version: '7.1'
|
||||
env:
|
||||
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
|
||||
38
.github/workflows/doxygen-gh-pages.yml.disabled
vendored
Normal file
38
.github/workflows/doxygen-gh-pages.yml.disabled
vendored
Normal 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
|
||||
@ -4,6 +4,9 @@ name: "Exakat analysis"
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 20 * * *"
|
||||
workflow_dispatch:
|
||||
branches:
|
||||
- develop
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@ -13,6 +16,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: Exakat
|
||||
uses: docker://exakat/exakat-ga
|
||||
with:
|
||||
3
.github/workflows/stale-issues-safe.yml
vendored
3
.github/workflows/stale-issues-safe.yml
vendored
@ -6,7 +6,8 @@ on:
|
||||
- cron: "0 21 * * *"
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {} # none
|
||||
|
||||
jobs:
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -19,6 +19,7 @@ default.properties
|
||||
*.orig
|
||||
Thumbs.db
|
||||
/dolibarr_genesis.mp4
|
||||
.phpunit.result.cache
|
||||
# Log files
|
||||
dolibarr_install.log
|
||||
upgrade.log
|
||||
|
||||
167
.scrutinizer.yml
167
.scrutinizer.yml
@ -8,21 +8,24 @@ build:
|
||||
override:
|
||||
- command: php-scrutinizer-run
|
||||
idle_timeout: 8000
|
||||
#- php-scrutinizer-run --sub-project-dir=htdocs/admin
|
||||
|
||||
imports:
|
||||
- javascript
|
||||
- php
|
||||
|
||||
filter:
|
||||
excluded_paths:
|
||||
- build/*
|
||||
- dev/*
|
||||
- doc/*
|
||||
- documents/*
|
||||
- node_modules/*
|
||||
- test/*
|
||||
dependency_paths:
|
||||
- htdocs/includes/*
|
||||
- build/
|
||||
- dev/
|
||||
- doc/
|
||||
- documents/
|
||||
- node_modules/
|
||||
- test/
|
||||
- htdocs/custom/
|
||||
- htdocs/includes/
|
||||
- htdocs/install/doctemplates/
|
||||
#dependency_paths:
|
||||
# - htdocs/includes/
|
||||
paths:
|
||||
- htdocs/*
|
||||
- scripts/*
|
||||
@ -33,21 +36,23 @@ tools:
|
||||
enabled: true
|
||||
extensions:
|
||||
- php
|
||||
dependency_paths:
|
||||
- htdocs/includes/
|
||||
#dependency_paths:
|
||||
# - htdocs/includes/
|
||||
filter:
|
||||
excluded_paths:
|
||||
- build/*
|
||||
- dev/*
|
||||
- doc/*
|
||||
- documents/*
|
||||
- htdocs/includes/*
|
||||
- build/
|
||||
- dev/
|
||||
- doc/
|
||||
- documents/
|
||||
- htdocs/custom/
|
||||
- htdocs/includes/
|
||||
- htdocs/install/doctemplates/
|
||||
- htdocs/core/class/lessc.class.php
|
||||
- node_modules/*
|
||||
- test/*
|
||||
- node_modules/
|
||||
- test/
|
||||
paths:
|
||||
- htdocs/
|
||||
- scripts/
|
||||
- htdocs/*
|
||||
- scripts/*
|
||||
config:
|
||||
parameter_reference_check:
|
||||
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)
|
||||
|
||||
# php_depend
|
||||
php_pdepend:
|
||||
enabled: false
|
||||
configuration_file: null
|
||||
suffixes:
|
||||
- php
|
||||
excluded_dirs: { }
|
||||
filter:
|
||||
excluded_paths:
|
||||
- 'build/*'
|
||||
- 'dev/*'
|
||||
- 'doc/*'
|
||||
- 'test/*'
|
||||
- 'htdocs/includes/*'
|
||||
paths: { }
|
||||
#php_pdepend:
|
||||
# enabled: false
|
||||
# configuration_file: null
|
||||
# suffixes:
|
||||
# - php
|
||||
# excluded_dirs: { }
|
||||
# filter:
|
||||
# excluded_paths:
|
||||
# - 'build/*'
|
||||
# - 'dev/*'
|
||||
# - 'doc/*'
|
||||
# - 'test/*'
|
||||
# - 'htdocs/includes/*'
|
||||
# paths: { }
|
||||
|
||||
# change tracking
|
||||
php_changetracking:
|
||||
enabled: false
|
||||
bug_patterns:
|
||||
- '\bfix(?:es|ed)?\b'
|
||||
feature_patterns:
|
||||
- '\badd(?:s|ed)?\b'
|
||||
- '\bimplement(?:s|ed)?\b'
|
||||
filter:
|
||||
excluded_paths:
|
||||
- 'build/*'
|
||||
- 'dev/*'
|
||||
- 'doc/*'
|
||||
- 'documents/*'
|
||||
- 'htdocs/includes/*'
|
||||
- 'node_modules/*'
|
||||
- 'test/*'
|
||||
paths: { }
|
||||
#php_changetracking:
|
||||
# enabled: false
|
||||
# bug_patterns:
|
||||
# - '\bfix(?:es|ed)?\b'
|
||||
# feature_patterns:
|
||||
# - '\badd(?:s|ed)?\b'
|
||||
# - '\bimplement(?:s|ed)?\b'
|
||||
# filter:
|
||||
# excluded_paths:
|
||||
# - 'build/*'
|
||||
# - 'dev/*'
|
||||
# - 'doc/*'
|
||||
# - 'documents/*'
|
||||
# - 'htdocs/includes/*'
|
||||
# - 'node_modules/*'
|
||||
# - 'test/*'
|
||||
# paths: { }
|
||||
|
||||
# Similar code detection
|
||||
php_sim:
|
||||
enabled: false
|
||||
min_mass: 30
|
||||
filter:
|
||||
excluded_paths:
|
||||
- 'build/*'
|
||||
- 'dev/*'
|
||||
- 'doc/*'
|
||||
- 'documents/*'
|
||||
- 'htdocs/includes/*'
|
||||
- 'node_modules/*'
|
||||
- 'test/*'
|
||||
paths: { }
|
||||
#php_sim:
|
||||
# enabled: false
|
||||
# min_mass: 30
|
||||
# filter:
|
||||
# excluded_paths:
|
||||
# - 'build/*'
|
||||
# - 'dev/*'
|
||||
# - 'doc/*'
|
||||
# - 'documents/*'
|
||||
# - 'htdocs/includes/*'
|
||||
# - 'node_modules/*'
|
||||
# - 'test/*'
|
||||
# paths: { }
|
||||
|
||||
# Coding-Style / Bug Detection
|
||||
js_hint:
|
||||
enabled: false
|
||||
use_native_config: true
|
||||
extensions:
|
||||
- js
|
||||
filter:
|
||||
excluded_paths:
|
||||
- 'build/*'
|
||||
- 'dev/*'
|
||||
- 'doc/*'
|
||||
- 'documents/*'
|
||||
- 'htdocs/includes/*'
|
||||
- 'node_modules/*'
|
||||
- 'test/*'
|
||||
paths: { }
|
||||
config: { }
|
||||
path_configs: { }
|
||||
#js_hint:
|
||||
# enabled: false
|
||||
# use_native_config: true
|
||||
# extensions:
|
||||
# - js
|
||||
# filter:
|
||||
# excluded_paths:
|
||||
# - 'build/*'
|
||||
# - 'dev/*'
|
||||
# - 'doc/*'
|
||||
# - 'documents/*'
|
||||
# - 'htdocs/includes/*'
|
||||
# - 'node_modules/*'
|
||||
# - 'test/*'
|
||||
# paths: { }
|
||||
# config: { }
|
||||
# path_configs: { }
|
||||
|
||||
|
||||
before_commands: { }
|
||||
|
||||
22
.travis.yml
22
.travis.yml
@ -95,19 +95,20 @@ notifications:
|
||||
|
||||
install:
|
||||
- |
|
||||
echo "Updating Composer"
|
||||
rm $TRAVIS_BUILD_DIR/composer.json
|
||||
rm $TRAVIS_BUILD_DIR/composer.lock
|
||||
echo "Updating Composer config"
|
||||
composer -V
|
||||
composer self-update
|
||||
composer -n init
|
||||
composer -n config vendor-dir htdocs/includes
|
||||
#rm $TRAVIS_BUILD_DIR/composer.json
|
||||
#rm $TRAVIS_BUILD_DIR/composer.lock
|
||||
#composer -n init
|
||||
#composer -n config vendor-dir htdocs/includes
|
||||
composer -n config -g vendor-dir htdocs/includes
|
||||
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
|
||||
composer self-update 2.2.18
|
||||
composer -n require phpunit/phpunit ^6 \
|
||||
php-parallel-lint/php-parallel-lint ^1 \
|
||||
php-parallel-lint/php-console-highlighter ^0 \
|
||||
@ -115,6 +116,7 @@ install:
|
||||
squizlabs/php_codesniffer ^3
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ]; then
|
||||
composer self-update 2.2.18
|
||||
composer -n require phpunit/phpunit ^7 \
|
||||
php-parallel-lint/php-parallel-lint ^1.2 \
|
||||
php-parallel-lint/php-console-highlighter ^0 \
|
||||
@ -123,12 +125,15 @@ install:
|
||||
fi
|
||||
# phpunit 9 is required for php 8
|
||||
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 \
|
||||
php-parallel-lint/php-parallel-lint ^1.2 \
|
||||
php-parallel-lint/php-console-highlighter ^0 \
|
||||
php-parallel-lint/php-var-dump-check ~0.4 \
|
||||
squizlabs/php_codesniffer ^3
|
||||
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
|
||||
|
||||
- |
|
||||
@ -450,6 +455,9 @@ script:
|
||||
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 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/
|
||||
|
||||
- |
|
||||
|
||||
70
ChangeLog
70
ChangeLog
@ -3,6 +3,16 @@ English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
|
||||
***** ChangeLog for 18.0.0 compared to 17.0.0 *****
|
||||
|
||||
WARNING:
|
||||
|
||||
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 method nb_expedition() has been renamed into countNbOfShipments()
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 17.0.0 compared to 16.0.0 *****
|
||||
|
||||
For users:
|
||||
@ -11,7 +21,7 @@ For users:
|
||||
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: #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: #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
|
||||
@ -36,7 +46,6 @@ NEW: Accountancy - Add a way to clean some words when you generate thirdparty ac
|
||||
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 method doAutoRenewContracts that can be used as a cron task.
|
||||
NEW: Add " as enclosure by default for CSV export. Keep removing CR/LF.
|
||||
@ -50,9 +59,6 @@ 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 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 margin infos to takepos invoice lines
|
||||
NEW: Add max size send for "backup and link to mail" option
|
||||
@ -92,16 +98,22 @@ 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: Contracts: Default template of contract is not mandatory
|
||||
NEW: Contracts: Manage Position (Rank) on Contract Lines
|
||||
NEW: EMail-Collector: add IMAP port setting
|
||||
NEW: EMail-Collector: add a button "Test collect"
|
||||
NEW: Members: default_lang for members
|
||||
NEW: Members: Table of membership types
|
||||
NEW: Members: add free membership amounts at the membership type level
|
||||
NEW: Projects: add author on list
|
||||
NEW: Proposals: show delivery mode on PDF for proposals
|
||||
NEW: Reception: add a from/to on search on date field
|
||||
NEW: TakePOS: Header Scroll in TakePOS
|
||||
NEW: TakePOS: add price to product box in TakePOS
|
||||
NEW: TakePOS: add setup parameters, can setup terminal name
|
||||
@ -124,7 +136,6 @@ 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 Position (Rank) on Contract Lines
|
||||
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
|
||||
@ -139,9 +150,7 @@ NEW: possibility to select scopes with checkbox for Oauth tokens
|
||||
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: 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
|
||||
@ -156,7 +165,7 @@ 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: experimental SMTP using PhpImap allowing OAuth2 authentication (need to add option MAIN_IMAP_USE_PHPIMAP)
|
||||
NEW: can substitue project title in mail template
|
||||
NEW: Supplier order list - Add column private and public note
|
||||
NEW: Support IP type in extrafields
|
||||
@ -164,19 +173,23 @@ 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: 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
|
||||
|
||||
Localisation:
|
||||
NEW: adding JAPAN Chart-of-Account and regions/departments
|
||||
NEW: adding NIF verification for Algeria
|
||||
|
||||
Modules
|
||||
NEW: Experimental module Asset
|
||||
|
||||
|
||||
For developers or integrators:
|
||||
------------------------------
|
||||
|
||||
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: #21750 Added "Get lines and Post lines from BOM" at the REST Service
|
||||
NEW: #22370 Modulebuilder supports 'alwayseditable' (like extrafields)
|
||||
NEW: Removed completely the need for the library adodbtime
|
||||
NEW: hook on agenda pages
|
||||
NEW: hook to complete payment in TakePOS
|
||||
@ -209,6 +222,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
|
||||
|
||||
|
||||
***** 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 *****
|
||||
|
||||
FIX: $sign is useless
|
||||
|
||||
@ -17,9 +17,9 @@ use Cwd;
|
||||
my $dir = getcwd;
|
||||
|
||||
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 "\n";
|
||||
@ -30,7 +30,7 @@ if (! -s $CONFFILE)
|
||||
exit 1;
|
||||
}
|
||||
|
||||
$SOURCE="../..";
|
||||
$SOURCE=".";
|
||||
|
||||
# Get version $MAJOR, $MINOR and $BUILD
|
||||
$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 "cat $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`;
|
||||
print "cat build/doxygen/$CONFFILE | sed -e 's/x\.y\.z/".$version."/' | doxygen $OPTIONS - 2>&1\n";
|
||||
$result=`cat build/doxygen/$CONFFILE | sed -e 's/x\.y\.z/$version/' | doxygen $OPTIONS - 2>&1`;
|
||||
|
||||
print $result;
|
||||
|
||||
|
||||
@ -1,14 +1,17 @@
|
||||
# Doxyfile 1.7.3
|
||||
# Doxyfile 1.8.16
|
||||
|
||||
# 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:
|
||||
# TAG = value [value, ...]
|
||||
# For lists items can also be appended using:
|
||||
# TAG += value [value, ...]
|
||||
# Values that contain spaces should be placed between quotes (" ")
|
||||
# TAG = value [value, ...]
|
||||
# For lists, items can also be appended using:
|
||||
# TAG += value [value, ...]
|
||||
# Values that contain spaces should be placed between quotes (\" \").
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# 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 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,
|
||||
# corresponding to a cache size of 2^16 = 65536 symbols
|
||||
|
||||
SYMBOL_CACHE_SIZE = 0
|
||||
#SYMBOL_CACHE_SIZE = 0
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
@ -448,7 +451,7 @@ GENERATE_TODOLIST = NO
|
||||
# disable (NO) the test list. This list is created by putting \test
|
||||
# commands in the documentation.
|
||||
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_TESTLIST = NO
|
||||
|
||||
# The GENERATE_BUGLIST tag can be used to enable (YES) or
|
||||
# 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
|
||||
# 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.
|
||||
# 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
|
||||
# to stderr.
|
||||
|
||||
WARN_LOGFILE = doxygen_warnings.log
|
||||
WARN_LOGFILE = build/html/doxygen_warnings.log
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# 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
|
||||
# with spaces.
|
||||
|
||||
INPUT = ../../htdocs ../../scripts
|
||||
INPUT = htdocs scripts
|
||||
|
||||
# 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
|
||||
@ -611,7 +614,7 @@ RECURSIVE = YES
|
||||
# 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.
|
||||
|
||||
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
|
||||
# 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
|
||||
# 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
|
||||
# (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
|
||||
# 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
|
||||
# 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
|
||||
# blank all files are included.
|
||||
|
||||
EXAMPLE_PATTERNS = *.php
|
||||
#EXAMPLE_PATTERNS = *.php
|
||||
|
||||
# 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
|
||||
# commands irrespective of the value of the RECURSIVE tag.
|
||||
# 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
|
||||
# directories that contain image that are included in the documentation (see
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
|
||||
# generate HTML output.
|
||||
# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
|
||||
# The default value is: YES.
|
||||
|
||||
GENERATE_HTML = YES
|
||||
|
||||
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
|
||||
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
|
||||
# put in front of it. If left blank `html' will be used as the default path.
|
||||
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
|
||||
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
|
||||
# it.
|
||||
# The default directory is: html.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_OUTPUT = html
|
||||
|
||||
@ -797,14 +802,14 @@ HTML_FILE_EXTENSION = .html
|
||||
# standard header.
|
||||
|
||||
# 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
|
||||
# each generated HTML page. If it is left blank doxygen will generate a
|
||||
# standard footer.
|
||||
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# 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 help appears.
|
||||
|
||||
GENERATE_ECLIPSEHELP = YES
|
||||
GENERATE_ECLIPSEHELP = NO
|
||||
|
||||
# A unique identifier for the eclipse help plugin. When installing the plugin
|
||||
# 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,
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# and does not have live searching capabilities.
|
||||
|
||||
SERVER_BASED_SEARCH = NO
|
||||
SERVER_BASED_SEARCH = YES
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# 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
|
||||
# syntax of the XML files.
|
||||
|
||||
XML_SCHEMA =
|
||||
#XML_SCHEMA =
|
||||
|
||||
# The XML_DTD tag can be used to specify an XML DTD,
|
||||
# which can be used by a validating XML parser to check the
|
||||
# syntax of the XML files.
|
||||
|
||||
XML_DTD =
|
||||
#XML_DTD =
|
||||
|
||||
# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
|
||||
# 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
|
||||
# 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
|
||||
@ -1453,7 +1469,7 @@ CLASS_DIAGRAMS = NO
|
||||
# the mscgen tool resides. If left empty the tool is assumed to be found in the
|
||||
# default search path.
|
||||
|
||||
MSCGEN_PATH =
|
||||
#MSCGEN_PATH =
|
||||
|
||||
# If set to YES, the inheritance and collaboration graphs will hide
|
||||
# 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
|
||||
# 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 default size is 10pt.
|
||||
@ -1634,3 +1650,7 @@ GENERATE_LEGEND = YES
|
||||
# the various graphs.
|
||||
|
||||
DOT_CLEANUP = YES
|
||||
|
||||
|
||||
FULL_SIDEBAR = NO
|
||||
HTML_EXTRA_STYLESHEET = build/doxygen/doxygen-awesome.css
|
||||
|
||||
2413
build/doxygen/doxygen-awesome.css
Normal file
2413
build/doxygen/doxygen-awesome.css
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,14 +1,15 @@
|
||||
<VirtualHost *:80>
|
||||
#php_admin_value sendmail_path "/usr/sbin/sendmail -t -i"
|
||||
#php_admin_value mail.force_extra_parameters "-f postmaster@mydomain.com"
|
||||
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com"
|
||||
#php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com"
|
||||
|
||||
php_admin_value open_basedir /tmp/:/home/.../htdocs:/home/.../dolibarr_documents:
|
||||
|
||||
|
||||
# Add this to use a custom apparmor profile when using apache php handler
|
||||
<IfModule mod_apparmor.c>
|
||||
AADefaultHatName sellyoursaas-instances
|
||||
</IfModule>
|
||||
<IfModule mod_apparmor.c>
|
||||
AADefaultHatName sellyoursaas-instances
|
||||
</IfModule>
|
||||
|
||||
|
||||
ServerName myvirtualalias
|
||||
@ -35,8 +36,8 @@
|
||||
#AuthUserFile /etc/apache2/.htpasswd
|
||||
#require valid-user
|
||||
</Directory>
|
||||
|
||||
# Leaving /public and /api, /dav, .well_known but also wrappers for document and viewimage accessible to everyone
|
||||
|
||||
# Leaving /public and /api, /dav, .well_known but also wrappers for document, viewimage and public json/img accessible to everyone
|
||||
<Directory /home/admin/wwwroot/dolibarr/htdocs/public/>
|
||||
AuthType None
|
||||
Require all granted
|
||||
|
||||
19
dev/setup/fail2ban/filter.d/web-accesslog-limit403.conf
Normal file
19
dev/setup/fail2ban/filter.d/web-accesslog-limit403.conf
Normal file
@ -0,0 +1,19 @@
|
||||
# Fail2Ban configuration file
|
||||
#
|
||||
# Regexp to detect forbidden access on pages (public or not) so we can add mitigation on IP making too much
|
||||
# access to your a Dolibarr instance.
|
||||
|
||||
|
||||
[Definition]
|
||||
|
||||
# To test, you can inject this example into log
|
||||
# echo `myvirtualhost.com:443 1.2.3.4 - - [15/Dec/2022:09:57:47 +0000] "GET /public/abc" 403 123 "-" "Mozilla" >> /var/log/apache2/access.log
|
||||
#
|
||||
# then
|
||||
# fail2ban-client status web-accesslog-limit403
|
||||
#
|
||||
# To test rule file on a existing log file
|
||||
# fail2ban-regex /var/log/apache2/access.log /etc/fail2ban/filter.d/web-accesslog-limit403.conf
|
||||
|
||||
failregex = <HOST> - - .*HTTP/[0-9]+(.[0-9]+)?" 403
|
||||
ignoreregex =
|
||||
14
dev/setup/qodana/README.md
Normal file
14
dev/setup/qodana/README.md
Normal 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
|
||||
|
||||
@ -47,6 +47,7 @@ $search_label = GETPOST('search_label', 'alpha');
|
||||
$search_labelshort = GETPOST('search_labelshort', 'alpha');
|
||||
$search_accountparent = GETPOST('search_accountparent', 'alpha');
|
||||
$search_pcgtype = GETPOST('search_pcgtype', 'alpha');
|
||||
$search_import_key = GETPOST('search_import_key', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
@ -83,16 +84,19 @@ if (!$sortorder) {
|
||||
}
|
||||
|
||||
$arrayfields = array(
|
||||
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
|
||||
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||
'aa.labelshort'=>array('label'=>$langs->trans("LabelToShow"), 'checked'=>1),
|
||||
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1),
|
||||
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
|
||||
'aa.reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1),
|
||||
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
|
||||
'aa.account_number'=>array('label'=>"AccountNumber", 'checked'=>1),
|
||||
'aa.label'=>array('label'=>"Label", 'checked'=>1),
|
||||
'aa.labelshort'=>array('label'=>"LabelToShow", 'checked'=>1),
|
||||
'aa.account_parent'=>array('label'=>"Accountparent", 'checked'=>1),
|
||||
'aa.pcg_type'=>array('label'=>"Pcgtype", 'checked'=>1, 'help'=>'PcgtypeDesc'),
|
||||
'categories'=>array('label'=>"AccountingCategories", 'checked'=>-1, 'help'=>'AccountingCategoriesDesc'),
|
||||
'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) {
|
||||
unset($arrayfields['categories']);
|
||||
unset($arrayfields['aa.reconcilable']);
|
||||
}
|
||||
|
||||
@ -226,15 +230,12 @@ if ($action == 'delete') {
|
||||
|
||||
$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 .= " 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;
|
||||
if ($db->type == 'pgsql') {
|
||||
$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 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".((int) $conf->entity);
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".((int) $conf->entity);
|
||||
$sql .= " WHERE asy.rowid = ".((int) $pcgver);
|
||||
//print $sql;
|
||||
if (strlen(trim($search_account))) {
|
||||
@ -337,6 +338,9 @@ if ($resql) {
|
||||
if ($search_pcgtype) {
|
||||
$param .= '&search_pcgtype='.urlencode($search_pcgtype);
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&search_import_key='.urlencode($search_import_key);
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
}
|
||||
@ -399,7 +403,7 @@ if ($resql) {
|
||||
}
|
||||
print "</select>";
|
||||
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>';
|
||||
|
||||
@ -436,11 +440,20 @@ if ($resql) {
|
||||
}
|
||||
if (!empty($arrayfields['aa.account_parent']['checked'])) {
|
||||
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>';
|
||||
}
|
||||
// Predefined group
|
||||
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 (!empty($arrayfields['aa.reconcilable']['checked'])) {
|
||||
@ -471,6 +484,12 @@ if ($resql) {
|
||||
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);
|
||||
}
|
||||
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 (!empty($arrayfields['aa.reconcilable']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['aa.reconcilable']['label'], $_SERVER["PHP_SELF"], 'aa.reconcilable', '', $param, '', $sortfield, $sortorder);
|
||||
@ -505,7 +524,7 @@ if ($resql) {
|
||||
// Account label
|
||||
if (!empty($arrayfields['aa.label']['checked'])) {
|
||||
print "<td>";
|
||||
print $obj->label;
|
||||
print dol_escape_htmltag($obj->label);
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
@ -515,7 +534,7 @@ if ($resql) {
|
||||
// Account label to show (label short)
|
||||
if (!empty($arrayfields['aa.labelshort']['checked'])) {
|
||||
print "<td>";
|
||||
print $obj->labelshort;
|
||||
print dol_escape_htmltag($obj->labelshort);
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
@ -549,10 +568,30 @@ if ($resql) {
|
||||
}
|
||||
}
|
||||
|
||||
// Chart of accounts type
|
||||
// Predefined group (deprecated)
|
||||
if (!empty($arrayfields['aa.pcg_type']['checked'])) {
|
||||
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";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
||||
@ -640,7 +640,8 @@ if ($id) {
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
$showfield = 1;
|
||||
$class = "left";
|
||||
$valuetoshow = $obj->{$fieldlist[$field]};
|
||||
$tmpvar = $fieldlist[$field];
|
||||
$valuetoshow = $obj->$tmpvar;
|
||||
if ($value == 'type_template') {
|
||||
$valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
|
||||
}
|
||||
|
||||
@ -282,7 +282,7 @@ if ($action == 'create') {
|
||||
print $form->textwithpicto($langs->trans("AccountingCategory"), $langs->transnoentitiesnoconv("AccountingAccountGroupsDesc"));
|
||||
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 '</table>';
|
||||
@ -329,7 +329,8 @@ if ($action == 'create') {
|
||||
// Account parent
|
||||
print '<tr><td>'.$langs->trans("Accountparent").'</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>';
|
||||
|
||||
// Chart of accounts type
|
||||
@ -358,7 +359,7 @@ if ($action == 'create') {
|
||||
print $form->textwithpicto($langs->trans("AccountingCategory"), $langs->transnoentitiesnoconv("AccountingAccountGroupsDesc"));
|
||||
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 '</table>';
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("bills", "accountancy"));
|
||||
$langs->loadLangs(array("bills", "accountancy", "compta"));
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
@ -44,6 +45,26 @@ if ($cat_id == 0) {
|
||||
$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
|
||||
if (!$user->hasRight('accounting', 'chartofaccount')) {
|
||||
accessforbidden();
|
||||
@ -110,18 +131,22 @@ print '<table class="border centpercent">';
|
||||
// Select the category
|
||||
print '<tr><td class="titlefield">'.$langs->trans("AccountingCategory").'</td>';
|
||||
print '<td>';
|
||||
$formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Select").'">';
|
||||
print $formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 0);
|
||||
print '<input type="submit" class="button small" value="'.$langs->trans("Select").'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
||||
// Select the accounts
|
||||
if (!empty($cat_id)) {
|
||||
$return = $accountingcategory->getAccountsWithNoCategory($cat_id);
|
||||
if ($return < 0) {
|
||||
setEventMessages(null, $accountingcategory->errors, 'errors');
|
||||
}
|
||||
print '<tr><td>'.$langs->trans("AddAccountFromBookKeepingWithNoCategories").'</td>';
|
||||
print '<td>';
|
||||
print '<br>';
|
||||
|
||||
$arraykeyvalue = array();
|
||||
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) {
|
||||
print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, null, null, "90%");
|
||||
print '<br>';
|
||||
/*print '<select class="flat minwidth200" size="8" name="cpt_bk[]" multiple>';
|
||||
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 img_picto($langs->trans("AccountingAccount"), 'accounting_account', 'class="pictofixedwith"');
|
||||
print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, '', 0, "80%", '', '', $langs->transnoentitiesnoconv("AddAccountFromBookKeepingWithNoCategories"));
|
||||
print '<input type="submit" class="button button-add small" id="" class="action-delete" value="'.$langs->trans("Add").'"> ';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
if ($action == 'display' || $action == 'delete') {
|
||||
print "<table class='noborder' width='100%'>\n";
|
||||
if ((empty($action) || $action == 'display' || $action == 'delete') && $cat_id > 0) {
|
||||
$param = 'account_category='.((int) $cat_id);
|
||||
|
||||
print '<br>';
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">'.$langs->trans("AccountAccounting")."</td>";
|
||||
print '<td class="liste_titre" colspan="2">'.$langs->trans("Label")."</td>";
|
||||
print "</tr>\n";
|
||||
print getTitleFieldOfList('AccountAccounting', 0, $_SERVER['PHP_SELF'], 'account_number', '', $param, '', $sortfield, $sortorder, '')."\n";
|
||||
print getTitleFieldOfList('Label', 0, $_SERVER['PHP_SELF'], 'label', '', $param, '', $sortfield, $sortorder, '')."\n";
|
||||
print getTitleFieldOfList('', 0, $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, '')."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
if (!empty($cat_id)) {
|
||||
$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) {
|
||||
$accountingcategory->lines_display = dol_sort_array($accountingcategory->lines_display, $sortfield, $sortorder, -1, 0, 1);
|
||||
|
||||
foreach ($accountingcategory->lines_display as $cpt) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.length_accountg($cpt->account_number).'</td>';
|
||||
@ -177,6 +196,8 @@ if ($action == 'display' || $action == 'delete') {
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
}
|
||||
} else {
|
||||
print '<tr><td colspan="3"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -190,7 +190,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
|
||||
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
||||
}
|
||||
}
|
||||
if (!is_numeric(GETPOST('position', 'alpha'))) {
|
||||
if (GETPOST('position') && !is_numeric(GETPOST('position', 'alpha'))) {
|
||||
$langs->loadLangs(array("errors"));
|
||||
$ok = 0;
|
||||
setEventMessages($langs->transnoentities('ErrorFieldMustBeANumeric', $langs->transnoentities("Position")), null, 'errors');
|
||||
@ -444,15 +444,37 @@ if ($search_country_id > 0) {
|
||||
if ($sortfield == 'country') {
|
||||
$sortfield = 'country_code';
|
||||
}
|
||||
if (empty($sortfield)) {
|
||||
$sortfield = 'position';
|
||||
}
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
$sql .= $db->plimit($listlimit + 1, $offset);
|
||||
//print $sql;
|
||||
|
||||
$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 '<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="sortfield" value="'.dol_escape_htmltag($sortfield).'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.dol_escape_htmltag($sortorder).'">';
|
||||
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder centpercent">';
|
||||
@ -571,20 +593,6 @@ if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$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
|
||||
if ($num > $listlimit) {
|
||||
print '<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).'">';
|
||||
@ -605,7 +613,7 @@ if ($resql) {
|
||||
if ($showfield) {
|
||||
if ($value == 'country') {
|
||||
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>';
|
||||
$filterfound++;
|
||||
} else {
|
||||
@ -725,11 +733,11 @@ if ($resql) {
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
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="rowid" value="'.$rowid.'">';
|
||||
print '<input type="submit" class="button button-edit" 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" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '<input type="submit" class="button button-edit smallpaddingimp" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print '<input type="submit" class="button button-cancel smallpaddingimp" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
} else {
|
||||
@ -743,7 +751,8 @@ if ($resql) {
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
$showfield = 1;
|
||||
$class = "left";
|
||||
$valuetoshow = $obj->{$fieldlist[$field]};
|
||||
$tmpvar = $fieldlist[$field];
|
||||
$valuetoshow = $obj->$tmpvar;
|
||||
if ($value == 'category_type') {
|
||||
$valuetoshow = yn($valuetoshow);
|
||||
} elseif ($valuetoshow == 'all') {
|
||||
@ -822,7 +831,7 @@ if ($resql) {
|
||||
}
|
||||
|
||||
// Link to setup the group
|
||||
print '<td class="center">';
|
||||
print '<td>';
|
||||
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 $langs->trans("ListOfAccounts");
|
||||
@ -887,10 +896,10 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co
|
||||
if ($context == 'add') {
|
||||
$fieldname = 'country_id';
|
||||
$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 {
|
||||
$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>';
|
||||
} elseif ($fieldlist[$field] == 'country_id') {
|
||||
|
||||
@ -84,6 +84,9 @@ $list_account[] = 'ACCOUNTING_VAT_PAY_ACCOUNT';
|
||||
if (isModEnabled('banque')) {
|
||||
$list_account[] = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
|
||||
}
|
||||
if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
|
||||
$list_account[] = 'ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY';
|
||||
}
|
||||
if (isModEnabled('don')) {
|
||||
$list_account[] = 'DONATION_ACCOUNTINGACCOUNT';
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -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);
|
||||
} elseif ($key == 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER') {
|
||||
$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 {
|
||||
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 '</table>';
|
||||
print '<br>';
|
||||
|
||||
// Lettering params
|
||||
print '<table class="noborder centpercent">';
|
||||
@ -499,6 +514,21 @@ if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
|
||||
}
|
||||
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 '<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans('Modify').'"></div>';
|
||||
|
||||
@ -587,7 +587,8 @@ if ($id) {
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
$showfield = 1;
|
||||
$class = "left";
|
||||
$valuetoshow = $obj->{$fieldlist[$field]};
|
||||
$tmpvar = $fieldlist[$field];
|
||||
$valuetoshow = $obj->$tmpvar;
|
||||
if ($valuetoshow == 'all') {
|
||||
$valuetoshow = $langs->trans('All');
|
||||
} elseif ($fieldlist[$field] == 'nature' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') {
|
||||
|
||||
@ -408,7 +408,7 @@ if ($resql) {
|
||||
$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) {
|
||||
// User
|
||||
$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 '</td>';
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* 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
|
||||
* 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')
|
||||
|
||||
$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)
|
||||
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
@ -54,10 +55,15 @@ $accountingaccount_number = GETPOST('accountingaccount_number', 'alphanohtml');
|
||||
$accountingaccount->fetch(null, $accountingaccount_number, true);
|
||||
$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);
|
||||
$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');
|
||||
if ($subledger_account == -1) {
|
||||
$subledger_account = null;
|
||||
@ -72,6 +78,10 @@ $save = GETPOST('save', 'alpha');
|
||||
if (!empty($save)) {
|
||||
$action = 'add';
|
||||
}
|
||||
$valid = GETPOST('validate', 'alpha');
|
||||
if (!empty($valid)) {
|
||||
$action = 'valid';
|
||||
}
|
||||
$update = GETPOST('update', 'alpha');
|
||||
if (!empty($update)) {
|
||||
$action = 'confirm_update';
|
||||
@ -156,64 +166,79 @@ if ($action == "confirm_update") {
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($action == "add") {
|
||||
} elseif ($action == 'add' || $action == 'valid') {
|
||||
$error = 0;
|
||||
|
||||
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
if (empty($accountingaccount_number) || $accountingaccount_number == '-1') {
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
|
||||
$action = '';
|
||||
if (array_sum($debit) != array_sum($credit)) {
|
||||
$action = 'add';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$object = new BookKeeping($db);
|
||||
foreach ($accountingaccount_number as $key => $value) {
|
||||
$accountingaccount->fetch(null, $accountingaccount_number[$key], true);
|
||||
$accountingaccount_label[$key] = $accountingaccount->label[$key];
|
||||
|
||||
$object->numero_compte = $accountingaccount_number;
|
||||
$object->subledger_account = $subledger_account;
|
||||
$object->subledger_label = $subledger_label;
|
||||
$object->label_compte = $accountingaccount_label;
|
||||
$object->label_operation = $label_operation;
|
||||
$object->debit = $debit;
|
||||
$object->credit = $credit;
|
||||
$object->doc_date = (string) GETPOST('doc_date', 'alpha');
|
||||
$object->doc_type = (string) GETPOST('doc_type', 'alpha');
|
||||
$object->piece_num = $piece_num;
|
||||
$object->doc_ref = (string) GETPOST('doc_ref', 'alpha');
|
||||
$object->code_journal = $journal_code;
|
||||
$object->journal_label = $journal_label;
|
||||
$object->fk_doc = GETPOSTINT('fk_doc');
|
||||
$object->fk_docdet = GETPOSTINT('fk_docdet');
|
||||
|
||||
if (floatval($debit) != 0.0) {
|
||||
$object->montant = $debit; // deprecated
|
||||
$object->amount = $debit;
|
||||
$object->sens = 'D';
|
||||
// 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($credit) != 0.0) {
|
||||
$object->montant = $credit; // deprecated
|
||||
$object->amount = $credit;
|
||||
$object->sens = 'C';
|
||||
}
|
||||
|
||||
$result = $object->createStd($user, false, $mode);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
if ($mode != '_tmp') {
|
||||
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
||||
}
|
||||
|
||||
$debit = 0;
|
||||
$credit = 0;
|
||||
|
||||
if ((floatval($debit[$key]) != 0.0) && (floatval($credit[$key]) != 0.0)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if (empty($accountingaccount_number[$key]) || $accountingaccount_number[$key] == '-1') {
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$object = new BookKeeping($db);
|
||||
$object->numero_compte = $accountingaccount_number[$key];
|
||||
$object->subledger_account = $subledger_account[$key];
|
||||
$object->subledger_label = $subledger_label[$key];
|
||||
$object->label_compte = $accountingaccount_label[$key];
|
||||
$object->label_operation = $label_operation[$key];
|
||||
$object->debit = price2num($debit[$key]);
|
||||
$object->credit = price2num($credit[$key]);
|
||||
$object->doc_date = $doc_date;
|
||||
$object->doc_type = (string) GETPOST('doc_type', 'alpha');
|
||||
$object->piece_num = $piece_num;
|
||||
$object->doc_ref = $doc_ref;
|
||||
$object->code_journal = $journal_code;
|
||||
$object->journal_label = $journal_label;
|
||||
$object->fk_doc = GETPOSTINT('fk_doc');
|
||||
$object->fk_docdet = GETPOSTINT('fk_docdet');
|
||||
|
||||
if (floatval($debit[$key]) != 0.0) {
|
||||
$object->montant = $object->debit; // deprecated
|
||||
$object->amount = $object->debit;
|
||||
$object->sens = 'D';
|
||||
}
|
||||
|
||||
if (floatval($credit[$key]) != 0.0) {
|
||||
$object->montant = $object->credit; // deprecated
|
||||
$object->amount = $object->credit;
|
||||
$object->sens = 'C';
|
||||
}
|
||||
|
||||
$result = $object->createStd($user, false, $mode);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (empty($error)) {
|
||||
if ($mode != '_tmp') {
|
||||
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
||||
}
|
||||
$debit = 0;
|
||||
$credit = 0;
|
||||
|
||||
$action = $action == 'add' ? '' : $action ; // stay in valid mode when not adding line
|
||||
}
|
||||
} elseif ($action == "confirm_delete") {
|
||||
$object = new BookKeeping($db);
|
||||
@ -230,17 +255,28 @@ if ($action == "confirm_update") {
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
} elseif ($action == "confirm_create") {
|
||||
} elseif ($action == 'create') {
|
||||
$error = 0;
|
||||
|
||||
$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') {
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors');
|
||||
$action = 'create';
|
||||
$error++;
|
||||
}
|
||||
if (!GETPOST('doc_ref', 'alpha')) {
|
||||
if (empty($doc_ref)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Piece")), null, 'errors');
|
||||
$action = 'create';
|
||||
$error++;
|
||||
@ -252,8 +288,8 @@ if ($action == "confirm_update") {
|
||||
$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_type = GETPOST('doc_type', 'alpha');
|
||||
$object->piece_num = GETPOST('next_num_mvt', 'alpha');
|
||||
$object->doc_ref = GETPOST('doc_ref', 'alpha');
|
||||
$object->piece_num = $next_num_mvt;
|
||||
$object->doc_ref = $doc_ref;
|
||||
$object->code_journal = $journal_code;
|
||||
$object->journal_label = $journal_label;
|
||||
$object->fk_doc = 0;
|
||||
@ -302,7 +338,7 @@ if ($action == 'setjournal') {
|
||||
}
|
||||
|
||||
if ($action == 'setdocref') {
|
||||
$refdoc = GETPOST('doc_ref', 'alpha');
|
||||
$refdoc = $doc_ref;
|
||||
$result = $object->updateByMvt($piece_num, 'doc_ref', $refdoc, $mode);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@ -333,7 +369,7 @@ if ($action == 'valid') {
|
||||
$html = new Form($db);
|
||||
$formaccounting = new FormAccounting($db);
|
||||
|
||||
$title = $langs->trans("CreateMvts");
|
||||
$title = $langs->trans($mode =="_tmp" ? "CreateMvts": "UpdateMvts");
|
||||
|
||||
llxHeader('', $title);
|
||||
|
||||
@ -343,28 +379,37 @@ if ($action == 'delete') {
|
||||
print $formconfirm;
|
||||
}
|
||||
|
||||
if ($action == 'create') {
|
||||
print load_fiche_titre($title);
|
||||
|
||||
$object = new BookKeeping($db);
|
||||
$next_num_mvt = $object->getNextNumMvt('_tmp');
|
||||
$object = new BookKeeping($db);
|
||||
$result = $object->fetchPerMvt($piece_num, $mode);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
if (empty($next_num_mvt)) {
|
||||
dol_print_error('', 'Failed to get next piece number');
|
||||
if (!empty($object->piece_num)) {
|
||||
$backlink = '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?restore_lastsearch_values=1">'.$langs->trans('BackToList').'</a>';
|
||||
|
||||
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();
|
||||
$h = 0;
|
||||
$head[$h][0] = $_SERVER['PHP_SELF'].'?piece_num='.$object->piece_num.($mode ? '&mode='.$mode : '');
|
||||
$head[$h][1] = $langs->trans("Transaction");
|
||||
$head[$h][2] = 'transaction';
|
||||
$h++;
|
||||
|
||||
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($head, 'transaction', '', -1);
|
||||
|
||||
print dol_get_fiche_head();
|
||||
//dol_banner_tab($object, '', $backlink);
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
/*print '<tr>';
|
||||
print '<td class="titlefieldcreate fieldrequired">' . $langs->trans("NumPiece") . '</td>';
|
||||
@ -374,7 +419,7 @@ if ($action == 'create') {
|
||||
print '<tr>';
|
||||
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Docdate").'</td>';
|
||||
print '<td>';
|
||||
print $html->selectDate('', 'doc_date', '', '', '', "create_mvt", 1, 1);
|
||||
print $html->selectDate($doc_date, 'doc_date', '', '', '', "create_mvt", 1, 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -385,294 +430,218 @@ if ($action == 'create') {
|
||||
|
||||
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 '<td><input type="text" class="minwidth200" name="doc_ref" value="'.$doc_ref.'" /></td>';
|
||||
print '</tr>';
|
||||
|
||||
/*
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans("Doctype") . '</td>';
|
||||
print '<td><input type="text" class="minwidth200 name="doc_type" value=""/></td>';
|
||||
print '<td><input type="text" class="minwidth200 name="doc_type" value="" /></td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
print '</table>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
print '</div>';
|
||||
|
||||
print $form->buttonsSaveCancel("Create");
|
||||
print '<div class="fichehalfright">';
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
$object = new BookKeeping($db);
|
||||
$result = $object->fetchPerMvt($piece_num, $mode);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
// Doc type
|
||||
if (!empty($object->doc_type)) {
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("Doctype").'</td>';
|
||||
print '<td>'.$object->doc_type.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if (!empty($object->piece_num)) {
|
||||
$backlink = '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?restore_lastsearch_values=1">'.$langs->trans('BackToList').'</a>';
|
||||
// Date document creation
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("DateCreation").'</td>';
|
||||
print '<td>';
|
||||
print $object->date_creation ? dol_print_date($object->date_creation, 'day') : ' ';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print load_fiche_titre($langs->trans("UpdateMvts"), $backlink);
|
||||
|
||||
$head = array();
|
||||
$h = 0;
|
||||
$head[$h][0] = $_SERVER['PHP_SELF'].'?piece_num='.$object->piece_num.($mode ? '&mode='.$mode : '');
|
||||
$head[$h][1] = $langs->trans("Transaction");
|
||||
$head[$h][2] = 'transaction';
|
||||
$h++;
|
||||
|
||||
print dol_get_fiche_head($head, 'transaction', '', -1);
|
||||
|
||||
//dol_banner_tab($object, '', $backlink);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
// Account movement
|
||||
// Don't show in tmp mode, inevitably empty
|
||||
if ($mode != "_tmp") {
|
||||
// Date document export
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("NumMvts").'</td>';
|
||||
print '<td>'.($mode == '_tmp' ? '<span class="opacitymedium" title="Id tmp '.$object->piece_num.'">'.$langs->trans("Draft").'</span>' : $object->piece_num).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// 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') : ' ';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Journal
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><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>';
|
||||
|
||||
// Ref document
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><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 '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<div class="fichehalfright">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
// Doc type
|
||||
if (!empty($object->doc_type)) {
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("Doctype").'</td>';
|
||||
print '<td>'.$object->doc_type.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Date document creation
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("DateCreation").'</td>';
|
||||
print '<td class="titlefield">'.$langs->trans("DateExport").'</td>';
|
||||
print '<td>';
|
||||
print $object->date_creation ? dol_print_date($object->date_creation, 'day') : ' ';
|
||||
print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' ';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// 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') : ' ';
|
||||
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') : ' ';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Validate
|
||||
/*
|
||||
// Date document validation
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">' . $langs->trans("Status") . '</td>';
|
||||
print '<td class="titlefield">'.$langs->trans("DateValidation").'</td>';
|
||||
print '<td>';
|
||||
if (empty($object->validated)) {
|
||||
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $line->id . '&action=enable&token='.newToken().'">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a>';
|
||||
} else {
|
||||
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $line->id . '&action=disable&token='.newToken().'">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' ';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
}
|
||||
// Validate
|
||||
/*
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">' . $langs->trans("Status") . '</td>';
|
||||
print '<td>';
|
||||
if (empty($object->validated)) {
|
||||
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $line->id . '&action=enable&token='.newToken().'">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a>';
|
||||
} else {
|
||||
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $line->id . '&action=disable&token='.newToken().'">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
// check data
|
||||
/*
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">' . $langs->trans("Control") . '</td>';
|
||||
if ($object->doc_type == 'customer_invoice')
|
||||
{
|
||||
$sqlmid = 'SELECT rowid as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."facture as fac";
|
||||
$sqlmid .= " WHERE fac.rowid=" . ((int) $object->fk_doc);
|
||||
dol_syslog("accountancy/bookkeeping/card.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||
$resultmid = $db->query($sqlmid);
|
||||
if ($resultmid) {
|
||||
$objmid = $db->fetch_object($resultmid);
|
||||
$invoicestatic = new Facture($db);
|
||||
$invoicestatic->fetch($objmid->ref);
|
||||
$ref=$langs->trans("Invoice").' '.$invoicestatic->getNomUrl(1);
|
||||
}
|
||||
else dol_print_error($db);
|
||||
}
|
||||
print '<td>' . $ref .'</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
print "</table>\n";
|
||||
|
||||
print '</div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
$result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
/*
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">' . $langs->trans("Control") . '</td>';
|
||||
if ($object->doc_type == 'customer_invoice') {
|
||||
$sqlmid = 'SELECT rowid as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."facture as fac";
|
||||
$sqlmid .= " WHERE fac.rowid=" . ((int) $object->fk_doc);
|
||||
dol_syslog("accountancy/bookkeeping/card.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||
$resultmid = $db->query($sqlmid);
|
||||
if ($resultmid) {
|
||||
$objmid = $db->fetch_object($resultmid);
|
||||
$invoicestatic = new Facture($db);
|
||||
$invoicestatic->fetch($objmid->ref);
|
||||
$ref=$langs->trans("Invoice").' '.$invoicestatic->getNomUrl(1);
|
||||
} else {
|
||||
// List of movements
|
||||
print load_fiche_titre($langs->trans("ListeMvts"), '', '');
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
print '<td>' . $ref .'</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
print "</table>\n";
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?piece_num='.$object->piece_num.'" method="post">';
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print dol_get_fiche_end();
|
||||
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
$result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
// List of movements
|
||||
print load_fiche_titre($langs->trans("ListeMvts"), '', '');
|
||||
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'" />';
|
||||
}
|
||||
|
||||
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="fk_doc" value="'.$object->fk_doc.'" />'."\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) {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
$total_debit = 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') : ' ';
|
||||
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') : ' ';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
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="doc_type" value="'.$object->doc_type.'">'."\n";
|
||||
print '<input type="hidden" name="doc_ref" value="'.$object->doc_ref.'">'."\n";
|
||||
print '<input type="hidden" name="code_journal" value="'.$object->code_journal.'">'."\n";
|
||||
print '<input type="hidden" name="fk_doc" value="'.$object->fk_doc.'">'."\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) {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
$total_debit = 0;
|
||||
$total_credit = 0;
|
||||
print_liste_field_titre("AccountAccountingShort");
|
||||
print_liste_field_titre("SubledgerAccount");
|
||||
print_liste_field_titre("LabelOperation");
|
||||
print_liste_field_titre("AccountingDebit", "", "", "", "", 'class="right"');
|
||||
print_liste_field_titre("AccountingCredit", "", "", "", "", 'class="right"');
|
||||
if (empty($object->date_validation)) {
|
||||
print_liste_field_titre("Action", "", "", "", "", 'width="60"', "", "", 'center ');
|
||||
} else {
|
||||
print_liste_field_titre("");
|
||||
}
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print "</tr>\n";
|
||||
|
||||
print_liste_field_titre("AccountAccountingShort");
|
||||
print_liste_field_titre("SubledgerAccount");
|
||||
print_liste_field_titre("LabelOperation");
|
||||
print_liste_field_titre("AccountingDebit", "", "", "", "", 'class="right"');
|
||||
print_liste_field_titre("AccountingCredit", "", "", "", "", 'class="right"');
|
||||
if (empty($object->date_validation)) {
|
||||
print_liste_field_titre("Action", "", "", "", "", 'width="60"', "", "", 'center ');
|
||||
} else {
|
||||
print_liste_field_titre("");
|
||||
}
|
||||
// In _tmp mode the first line is empty so we remove it
|
||||
if ($mode == "_tmp") {
|
||||
array_shift($object->linesmvt);
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
// Add an empty line at the end to be able to add transaction
|
||||
$line = new BookKeepingLine();
|
||||
$object->linesmvt[] = $line;
|
||||
|
||||
// Add an empty line if there is not yet
|
||||
if (!empty($object->linesmvt[0])) {
|
||||
$tmpline = $object->linesmvt[0];
|
||||
if (!empty($tmpline->numero_compte)) {
|
||||
$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();
|
||||
$object->linesmvt[] = $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).'">';
|
||||
$total_debit += $line->debit;
|
||||
$total_credit += $line->credit;
|
||||
|
||||
if ($action == 'update' && $line->id == $id) {
|
||||
print '<!-- td columns in edit mode -->';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, '');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because:
|
||||
// It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases.
|
||||
// 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.
|
||||
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');
|
||||
} 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")).'" />';
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($object->linesmvt as $line) {
|
||||
print '<tr class="oddeven" data-lineid="'.((int) $line->id).'">';
|
||||
$total_debit += $line->debit;
|
||||
$total_credit += $line->credit;
|
||||
|
||||
if ($action == 'update' && $line->id == $id) {
|
||||
print '<!-- td columns in edit mode -->';
|
||||
// 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 '</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="credit" value="'.(GETPOSTISSET("credit") ? GETPOST("credit", "alpha") : price($line->credit)).'" /></td>';
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="id" value="'.$line->id.'" />'."\n";
|
||||
print '<input type="submit" class="button" name="update" value="'.$langs->trans("Update").'" />';
|
||||
print '</td>';
|
||||
} elseif (empty($line->numero_compte) || (empty($line->debit) && empty($line->credit))) {
|
||||
if ($action == "" || $action == 'add') {
|
||||
print '<!-- td columns in add mode -->';
|
||||
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((is_array($accountingaccount_number) ? $accountingaccount_number[$key] : $accountingaccount_number ), 'accountingaccount_number['.$key.']', 1, array(), 1, 1, '');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because:
|
||||
@ -680,124 +649,102 @@ if ($action == 'create') {
|
||||
// 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.
|
||||
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((is_array($subledger_account) ? $subledger_account[$key] : $subledger_account ), 'subledger_account['.$key.']', 1, 'maxwidth250', '', 'subledger_label');
|
||||
} 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['.$key.']" value="' . (is_array($subledger_account) ? $subledger_account[$key] : $subledger_account ) . '" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccount")) . '" />';
|
||||
}
|
||||
// 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['.$key.']" value="' . (is_array($subledger_label) ? $subledger_label[$key] : $subledger_label ) . '" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccountLabel")) . '" />';
|
||||
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 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>';
|
||||
print '<input type="hidden" name="id" value="'.$line->id.'">'."\n";
|
||||
print '<input type="submit" class="button" name="update" value="'.$langs->trans("Update").'">';
|
||||
print '</td>';
|
||||
} elseif (empty($line->numero_compte) || (empty($line->debit) && empty($line->credit))) {
|
||||
if ($action == "" || $action == 'add') {
|
||||
print '<!-- td columns in add mode -->';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because:
|
||||
// It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases.
|
||||
// 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.
|
||||
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
|
||||
print $formaccounting->select_auxaccount('', 'subledger_account', 1, 'maxwidth250', '', 'subledger_label');
|
||||
} else {
|
||||
print '<input type="text" class="maxwidth150" name="subledger_account" value="" 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 '</td>';
|
||||
print '<td><input type="text" class="minwidth200" name="label_operation" value="' . $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="credit" value=""/></td>';
|
||||
print '<td class="center"><input type="submit" class="button small" name="save" value="' . $langs->trans("Add") . '"></td>';
|
||||
}
|
||||
} else {
|
||||
print '<!-- td columns in display mode -->';
|
||||
$resultfetch = $accountingaccount->fetch(null, $line->numero_compte, true);
|
||||
print '<td>';
|
||||
if ($resultfetch > 0) {
|
||||
print $accountingaccount->getNomUrl(0, 1, 1, '', 0);
|
||||
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['.$key.']" value="' . (is_array($debit) ? $debit[$key] : $debit ) . '" /></td>';
|
||||
print '<td class="right"><input type="text" size="6" class="right" name="credit['.$key.']" value="' . (is_array($credit) ? $credit[$key] : $credit ) . '" /></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 $line->numero_compte.' <span class="warning">('.$langs->trans("AccountRemovedFromCurrentChartOfAccount").')</span>';
|
||||
print '<td class="right"></td>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.length_accounta($line->subledger_account);
|
||||
if ($line->subledger_label) {
|
||||
print ' - <span class="opacitymedium">'.$line->subledger_label.'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.$line->label_operation.'</td>';
|
||||
print '<td class="right nowraponall amount">'.($line->debit != 0 ? price($line->debit) : '').'</td>';
|
||||
print '<td class="right nowraponall amount">'.($line->credit != 0 ? price($line->credit) : '').'</td>';
|
||||
|
||||
print '<td class="center nowraponall">';
|
||||
if (empty($line->date_export) && empty($line->date_validation)) {
|
||||
print '<a class="editfielda reposition" href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">';
|
||||
print img_edit('', 0, 'class="marginrightonly"');
|
||||
print '</a> ';
|
||||
} else {
|
||||
print '<a class="editfielda nohover cursornotallowed reposition disabled" href="#" title="'.dol_escape_htmltag($langs->trans("ForbiddenTransactionAlreadyExported")).'">';
|
||||
print img_edit($langs->trans("ForbiddenTransactionAlreadyExported"), 0, 'class="marginrightonly"');
|
||||
print '</a> ';
|
||||
}
|
||||
|
||||
if (empty($line->date_validation)) {
|
||||
$actiontodelete = 'delete';
|
||||
if ($mode == '_tmp' || $action != 'delmouv') {
|
||||
$actiontodelete = 'confirm_delete';
|
||||
}
|
||||
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=' . $actiontodelete . '&id=' . $line->id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">';
|
||||
print img_delete();
|
||||
print '</a>';
|
||||
} else {
|
||||
print '<a class="editfielda nohover cursornotallowed disabled" href="#" title="'.dol_escape_htmltag($langs->trans("ForbiddenTransactionAlreadyExported")).'">';
|
||||
print img_delete($langs->trans("ForbiddenTransactionAlreadyValidated"));
|
||||
print '</a>';
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
$total_debit = price2num($total_debit, 'MT');
|
||||
$total_credit = price2num($total_credit, 'MT');
|
||||
|
||||
if ($total_debit != $total_credit) {
|
||||
setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_debit, $total_credit)), 'warnings');
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
if ($mode == '_tmp' && $action == '') {
|
||||
print '<br>';
|
||||
print '<div class="center">';
|
||||
if ($total_debit == $total_credit) {
|
||||
print '<a class="button" href="'.$_SERVER["PHP_SELF"].'?piece_num='.$object->piece_num.'&action=valid">'.$langs->trans("ValidTransaction").'</a>';
|
||||
} else {
|
||||
print '<!-- td columns in display mode -->';
|
||||
$resultfetch = $accountingaccount->fetch(null, $line->numero_compte, true);
|
||||
print '<td>';
|
||||
if ($resultfetch > 0) {
|
||||
print $accountingaccount->getNomUrl(0, 1, 1, '', 0);
|
||||
} 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 $line->numero_compte.' <span class="warning">('.$langs->trans("AccountRemovedFromCurrentChartOfAccount").')</span>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.length_accounta($line->subledger_account);
|
||||
if ($line->subledger_label) {
|
||||
print ' - <span class="opacitymedium">'.$line->subledger_label.'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.$line->label_operation.'</td>';
|
||||
print '<td class="right nowraponall amount">'.($line->debit != 0 ? price($line->debit) : '').'</td>';
|
||||
print '<td class="right nowraponall amount">'.($line->credit != 0 ? price($line->credit) : '').'</td>';
|
||||
|
||||
print '<td class="center nowraponall">';
|
||||
if (empty($line->date_export) && empty($line->date_validation)) {
|
||||
print '<a class="editfielda reposition" href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">';
|
||||
print img_edit('', 0, 'class="marginrightonly"');
|
||||
print '</a> ';
|
||||
} else {
|
||||
print '<a class="editfielda nohover cursornotallowed reposition disabled" href="#" title="'.dol_escape_htmltag($langs->trans("ForbiddenTransactionAlreadyExported")).'">';
|
||||
print img_edit($langs->trans("ForbiddenTransactionAlreadyExported"), 0, 'class="marginrightonly"');
|
||||
print '</a> ';
|
||||
}
|
||||
|
||||
print ' ';
|
||||
print '<a class="button button-cancel" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">'.$langs->trans("Cancel").'</a>';
|
||||
if (empty($line->date_validation)) {
|
||||
$actiontodelete = 'delete';
|
||||
if ($mode == '_tmp' || $action != 'delmouv') {
|
||||
$actiontodelete = 'confirm_delete';
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=' . $actiontodelete . '&id=' . $line->id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">';
|
||||
print img_delete();
|
||||
print '</a>';
|
||||
} else {
|
||||
print '<a class="editfielda nohover cursornotallowed disabled" href="#" title="'.dol_escape_htmltag($langs->trans("ForbiddenTransactionAlreadyExported")).'">';
|
||||
print img_delete($langs->trans("ForbiddenTransactionAlreadyValidated"));
|
||||
print '</a>';
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
$total_debit = price2num($total_debit, 'MT');
|
||||
$total_credit = price2num($total_credit, 'MT');
|
||||
|
||||
if ($total_debit != $total_credit) {
|
||||
setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_debit, $total_credit)), 'warnings');
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
if ($mode == '_tmp' && $action == '') {
|
||||
print '<br>';
|
||||
print '<div class="center">';
|
||||
if ($total_debit == $total_credit) {
|
||||
print '<input type="submit" class="button" name="validate" value="' . $langs->trans("ValidTransaction") . '" />';
|
||||
} 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 ' ';
|
||||
print '<a class="button button-cancel" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">'.$langs->trans("Cancel").'</a>';
|
||||
|
||||
print "</div>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print load_fiche_titre($langs->trans("NoRecords"));
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
} else {
|
||||
print load_fiche_titre($langs->trans("NoRecords"));
|
||||
}
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
@ -2,8 +2,10 @@
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* 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) 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
|
||||
* 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';
|
||||
}
|
||||
|
||||
$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');
|
||||
if ($search_accountancy_code_start == - 1) {
|
||||
$search_accountancy_code_start = '';
|
||||
@ -253,6 +257,7 @@ if (empty($reshook)) {
|
||||
$search_doc_type = '';
|
||||
$search_doc_ref = '';
|
||||
$search_doc_date = '';
|
||||
$search_account_category = '';
|
||||
$search_accountancy_code = '';
|
||||
$search_accountancy_code_start = '';
|
||||
$search_accountancy_code_end = '';
|
||||
@ -335,6 +340,20 @@ if (empty($reshook)) {
|
||||
$filter['t.doc_ref'] = $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)) {
|
||||
$filter['t.numero_compte'] = $search_accountancy_code;
|
||||
$param .= '&search_accountancy_code='.urlencode($search_accountancy_code);
|
||||
@ -642,6 +661,9 @@ $sql .= " t.tms as date_modification,";
|
||||
$sql .= " t.date_export,";
|
||||
$sql .= " t.date_validated as date_validation,";
|
||||
$sql .= " t.import_key";
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t';
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
@ -672,7 +694,13 @@ if (count($filter) > 0) {
|
||||
} elseif ($key == 't.reconciled_option') {
|
||||
$sqlwhere[] = 't.lettering_code IS NULL';
|
||||
} elseif ($key == 't.code_journal' && !empty($value)) {
|
||||
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
|
||||
if (is_array($value)) {
|
||||
$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 {
|
||||
$sqlwhere[] = natural_search($key, $value, 0, 1);
|
||||
}
|
||||
@ -685,9 +713,6 @@ if (empty($conf->global->ACCOUNTING_REEXPORT)) {
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' AND '.implode(' AND ', $sqlwhere);
|
||||
}
|
||||
if (!empty($sortfield)) {
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
}
|
||||
//print $sql;
|
||||
|
||||
|
||||
@ -715,58 +740,62 @@ 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');
|
||||
$notifiedvalidationdate = GETPOST('notifiedvalidationdate', 'alpha');
|
||||
$withAttachment = !empty(trim(GETPOST('notifiedexportfull', 'alphanohtml'))) ? 1 : 0;
|
||||
|
||||
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;
|
||||
$db->begin();
|
||||
// Output data on screen or download
|
||||
$result = $accountancyexport->export($object->lines, $formatexportset, $withAttachment);
|
||||
|
||||
if (is_array($object->lines)) {
|
||||
foreach ($object->lines as $movement) {
|
||||
$now = dol_now();
|
||||
$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();
|
||||
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||
$sql .= " SET";
|
||||
if (!empty($notifiedexportdate) && !empty($notifiedvalidationdate)) {
|
||||
$sql .= " date_export = '".$db->idate($now)."'";
|
||||
$sql .= ", date_validated = '".$db->idate($now)."'";
|
||||
} elseif (!empty($notifiedexportdate)) {
|
||||
$sql .= " date_export = '".$db->idate($now)."'";
|
||||
} elseif (!empty($notifiedvalidationdate)) {
|
||||
$sql .= " date_validated = '".$db->idate($now)."'";
|
||||
foreach ($object->lines as $movement) {
|
||||
$now = dol_now();
|
||||
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||
$sql .= " SET";
|
||||
if (!empty($notifiedexportdate) && !empty($notifiedvalidationdate)) {
|
||||
$sql .= " date_export = '".$db->idate($now)."'";
|
||||
$sql .= ", date_validated = '".$db->idate($now)."'";
|
||||
} elseif (!empty($notifiedexportdate)) {
|
||||
$sql .= " date_export = '".$db->idate($now)."'";
|
||||
} elseif (!empty($notifiedvalidationdate)) {
|
||||
$sql .= " date_validated = '".$db->idate($now)."'";
|
||||
}
|
||||
$sql .= " WHERE rowid = ".((int) $movement->id);
|
||||
|
||||
dol_syslog("/accountancy/bookkeeping/list.php Function export_file Specify movements as exported", LOG_DEBUG);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$sql .= " WHERE rowid = ".((int) $movement->id);
|
||||
|
||||
dol_syslog("/accountancy/bookkeeping/list.php Function export_file Specify movements as exported", LOG_DEBUG);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
} else {
|
||||
$error++;
|
||||
break;
|
||||
$accountancyexport->errors[] = $langs->trans('NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated');
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
} else {
|
||||
$error++;
|
||||
$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,28 +812,38 @@ $title_page = $langs->trans("Operations").' - '.$langs->trans("Journals");
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$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;
|
||||
$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) {
|
||||
$num = $nbtotalofrecords;
|
||||
} else {
|
||||
|
||||
// Complete request and execute it with limit
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
|
||||
// Output page
|
||||
@ -854,7 +893,17 @@ if ($action == 'export_file') {
|
||||
$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') {
|
||||
@ -997,15 +1046,25 @@ if ($massactionbutton && $contextpage != 'poslist') {
|
||||
}
|
||||
|
||||
$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();
|
||||
$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)) {
|
||||
$moreforfilter .= $hookmanager->resPrint;
|
||||
} else {
|
||||
$moreforfilter = $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
print '</div>';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste centpercent">';
|
||||
|
||||
@ -1511,6 +1570,16 @@ while ($i < min($num, $limit)) {
|
||||
// Show total line
|
||||
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);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
@ -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_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');
|
||||
if ($search_accountancy_code_start == - 1) {
|
||||
$search_accountancy_code_start = '';
|
||||
@ -198,6 +199,8 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
||||
/*
|
||||
* 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
|
||||
$search_doc_date = '';
|
||||
$search_accountancy_code = '';
|
||||
$search_account_category = '';
|
||||
$search_accountancy_code_start = '';
|
||||
$search_accountancy_code_end = '';
|
||||
$search_label_account = '';
|
||||
@ -280,6 +283,20 @@ if (empty($reshook)) {
|
||||
$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 ($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 ($type == 'sub') {
|
||||
$filter['t.subledger_account>='] = $search_accountancy_code_start;
|
||||
@ -358,7 +375,6 @@ if (empty($reshook)) {
|
||||
$filter['t.import_key'] = $search_import_key;
|
||||
$param .= '&search_import_key='.urlencode($search_import_key);
|
||||
}
|
||||
|
||||
// param with type of list
|
||||
$url_param = substr($param, 1); // remove first "&"
|
||||
if (!empty($type)) {
|
||||
@ -544,25 +560,29 @@ llxHeader('', $title_page);
|
||||
// List
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
// TODO Perf Replace this by a count
|
||||
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 {
|
||||
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter);
|
||||
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 0, 1);
|
||||
}
|
||||
|
||||
if ($nbtotalofrecords < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($type == 'sub') {
|
||||
$result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 1);
|
||||
} else {
|
||||
$result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter);
|
||||
}
|
||||
if (!$error) {
|
||||
if ($type == 'sub') {
|
||||
$result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 1);
|
||||
} else {
|
||||
$result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 0);
|
||||
}
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
@ -711,7 +731,7 @@ if ($type == 'sub') {
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
// Accountancy account
|
||||
// Search on accountancy custom groups or account
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('AccountAccounting').': ';
|
||||
$moreforfilter .= '<div class="nowrap inline-block">';
|
||||
@ -729,6 +749,13 @@ if ($type == 'sub') {
|
||||
$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();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) {
|
||||
@ -935,8 +962,8 @@ while ($i < min($num, $limit)) {
|
||||
} else {
|
||||
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($sous_total_credit).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($sous_total_debit, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($sous_total_credit, 'MT')).'</td>';
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
print '</tr>';
|
||||
// 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>';
|
||||
if ($balance > 0) {
|
||||
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></td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
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 colspan="'.$colspanend.'"></td>';
|
||||
@ -1206,8 +1233,8 @@ while ($i < min($num, $limit)) {
|
||||
if ($num > 0 && $colspan > 0) {
|
||||
print '<tr class="liste_total">';
|
||||
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($sous_total_credit).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($sous_total_debit, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($sous_total_credit, 'MT')).'</td>';
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
print '</tr>';
|
||||
// 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>';
|
||||
if ($balance > 0) {
|
||||
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></td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
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 colspan="'.$colspanend.'"></td>';
|
||||
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
|
||||
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);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
@ -353,7 +353,7 @@ class AccountancyCategory // extends CommonObject
|
||||
$sql .= " formula=".(isset($this->formula) ? "'".$this->db->escape($this->formula)."'" : "null").",";
|
||||
$sql .= " position=".(isset($this->position) ? $this->position : "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);
|
||||
|
||||
$this->db->begin();
|
||||
@ -446,7 +446,7 @@ class AccountancyCategory // extends CommonObject
|
||||
} else {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
$this->errors[] = $this->error;
|
||||
dol_syslog(__METHOD__." ".implode(','.$this->errors), LOG_ERR);
|
||||
dol_syslog(__METHOD__." ".implode(',', $this->errors), LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -488,7 +488,7 @@ class AccountancyCategory // extends CommonObject
|
||||
} else {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
$this->errors[] = $this->error;
|
||||
dol_syslog(__METHOD__." ".implode(','.$this->errors), LOG_ERR);
|
||||
dol_syslog(__METHOD__." ".implode(',', $this->errors), LOG_ERR);
|
||||
|
||||
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
|
||||
*
|
||||
@ -678,6 +624,22 @@ class AccountancyCategory // extends CommonObject
|
||||
$this->sdc = 0;
|
||||
$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";
|
||||
if (is_array($cpt)) {
|
||||
$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';
|
||||
$sql .= " WHERE t.entity = ".$conf->entity;
|
||||
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).")";
|
||||
} else {
|
||||
$sql .= " AND t.numero_compte = '".$this->db->escape($cpt)."'";
|
||||
@ -709,22 +664,28 @@ class AccountancyCategory // extends CommonObject
|
||||
if (is_array($cpt)) {
|
||||
$sql .= " GROUP BY t.numero_compte";
|
||||
}
|
||||
//print $sql;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($sens == 1) {
|
||||
$this->sdc = $obj->debit - $obj->credit;
|
||||
} else {
|
||||
$this->sdc = $obj->credit - $obj->debit;
|
||||
}
|
||||
if (is_array($cpt)) {
|
||||
$this->sdcperaccount[$obj->accountancy_account] = $this->sdc;
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
if ($sens == 1) {
|
||||
$this->sdc = $obj->debit - $obj->credit;
|
||||
} else {
|
||||
$this->sdc = $obj->credit - $obj->debit;
|
||||
}
|
||||
if (is_array($cpt)) {
|
||||
$this->sdcperaccount[$obj->accountancy_account] = $this->sdc;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $num;
|
||||
} else {
|
||||
$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.
|
||||
* For list + detail of accounting account, see getCatsCpt()
|
||||
*
|
||||
* @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups
|
||||
* @param int $active 1= active, 0=not active
|
||||
* @return array|int Array of groups or -1 if error
|
||||
* @see getCatsCpts(), getCptsCat()
|
||||
*/
|
||||
public function getCats($categorytype = -1, $active = 1)
|
||||
{
|
||||
@ -774,9 +798,10 @@ class AccountancyCategory // extends CommonObject
|
||||
'rowid' => $obj->rowid,
|
||||
'code' => $obj->code,
|
||||
'label' => $obj->label,
|
||||
'formula' => $obj->formula,
|
||||
'position' => $obj->position,
|
||||
'category_type' => $obj->category_type,
|
||||
'formula' => $obj->formula,
|
||||
'sens' => $obj->sens,
|
||||
'bc' => $obj->sens
|
||||
);
|
||||
$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)
|
||||
*
|
||||
* @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
|
||||
* @see getCats(), getCatsCpts()
|
||||
*/
|
||||
public function getCptsCat($cat_id, $predefinedgroupwhere = '')
|
||||
{
|
||||
|
||||
@ -5,13 +5,15 @@
|
||||
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||
* Copyright (C) 2016-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2016-2022 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) 2017 Elarifr. Ari Elbaz <github@accedinfo.com>
|
||||
* Copyright (C) 2017-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2017 André Schild <a.schild@aarboard.ch>
|
||||
* Copyright (C) 2020 Guillaume Alexandre <guillaume@tag-info.fr>
|
||||
* 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
|
||||
* 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/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
@ -313,9 +316,10 @@ class AccountancyExport
|
||||
*
|
||||
* @param array $TData Array with data
|
||||
* @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 $search_date_end; // Used into /accountancy/tpl/export_journal.tpl.php
|
||||
@ -325,8 +329,44 @@ class AccountancyExport
|
||||
$type_export = 'general_ledger';
|
||||
|
||||
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';
|
||||
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) {
|
||||
case self::$EXPORT_TYPE_CONFIGURABLE:
|
||||
@ -345,7 +385,7 @@ class AccountancyExport
|
||||
$this->exportCiel($TData);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_QUADRATUS:
|
||||
$this->exportQuadratus($TData);
|
||||
$archiveFileList = $this->exportQuadratus($TData, $exportFile, $archiveFileList, $withAttachment);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_WINFIC:
|
||||
$this->exportWinfic($TData);
|
||||
@ -399,6 +439,69 @@ class AccountancyExport
|
||||
}
|
||||
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 $line->piece_num.$separator;
|
||||
print length_accountg($line->numero_compte).$separator;
|
||||
print ''.$separator;
|
||||
print $separator;
|
||||
print $line->label_operation.$separator;
|
||||
print $date.$separator;
|
||||
if ($line->sens == 'D') {
|
||||
print price($line->debit).$separator;
|
||||
print ''.$separator;
|
||||
print $separator;
|
||||
} elseif ($line->sens == 'C') {
|
||||
print ''.$separator;
|
||||
print $separator;
|
||||
print price($line->credit).$separator;
|
||||
}
|
||||
print $line->doc_ref.$separator;
|
||||
@ -584,10 +687,13 @@ class AccountancyExport
|
||||
* Help : https://docplayer.fr/20769649-Fichier-d-entree-ascii-dans-quadracompta.html
|
||||
* In QuadraCompta | Use menu : "Outils" > "Suivi des dossiers" > "Import ASCII(Compta)"
|
||||
*
|
||||
* @param array $TData data
|
||||
* @return void
|
||||
* @param array $TData Data
|
||||
* @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;
|
||||
|
||||
@ -637,7 +743,11 @@ class AccountancyExport
|
||||
|
||||
$Tab['end_line'] = $end_line;
|
||||
|
||||
print implode($Tab);
|
||||
if ($exportFile) {
|
||||
fwrite($exportFile, implode($Tab));
|
||||
} else {
|
||||
print implode($Tab);
|
||||
}
|
||||
}
|
||||
|
||||
$Tab = array();
|
||||
@ -708,12 +818,63 @@ class AccountancyExport
|
||||
// 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'] = 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;
|
||||
|
||||
print implode($Tab);
|
||||
if ($exportFile) {
|
||||
fwrite($exportFile, implode($Tab));
|
||||
} else {
|
||||
print implode($Tab);
|
||||
}
|
||||
}
|
||||
|
||||
return $archiveFileList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -454,27 +454,12 @@ class AccountingJournal extends CommonObject
|
||||
}
|
||||
|
||||
$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 .= ", 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 .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation as ad";
|
||||
$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
|
||||
// Compatibility with Mysql 5.7
|
||||
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')";
|
||||
} elseif ($in_bookkeeping == 'notyet') {
|
||||
@ -488,11 +473,6 @@ class AccountingJournal extends CommonObject
|
||||
if (!empty($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";
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@ -817,56 +817,61 @@ 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 $sortfield Sort field
|
||||
* @param int $limit offset limit
|
||||
* @param int $offset offset limit
|
||||
* @param array $filter filter array
|
||||
* @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
|
||||
* @param string $sortorder Sort Order
|
||||
* @param string $sortfield Sort field
|
||||
* @param int $limit offset limit
|
||||
* @param int $offset offset limit
|
||||
* @param array $filter filter array
|
||||
* @param string $filtermode filter mode (AND or OR)
|
||||
* @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, 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;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$this->lines = array();
|
||||
$num = 0;
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
$sql .= " t.doc_date,";
|
||||
$sql .= " t.doc_type,";
|
||||
$sql .= " t.doc_ref,";
|
||||
$sql .= " t.fk_doc,";
|
||||
$sql .= " t.fk_docdet,";
|
||||
$sql .= " t.thirdparty_code,";
|
||||
$sql .= " t.subledger_account,";
|
||||
$sql .= " t.subledger_label,";
|
||||
$sql .= " t.numero_compte,";
|
||||
$sql .= " t.label_compte,";
|
||||
$sql .= " t.label_operation,";
|
||||
$sql .= " t.debit,";
|
||||
$sql .= " t.credit,";
|
||||
$sql .= " t.montant as amount,";
|
||||
$sql .= " t.sens,";
|
||||
$sql .= " t.multicurrency_amount,";
|
||||
$sql .= " t.multicurrency_code,";
|
||||
$sql .= " t.lettering_code,";
|
||||
$sql .= " t.date_lettering,";
|
||||
$sql .= " t.fk_user_author,";
|
||||
$sql .= " t.import_key,";
|
||||
$sql .= " t.code_journal,";
|
||||
$sql .= " t.journal_label,";
|
||||
$sql .= " t.piece_num,";
|
||||
$sql .= " t.date_creation,";
|
||||
$sql .= " t.date_export,";
|
||||
$sql .= " t.date_validated as date_validation,";
|
||||
$sql .= " t.import_key";
|
||||
if ($countonly) {
|
||||
$sql .= ' COUNT(t.rowid) as nb';
|
||||
} else {
|
||||
$sql .= ' t.rowid,';
|
||||
$sql .= " t.doc_date,";
|
||||
$sql .= " t.doc_type,";
|
||||
$sql .= " t.doc_ref,";
|
||||
$sql .= " t.fk_doc,";
|
||||
$sql .= " t.fk_docdet,";
|
||||
$sql .= " t.thirdparty_code,";
|
||||
$sql .= " t.subledger_account,";
|
||||
$sql .= " t.subledger_label,";
|
||||
$sql .= " t.numero_compte,";
|
||||
$sql .= " t.label_compte,";
|
||||
$sql .= " t.label_operation,";
|
||||
$sql .= " t.debit,";
|
||||
$sql .= " t.credit,";
|
||||
$sql .= " t.montant as amount,";
|
||||
$sql .= " t.sens,";
|
||||
$sql .= " t.multicurrency_amount,";
|
||||
$sql .= " t.multicurrency_code,";
|
||||
$sql .= " t.lettering_code,";
|
||||
$sql .= " t.date_lettering,";
|
||||
$sql .= " t.fk_user_author,";
|
||||
$sql .= " t.import_key,";
|
||||
$sql .= " t.code_journal,";
|
||||
$sql .= " t.journal_label,";
|
||||
$sql .= " t.piece_num,";
|
||||
$sql .= " t.date_creation,";
|
||||
$sql .= " t.date_export,";
|
||||
$sql .= " t.date_validated as date_validation,";
|
||||
$sql .= " t.import_key";
|
||||
}
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
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') {
|
||||
$sqlwhere[] = $key.'='.$value;
|
||||
} 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<=') {
|
||||
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
|
||||
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
|
||||
@ -897,18 +902,19 @@ class BookKeeping extends CommonObject
|
||||
} else {
|
||||
$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 {
|
||||
$sqlwhere[] = natural_search($key, $value, 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
$sql .= ' WHERE 1 = 1';
|
||||
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||
$sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere);
|
||||
}
|
||||
// Affichage par compte comptable
|
||||
// Filter by ledger account or subledger account
|
||||
if (!empty($option)) {
|
||||
$sql .= " AND t.subledger_account IS NOT NULL";
|
||||
$sql .= " AND t.subledger_account <> ''";
|
||||
@ -919,54 +925,63 @@ class BookKeeping extends CommonObject
|
||||
$sortorder = 'ASC'.($sortorder ? ','.$sortorder : '');
|
||||
}
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
if (!empty($limit)) {
|
||||
$sql .= $this->db->plimit($limit + 1, $offset);
|
||||
if (!$countonly) {
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
if (!empty($limit)) {
|
||||
$sql .= $this->db->plimit($limit + 1, $offset);
|
||||
}
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($countonly) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
$num = $obj->nb;
|
||||
}
|
||||
} else {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
$i = 0;
|
||||
while (($obj = $this->db->fetch_object($resql)) && (empty($limit) || $i < min($limit, $num))) {
|
||||
$line = new BookKeepingLine();
|
||||
$i = 0;
|
||||
while (($obj = $this->db->fetch_object($resql)) && (empty($limit) || $i < min($limit, $num))) {
|
||||
$line = new BookKeepingLine();
|
||||
|
||||
$line->id = $obj->rowid;
|
||||
$line->id = $obj->rowid;
|
||||
|
||||
$line->doc_date = $this->db->jdate($obj->doc_date);
|
||||
$line->doc_type = $obj->doc_type;
|
||||
$line->doc_ref = $obj->doc_ref;
|
||||
$line->fk_doc = $obj->fk_doc;
|
||||
$line->fk_docdet = $obj->fk_docdet;
|
||||
$line->thirdparty_code = $obj->thirdparty_code;
|
||||
$line->subledger_account = $obj->subledger_account;
|
||||
$line->subledger_label = $obj->subledger_label;
|
||||
$line->numero_compte = $obj->numero_compte;
|
||||
$line->label_compte = $obj->label_compte;
|
||||
$line->label_operation = $obj->label_operation;
|
||||
$line->debit = $obj->debit;
|
||||
$line->credit = $obj->credit;
|
||||
$line->montant = $obj->amount; // deprecated
|
||||
$line->amount = $obj->amount;
|
||||
$line->sens = $obj->sens;
|
||||
$line->multicurrency_amount = $obj->multicurrency_amount;
|
||||
$line->multicurrency_code = $obj->multicurrency_code;
|
||||
$line->lettering_code = $obj->lettering_code;
|
||||
$line->date_lettering = $obj->date_lettering;
|
||||
$line->fk_user_author = $obj->fk_user_author;
|
||||
$line->import_key = $obj->import_key;
|
||||
$line->code_journal = $obj->code_journal;
|
||||
$line->journal_label = $obj->journal_label;
|
||||
$line->piece_num = $obj->piece_num;
|
||||
$line->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$line->date_export = $this->db->jdate($obj->date_export);
|
||||
$line->date_validation = $this->db->jdate($obj->date_validation);
|
||||
$line->import_key = $obj->import_key;
|
||||
$line->doc_date = $this->db->jdate($obj->doc_date);
|
||||
$line->doc_type = $obj->doc_type;
|
||||
$line->doc_ref = $obj->doc_ref;
|
||||
$line->fk_doc = $obj->fk_doc;
|
||||
$line->fk_docdet = $obj->fk_docdet;
|
||||
$line->thirdparty_code = $obj->thirdparty_code;
|
||||
$line->subledger_account = $obj->subledger_account;
|
||||
$line->subledger_label = $obj->subledger_label;
|
||||
$line->numero_compte = $obj->numero_compte;
|
||||
$line->label_compte = $obj->label_compte;
|
||||
$line->label_operation = $obj->label_operation;
|
||||
$line->debit = $obj->debit;
|
||||
$line->credit = $obj->credit;
|
||||
$line->montant = $obj->amount; // deprecated
|
||||
$line->amount = $obj->amount;
|
||||
$line->sens = $obj->sens;
|
||||
$line->multicurrency_amount = $obj->multicurrency_amount;
|
||||
$line->multicurrency_code = $obj->multicurrency_code;
|
||||
$line->lettering_code = $obj->lettering_code;
|
||||
$line->date_lettering = $obj->date_lettering;
|
||||
$line->fk_user_author = $obj->fk_user_author;
|
||||
$line->import_key = $obj->import_key;
|
||||
$line->code_journal = $obj->code_journal;
|
||||
$line->journal_label = $obj->journal_label;
|
||||
$line->piece_num = $obj->piece_num;
|
||||
$line->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$line->date_export = $this->db->jdate($obj->date_export);
|
||||
$line->date_validation = $this->db->jdate($obj->date_validation);
|
||||
$line->import_key = $obj->import_key;
|
||||
|
||||
$this->lines[] = $line;
|
||||
$this->lines[] = $line;
|
||||
|
||||
$i++;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
|
||||
@ -529,6 +529,10 @@ if ($result) {
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
if ($num_lines == 0) {
|
||||
print '<tr><td colspan="12"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print "</div>";
|
||||
|
||||
|
||||
@ -749,6 +749,10 @@ if ($result) {
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
if ($num_lines == 0) {
|
||||
print '<tr><td colspan="13"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print "</div>";
|
||||
|
||||
|
||||
@ -427,6 +427,13 @@ if ($result) {
|
||||
print "</tr>";
|
||||
$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 "</div>";
|
||||
|
||||
@ -513,6 +513,9 @@ if ($result) {
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
if ($num_lines == 0) {
|
||||
print '<tr><td colspan="13"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print "</div>";
|
||||
|
||||
@ -793,7 +793,7 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
} 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';
|
||||
$lettering_static = new Lettering($db);
|
||||
$nb_lettering = $lettering_static->bookkeepingLetteringAll(array($bookkeeping->id));
|
||||
@ -1227,22 +1227,22 @@ if (empty($action) || $action == 'view') {
|
||||
$account_ledger = $k;
|
||||
// Try to force general ledger account depending on type
|
||||
if ($tabtype[$key] == 'payment') {
|
||||
$account_ledger = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||
$account_ledger = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER');
|
||||
}
|
||||
if ($tabtype[$key] == 'payment_supplier') {
|
||||
$account_ledger = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||
$account_ledger = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER');
|
||||
}
|
||||
if ($tabtype[$key] == 'payment_expensereport') {
|
||||
$account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
$account_ledger = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT');
|
||||
}
|
||||
if ($tabtype[$key] == 'payment_salary') {
|
||||
$account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
$account_ledger = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT');
|
||||
}
|
||||
if ($tabtype[$key] == 'payment_vat') {
|
||||
$account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT;
|
||||
$account_ledger = getDolGlobalString('ACCOUNTING_VAT_PAY_ACCOUNT');
|
||||
}
|
||||
if ($tabtype[$key] == 'member') {
|
||||
$account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT;
|
||||
$account_ledger = getDolGlobalString('ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT');
|
||||
}
|
||||
if ($tabtype[$key] == 'payment_various') {
|
||||
$account_ledger = $tabpay[$key]["account_various"];
|
||||
@ -1281,7 +1281,7 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
}
|
||||
print '<td class="maxwidth300" title="'.dol_escape_htmltag(dol_string_nohtmltag($accounttoshow)).'">';
|
||||
print $accounttoshow;
|
||||
print $accounttoshow; // This is a HTML string
|
||||
print "</td>";
|
||||
|
||||
// Subledger account
|
||||
@ -1310,7 +1310,7 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
}
|
||||
print '<td class="maxwidth300">';
|
||||
print $accounttoshowsubledger;
|
||||
print $accounttoshowsubledger; // This is a html string
|
||||
print "</td>";
|
||||
|
||||
print "<td>".$reflabel."</td>";
|
||||
|
||||
@ -376,7 +376,7 @@ if ($action == 'writebookkeeping') {
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
} 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';
|
||||
$lettering_static = new Lettering($db);
|
||||
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* 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 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* 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);
|
||||
}
|
||||
|
||||
$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 .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur,";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
@ -168,6 +168,7 @@ if ($result) {
|
||||
$tabht = array();
|
||||
$tabtva = array();
|
||||
$def_tva = array();
|
||||
$tabwarranty = array();
|
||||
$tabttc = array();
|
||||
$tablocaltax1 = array();
|
||||
$tablocaltax2 = array();
|
||||
@ -248,7 +249,13 @@ if ($result) {
|
||||
$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;
|
||||
if (empty($line->tva_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);
|
||||
|
||||
$accountingaccountcustomerwarranty = new AccountingAccount($db);
|
||||
|
||||
$accountingaccountcustomerwarranty->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY, true);
|
||||
|
||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||
$errorforline = 0;
|
||||
|
||||
@ -344,6 +355,55 @@ if ($action == 'writebookkeeping') {
|
||||
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
|
||||
if (!$errorforline) {
|
||||
foreach ($tabttc[$key] as $k => $mt) {
|
||||
@ -390,7 +450,7 @@ if ($action == 'writebookkeeping') {
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
} 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';
|
||||
$lettering_static = new Lettering($db);
|
||||
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
|
||||
@ -624,6 +684,25 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
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
|
||||
foreach ($tabttc[$key] as $k => $mt) {
|
||||
//if ($mt) {
|
||||
@ -849,6 +928,36 @@ if (empty($action) || $action == 'view') {
|
||||
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
|
||||
foreach ($tabttc[$key] as $k => $mt) {
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -558,6 +558,10 @@ if ($result) {
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
if ($num_lines == 0) {
|
||||
print '<tr><td colspan="13"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print "</div>";
|
||||
|
||||
|
||||
@ -777,6 +777,9 @@ if ($result) {
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
if ($num_lines == 0) {
|
||||
print '<tr><td colspan="14"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print "</div>";
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
/* 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) 2022 Progiseize <a.bisotti@progiseize.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -33,7 +35,9 @@ $siren = getDolGlobalString('MAIN_INFO_SIREN');
|
||||
$date_export = "_".dol_print_date(dol_now(), '%Y%m%d%H%M%S');
|
||||
$endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d');
|
||||
|
||||
header('Content-Type: text/csv');
|
||||
if (empty($withAttachment)) {
|
||||
header('Content-Type: text/csv');
|
||||
}
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
|
||||
$accountancyexport = new AccountancyExport($db);
|
||||
@ -66,4 +70,6 @@ if (($accountancyexport->getFormatCode($formatexportset) == 'fec' || $accountanc
|
||||
$completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format;
|
||||
}
|
||||
|
||||
header('Content-Disposition: attachment;filename='.$completefilename);
|
||||
if (empty($withAttachment)) {
|
||||
header('Content-Disposition: attachment;filename=' . $completefilename);
|
||||
}
|
||||
|
||||
@ -152,10 +152,13 @@ if ($action == 'set_default') {
|
||||
setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
|
||||
$db->commit();
|
||||
}
|
||||
}
|
||||
|
||||
// Action to update or add a constant
|
||||
if ($action == 'update' || $action == 'add') {
|
||||
} 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
|
||||
$constname = GETPOST('constname', 'alpha');
|
||||
$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');
|
||||
|
||||
$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 '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="updatemainoptions">';
|
||||
|
||||
@ -178,7 +178,7 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
|
||||
//print $langs->trans('FollowingLinksArePublic').'<br>';
|
||||
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>';
|
||||
if (isModEnabled('multicompany')) {
|
||||
$entity_qr = '?entity='.$conf->entity;
|
||||
$entity_qr = '?entity='.((int) $conf->entity);
|
||||
} else {
|
||||
$entity_qr = '';
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ if (GETPOST('actioncode', 'array')) {
|
||||
$actioncode = '0';
|
||||
}
|
||||
} 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');
|
||||
|
||||
|
||||
@ -112,34 +112,9 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
|
||||
$this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1);
|
||||
} else {
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@ -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>';
|
||||
}
|
||||
|
||||
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>';
|
||||
}
|
||||
|
||||
if ($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->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->hasRight('adherent', 'supprimer'));
|
||||
}
|
||||
|
||||
echo '</div><br>';
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012-2020 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* 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>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -305,23 +305,23 @@ if (empty($reshook)) {
|
||||
$object->phone = trim(GETPOST("phone", 'alpha'));
|
||||
$object->phone_perso = trim(GETPOST("phone_perso", 'alpha'));
|
||||
$object->phone_mobile = trim(GETPOST("phone_mobile", 'alpha'));
|
||||
$object->email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
|
||||
$object->url = trim(GETPOST('member_url', 'custom', 0, FILTER_SANITIZE_URL));
|
||||
$object->email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
|
||||
$object->url = trim(GETPOST('member_url', 'custom', 0, FILTER_SANITIZE_URL));
|
||||
$object->socialnetworks = array();
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (GETPOSTISSET($key) && 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->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->default_lang = GETPOST('default_lang', 'alpha');
|
||||
$object->typeid = GETPOST("typeid", 'int');
|
||||
//$object->note = trim(GETPOST("comment","alpha"));
|
||||
$object->morphy = GETPOST("morphy", 'alpha');
|
||||
$object->typeid = GETPOST("typeid", 'int');
|
||||
//$object->note = trim(GETPOST("comment","alpha"));
|
||||
$object->morphy = GETPOST("morphy", 'alpha');
|
||||
|
||||
if (GETPOST('deletephoto', 'alpha')) {
|
||||
$object->photo = '';
|
||||
@ -330,8 +330,8 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// Get status and public property
|
||||
$object->statut = GETPOST("statut", 'alpha');
|
||||
$object->public = GETPOST("public", 'alpha');
|
||||
$object->statut = GETPOST("statut", 'alpha');
|
||||
$object->public = GETPOST("public", 'alpha');
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
@ -342,7 +342,7 @@ if (empty($reshook)) {
|
||||
// Check if we need to also synchronize user information
|
||||
$nosyncuser = 0;
|
||||
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
|
||||
}
|
||||
}
|
||||
@ -350,7 +350,7 @@ if (empty($reshook)) {
|
||||
// Check if we need to also synchronize password information
|
||||
$nosyncuserpass = 0;
|
||||
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
|
||||
}
|
||||
}
|
||||
@ -454,7 +454,7 @@ if (empty($reshook)) {
|
||||
// $facebook=GETPOST("member_facebook", 'alpha');
|
||||
// $linkedin=GETPOST("member_linkedin", 'alpha');
|
||||
$email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
|
||||
$url = trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL));
|
||||
$url = trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL));
|
||||
$login = GETPOST("member_login", 'alphanohtml');
|
||||
$pass = GETPOST("password", 'none'); // For password, we use 'none'
|
||||
$photo = GETPOST("photo", 'alphanohtml');
|
||||
@ -565,7 +565,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
if (!empty($object->url) && !isValidUrl($object->url)) {
|
||||
$langs->load("errors");
|
||||
setEventMessages('', $langs->trans("ErrorBadUrl", $object->url), 'errors');
|
||||
setEventMessages($langs->trans("ErrorBadUrl", $object->url), null, 'errors');
|
||||
}
|
||||
$public = 0;
|
||||
if (isset($public)) {
|
||||
@ -659,7 +659,7 @@ if (empty($reshook)) {
|
||||
$outputlangs->loadLangs(array("main", "members", "companies", "install", "other"));
|
||||
// Get email content from template
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION;
|
||||
$labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION');
|
||||
|
||||
if (!empty($labeltouse)) {
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
@ -731,7 +731,7 @@ if (empty($reshook)) {
|
||||
$outputlangs->loadLangs(array("main", "members", "companies", "install", "other"));
|
||||
// Get email content from template
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION;
|
||||
$labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_CANCELATION');
|
||||
|
||||
if (!empty($labeltouse)) {
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
@ -802,7 +802,7 @@ if (empty($reshook)) {
|
||||
$outputlangs->loadLangs(array("main", "members", "companies", "install", "other"));
|
||||
// Get email content from template
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_EXCLUSION;
|
||||
$labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_EXCLUSION');
|
||||
|
||||
if (!empty($labeltouse)) {
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
@ -1046,7 +1046,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Website
|
||||
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
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>';
|
||||
@ -1524,7 +1524,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
|
||||
$subject = $arraydefaultmessage->topic;
|
||||
$msg = $arraydefaultmessage->content;
|
||||
$msg = $arraydefaultmessage->content;
|
||||
}
|
||||
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
@ -1533,10 +1533,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
|
||||
|
||||
$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>';
|
||||
$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("Subject").'</b>:<br>'."\n";
|
||||
$helpcontent .= $subjecttosend."\n";
|
||||
@ -1596,10 +1596,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs);
|
||||
|
||||
$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>)';
|
||||
$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("Subject").'</b>:<br>'."\n";
|
||||
$helpcontent .= $subjecttosend."\n";
|
||||
@ -1639,7 +1639,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$outputlangs->loadLangs(array("main", "members"));
|
||||
// Get email content from template
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_EXCLUSION;
|
||||
$labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_EXCLUSION');
|
||||
|
||||
if (!empty($labeltouse)) {
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
@ -1656,10 +1656,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnExclude()), $substitutionarray, $outputlangs);
|
||||
|
||||
$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>)';
|
||||
$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("Subject").'</b>:<br>'."\n";
|
||||
$helpcontent .= $subjecttosend."\n";
|
||||
|
||||
@ -307,7 +307,7 @@ foreach (array_keys($_Avery_Labels) as $codecards) {
|
||||
}
|
||||
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 '<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 '</form>';
|
||||
|
||||
|
||||
@ -92,6 +92,7 @@ class Adherent extends CommonObject
|
||||
/**
|
||||
* @var string company name
|
||||
* @deprecated
|
||||
* @see $company
|
||||
*/
|
||||
public $societe;
|
||||
|
||||
@ -102,8 +103,14 @@ class Adherent extends CommonObject
|
||||
|
||||
/**
|
||||
* @var int Thirdparty ID
|
||||
* @deprecated
|
||||
* @see $socid
|
||||
*/
|
||||
public $fk_soc;
|
||||
|
||||
/**
|
||||
* @var int socid
|
||||
*/
|
||||
public $socid;
|
||||
|
||||
/**
|
||||
@ -154,24 +161,28 @@ class Adherent extends CommonObject
|
||||
/**
|
||||
* @var string skype account
|
||||
* @deprecated
|
||||
* @see $socialnetworks
|
||||
*/
|
||||
public $skype;
|
||||
|
||||
/**
|
||||
* @var string twitter account
|
||||
* @deprecated
|
||||
* @see $socialnetworks
|
||||
*/
|
||||
public $twitter;
|
||||
|
||||
/**
|
||||
* @var string facebook account
|
||||
* @deprecated
|
||||
* @see $socialnetworks
|
||||
*/
|
||||
public $facebook;
|
||||
|
||||
/**
|
||||
* @var string linkedin account
|
||||
* @deprecated
|
||||
* @see $socialnetworks
|
||||
*/
|
||||
public $linkedin;
|
||||
|
||||
@ -259,10 +270,19 @@ class Adherent extends CommonObject
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* @var int need_subscription
|
||||
*/
|
||||
public $need_subscription;
|
||||
|
||||
/**
|
||||
* @var int user_id
|
||||
*/
|
||||
public $user_id;
|
||||
|
||||
/**
|
||||
* @var string user_login
|
||||
*/
|
||||
public $user_login;
|
||||
|
||||
public $datefin;
|
||||
@ -425,8 +445,8 @@ class Adherent extends CommonObject
|
||||
|
||||
// Envoi mail confirmation
|
||||
$from = $conf->email_from;
|
||||
if (!empty($conf->global->ADHERENT_MAIL_FROM)) {
|
||||
$from = $conf->global->ADHERENT_MAIL_FROM;
|
||||
if (!empty(getDolGlobalString('ADHERENT_MAIL_FROM'))) {
|
||||
$from = getDolGlobalString('ADHERENT_MAIL_FROM');
|
||||
}
|
||||
|
||||
$trackid = 'mem'.$this->id;
|
||||
@ -576,7 +596,7 @@ class Adherent extends CommonObject
|
||||
*/
|
||||
public function create($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $conf, $langs, $mysoc;
|
||||
|
||||
$error = 0;
|
||||
|
||||
@ -624,7 +644,22 @@ class Adherent extends CommonObject
|
||||
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent");
|
||||
if ($id > 0) {
|
||||
$this->id = $id;
|
||||
$this->ref = (string) $id;
|
||||
if (getDolGlobalString('MEMBER_CODEMEMBER_ADDON') == '') {
|
||||
// keep old numbering
|
||||
$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
|
||||
$result = $this->update($user, 1, 1, 0, 0, 'add'); // nosync is 1 to avoid update data of user
|
||||
@ -1505,7 +1540,7 @@ class Adherent extends CommonObject
|
||||
|
||||
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.datec as datec,";
|
||||
$sql .= " c.dateadh as dateh,";
|
||||
@ -1537,7 +1572,8 @@ class Adherent extends CommonObject
|
||||
$subscription->fk_adherent = $obj->fk_adherent;
|
||||
$subscription->fk_type = $obj->fk_type;
|
||||
$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->datem = $this->db->jdate($obj->datem);
|
||||
$subscription->datec = $this->db->jdate($obj->datec);
|
||||
@ -2871,8 +2907,8 @@ class Adherent extends CommonObject
|
||||
* Adds it to non existing supplied categories.
|
||||
* Existing categories are left untouch.
|
||||
*
|
||||
* @param int[]|int $categories Category or categories IDs
|
||||
* @return void
|
||||
* @param int[]|int $categories Category or categories IDs
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setCategories($categories)
|
||||
{
|
||||
@ -3015,7 +3051,7 @@ class Adherent extends CommonObject
|
||||
|
||||
$subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs);
|
||||
$msg = make_substitutions($arraydefaultmessage->content, $substitutionarray, $outputlangs);
|
||||
$from = $conf->global->ADHERENT_MAIL_FROM;
|
||||
$from = getDolGlobalString('ADHERENT_MAIL_FROM');
|
||||
$to = $adherent->email;
|
||||
|
||||
$trackid = 'mem'.$adherent->id;
|
||||
|
||||
@ -472,7 +472,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
|
||||
* @return int <0 if KO, >0 if OK
|
||||
@ -927,4 +927,46 @@ class AdherentType extends CommonObject
|
||||
|
||||
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)
|
||||
* @return string HTML Code for Kanban thumb.
|
||||
*/
|
||||
public function getKanbanView($option = '')
|
||||
{
|
||||
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"> </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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ class AdherentStats extends Stats
|
||||
*/
|
||||
public function __construct($db, $socid = 0, $userid = 0)
|
||||
{
|
||||
global $user, $conf;
|
||||
global $conf;
|
||||
|
||||
$this->db = $db;
|
||||
$this->socid = $socid;
|
||||
@ -87,8 +87,6 @@ class AdherentStats extends Stats
|
||||
*/
|
||||
public function getNbByMonth($year, $format = 0)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//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()
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.dateadh,'%Y') as dm, count(*)";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//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)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//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)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//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()
|
||||
{
|
||||
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 .= " FROM ".$this->from;
|
||||
//if (empty($user->rights->societe->client->voir) && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
|
||||
@ -62,7 +62,7 @@ class Members extends DolibarrApi
|
||||
*/
|
||||
public function get($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->lire) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ class Members extends DolibarrApi
|
||||
*/
|
||||
public function getByThirdparty($thirdparty)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->lire) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ class Members extends DolibarrApi
|
||||
*/
|
||||
public function getByThirdpartyEmail($email)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->lire) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ class Members extends DolibarrApi
|
||||
*/
|
||||
public function getByThirdpartyBarcode($barcode)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->lire) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ class Members extends DolibarrApi
|
||||
|
||||
$obj_ret = array();
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->lire) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -370,7 +370,7 @@ class Members extends DolibarrApi
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->supprimer) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'supprimer')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$member = new Adherent($this->db);
|
||||
@ -464,7 +464,7 @@ class Members extends DolibarrApi
|
||||
{
|
||||
$obj_ret = array();
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'cotisation', 'lire')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -495,7 +495,7 @@ class Members extends DolibarrApi
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ class MembersTypes extends DolibarrApi
|
||||
*/
|
||||
public function get($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->lire) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ class MembersTypes extends DolibarrApi
|
||||
|
||||
$obj_ret = array();
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->lire) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ class MembersTypes extends DolibarrApi
|
||||
*/
|
||||
public function post($request_data = null)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->configurer) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'configurer')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
// Check mandatory fields
|
||||
@ -176,7 +176,7 @@ class MembersTypes extends DolibarrApi
|
||||
*/
|
||||
public function put($id, $request_data = null)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->configurer) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'configurer')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -216,7 +216,7 @@ class MembersTypes extends DolibarrApi
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->configurer) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'configurer')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$membertype = new AdherentType($this->db);
|
||||
|
||||
@ -58,7 +58,7 @@ class Subscriptions extends DolibarrApi
|
||||
*/
|
||||
public function get($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'cotisation', 'lire')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ class Subscriptions extends DolibarrApi
|
||||
|
||||
$obj_ret = array();
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'cotisation', 'lire')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ class Subscriptions extends DolibarrApi
|
||||
*/
|
||||
public function post($request_data = null)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'cotisation', 'creer')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
// Check mandatory fields
|
||||
@ -206,7 +206,7 @@ class Subscriptions extends DolibarrApi
|
||||
public function delete($id)
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
$subscription = new Subscription($this->db);
|
||||
|
||||
@ -505,4 +505,36 @@ class Subscription extends CommonObject
|
||||
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)
|
||||
* @return string HTML Code for Kanban thumb.
|
||||
*/
|
||||
public function getKanbanView($option = '')
|
||||
{
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
if ($object->user_id) {
|
||||
// $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')));
|
||||
$caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'password'))
|
||||
|| (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password')));
|
||||
|
||||
@ -37,7 +37,7 @@ $sortorder = GETPOST('sortorder', 'aZ09');
|
||||
if (!isModEnabled('adherent')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->adherent->export)) {
|
||||
if (!$user->hasRight('adherent', 'export')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@ -51,14 +51,14 @@ if ($id > 0 || !empty($ref)) {
|
||||
$result = $object->fetch($id, $ref);
|
||||
|
||||
// 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
|
||||
if ($object->user_id) {
|
||||
// $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))
|
||||
|| (($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)
|
||||
|| (($user->id != $object->user_id) && !empty($user->rights->user->user->password)));
|
||||
|| (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password')));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -126,7 +126,6 @@ $fieldstosearchall = array(
|
||||
'd.login'=>'Login',
|
||||
'd.lastname'=>'Lastname',
|
||||
'd.firstname'=>'Firstname',
|
||||
'd.login'=>'Login',
|
||||
'd.societe'=>"Company",
|
||||
'd.email'=>'EMail',
|
||||
'd.address'=>'Address',
|
||||
@ -262,7 +261,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// 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);
|
||||
$error = 0;
|
||||
$nbcreated = 0;
|
||||
@ -836,14 +835,14 @@ if (!empty($arrayfields['d.tms']['checked'])) {
|
||||
}
|
||||
// Status
|
||||
if (!empty($arrayfields['d.statut']['checked'])) {
|
||||
print '<td class="liste_titre right maxwidthonsmartphone">';
|
||||
print '<td class="liste_titre right parentonrightofpage">';
|
||||
$liststatus = array(
|
||||
Adherent::STATUS_DRAFT => $langs->trans("Draft"),
|
||||
Adherent::STATUS_VALIDATED => $langs->trans("Validated"),
|
||||
Adherent::STATUS_RESILIATED => $langs->trans("MemberStatusResiliatedShort"),
|
||||
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>';
|
||||
}
|
||||
if (!empty($arrayfields['d.import_key']['checked'])) {
|
||||
|
||||
@ -76,13 +76,13 @@ foreach ($object->fields as $key => $val) {
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
|
||||
|
||||
$permissiontoread = $user->rights->partnership->read;
|
||||
$permissiontoadd = $user->rights->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);
|
||||
$permissionnote = $user->rights->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
|
||||
$usercanclose = $user->rights->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];
|
||||
$permissiontoread = $user->hasRight('partnership', 'read');
|
||||
$permissiontoadd = $user->hasRight('partnership', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
$permissiontodelete = $user->hasRight('partnership', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
$permissionnote = $user->hasRight('partnership', 'write'); // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->hasRight('partnership', 'write'); // Used by the include of actions_dellink.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];
|
||||
|
||||
|
||||
if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') != 'member') {
|
||||
|
||||
@ -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;
|
||||
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) {
|
||||
$error++;
|
||||
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;
|
||||
|
||||
$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)
|
||||
if ($user->rights->adherent->cotisation->creer) {
|
||||
if ($user->hasRight('adherent', 'cotisation', 'creer')) {
|
||||
if ($action != 'addsubscription' && $action != 'create_thirdparty') {
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
@ -814,7 +814,7 @@ if ($rowid > 0) {
|
||||
/*
|
||||
* 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 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' : '')).'>';
|
||||
$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("MailTopic").'</b>:<br>'."\n";
|
||||
if ($subjecttosend) {
|
||||
|
||||
@ -49,13 +49,13 @@ $note = GETPOST('note', 'alpha');
|
||||
$typeid = (int) GETPOST('typeid', 'int');
|
||||
$amount = price2num(GETPOST('amount', 'alpha'), 'MT');
|
||||
|
||||
if (empty($user->rights->adherent->cotisation->lire)) {
|
||||
if (!$user->hasRight('adherent', 'cotisation', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$permissionnote = $user->rights->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
|
||||
$permissiontoedit = $user->rights->adherent->cotisation->creer; // Used by the include of actions_lineupdonw.inc.php
|
||||
$permissionnote = $user->hasRight('adherent', 'cotisation', 'creer'); // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->hasRight('adherent', 'cotisation', 'creer'); // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoedit = $user->hasRight('adherent', 'cotisation', 'creer'); // Used by the include of actions_lineupdonw.inc.php
|
||||
|
||||
$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
|
||||
|
||||
|
||||
if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cancel) {
|
||||
if ($user->hasRight('adherent', 'cotisation', 'creer') && $action == 'update' && !$cancel) {
|
||||
// Load current object
|
||||
$result = $object->fetch($rowid);
|
||||
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->datef = dol_mktime(GETPOST('datesubendhour', 'int'), GETPOST('datesubendmin', 'int'), 0, GETPOST('datesubendmonth', 'int'), GETPOST('datesubendday', 'int'), GETPOST('datesubendyear', 'int'));
|
||||
$object->fk_type = $typeid;
|
||||
$object->note = $note;
|
||||
$object->note_public = $note;
|
||||
$object->note_private = $note;
|
||||
|
||||
$object->amount = $amount;
|
||||
|
||||
$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->delete($user);
|
||||
if ($result > 0) {
|
||||
@ -166,7 +167,7 @@ llxHeader('', $langs->trans("SubscriptionCard"), $help_url);
|
||||
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
|
||||
@ -350,7 +351,7 @@ if ($rowid && $action != 'edit') {
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->adherent->cotisation->creer) {
|
||||
if ($user->hasRight('adherent', 'cotisation', 'creer')) {
|
||||
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>";
|
||||
} else {
|
||||
@ -359,7 +360,7 @@ if ($rowid && $action != 'edit') {
|
||||
}
|
||||
|
||||
// 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";
|
||||
}
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("companies", "members", "bills", "users"));
|
||||
|
||||
if (empty($user->rights->adherent->lire)) {
|
||||
if (!$user->hasRight('adherent', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
@ -37,6 +37,8 @@ $massaction = GETPOST('massaction', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$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);
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
@ -242,17 +244,20 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
|
||||
exit;
|
||||
}
|
||||
|
||||
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
|
||||
llxHeader('', $langs->trans("ListOfSubscriptions"), $help_url);
|
||||
|
||||
$i = 0;
|
||||
|
||||
$title = $langs->trans("ListOfSubscriptions");
|
||||
$title = $langs->trans("Subscriptions");
|
||||
if (!empty($date_select)) {
|
||||
$title .= ' ('.$langs->trans("Year").' '.$date_select.')';
|
||||
}
|
||||
|
||||
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$i = 0;
|
||||
|
||||
$param = '';
|
||||
if (!empty($mode)) {
|
||||
$param .='&mode='.urlencode($mode);
|
||||
}
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.urlencode($contextpage);
|
||||
}
|
||||
@ -291,14 +296,17 @@ $arrayofmassactions = array(
|
||||
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
//'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'))) {
|
||||
$arrayofmassactions = array();
|
||||
}
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$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');
|
||||
}
|
||||
|
||||
@ -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="contextpage" value="'.$contextpage.'">';
|
||||
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);
|
||||
|
||||
@ -507,143 +517,166 @@ while ($i < min($num, $limit)) {
|
||||
|
||||
$adherent->need_subscription = $adht->subscription;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
if ($mode == 'kanban') {
|
||||
if ($i == 0) {
|
||||
print '<tr><td colspan="12">';
|
||||
print '<div class="box-flex-container">';
|
||||
}
|
||||
|
||||
// Ref
|
||||
if (!empty($arrayfields['d.ref']['checked'])) {
|
||||
print '<td>'.$subscription->getNomUrl(1).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Type
|
||||
if (!empty($arrayfields['d.fk_type']['checked'])) {
|
||||
print '<td class="nowraponall">';
|
||||
if ($typeid > 0) {
|
||||
print $adht->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Lastname
|
||||
if (!empty($arrayfields['d.lastname']['checked'])) {
|
||||
print '<td class="tdoverflowmax150">'.$adherent->getNomUrl(-1, 0, 'card', 'lastname').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Firstname
|
||||
if (!empty($arrayfields['d.firstname']['checked'])) {
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->firstname).'">'.$adherent->firstname.'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Login
|
||||
if (!empty($arrayfields['d.login']['checked'])) {
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->login).'">'.$adherent->login.'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Label
|
||||
if (!empty($arrayfields['t.libelle']['checked'])) {
|
||||
print '<td class="tdoverflowmax400" title="'.dol_escape_htmltag($obj->note).'">';
|
||||
print $obj->note;
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Banque
|
||||
if (!empty($arrayfields['d.bank']['checked'])) {
|
||||
print '<td class="tdmaxoverflow150">';
|
||||
//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);
|
||||
//$accountstatic->label=$obj->label;
|
||||
print $accountstatic->getNomUrl(1);
|
||||
$subscription->fk_bank = $accountstatic->getNomUrl(1);
|
||||
}
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
// Output Kanban
|
||||
print $subscription->getKanbanView('');
|
||||
if ($i == (min($num, $limit) - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Date start
|
||||
if (!empty($arrayfields['c.dateadh']['checked'])) {
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->dateadh), 'day')."</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
// Ref
|
||||
if (!empty($arrayfields['d.ref']['checked'])) {
|
||||
print '<td>'.$subscription->getNomUrl(1).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Date end
|
||||
if (!empty($arrayfields['c.datef']['checked'])) {
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->datef), 'day')."</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
// Type
|
||||
if (!empty($arrayfields['d.fk_type']['checked'])) {
|
||||
print '<td class="nowraponall">';
|
||||
if ($typeid > 0) {
|
||||
print $adht->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Price
|
||||
if (!empty($arrayfields['d.amount']['checked'])) {
|
||||
print '<td class="right amount">'.price($obj->subscription).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
||||
// Lastname
|
||||
if (!empty($arrayfields['d.lastname']['checked'])) {
|
||||
print '<td class="tdoverflowmax150">'.$adherent->getNomUrl(-1, 0, 'card', 'lastname').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'd.amount';
|
||||
// Firstname
|
||||
if (!empty($arrayfields['d.firstname']['checked'])) {
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->firstname).'">'.$adherent->firstname.'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
if (empty($totalarray['val']['d.amount'])) {
|
||||
$totalarray['val']['d.amount'] = $obj->subscription;
|
||||
} else {
|
||||
$totalarray['val']['d.amount'] += $obj->subscription;
|
||||
|
||||
// Login
|
||||
if (!empty($arrayfields['d.login']['checked'])) {
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->login).'">'.$adherent->login.'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Label
|
||||
if (!empty($arrayfields['t.libelle']['checked'])) {
|
||||
print '<td class="tdoverflowmax400" title="'.dol_escape_htmltag($obj->note).'">';
|
||||
print $obj->note;
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Banque
|
||||
if (!empty($arrayfields['d.bank']['checked'])) {
|
||||
print '<td class="tdmaxoverflow150">';
|
||||
if ($obj->fk_account > 0) {
|
||||
$accountstatic->id = $obj->fk_account;
|
||||
$accountstatic->fetch($obj->fk_account);
|
||||
//$accountstatic->label=$obj->label;
|
||||
print $accountstatic->getNomUrl(1);
|
||||
}
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Date start
|
||||
if (!empty($arrayfields['c.dateadh']['checked'])) {
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->dateadh), 'day')."</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Date end
|
||||
if (!empty($arrayfields['c.datef']['checked'])) {
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->datef), 'day')."</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Price
|
||||
if (!empty($arrayfields['d.amount']['checked'])) {
|
||||
print '<td class="right amount">'.price($obj->subscription).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'd.amount';
|
||||
}
|
||||
if (empty($totalarray['val']['d.amount'])) {
|
||||
$totalarray['val']['d.amount'] = $obj->subscription;
|
||||
} else {
|
||||
$totalarray['val']['d.amount'] += $obj->subscription;
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (!empty($arrayfields['c.datec']['checked'])) {
|
||||
print '<td class="nowrap center">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Date modification
|
||||
if (!empty($arrayfields['c.tms']['checked'])) {
|
||||
print '<td class="nowrap center">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Action column
|
||||
print '<td class="center">';
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($obj->crowid, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$obj->crowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->crowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (!empty($arrayfields['c.datec']['checked'])) {
|
||||
print '<td class="nowrap center">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Date modification
|
||||
if (!empty($arrayfields['c.tms']['checked'])) {
|
||||
print '<td class="nowrap center">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Action column
|
||||
print '<td class="center">';
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($obj->crowid, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$obj->crowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->crowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
|
||||
echo '<td class="center"></td>';
|
||||
echo '<td class="center">'.dol_print_date($objectlink->dateh, 'day').'</td>';
|
||||
echo '<td class="right">';
|
||||
if ($user->rights->adherent->lire) {
|
||||
if ($user->hasRight('adherent', 'lire')) {
|
||||
$total = $total + $objectlink->amount;
|
||||
echo price($objectlink->amount);
|
||||
}
|
||||
|
||||
@ -44,6 +44,7 @@ $action = GETPOST('action', 'aZ09');
|
||||
$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
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$mode = GETPOST('mode', 'alopha');
|
||||
|
||||
$sall = GETPOST("sall", "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->oldcopy = dol_clone($object);
|
||||
@ -207,7 +208,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && !empty($user->rights->adherent->configurer)) {
|
||||
if ($action == 'confirm_delete' && $user->hasRight('adherent', 'configurer')) {
|
||||
$object->fetch($rowid);
|
||||
$res = $object->delete();
|
||||
|
||||
@ -249,6 +250,9 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
|
||||
$i = 0;
|
||||
|
||||
$param = '';
|
||||
if (!empty($mode)) {
|
||||
$param .= '&mode'.urlencode($mode);
|
||||
}
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.$contextpage;
|
||||
}
|
||||
@ -257,7 +261,11 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
|
||||
}
|
||||
|
||||
$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');
|
||||
}
|
||||
|
||||
@ -270,6 +278,8 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
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);
|
||||
|
||||
@ -292,7 +302,13 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
|
||||
|
||||
$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);
|
||||
|
||||
$membertype->id = $objp->rowid;
|
||||
@ -303,32 +319,46 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
|
||||
$membertype->amount = $objp->amount;
|
||||
$membertype->caneditamount = $objp->caneditamount;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowraponall">';
|
||||
print $membertype->getNomUrl(1);
|
||||
//<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
|
||||
print '</td>';
|
||||
print '<td>'.dol_escape_htmltag($objp->label).'</td>';
|
||||
print '<td class="center">';
|
||||
if ($objp->morphy == 'phy') {
|
||||
print $langs->trans("Physical");
|
||||
} elseif ($objp->morphy == 'mor') {
|
||||
print $langs->trans("Moral");
|
||||
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 $langs->trans("MorAndPhy");
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowraponall">';
|
||||
print $membertype->getNomUrl(1);
|
||||
//<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
|
||||
print '</td>';
|
||||
print '<td>'.dol_escape_htmltag($objp->label).'</td>';
|
||||
print '<td class="center">';
|
||||
if ($objp->morphy == 'phy') {
|
||||
print $langs->trans("Physical");
|
||||
} elseif ($objp->morphy == 'mor') {
|
||||
print $langs->trans("Moral");
|
||||
} else {
|
||||
print $langs->trans("MorAndPhy");
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="center">'.yn($objp->subscription).'</td>';
|
||||
print '<td class="center"><span class="amount">'.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).'</span></td>';
|
||||
print '<td class="center">'.yn($objp->caneditamount).'</td>';
|
||||
print '<td class="center">'.yn($objp->vote).'</td>';
|
||||
print '<td class="center">'.$membertype->getLibStatut(5).'</td>';
|
||||
if ($user->rights->adherent->configurer) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
|
||||
} else {
|
||||
print '<td class="right"> </td>';
|
||||
}
|
||||
print "</tr>";
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="center">'.yn($objp->subscription).'</td>';
|
||||
print '<td class="center"><span class="amount">'.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).'</span></td>';
|
||||
print '<td class="center">'.yn($objp->caneditamount).'</td>';
|
||||
print '<td class="center">'.yn($objp->vote).'</td>';
|
||||
print '<td class="center">'.$membertype->getLibStatut(5).'</td>';
|
||||
if ($user->rights->adherent->configurer) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
|
||||
} else {
|
||||
print '<td class="right"> </td>';
|
||||
}
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ if ($action == 'delete' && GETPOST('langtodelete', 'alpha')) {
|
||||
}
|
||||
|
||||
// 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->fetch($id);
|
||||
$current_lang = $langs->getDefaultLang();
|
||||
@ -99,7 +99,7 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->ad
|
||||
}
|
||||
|
||||
// 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->fetch($id);
|
||||
$current_lang = $langs->getDefaultLang();
|
||||
@ -125,7 +125,7 @@ if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->rights->a
|
||||
}
|
||||
|
||||
// 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->fetch($id);
|
||||
$langtodelete = GETPOST('langdel', 'alpha');
|
||||
|
||||
@ -42,14 +42,14 @@ if ($id > 0 || !empty($ref)) {
|
||||
$result = $object->fetch($id, $ref);
|
||||
|
||||
// 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
|
||||
if ($object->user_id) {
|
||||
// $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)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
|
||||
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
|
||||
$caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'creer'))
|
||||
|| (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer')));
|
||||
$caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'password'))
|
||||
|| (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password')));
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,18 +122,23 @@ if ($company->id) {
|
||||
} elseif (empty(trim($object->email))) {
|
||||
// when adherent e-mail is empty, use only company e-mail
|
||||
$v->setEmail($company->email);
|
||||
} elseif (strtolower(end(explode("@", $object->email))) == strtolower(end(explode("@", $company->email)))) {
|
||||
// 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);
|
||||
|
||||
// support by Microsoft Outlook (2019 and possible earlier)
|
||||
$v->setEmail($company->email, 'INTERNET');
|
||||
} else {
|
||||
// when e-mail of adherent and company complete different use company e-mail at first (and adherent e-mail at second)
|
||||
$v->setEmail($company->email);
|
||||
$tmpobject = explode("@", trim($object->email));
|
||||
$tmpcompany = explode("@", trim($company->email));
|
||||
|
||||
// support by Microsoft Outlook (2019 and possible earlier)
|
||||
$v->setEmail($object->email, 'INTERNET');
|
||||
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)
|
||||
$v->setEmail($object->email);
|
||||
|
||||
// support by Microsoft Outlook (2019 and possible earlier)
|
||||
$v->setEmail($company->email, 'INTERNET');
|
||||
} else {
|
||||
// when e-mail of adherent and company complete different use company e-mail at first (and adherent e-mail at second)
|
||||
$v->setEmail($company->email);
|
||||
|
||||
// support by Microsoft Outlook (2019 and possible earlier)
|
||||
$v->setEmail($object->email, 'INTERNET');
|
||||
}
|
||||
}
|
||||
|
||||
// Si adherent lie a un tiers non de type "particulier"
|
||||
|
||||
@ -368,7 +368,7 @@ if (!is_array($result) && $result < 0) {
|
||||
} elseif (count($result) > 0) {
|
||||
$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";
|
||||
|
||||
// AGENDA_DEFAULT_FILTER_TYPE
|
||||
|
||||
@ -51,10 +51,10 @@ $type = 'bom';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
$maskconstbom = GETPOST('maskconstBom', 'alpha');
|
||||
$maskconstbom = GETPOST('maskconstBom', 'aZ09');
|
||||
$maskbom = GETPOST('maskBom', 'alpha');
|
||||
|
||||
if ($maskconstbom) {
|
||||
if ($maskconstbom && preg_match('/_MASK$/', $maskconstbom)) {
|
||||
$res = dolibarr_set_const($db, $maskconstbom, $maskbom, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
|
||||
@ -54,9 +54,9 @@ if (empty($conf->global->CHEQUERECEIPTS_ADDON)) {
|
||||
*/
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
$maskconstchequereceipts = GETPOST('maskconstchequereceipts', 'alpha');
|
||||
$maskconstchequereceipts = GETPOST('maskconstchequereceipts', 'aZ09');
|
||||
$maskchequereceipts = GETPOST('maskchequereceipts', 'alpha');
|
||||
if ($maskconstchequereceipts) {
|
||||
if ($maskconstchequereceipts && preg_match('/_MASK$/', $maskconstchequereceipts)) {
|
||||
$res = dolibarr_set_const($db, $maskconstchequereceipts, $maskchequereceipts, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ foreach ($dirmodels as $reldir) {
|
||||
print '<td class="center">';
|
||||
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)) {
|
||||
dol_htmloutput_mesg($module->error, '', 'error', 1);
|
||||
}
|
||||
|
||||
@ -61,10 +61,10 @@ $type = 'order';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
$maskconstorder = GETPOST('maskconstorder', 'alpha');
|
||||
$maskconstorder = GETPOST('maskconstorder', 'aZ09');
|
||||
$maskorder = GETPOST('maskorder', 'alpha');
|
||||
|
||||
if ($maskconstorder) {
|
||||
if ($maskconstorder && preg_match('/_MASK$/', $maskconstorder)) {
|
||||
$res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
|
||||
@ -58,9 +58,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
$error=0;
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
$maskconst = GETPOST('maskconstcontract', 'alpha');
|
||||
$maskconst = GETPOST('maskconstcontract', 'aZ09');
|
||||
$maskvalue = GETPOST('maskcontract', 'alpha');
|
||||
if ($maskconst) {
|
||||
if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
|
||||
$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
|
||||
@ -325,7 +325,7 @@ if (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METE
|
||||
if (!empty($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)) {
|
||||
$level1 = $conf->global->MAIN_METEO_LEVEL1;
|
||||
}
|
||||
@ -459,7 +459,7 @@ if ($action == 'edit') {
|
||||
print '</form>';
|
||||
} else {
|
||||
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>';
|
||||
}
|
||||
|
||||
|
||||
@ -90,9 +90,9 @@ if ($action == 'activate_delivery') {
|
||||
}
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
$maskconstdelivery = GETPOST('maskconstdelivery', 'alpha');
|
||||
$maskconstdelivery = GETPOST('maskconstdelivery', 'aZ09');
|
||||
$maskdelivery = GETPOST('maskdelivery', 'alpha');
|
||||
if ($maskconstdelivery) {
|
||||
if ($maskconstdelivery && preg_match('/_MASK$/', $maskconstdelivery)) {
|
||||
$res = dolibarr_set_const($db, $maskconstdelivery, $maskdelivery, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
|
||||
@ -1944,7 +1944,7 @@ if ($id > 0) {
|
||||
//var_dump($fieldlist);
|
||||
$class = '';
|
||||
$showfield = 1;
|
||||
$valuetoshow = empty($obj->{$value}) ? '' : $obj->{$value};
|
||||
$valuetoshow = empty($obj->$value) ? '' : $obj->$value;
|
||||
$titletoshow = '';
|
||||
|
||||
if ($value == 'entity') {
|
||||
@ -1985,76 +1985,76 @@ if ($id > 0) {
|
||||
} elseif ($value == 'libelle_facture') {
|
||||
$langs->load("bills");
|
||||
$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);
|
||||
} elseif ($value == 'label' && $tabname[$id] == 'c_country') {
|
||||
$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') {
|
||||
$langs->load("propal");
|
||||
$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') {
|
||||
$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') {
|
||||
$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') {
|
||||
$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') {
|
||||
$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') {
|
||||
$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') {
|
||||
$langs->load('agenda');
|
||||
$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') {
|
||||
$langs->load("bills");
|
||||
$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') {
|
||||
$langs->load("bills");
|
||||
$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') {
|
||||
$payment_type_list = array(0=>$langs->trans('PaymentTypeCustomer'), 1=>$langs->trans('PaymentTypeSupplier'), 2=>$langs->trans('PaymentTypeBoth'));
|
||||
$valuetoshow = $payment_type_list[$valuetoshow];
|
||||
} elseif ($value == 'label' && $tabname[$id] == 'c_input_reason') {
|
||||
$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') {
|
||||
$langs->load("orders");
|
||||
$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') {
|
||||
$langs->load("sendings");
|
||||
$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') {
|
||||
$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') {
|
||||
$langs->load('trips');
|
||||
$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') {
|
||||
$showfield = 0;
|
||||
} elseif ($value == 'unicode') {
|
||||
$valuetoshow = $langs->getCurrencySymbol($obj->code, 1);
|
||||
} elseif ($value == 'label' && $tabname[GETPOST("id", 'int')] == 'c_units') {
|
||||
$langs->load("products");
|
||||
$valuetoshow = $langs->trans($obj->{$value});
|
||||
$valuetoshow = $langs->trans($obj->$value);
|
||||
} elseif ($value == 'short_label' && $tabname[GETPOST("id", 'int')] == 'c_units') {
|
||||
$langs->load("products");
|
||||
$valuetoshow = $langs->trans($obj->{$value});
|
||||
$valuetoshow = $langs->trans($obj->$value);
|
||||
} elseif (($value == 'unit') && ($tabname[$id] == 'c_paper_format')) {
|
||||
$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') {
|
||||
$class = "center";
|
||||
} elseif ($value == 'localtax1_type') {
|
||||
@ -2357,7 +2357,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
if ($value == 'entity') {
|
||||
$withentity = $obj->{$value};
|
||||
$withentity = $obj->$value;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
// Load translation files required by the page
|
||||
$langs->load("admin");
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
@ -41,6 +43,7 @@ if (!$user->admin) {
|
||||
*/
|
||||
|
||||
// set
|
||||
$reg = array();
|
||||
if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
|
||||
$code = $reg[1];
|
||||
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
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$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 '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td class="center" width="20"> </td>';
|
||||
print '<td class="center" width="100">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '<td class="center" width="100px">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '</tr>';
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
// Mail required for members
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("ECMAutoTree").'</td>';
|
||||
print '<td class="center" width="20"> </td>';
|
||||
|
||||
print '<td class="center" width="100">';
|
||||
print '<td class="center">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('ECM_AUTO_TREE_ENABLED');
|
||||
print ajax_constantonoff('ECM_AUTO_TREE_HIDEN', null, null, 1);
|
||||
} else {
|
||||
if (empty($conf->global->ECM_AUTO_TREE_ENABLED)) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_ECM_AUTO_TREE_ENABLED&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
} elseif (!empty($conf->global->USER_MAIL_REQUIRED)) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_ECM_AUTO_TREE_ENABLED&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||
if (empty($conf->global->ECM_AUTO_TREE_HIDEN)) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_ECM_AUTO_TREE_HIDEN&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||
} else {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_ECM_AUTO_TREE_HIDEN&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
@ -83,15 +83,13 @@ if ($cancel) {
|
||||
$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') {
|
||||
$maskconstorder = GETPOST('maskconstorder', 'alpha');
|
||||
$maskconstorder = GETPOST('maskconstorder', 'aZ09');
|
||||
$maskorder = GETPOST('maskorder', 'alpha');
|
||||
|
||||
if ($maskconstorder) {
|
||||
if ($maskconstorder && preg_match('/_MASK$/', $maskconstorder)) {
|
||||
$res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
|
||||
@ -62,9 +62,9 @@ if (empty($conf->global->EXPEDITION_ADDON_NUMBER)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
$maskconst = GETPOST('maskconstexpedition', 'alpha');
|
||||
$maskconst = GETPOST('maskconstexpedition', 'aZ09');
|
||||
$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);
|
||||
}
|
||||
|
||||
|
||||
@ -58,9 +58,9 @@ $type = 'expensereport';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
$maskconst = GETPOST('maskconst', 'alpha');
|
||||
$maskconst = GETPOST('maskconst', 'aZ09');
|
||||
$maskvalue = GETPOST('maskvalue', 'alpha');
|
||||
if ($maskconst) {
|
||||
if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
|
||||
$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
|
||||
@ -58,24 +58,24 @@ $type = 'invoice';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
$maskconstinvoice = GETPOST('maskconstinvoice', 'alpha');
|
||||
$maskconstreplacement = GETPOST('maskconstreplacement', 'alpha');
|
||||
$maskconstcredit = GETPOST('maskconstcredit', 'alpha');
|
||||
$maskconstdeposit = GETPOST('maskconstdeposit', 'alpha');
|
||||
$maskconstinvoice = GETPOST('maskconstinvoice', 'aZ09');
|
||||
$maskconstreplacement = GETPOST('maskconstreplacement', 'aZ09');
|
||||
$maskconstcredit = GETPOST('maskconstcredit', 'aZ09');
|
||||
$maskconstdeposit = GETPOST('maskconstdeposit', 'aZ09');
|
||||
$maskinvoice = GETPOST('maskinvoice', 'alpha');
|
||||
$maskreplacement = GETPOST('maskreplacement', 'alpha');
|
||||
$maskcredit = GETPOST('maskcredit', 'alpha');
|
||||
$maskdeposit = GETPOST('maskdeposit', 'alpha');
|
||||
if ($maskconstinvoice) {
|
||||
if ($maskconstinvoice && preg_match('/_MASK_/', $maskconstinvoice)) {
|
||||
$res = dolibarr_set_const($db, $maskconstinvoice, $maskinvoice, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if ($maskconstreplacement) {
|
||||
if ($maskconstreplacement && preg_match('/_MASK_/', $maskconstreplacement)) {
|
||||
$res = dolibarr_set_const($db, $maskconstreplacement, $maskreplacement, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if ($maskconstcredit) {
|
||||
if ($maskconstcredit && preg_match('/_MASK_/', $maskconstcredit)) {
|
||||
$res = dolibarr_set_const($db, $maskconstcredit, $maskcredit, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if ($maskconstdeposit) {
|
||||
if ($maskconstdeposit && preg_match('/_MASK_/', $maskconstdeposit)) {
|
||||
$res = dolibarr_set_const($db, $maskconstdeposit, $maskdeposit, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
@ -743,7 +743,7 @@ print load_fiche_titre($langs->trans("OtherOptions"), '', '');
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td>'.$langs->trans("Parameters").'</td>';
|
||||
print '<td class="center" width="60">'.$langs->trans("Value").'</td>';
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -58,9 +58,9 @@ $type = 'ficheinter';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
$maskconst = GETPOST('maskconst', 'alpha');
|
||||
$maskconst = GETPOST('maskconst', 'aZ09');
|
||||
$maskvalue = GETPOST('maskvalue', 'alpha');
|
||||
if ($maskconst) {
|
||||
if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
|
||||
$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
|
||||
@ -58,9 +58,9 @@ if (empty($conf->global->HOLIDAY_ADDON)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
$maskconst = GETPOST('maskconstholiday', 'alpha');
|
||||
$maskconst = GETPOST('maskconstholiday', 'aZ09');
|
||||
$maskvalue = GETPOST('maskholiday', 'alpha');
|
||||
if ($maskconst) {
|
||||
if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
|
||||
$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ $label = GETPOST('label', 'alpha');
|
||||
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
|
||||
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type = 'myobject';
|
||||
$type = 'evaluation';
|
||||
|
||||
$arrayofparameters = array(
|
||||
'HRM_MAXRANK'=>array('type'=>'integer','enabled'=>1),
|
||||
@ -70,9 +70,7 @@ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
* Actions
|
||||
*/
|
||||
|
||||
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 == 'update') {
|
||||
$max_rank = GETPOST('HRM_MAXRANK', 'int');
|
||||
@ -91,11 +89,11 @@ if ($action == 'update') {
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'updateMask') {
|
||||
$maskconstorder = GETPOST('maskconstorder', 'alpha');
|
||||
$maskorder = GETPOST('maskorder', 'alpha');
|
||||
$maskconst = GETPOST('maskconstEvaluation', 'aZ09');
|
||||
$maskvalue = GETPOST('maskEvaluation', 'alpha');
|
||||
|
||||
if ($maskconstorder) {
|
||||
$res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity);
|
||||
if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
|
||||
$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
@ -210,10 +208,10 @@ print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "hrm"
|
||||
|
||||
$moduledir = 'hrm';
|
||||
$myTmpObjects = array();
|
||||
$myTmpObjects['evaluation'] = array('includerefgeneration'=>1, 'includedocgeneration'=>0);
|
||||
$myTmpObjects['evaluation'] = array('label'=>'Evaluation', 'includerefgeneration'=>1, 'includedocgeneration'=>0);
|
||||
|
||||
foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
if ($myTmpObjectKey == 'MyObject') {
|
||||
if ($myTmpObjectKey != $type) {
|
||||
continue;
|
||||
}
|
||||
if ($myTmpObjectArray['includerefgeneration']) {
|
||||
@ -222,7 +220,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
*/
|
||||
$setupnotempty++;
|
||||
|
||||
print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', '');
|
||||
print load_fiche_titre($langs->trans("NumberingModules").' ('.$myTmpObjectArray['label'].')', '', '');
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
@ -493,16 +491,16 @@ if ($action == 'edit') {
|
||||
|
||||
if ($val['type'] == 'textarea') {
|
||||
print '<textarea class="flat" name="' . $constname . '" id="' . $constname . '" cols="50" rows="5" wrap="soft">' . "\n";
|
||||
print $conf->global->{$constname};
|
||||
print getDolGlobalString($constname);
|
||||
print "</textarea>\n";
|
||||
} elseif ($val['type'] == 'integer') {
|
||||
print '<input class="flat" name="' . $constname . '" id="' . $constname . '" value="' . $conf->global->$constname . '" type="number" step="1" min="0" max="50" >' . "\n";
|
||||
print '<input class="flat" name="' . $constname . '" id="' . $constname . '" value="' . getDolGlobalString($constname) . '" type="number" step="1" min="0" max="50" >' . "\n";
|
||||
} elseif ($val['type'] == 'html') {
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%');
|
||||
$doleditor = new DolEditor($constname, getDolGlobalString($constname), '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%');
|
||||
$doleditor->Create();
|
||||
} elseif ($val['type'] == 'yesno') {
|
||||
print $form->selectyesno($constname, $conf->global->{$constname}, 1);
|
||||
print $form->selectyesno($constname, getDolGlobalString($constname), 1);
|
||||
} elseif (preg_match('/emailtemplate:/', $val['type'])) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
@ -577,9 +575,9 @@ if ($action == 'edit') {
|
||||
print '</td><td>';
|
||||
|
||||
if ($val['type'] == 'textarea') {
|
||||
print dol_nl2br($conf->global->{$constname});
|
||||
print dol_nl2br(getDolGlobalString($constname));
|
||||
} elseif ($val['type']== 'html') {
|
||||
print $conf->global->{$constname};
|
||||
print getDolGlobalString($constname);
|
||||
} elseif ($val['type'] == 'yesno') {
|
||||
print ajax_constantonoff($constname);
|
||||
} elseif (preg_match('/emailtemplate:/', $val['type'])) {
|
||||
@ -588,14 +586,14 @@ if ($action == 'edit') {
|
||||
|
||||
$tmp = explode(':', $val['type']);
|
||||
|
||||
$template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname});
|
||||
$template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname));
|
||||
if ($template<0) {
|
||||
setEventMessages(null, $formmail->errors, 'errors');
|
||||
}
|
||||
print $langs->trans($template->label);
|
||||
} elseif (preg_match('/category:/', $val['type'])) {
|
||||
$c = new Categorie($db);
|
||||
$result = $c->fetch($conf->global->{$constname});
|
||||
$result = $c->fetch(getDolGlobalString($constname));
|
||||
if ($result < 0) {
|
||||
setEventMessages(null, $c->errors, 'errors');
|
||||
}
|
||||
|
||||
@ -69,11 +69,11 @@ if (!$user->admin) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
$maskconstorder = GETPOST('maskconstorder', 'alpha');
|
||||
$maskconst = GETPOST('maskconst', 'aZ09');
|
||||
$maskorder = GETPOST('maskorder', 'alpha');
|
||||
|
||||
if ($maskconstorder) {
|
||||
$res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity);
|
||||
if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
|
||||
$res = dolibarr_set_const($db, $maskconst, $maskorder, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
@ -209,14 +209,14 @@ if ($action == 'edit') {
|
||||
|
||||
if ($val['type'] == 'textarea') {
|
||||
print '<textarea class="flat" name="' . $constname . '" id="' . $constname . '" cols="50" rows="5" wrap="soft">' . "\n";
|
||||
print $conf->global->{$constname};
|
||||
print getDolGlobalString($constname);
|
||||
print "</textarea>\n";
|
||||
} elseif ($val['type'] == 'html') {
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%');
|
||||
$doleditor = new DolEditor($constname, getDolGlobalString($constname), '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%');
|
||||
$doleditor->Create();
|
||||
} elseif ($val['type'] == 'yesno') {
|
||||
print $form->selectyesno($constname, $conf->global->{$constname}, 1);
|
||||
print $form->selectyesno($constname, getDolGlobalString($constname), 1);
|
||||
} elseif (preg_match('/emailtemplate:/', $val['type'])) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
@ -275,9 +275,9 @@ if ($action == 'edit') {
|
||||
print '</td><td>';
|
||||
|
||||
if ($val['type'] == 'textarea') {
|
||||
print dol_nl2br($conf->global->{$constname});
|
||||
print dol_nl2br(getDolGlobalString($constname));
|
||||
} elseif ($val['type']== 'html') {
|
||||
print $conf->global->{$constname};
|
||||
print getDolGlobalString($constname);
|
||||
} elseif ($val['type'] == 'yesno') {
|
||||
print ajax_constantonoff($constname);
|
||||
} elseif (preg_match('/emailtemplate:/', $val['type'])) {
|
||||
@ -286,7 +286,7 @@ if ($action == 'edit') {
|
||||
|
||||
$tmp = explode(':', $val['type']);
|
||||
|
||||
$template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname});
|
||||
$template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname));
|
||||
if ($template<0) {
|
||||
setEventMessages(null, $formmail->errors, 'errors');
|
||||
}
|
||||
@ -304,17 +304,17 @@ if ($action == 'edit') {
|
||||
}
|
||||
print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
|
||||
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
|
||||
if ($conf->global->{$constname}==2) {
|
||||
if (getDolGlobalString($constname)==2) {
|
||||
print $langs->trans("Prospect");
|
||||
} elseif ($conf->global->{$constname}==3) {
|
||||
} elseif (getDolGlobalString($constname)==3) {
|
||||
print $langs->trans("ProspectCustomer");
|
||||
} elseif ($conf->global->{$constname}==1) {
|
||||
} elseif (getDolGlobalInt($constname)==1) {
|
||||
print $langs->trans("Customer");
|
||||
} elseif ($conf->global->{$constname}==0) {
|
||||
} elseif (getDolGlobalInt($constname)==0) {
|
||||
print $langs->trans("NorProspectNorCustomer");
|
||||
}
|
||||
} else {
|
||||
print $conf->global->{$constname};
|
||||
print getDolGlobalString($constname);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -69,6 +69,7 @@ $search_type_template = GETPOST('search_type_template', 'alpha');
|
||||
$search_lang = GETPOST('search_lang', 'alpha');
|
||||
$search_fk_user = GETPOST('search_fk_user', 'intcomma');
|
||||
$search_topic = GETPOST('search_topic', 'alpha');
|
||||
$search_module = GETPOST('search_module', 'alpha');
|
||||
|
||||
$acts = array();
|
||||
$actl = array();
|
||||
@ -108,7 +109,7 @@ $tabname[25] = MAIN_DB_PREFIX."c_email_templates";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield = array();
|
||||
$tabfield[25] = "label,lang,type_template,fk_user,private,position,topic,joinfiles,content";
|
||||
$tabfield[25] = "label,lang,type_template,fk_user,private,position,module,topic,joinfiles,content";
|
||||
if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
|
||||
$tabfield[25] .= ',content_lines';
|
||||
}
|
||||
@ -290,6 +291,7 @@ if (empty($reshook)) {
|
||||
$search_lang = '';
|
||||
$search_fk_user = '';
|
||||
$search_topic = '';
|
||||
$search_module = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
@ -598,6 +600,9 @@ if ($search_lang) {
|
||||
if ($search_fk_user != '' && $search_fk_user != '-1') {
|
||||
$sql .= natural_search('fk_user', $search_fk_user, 2);
|
||||
}
|
||||
if ($search_module) {
|
||||
$sql .= natural_search('module', $search_module);
|
||||
}
|
||||
if ($search_topic) {
|
||||
$sql .= natural_search('topic', $search_topic);
|
||||
}
|
||||
@ -703,6 +708,9 @@ if ($action == 'create') {
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow = $langs->trans($valuetoshow); // try to translate
|
||||
$align = "left";
|
||||
if ($fieldlist[$field] == 'module') {
|
||||
$valuetoshow = '';
|
||||
}
|
||||
if ($fieldlist[$field] == 'fk_user') {
|
||||
$valuetoshow = $langs->trans("Owner");
|
||||
}
|
||||
@ -802,9 +810,9 @@ if ($action == 'create') {
|
||||
$fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines');
|
||||
}
|
||||
foreach ($fieldsforcontent as $tmpfieldlist) {
|
||||
print '<tr class="impair nodrag nodrop nohover"><td colspan="7" class="nobottom">';
|
||||
print '<tr class="impair nodrag nodrop nohover"><td colspan="8" class="nobottom">';
|
||||
|
||||
// Label
|
||||
// Topic of email
|
||||
if ($tmpfieldlist == 'topic') {
|
||||
print '<strong>'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
|
||||
}
|
||||
@ -882,6 +890,9 @@ if ($search_type_template != '-1') {
|
||||
if ($search_fk_user > 0) {
|
||||
$param .= '&search_fk_user='.urlencode($search_fk_user);
|
||||
}
|
||||
if ($search_module) {
|
||||
$param .= '&search_module='.urlencode($search_module);
|
||||
}
|
||||
if ($search_topic) {
|
||||
$param .= '&search_topic='.urlencode($search_topic);
|
||||
}
|
||||
@ -909,7 +920,9 @@ if ($num > $listlimit) {
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
if ($value == 'label') {
|
||||
if ($value == 'module') {
|
||||
print '<td class="liste_titre"><input type="text" name="search_module" class="maxwidth75" value="'.dol_escape_htmltag($search_module).'"></td>';
|
||||
} elseif ($value == 'label') {
|
||||
print '<td class="liste_titre"><input type="text" name="search_label" class="maxwidth200" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||
} elseif ($value == 'lang') {
|
||||
print '<td class="liste_titre">';
|
||||
@ -917,7 +930,7 @@ foreach ($fieldlist as $field => $value) {
|
||||
print '</td>';
|
||||
} elseif ($value == 'fk_user') {
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'maxwidth125', 1);
|
||||
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'maxwidth100', 1);
|
||||
print '</td>';
|
||||
} elseif ($value == 'topic') {
|
||||
print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
|
||||
@ -958,6 +971,9 @@ foreach ($fieldlist as $field => $value) {
|
||||
*/
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // By defaut
|
||||
$valuetoshow = $langs->trans($valuetoshow); // try to translate
|
||||
if ($fieldlist[$field] == 'module') {
|
||||
$align = 'tdoverflowmax100';
|
||||
}
|
||||
if ($fieldlist[$field] == 'fk_user') {
|
||||
$valuetoshow = $langs->trans("Owner");
|
||||
}
|
||||
@ -1000,11 +1016,15 @@ foreach ($fieldlist as $field => $value) {
|
||||
$valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, '', $forcenowrap); // Tooltip on hover
|
||||
}
|
||||
}
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "align=".$align, $sortfield, $sortorder);
|
||||
$sortfieldtouse = ($sortable ? $fieldlist[$field] : '');
|
||||
if ($sortfieldtouse == 'type_template') {
|
||||
$sortfieldtouse.= ',label';
|
||||
}
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], $sortfieldtouse, ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, $align.' ');
|
||||
}
|
||||
}
|
||||
|
||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder);
|
||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center ');
|
||||
print getTitleFieldOfList('');
|
||||
print '</tr>';
|
||||
|
||||
@ -1052,7 +1072,7 @@ if ($num) {
|
||||
if ($showfield) {
|
||||
// Show line for topic, joinfiles and content
|
||||
print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$rowid.' ">';
|
||||
print '<td colspan="8">';
|
||||
print '<td colspan="9">';
|
||||
if ($tmpfieldlist == 'topic') {
|
||||
print '<strong>'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
|
||||
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
|
||||
@ -1068,7 +1088,6 @@ if ($num) {
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
|
||||
$okforextended = false;
|
||||
}
|
||||
|
||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%');
|
||||
print $doleditor->Create(1);
|
||||
}
|
||||
@ -1130,7 +1149,8 @@ if ($num) {
|
||||
$align = "";
|
||||
$class = "tddict";
|
||||
$title = '';
|
||||
$valuetoshow = $obj->{$fieldlist[$field]};
|
||||
$tmpvar = $fieldlist[$field];
|
||||
$valuetoshow = $obj->$tmpvar;
|
||||
if ($value == 'label' || $value == 'topic') {
|
||||
if ($langs->trans($valuetoshow) != $valuetoshow) {
|
||||
$valuetoshow = $langs->trans($valuetoshow);
|
||||
@ -1268,29 +1288,31 @@ $db->close();
|
||||
*/
|
||||
function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
{
|
||||
global $conf, $langs, $user, $db;
|
||||
global $langs, $user, $db;
|
||||
global $form;
|
||||
global $elementList;
|
||||
|
||||
$formadmin = new FormAdmin($db);
|
||||
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
if ($value == 'fk_user') {
|
||||
if ($value == 'module') {
|
||||
print '<td></td>';
|
||||
} elseif ($value == 'fk_user') {
|
||||
print '<td>';
|
||||
if ($user->admin) {
|
||||
print $form->select_dolusers(empty($obj->{$value}) ? '' : $obj->{$value}, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'minwidth150 maxwidth200');
|
||||
print $form->select_dolusers(empty($obj->$value) ? '' : $obj->$value, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'minwidth75 maxwidth100');
|
||||
} else {
|
||||
if ($context == 'add') { // I am not admin and we show the add form
|
||||
print $user->getNomUrl(1); // Me
|
||||
$forcedvalue = $user->id;
|
||||
} else {
|
||||
if ($obj && !empty($obj->{$value}) && $obj->{$value} > 0) {
|
||||
if ($obj && !empty($obj->$value) && $obj->$value > 0) {
|
||||
$fuser = new User($db);
|
||||
$fuser->fetch($obj->{$value});
|
||||
$fuser->fetch($obj->$value);
|
||||
print $fuser->getNomUrl(1);
|
||||
$forcedvalue = $fuser->id;
|
||||
} else {
|
||||
$forcedvalue = $obj->{$value};
|
||||
$forcedvalue = $obj->$value;
|
||||
}
|
||||
}
|
||||
$keyname = $value;
|
||||
@ -1304,7 +1326,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
if ($context == 'edit') {
|
||||
$selectedlang = $obj->lang;
|
||||
}
|
||||
print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1, 0, 0, 'maxwidth150');
|
||||
print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1, 0, 0, 'maxwidth100');
|
||||
} else {
|
||||
if (!empty($obj->lang)) {
|
||||
print $obj->lang.' - '.$langs->trans('Language_'.$obj->lang);
|
||||
@ -1324,7 +1346,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
print '<input type="hidden" name="type_template" value="'.$obj->type_template.'">';
|
||||
print $obj->type_template;
|
||||
} else {
|
||||
print $form->selectarray('type_template', $elementList, (!empty($obj->type_template) ? $obj->type_template:''), 1, 0, 0, '', 0, 0, 0, '', 'minwidth150', 1, '', 0, 1);
|
||||
print $form->selectarray('type_template', $elementList, (!empty($obj->type_template) ? $obj->type_template:''), 1, 0, 0, '', 0, 0, 0, '', 'minwidth75 maxwidth125', 1, '', 0, 1);
|
||||
}
|
||||
print '</td>';
|
||||
} elseif ($context == 'add' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
|
||||
|
||||
@ -372,13 +372,13 @@ if ($mode == 'feature') {
|
||||
if (count($objMod->depends)) {
|
||||
$text .= join(',', $objMod->depends);
|
||||
} else {
|
||||
$text .= $langs->trans("None");
|
||||
$text .= '<span class="opacitymedium">'.$langs->trans("None").'</span>';
|
||||
}
|
||||
$text .= '<br><strong>'.$langs->trans("RequiredBy").':</strong> ';
|
||||
if (count($objMod->requiredby)) {
|
||||
$text .= join(',', $objMod->requiredby);
|
||||
} else {
|
||||
$text .= $langs->trans("None");
|
||||
$text .= '<span class="opacitymedium">'.$langs->trans("None").'</span>';
|
||||
}
|
||||
|
||||
$text .= '<br><br>';
|
||||
@ -395,7 +395,7 @@ if ($mode == 'feature') {
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
$text .= '<span class="opacitymedium">'.$langs->trans("No").'</span>';
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
@ -408,7 +408,7 @@ if ($mode == 'feature') {
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
$text .= '<span class="opacitymedium">'.$langs->trans("No").'</span>';
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
@ -418,7 +418,7 @@ if ($mode == 'feature') {
|
||||
if (dol_is_file($filedata)) {
|
||||
$text .= $langs->trans("Yes").' <span class="opacitymedium">('.$moduledir.'/sql/data.sql)</span>';
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
$text .= '<span class="opacitymedium">'.$langs->trans("No").'</span>';
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
@ -437,7 +437,7 @@ if ($mode == 'feature') {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
$text .= '<span class="opacitymedium">'.$langs->trans("No").'</span>';
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
@ -446,7 +446,7 @@ if ($mode == 'feature') {
|
||||
if (isset($objMod->module_parts) && isset($objMod->module_parts['models']) && $objMod->module_parts['models']) {
|
||||
$text .= $langs->trans("Yes");
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
$text .= '<span class="opacitymedium">'.$langs->trans("No").'</span>';
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
@ -455,7 +455,7 @@ if ($mode == 'feature') {
|
||||
if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions']) {
|
||||
$text .= $langs->trans("Yes");
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
$text .= '<span class="opacitymedium">'.$langs->trans("No").'</span>';
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
@ -468,7 +468,7 @@ if ($mode == 'feature') {
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
$text .= '<span class="opacitymedium">'.$langs->trans("No").'</span>';
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
@ -502,7 +502,7 @@ if ($mode == 'feature') {
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
$text .= '<span class="opacitymedium">'.$langs->trans("No").'</span>';
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
@ -531,7 +531,7 @@ if ($mode == 'feature') {
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
$text .= '<span class="opacitymedium">'.$langs->trans("No").'</span>';
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
@ -544,7 +544,7 @@ if ($mode == 'feature') {
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
$text .= '<span class="opacitymedium">'.$langs->trans("No").'</span>';
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
@ -553,7 +553,7 @@ if ($mode == 'feature') {
|
||||
if (isset($objMod->menu) && !empty($objMod->menu)) { // objMod can be an array or just an int 1
|
||||
$text .= $langs->trans("Yes");
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
$text .= '<span class="opacitymedium">'.$langs->trans("No").'</span>';
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
@ -566,7 +566,7 @@ if ($mode == 'feature') {
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
$text .= '<span class="opacitymedium">'.$langs->trans("No").'</span>';
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
@ -579,13 +579,13 @@ if ($mode == 'feature') {
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
$text .= $langs->trans("No");
|
||||
$text .= '<span class="opacitymedium">'.$langs->trans("No").'</span>';
|
||||
}
|
||||
|
||||
$text .= '<br>';
|
||||
|
||||
$text .= '<br><strong>'.$langs->trans("AddOtherPagesOrServices").':</strong> ';
|
||||
$text .= $langs->trans("DetectionNotPossible");
|
||||
$text .= '<span class="opacitymedium">'.$langs->trans("DetectionNotPossible").'</span>';
|
||||
}
|
||||
|
||||
|
||||
@ -594,7 +594,7 @@ if ($mode == 'changelog') {
|
||||
if ($changelog) {
|
||||
$text .= '<div class="moduledesclong">'.$changelog.'<div>';
|
||||
} else {
|
||||
$text .= '<div class="moduledesclong">'.$langs->trans("NotAvailable").'</div>';
|
||||
$text .= '<div class="moduledesclong"><span class="opacitymedium">'.$langs->trans("NotAvailable").'</span></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -65,9 +65,9 @@ $search_version = GETPOST('search_version', 'alpha');
|
||||
// For dolistore search
|
||||
$options = array();
|
||||
$options['per_page'] = 20;
|
||||
$options['categorie'] = ((GETPOST('categorie', 'int') ?GETPOST('categorie', 'int') : 0) + 0);
|
||||
$options['start'] = ((GETPOST('start', 'int') ?GETPOST('start', 'int') : 0) + 0);
|
||||
$options['end'] = ((GETPOST('end', 'int') ?GETPOST('end', 'int') : 0) + 0);
|
||||
$options['categorie'] = ((int) (GETPOST('categorie', 'int') ? GETPOST('categorie', 'int') : 0));
|
||||
$options['start'] = ((int) (GETPOST('start', 'int') ?GETPOST('start', 'int') : 0));
|
||||
$options['end'] = ((int) (GETPOST('end', 'int') ?GETPOST('end', 'int') : 0));
|
||||
$options['search'] = GETPOST('search_keyword', 'alpha');
|
||||
$dolistore = new Dolistore(false);
|
||||
|
||||
@ -641,11 +641,11 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
// We discard showing according to filters
|
||||
if ($search_keyword) {
|
||||
$qualified = 0;
|
||||
if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename)
|
||||
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduletechnicalname)
|
||||
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduledesc)
|
||||
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduledesclong)
|
||||
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduleauthor)
|
||||
if (preg_match('/'.preg_quote($search_keyword, '/').'/i', $modulename)
|
||||
|| preg_match('/'.preg_quote($search_keyword, '/').'/i', $moduletechnicalname)
|
||||
|| ($moduledesc && preg_match('/'.preg_quote($search_keyword, '/').'/i', $moduledesc))
|
||||
|| ($moduledesclong && preg_match('/'.preg_quote($search_keyword, '/').'/i', $moduledesclong))
|
||||
|| ($moduleauthor && preg_match('/'.preg_quote($search_keyword, '/').'/i', $moduleauthor))
|
||||
) {
|
||||
$qualified = 1;
|
||||
}
|
||||
@ -844,10 +844,10 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif (preg_match('/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs)) {
|
||||
} elseif (preg_match('/^([^@]+)@([^@]+)$/i', (string) $objMod->config_page_url, $regs)) {
|
||||
$codetoconfig .= '<a class="valignmiddle" href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1).'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').'</a>';
|
||||
} else {
|
||||
$codetoconfig .= '<a class="valignmiddle" href="'.$objMod->config_page_url.'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').'</a>';
|
||||
$codetoconfig .= '<a class="valignmiddle" href="'.((string) $objMod->config_page_url).'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').'</a>';
|
||||
}
|
||||
} else {
|
||||
$codetoconfig .= img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"', false, 0, 0, '', 'fa-15');
|
||||
@ -1075,7 +1075,7 @@ if ($mode == 'marketplace') {
|
||||
<div id="listing-content">
|
||||
<table summary="list_of_modules" id="list_of_modules" class="productlist centpercent">
|
||||
<tbody id="listOfModules">
|
||||
<?php echo $dolistore->get_products(!empty($categorie) ? $categorie: ''); ?>
|
||||
<?php echo $dolistore->get_products(); ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@ -1216,10 +1216,10 @@ if ($mode == 'deploy') {
|
||||
print '<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
jQuery("#fileinstall").on("change", function() {
|
||||
if(this.files[0].size > '.($maxmin * 1024).'){
|
||||
if(this.files[0].size > '.($maxmin * 1024).') {
|
||||
alert("'.dol_escape_js($langs->trans("ErrorFileSizeTooLarge")).'");
|
||||
this.value = "";
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>'."\n";
|
||||
|
||||
@ -52,10 +52,10 @@ $type = 'mrp';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
$maskconstmrp = GETPOST('maskconstMo', 'alpha');
|
||||
$maskconstmrp = GETPOST('maskconstMo', 'aZ09');
|
||||
$maskmrp = GETPOST('maskMo', 'alpha');
|
||||
|
||||
if ($maskconstmrp) {
|
||||
if ($maskconstmrp && preg_match('/_MASK$/', $maskconstmrp)) {
|
||||
$res = dolibarr_set_const($db, $maskconstmrp, $maskmrp, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
|
||||
@ -134,7 +134,8 @@ if ($action == 'add_currency') {
|
||||
dolibarr_set_const($db, 'MULTICURRENCY_APP_SOURCE', GETPOST('MULTICURRENCY_APP_SOURCE', 'alpha'));
|
||||
//dolibarr_set_const($db, 'MULTICURRENCY_ALTERNATE_SOURCE', GETPOST('MULTICURRENCY_ALTERNATE_SOURCE', 'alpha'));
|
||||
} else {
|
||||
$result = MultiCurrency::syncRates($conf->global->MULTICURRENCY_APP_ID);
|
||||
$multiurrency = new MultiCurrency($db);
|
||||
$result = $multiurrency->syncRates(getDolGlobalString('MULTICURRENCY_APP_ID'));
|
||||
if ($result > 0) {
|
||||
setEventMessages($langs->trans("CurrencyRateSyncSucceed"), null, "mesgs");
|
||||
}
|
||||
|
||||
@ -285,7 +285,7 @@ if (count($listinsetup) > 0) {
|
||||
// Delete
|
||||
print '<td>';
|
||||
$label = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array);
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&provider='.$keyforprovider.'&label='.$label.'">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&provider='.urlencode($keyforprovider).'&label='.urlencode($label).'">';
|
||||
print img_picto('', 'delete');
|
||||
print '</a>';
|
||||
|
||||
@ -298,7 +298,8 @@ if (count($listinsetup) > 0) {
|
||||
$redirect_uri = $urlwithroot.'/core/modules/oauth/'.$supportedoauth2array[$keyforsupportedoauth2array]['callbackfile'].'_oauthcallback.php';
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>';
|
||||
print '<td><input style="width: 80%" type"text" name="uri'.$keyforsupportedoauth2array.'" value="'.$redirect_uri.'" disabled>';
|
||||
print '<td><input style="width: 80%" type="text" name="uri'.$keyforsupportedoauth2array.'" id="uri'.$keyforsupportedoauth2array.$keyforprovider.'" value="'.$redirect_uri.'" disabled>';
|
||||
print ajax_autoselect('uri'.$keyforsupportedoauth2array.$keyforprovider);
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
@ -306,7 +307,7 @@ if (count($listinsetup) > 0) {
|
||||
if ($keyforsupportedoauth2array == 'OAUTH_OTHER_NAME') {
|
||||
print '<tr class="oddeven value">';
|
||||
print '<td>'.$langs->trans("URLOfServiceForAuthorization").'</td>';
|
||||
print '<td><input style="width: 80%" type"text" name="'.$key[3].'" value="'.getDolGlobalString($key[3]).'" >';
|
||||
print '<td><input style="width: 80%" type="text" name="'.$key[3].'" value="'.getDolGlobalString($key[3]).'" >';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -213,7 +213,13 @@ if ($mode == 'setup' && $user->admin) {
|
||||
$urltocheckperms = '';
|
||||
}
|
||||
|
||||
$urltorenew .= '&keyforprovider='.urlencode($keyforprovider);
|
||||
if ($urltorenew) {
|
||||
$urltorenew .= '&keyforprovider='.urlencode($keyforprovider);
|
||||
}
|
||||
if ($urltodelete) {
|
||||
$urltodelete .= '&keyforprovider='.urlencode($keyforprovider);
|
||||
}
|
||||
|
||||
|
||||
// Show value of token
|
||||
$tokenobj = null;
|
||||
|
||||
@ -51,9 +51,9 @@ if (empty($conf->global->PAYMENT_ADDON)) {
|
||||
*/
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
$maskconstpayment = GETPOST('maskconstpayment', 'alpha');
|
||||
$maskconstpayment = GETPOST('maskconstpayment', 'aZ09');
|
||||
$maskpayment = GETPOST('maskpayment', 'alpha');
|
||||
if ($maskconstpayment) {
|
||||
if ($maskconstpayment && preg_match('/_MASK$/', $maskconstpayment)) {
|
||||
$res = dolibarr_set_const($db, $maskconstpayment, $maskpayment, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips'));
|
||||
$langs->loadLangs(array('admin', 'companies', 'languages', 'members', 'other', 'products', 'stocks', 'trips'));
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
@ -276,7 +276,7 @@ print load_fiche_titre($langs->trans("DictionaryPaperFormat"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
$selected = (isset($conf->global->MAIN_PDF_FORMAT) ? $conf->global->MAIN_PDF_FORMAT : '');
|
||||
if (empty($selected)) {
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2012-2107 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2021-2022 Anthony Berton <bertonanthony@gmail.com>
|
||||
* Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -35,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips'));
|
||||
$langs->loadLangs(array('admin', 'bills', 'companies', 'languages', 'members', 'other', 'products', 'propal', 'receptions', 'stocks', 'trips'));
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
@ -69,6 +70,9 @@ if ($action == 'update') {
|
||||
dolibarr_set_const($db, "INVOICE_ADD_SWISS_QR_CODE", GETPOST("INVOICE_ADD_SWISS_QR_CODE", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_del_const($db, "INVOICE_ADD_ZATCA_QR_CODE", $conf->entity);
|
||||
}
|
||||
if (GETPOSTISSET('INVOICE_CATEGORY_OF_OPERATION')) {
|
||||
dolibarr_set_const($db, "INVOICE_CATEGORY_OF_OPERATION", GETPOST("INVOICE_CATEGORY_OF_OPERATION", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
if (GETPOSTISSET('INVOICE_SHOW_SHIPPING_ADDRESS')) {
|
||||
dolibarr_set_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", GETPOST("INVOICE_SHOW_SHIPPING_ADDRESS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_del_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", $conf->entity);
|
||||
@ -135,7 +139,7 @@ if (isModEnabled('facture')) {
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("INVOICE_ADD_ZATCA_QR_CODE"), $langs->trans("INVOICE_ADD_ZATCA_QR_CODEMore"));
|
||||
@ -159,11 +163,21 @@ if (isModEnabled('facture')) {
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Mention category of operations
|
||||
// French Decret n°2099-1299 2022-10-07
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("INVOICE_SHOW_SHIPPING_ADDRESS"), $langs->trans("INVOICE_SHOW_SHIPPING_ADDRESSMore"));
|
||||
print $form->textwithpicto($langs->trans("InvoiceOptionCategoryOfOperations"), $langs->trans('InvoiceOptionCategoryOfOperationsHelp'), 1);
|
||||
print '</td><td>';
|
||||
$arrval = array('0'=>$langs->trans("No"),
|
||||
'1'=>$langs->trans("InvoiceOptionCategoryOfOperationsYes1"),
|
||||
'2'=>$langs->trans("InvoiceOptionCategoryOfOperationsYes2")
|
||||
);
|
||||
print $form->selectarray("INVOICE_CATEGORY_OF_OPERATION", $arrval, $conf->global->INVOICE_CATEGORY_OF_OPERATION, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING").'</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('INVOICE_SHOW_SHIPPING_ADDRESS');
|
||||
print ajax_constantonoff('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("INVOICE_SHOW_SHIPPING_ADDRESS", $arrval, $conf->global->INVOICE_SHOW_SHIPPING_ADDRESS);
|
||||
@ -181,7 +195,7 @@ if (isModEnabled('reception')) {
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("RECEPTION_PDF_HIDE_ORDERED");
|
||||
|
||||
@ -227,7 +227,7 @@ if ($result) {
|
||||
// Tick
|
||||
if ($obj->bydefault == 1) {
|
||||
print '<td class="center">';
|
||||
print '<a class="reposition" href="perms.php?pid='.$obj->id.'&action=remove">';
|
||||
print '<a class="reposition" href="perms.php?pid='.$obj->id.'&action=remove&token='.newToken().'">';
|
||||
//print img_edit_remove();
|
||||
print img_picto('', 'switch_on');
|
||||
print '</a>';
|
||||
|
||||
@ -58,9 +58,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
$error = 0;
|
||||
if ($action == 'updateMask') {
|
||||
$maskconstpropal = GETPOST('maskconstpropal', 'alpha');
|
||||
$maskconstpropal = GETPOST('maskconstpropal', 'aZ09');
|
||||
$maskpropal = GETPOST('maskpropal', 'alpha');
|
||||
if ($maskconstpropal) {
|
||||
if ($maskconstpropal && preg_match('/_MASK$/', $maskconstpropal)) {
|
||||
$res = dolibarr_set_const($db, $maskconstpropal, $maskpropal, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
|
||||
@ -65,9 +65,9 @@ if (empty($conf->global->RECEPTION_ADDON_NUMBER)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
$maskconst = GETPOST('maskconstreception', 'alpha');
|
||||
$maskconst = GETPOST('maskconstreception', 'aZ09');
|
||||
$maskvalue = GETPOST('maskreception', 'alpha');
|
||||
if (!empty($maskconst)) {
|
||||
if (!empty($maskconst) && preg_match('/_MASK$/', $maskconst)) {
|
||||
$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
|
||||
@ -56,8 +56,8 @@ if ($action == 'activate_encrypt') {
|
||||
|
||||
$db->begin();
|
||||
|
||||
// On old version a bug created the constant into user entity, so we delete it to be sure, such entry won't exists. We want it in entity 0 or nowhere.
|
||||
dolibarr_del_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $conf->entity);
|
||||
// On old version, a bug created the constant into user entity, so we delete it to be sure such entry won't exists. We want it in entity 0 or nowhere.
|
||||
dolibarr_del_const($db, "DATABASE_PWD_ENCRYPTED", $conf->entity);
|
||||
// We set entity=0 (all) because DATABASE_PWD_ENCRYPTED is a setup into conf file, so always shared for everybody
|
||||
$entityforall = 0;
|
||||
dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $entityforall);
|
||||
|
||||
@ -211,7 +211,11 @@ print '<td>'.$langs->trans("DeStockOnBill").'</td>';
|
||||
print '<td class="right">';
|
||||
if (isModEnabled('facture')) {
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('STOCK_CALCULATE_ON_BILL', array(), null, 0, 0, 0, 2, 1);
|
||||
if ($disabled) {
|
||||
print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"');
|
||||
} else {
|
||||
print ajax_constantonoff('STOCK_CALCULATE_ON_BILL', array(), null, 0, 0, 0, 2, 1, 0, '', '', 'reposition');
|
||||
}
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL);
|
||||
@ -228,7 +232,11 @@ print '<td>'.$langs->trans("DeStockOnValidateOrder").'</td>';
|
||||
print '<td class="right">';
|
||||
if (isModEnabled('commande')) {
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1);
|
||||
if ($disabled) {
|
||||
print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"');
|
||||
} else {
|
||||
print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition');
|
||||
}
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER);
|
||||
@ -239,7 +247,7 @@ if (isModEnabled('commande')) {
|
||||
print "</td>\n</tr>\n";
|
||||
$found++;
|
||||
|
||||
//if (!empty($conf->expedition->enabled))
|
||||
//if (isModEnabled('expedition'))
|
||||
//{
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
@ -247,7 +255,7 @@ print '<td>'.$langs->trans("DeStockOnShipment").'</td>';
|
||||
print '<td class="right">';
|
||||
if (isModEnabled("expedition")) {
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT', array(), null, 0, 0, 0, 2, 1);
|
||||
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT);
|
||||
@ -264,7 +272,7 @@ print '<td>'.$langs->trans("DeStockOnShipmentOnClosing").'</td>';
|
||||
print '<td class="right">';
|
||||
if (isModEnabled("expedition")) {
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE', array(), null, 0, 0, 0, 2, 1);
|
||||
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE);
|
||||
@ -295,7 +303,11 @@ print '<td>'.$langs->trans("ReStockOnBill").'</td>';
|
||||
print '<td class="right">';
|
||||
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) {
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL', array(), null, 0, 0, 0, 2, 1);
|
||||
if ($disabled) {
|
||||
print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"');
|
||||
} else {
|
||||
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition');
|
||||
}
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL);
|
||||
@ -313,7 +325,11 @@ print '<td>'.$langs->trans("ReStockOnValidateOrder").'</td>';
|
||||
print '<td class="right">';
|
||||
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) {
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1);
|
||||
if ($disabled) {
|
||||
print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"');
|
||||
} else {
|
||||
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition');
|
||||
}
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER);
|
||||
@ -330,7 +346,7 @@ if (isModEnabled("reception")) {
|
||||
print '<td class="right">';
|
||||
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION', array(), null, 0, 0, 0, 2, 1);
|
||||
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION);
|
||||
@ -345,7 +361,7 @@ if (isModEnabled("reception")) {
|
||||
print '<td class="right">';
|
||||
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE', array(), null, 0, 0, 0, 2, 1);
|
||||
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE);
|
||||
@ -358,7 +374,7 @@ if (isModEnabled("reception")) {
|
||||
print '<td class="right">';
|
||||
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) {
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', array(), null, 0, 0, 0, 2, 1);
|
||||
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER);
|
||||
|
||||
@ -64,10 +64,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
$maskconststocktransfer = GETPOST('maskconststocktransfer', 'alpha');
|
||||
$maskconststocktransfer = GETPOST('maskconststocktransfer', 'aZ09');
|
||||
$maskstocktransfer = GETPOST('maskStockTransfer', 'alpha');
|
||||
|
||||
if ($maskconststocktransfer) {
|
||||
if ($maskconststocktransfer && preg_match('/_MASK$/', $maskconststocktransfer)) {
|
||||
$res = dolibarr_set_const($db, $maskconststocktransfer, $maskstocktransfer, 'chaine', 0, '', $conf->entity);
|
||||
if ($res <= 0) $error++;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user