FIX resolve conflicts

This commit is contained in:
lvessiller 2022-10-14 09:33:58 +02:00
commit f71c94ed05
3586 changed files with 235101 additions and 38778 deletions

View File

@ -6,9 +6,13 @@ on:
- cron: "0 21 * * *" - cron: "0 21 * * *"
issue_comment: issue_comment:
types: [created] types: [created]
permissions: {} # none
jobs: jobs:
stale: stale:
permissions:
issues: write
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: Dolibarr/stale@staleunstale - uses: Dolibarr/stale@staleunstale
@ -21,4 +25,4 @@ jobs:
days-before-close: 10 days-before-close: 10
operations-per-run: 100 operations-per-run: 100
dry-run: false dry-run: false

3
.gitignore vendored
View File

@ -42,6 +42,8 @@ htdocs/includes/sebastian/
htdocs/includes/squizlabs/ htdocs/includes/squizlabs/
htdocs/includes/webmozart/ htdocs/includes/webmozart/
htdocs/.well-known/apple-developer-merchantid-domain-association htdocs/.well-known/apple-developer-merchantid-domain-association
/factory/
/output/
# Node Modules # Node Modules
build/yarn-error.log build/yarn-error.log
@ -55,4 +57,3 @@ yarn.lock
package-lock.json package-lock.json
doc/install.lock doc/install.lock
/factory/

View File

@ -6,8 +6,9 @@ build:
analysis: analysis:
tests: tests:
override: override:
- php-scrutinizer-run - command: php-scrutinizer-run
idle_timeout: 8000
imports: imports:
- javascript - javascript
- php - php
@ -39,9 +40,11 @@ tools:
- build/* - build/*
- dev/* - dev/*
- doc/* - doc/*
- test/* - documents/*
- htdocs/includes/* - htdocs/includes/*
- htdocs/core/class/lessc.class.php - htdocs/core/class/lessc.class.php
- node_modules/*
- test/*
paths: paths:
- htdocs/ - htdocs/
- scripts/ - scripts/
@ -181,8 +184,10 @@ tools:
- 'build/*' - 'build/*'
- 'dev/*' - 'dev/*'
- 'doc/*' - 'doc/*'
- 'test/*' - 'documents/*'
- 'htdocs/includes/*' - 'htdocs/includes/*'
- 'node_modules/*'
- 'test/*'
paths: { } paths: { }
# Similar code detection # Similar code detection
@ -194,8 +199,10 @@ tools:
- 'build/*' - 'build/*'
- 'dev/*' - 'dev/*'
- 'doc/*' - 'doc/*'
- 'test/*' - 'documents/*'
- 'htdocs/includes/*' - 'htdocs/includes/*'
- 'node_modules/*'
- 'test/*'
paths: { } paths: { }
# Coding-Style / Bug Detection # Coding-Style / Bug Detection
@ -209,8 +216,10 @@ tools:
- 'build/*' - 'build/*'
- 'dev/*' - 'dev/*'
- 'doc/*' - 'doc/*'
- 'test/*' - 'documents/*'
- 'htdocs/includes/*' - 'htdocs/includes/*'
- 'node_modules/*'
- 'test/*'
paths: { } paths: { }
config: { } config: { }
path_configs: { } path_configs: { }

View File

@ -2,10 +2,9 @@
# from Dolibarr GitHub repository. # from Dolibarr GitHub repository.
# For syntax, see https://docs.travis-ci.com/user/languages/php/ # For syntax, see https://docs.travis-ci.com/user/languages/php/
# We use dist: xenial to have php 5.6+ available # We use dist: bionic = 18.04
os: linux os: linux
dist: xenial dist: bionic
#dist: bionic
language: php language: php
@ -18,22 +17,43 @@ services:
- mysql - mysql
- postgresql - postgresql
before_install:
- |
echo "Add ondrej PPA"
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update
echo "Disabling Xdebug for composer"
export PHP_VERSION_NAME=$(phpenv version-name)
echo $PHP_VERSION_NAME
ls ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini
phpenv config-rm xdebug.ini
phpenv rehash
echo
addons: addons:
# Force postgresql to 9.4 (the oldest availablable on xenial) # Force postgresql version
postgresql: '9.4' postgresql: '10'
apt: apt:
sources: sources:
# To use the last version of pgloader, we add repo of postgresql with a name available in http://apt.postgresql.org/pub/repos/apt/ - sourceline: 'ppa:ondrej/php'
- pgdg-xenial
packages: packages:
# We need a webserver to test the webservices # We need a webserver to test the webservices
# Let's install Apache with. # Let's install Apache with.
- apache2 - apache2
# mod_php is not supported by Travis. Add fcgi. We install FPM later on.
- libapache2-mod-fastcgi
# We need pgloader for import mysql database into pgsql # We need pgloader for import mysql database into pgsql
- pgloader - pgloader
- php
- php7.1-pgsql
- php7.1-mysqli
- php7.1-xml
- php7.1-intl
- php8.1-pgsql
- php8.1-mysqli
- php8.1-xml
- php8.1-intl
env: env:
global: global:
# Set to true for very verbose output # Set to true for very verbose output
@ -44,21 +64,21 @@ jobs:
#allow_failures: #allow_failures:
#- php: nightly #- php: nightly
include: include:
- stage: PHP 5.6-7.4 - stage: PHP 7.0-8.1
if: type = push if: type = push
php: '5.6' php: '7.1'
env: DB=postgresql env: DB=postgresql
- stage: PHP 5.6-7.4 - stage: PHP 7.0-8.1
if: type = pull_request OR type = push if: type = pull_request OR type = push
php: '7.4.22' php: '8.1'
env: DB=mysql env: DB=mysql
- stage: PHP Dev - stage: PHP Dev
if: type = push AND branch = develop if: type = push AND branch = develop
php: nightly php: nightly
env: DB=mysql env: DB=mysql
- stage: PHP Dev - stage: PHP Dev
if: type = push AND branch = 15.0 if: type = push AND branch = 17.0
php: nightly php: nightly
env: DB=mysql env: DB=mysql
notifications: notifications:
@ -72,13 +92,6 @@ notifications:
on_failure: always on_failure: always
use_notice: true use_notice: true
before_install:
- |
echo "Disabling Xdebug for composer"
export PHP_VERSION_NAME=$(phpenv version-name)
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini
phpenv config-rm xdebug.ini
echo
install: install:
- | - |
@ -94,13 +107,6 @@ install:
- | - |
echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer, PHP Vardump check - for $TRAVIS_PHP_VERSION" echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer, PHP Vardump check - for $TRAVIS_PHP_VERSION"
if [ "$TRAVIS_PHP_VERSION" = '5.6' ]; then
composer -n require phpunit/phpunit ^5 \
php-parallel-lint/php-parallel-lint ^1 \
php-parallel-lint/php-console-highlighter ^0 \
php-parallel-lint/php-var-dump-check ~0.4 \
squizlabs/php_codesniffer ^3
fi
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then
composer -n require phpunit/phpunit ^6 \ composer -n require phpunit/phpunit ^6 \
php-parallel-lint/php-parallel-lint ^1 \ php-parallel-lint/php-parallel-lint ^1 \
@ -108,7 +114,7 @@ install:
php-parallel-lint/php-var-dump-check ~0.4 \ php-parallel-lint/php-var-dump-check ~0.4 \
squizlabs/php_codesniffer ^3 squizlabs/php_codesniffer ^3
fi fi
if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '7.4.22' ]; then if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ]; then
composer -n require phpunit/phpunit ^7 \ composer -n require phpunit/phpunit ^7 \
php-parallel-lint/php-parallel-lint ^1.2 \ php-parallel-lint/php-parallel-lint ^1.2 \
php-parallel-lint/php-console-highlighter ^0 \ php-parallel-lint/php-console-highlighter ^0 \
@ -116,8 +122,8 @@ install:
squizlabs/php_codesniffer ^3 squizlabs/php_codesniffer ^3
fi fi
# phpunit 9 is required for php 8 # phpunit 9 is required for php 8
if [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then if [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
composer -n require --ignore-platform-reqs phpunit/phpunit ^7 \ composer -n require --ignore-platform-reqs phpunit/phpunit ^8 \
php-parallel-lint/php-parallel-lint ^1.2 \ php-parallel-lint/php-parallel-lint ^1.2 \
php-parallel-lint/php-console-highlighter ^0 \ php-parallel-lint/php-console-highlighter ^0 \
php-parallel-lint/php-var-dump-check ~0.4 \ php-parallel-lint/php-var-dump-check ~0.4 \
@ -246,17 +252,22 @@ before_script:
- echo "Setting up Apache + FPM" - echo "Setting up Apache + FPM"
# setup link for php legacy
- sudo ln -s ~/.phpenv/versions/$(phpenv version-name)/bin/php /bin/php
# install apache web server
- sudo apt-get install apache2 php-fpm php-mysql php-pgsql php-gd php-ldap php-xml php-mbstring libapache2-mod-php
# enable php-fpm # enable php-fpm
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- | - |
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '7.4.22' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
# Copy the included pool # Copy the included pool
sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf
fi fi
- sudo a2enmod rewrite actions fastcgi alias - sudo a2enmod proxy_fcgi rewrite setenvif cgi alias
- echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars - sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars
- sudo chown -R travis:travis /var/lib/apache2/fastcgi #- sudo chown -R travis:travis /var/lib/apache2/fastcgi
# start php-fpm
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
# configure apache virtual hosts # configure apache virtual hosts
- sudo cp -f build/travis-ci/apache.conf /etc/apache2/sites-available/000-default.conf - sudo cp -f build/travis-ci/apache.conf /etc/apache2/sites-available/000-default.conf
@ -284,12 +295,12 @@ script:
set -e set -e
#parallel-lint --exclude htdocs/includes --blame . #parallel-lint --exclude htdocs/includes --blame .
# Exclusions are defined in the ruleset.xml file # Exclusions are defined in the ruleset.xml file
if [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then if [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \ parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \
--exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \ --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \
--exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \ --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \
--exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \ --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \
--exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --blame . --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --exclude htdocs/includes/webklex --blame .
fi fi
set +e set +e
echo echo
@ -299,7 +310,7 @@ script:
# Ensure we catch errors # Ensure we catch errors
set -e set -e
# Exclusions are defined in the ruleset.xml file # Exclusions are defined in the ruleset.xml file
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .;
fi fi
set +e set +e
@ -310,7 +321,7 @@ script:
# Ensure we catch errors # Ensure we catch errors
set -e set -e
# Exclusions are defined in the ruleset.xml file # Exclusions are defined in the ruleset.xml file
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
var-dump-check --extensions php --tracy --exclude htdocs/includes --exclude test/ --exclude htdocs/public/test/ --exclude htdocs/core/lib/functions.lib.php . var-dump-check --extensions php --tracy --exclude htdocs/includes --exclude test/ --exclude htdocs/public/test/ --exclude htdocs/core/lib/functions.lib.php .
fi fi
set +e set +e
@ -471,6 +482,9 @@ after_script:
ls $TRAVIS_BUILD_DIR/documents ls $TRAVIS_BUILD_DIR/documents
#cat $TRAVIS_BUILD_DIR/documents/dolibarr.log #cat $TRAVIS_BUILD_DIR/documents/dolibarr.log
sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log
echo "After script - Output last lines of apache error.log"
sudo ls /var/log/apache2
sudo tail -n 50 /var/log/apache2/travis_error_log
after_success: after_success:
- | - |
@ -479,16 +493,16 @@ after_success:
after_failure: after_failure:
- | - |
echo Failure detected, so we show samples of log to help diagnose echo Failure detected, so we show samples of log to help diagnose
# This part of code is executed only if previous command that fails are enclosed with set +e # This part of code is executed only if the command that fails are enclosed with set +e
# Upgrade log files # Show upgrade log files
for ficlog in `ls $TRAVIS_BUILD_DIR/*.log` for ficlog in `ls $TRAVIS_BUILD_DIR/*.log`
do do
echo "Debugging informations for file $ficlog" echo "Debugging informations for file $ficlog"
#cat $ficlog #cat $ficlog
done done
# Apache log file # Show Apache log file
echo "Debugging informations for file apache error.log" echo "Debugging informations for file apache error.log"
sudo cat /var/log/apache2/travis_error_log sudo tail -n 50 /var/log/apache2/travis_error_log
if [ "$DEBUG" = true ]; then if [ "$DEBUG" = true ]; then
# Dolibarr log file # Dolibarr log file
echo "Debugging informations for file dolibarr.log (latest 50 lines)" echo "Debugging informations for file dolibarr.log (latest 50 lines)"

View File

@ -98,6 +98,12 @@ source_file = htdocs/langs/en_US/cron.lang
source_lang = en_US source_lang = en_US
type = MOZILLAPROPERTIES type = MOZILLAPROPERTIES
[dolibarr.datapolicy]
file_filter = htdocs/langs/<lang>/datapolicy.lang
source_file = htdocs/langs/en_US/datapolicy.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.deliveries] [dolibarr.deliveries]
file_filter = htdocs/langs/<lang>/deliveries.lang file_filter = htdocs/langs/<lang>/deliveries.lang
source_file = htdocs/langs/en_US/deliveries.lang source_file = htdocs/langs/en_US/deliveries.lang

View File

@ -13,7 +13,7 @@ The Dolibarr images resources (available in the doc directory) is distributed un
The name Dolibarr is a trademark initially registered by Laurent Destailleur and ceased to the Dolibarr foundation. You can use the name Dolibarr The name Dolibarr is a trademark initially registered by Laurent Destailleur and ceased to the Dolibarr foundation. You can use the name Dolibarr
for your own need as long as you follow the rules defined on the page https://wiki.dolibarr.org/index.php/Rules_to_use_the_brand_name_%22Dolibarr%22 for your own need as long as you follow the rules defined on the page https://wiki.dolibarr.org/index.php/Rules_to_use_the_brand_name_%22Dolibarr%22
The use of the name DoliStore is also restricted to the same rules defined on https://wiki.dolibarr.org/index.php/Rules_to_use_the_brand_name_%22Dolibarr%22 The use of the name DoliStore is also restricted to the same rules defined on https://wiki.dolibarr.org/index.php/Rules_to_use_the_brand_name_%22Dolibarr%22
@ -31,10 +31,11 @@ Mobiledetect 2.8.39 MIT License Yes
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package) NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
ParseDown 1.6 MIT License Yes Markdown parser ParseDown 1.6 MIT License Yes Markdown parser
PCLZip 2.8.4 LGPL-3+ Yes Library to zip/unzip files PCLZip 2.8.4 LGPL-3+ Yes Library to zip/unzip files
PHPDebugBar 1.15.1 MIT License Yes Used only by the module "debugbar" for developers PHPDebugBar 1.15.1 MIT License Yes Used only by the module "debugbar" for developers
PHP-Imap 2.7.2 MIT License Yes Library to use IMAP with OAuth
PHPSpreadSheet 1.8.2 LGPL-2.1+ Yes Read/Write XLS files, read ODS files PHPSpreadSheet 1.8.2 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
php-iban 4.1 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP php-iban 4.1.1 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
PSR/Logs 1.0 MIT License Yes Library for logs (used by DebugBar) PSR/Logs 1.0 MIT License Yes Library for logs (used by DebugBar)
@ -52,7 +53,7 @@ Ace 1.4.14 BSD Yes
ChartJS 3.7.1 MIT License Yes JS library for graph ChartJS 3.7.1 MIT License Yes JS library for graph
CKEditor 4.18 LGPL-2.1+ Yes Editor WYSIWYG CKEditor 4.18 LGPL-2.1+ Yes Editor WYSIWYG
jQuery 3.6.0 MIT License Yes JS library jQuery 3.6.0 MIT License Yes JS library
jQuery UI 1.13.1 GPL and MIT License Yes JS library plugin UI jQuery UI 1.13.2 GPL and MIT License Yes JS library plugin UI
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups) jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors

397
ChangeLog
View File

@ -4,11 +4,107 @@ English Dolibarr ChangeLog
***** ChangeLog for 17.0.0 compared to 16.0.0 ***** ***** ChangeLog for 17.0.0 compared to 16.0.0 *****
For users:
---------------
NEW Minimal PHP version is now PHP 7.0 instead of PHP 5.6
...
For developers or integrators: For developers or integrators:
------------------------------ ------------------------------
NEW Minimal PHP version is now PHP 7.0 instead of PHP 5.6
...
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product * The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product
* Trigger ORDER_SUPPLIER_DISPATCH is removed, use ORDER_SUPPLIER_RECEIVE and/or LINEORDER_SUPPLIER_DISPATCH instead.
* All functions fetch_all() are deprecated for naming consitency, use fetchAll() instead
***** ChangeLog for 16.0.1 compared to 16.0.0 *****
FIX: #16476 on massaction the pdf generation is not using the t…
FIX: #21416 Filter tag no-categorie in members
FIX: #21543
FIX: #21799 inactive companies shall not be selectable for new proposals, orders and invoices
FIX: #21859 Don't show html balise on list for private/public note
FIX: #22164
FIX: #22241
FIX: #22263 Accountancy - Account number expected in place of a rowid on parent account on export
FIX: #22264 Accountancy - Translation on chart of accounts export
FIX: #22265 Accountancy - Account number expected in place of a rowid on export
FIX: #22334
FIX: #22360
FIX: #22379 creating events on supplier order
FIX: #22382 Error on length of supplier reference
FIX: #22386 IBAN not mandatory for International Export Countries
FIX: #22440 Lang Key "UserAccountNotDefined" is missing
FIX: #22482
FIX: #22507
FIX: Accountancy - Some manuals operations are displayed in subledger
FIX: API reception return error 500
FIX: avoid override initial message ($this instead $object)
FIX: avoid some warnings (php8+)
FIX: Bad backtopage and CSRF on link for ticket message
FIX: bad closing select
FIX: broken feature, wrong fk_parent_line after cloning object
FIX: Column label
FIX: compatibility if javascript not actived
FIX: compatibility with Mysql <= 5.7
FIX: contact deletion: execute trigger before really deleting
FIX: CronJob sendBackup
FIX: CSRF + lost value of constant after use save button
FIX: CSS
FIX: data integrity for llx_delivery table
FIX: default value for partnership status
FIX: deletion of the MO_CHILD link
FIX: Dictionary - Display error on cache_vatrates
FIX: Dolibarr#16476 version 2a
FIX: Duplicate creation of invoice when closing shipment linked to order
FIX: Duplicate in list when filtering on categories
FIX: extrafields with value '0' was ''
FIX: filters lost when sorting on productMargin and customerMargins
FIX: fk_expedition in $line can be usefull for triggers
FIX: Import in upgrade when using a socialnetwork field.
FIX: input hidden with fk_product of line on mo production can be usefull
FIX: inventory code must be different at each transation
FIX: inventory total columns
FIX: Issue #16476 on massaction the pdf generation is not using the thirdparty language settings
FIX: Linked object agenda card
FIX: missing check if category module is enabled
FIX: missing check if incoice as a payment (wrong status)
FIX: missing class "societe" when create another object with workflow
FIX: missing error message if image size too large
FIX: Missing reposition
FIX: missing the management of a constant in the Ticket config
FIX: Missing token in different URLs links
FIX: @ must be allowed into dol_eval to allow rules including external module string 'abc@def'
FIX: - php V8 get number doc saphir
FIX: - php V8 propal index last draft
FIX: Preview button position on documents list (case when the file is too long)
FIX: Project - on global view, missing display of ref customer
FIX: Protection against bad value into accurancy setup
FIX: reading of trackid in emailcollector (when on recipient suffix)
FIX: recruitment linked files
FIX: Remove use of code we should not have
FIX: Restore the option MAIN_OPTIMIZEFORTEXTBROWSER
FIX: Rich text is not diplayed
FIX: same thing in deleteline
FIX: Supplier Reference is lost when page breaks
FIX: support of array parameters in "add to bookmark" feature.
FIX: Test that web dir is correct in install
FIX: the shipment PDF was using the full size logo instead of small
FIX: Token Error : delete stock transfer
FIX: ToOfferALinkForOnlinePayment not translated
FIX: tooltip of technical tables added of a module
FIX: wrong result check when update expensereport line
***** ChangeLog for 16.0.0 compared to 15.0.0 ***** ***** ChangeLog for 16.0.0 compared to 15.0.0 *****
@ -16,120 +112,120 @@ Following changes may create regressions for some external modules, but were nec
For users: For users:
--------------- ---------------
NEW: PHP 8.1 compatibility NEW: PHP 8.0 and 8.1 compatibility:
Warning!! Application works correctly with PHP 8.0 and 8.1 but you will experience a lot of PHP warnings into the PHP server
log files (depending on your PHP setup). Removal of all PHP warnings on server side is planned for v17.
NEW: Support for recurring purchase invoices. NEW: Support for recurring purchase invoices.
NEW: #20292 Include German public holidays NEW: #20292 Include German public holidays
NEW: Can show ZATCA QRCode on PDFs NEW: Can show ZATCA QR-Code on PDFs
NEW: Can show Swiss QR Code on PDFs NEW: Can show Swiss QR-Code on PDFs
NEW: #17123 added ExtraFields for Stock Mouvement NEW: #17123 added ExtraFields for Stock Mouvement
NEW: #20609 : new massaction to assign a sale representatives on a selection of thirdparties NEW: #20609 new massaction to assign a sale representatives on a selection of thirdparties
NEW: #20653 edit discount pourcentage for all lines in one shot NEW: #20653 edit discount pourcentage for all lines in one shot
NEW: Accept 'auto' for ref of object on import of purchase order/proposal NEW: Accept 'auto' for ref of object on import of purchase order/proposal
NEW: Accountancy - Add more filters and info on page to bind accounting accounts NEW: Accountancy - Add more filters and info on page to bind accounting accounts
NEW: Accountancy - Add subledger account when we generate a transaction with a deposit invoice NEW: Accountancy - Add subledger account when generate a transaction with a deposit invoice
NEW: Accountancy - Add a massaction to preselect an account (customer and supplier list) NEW: Accountancy - Add a massaction to preselect an account (customer and supplier list)
NEW: Accountancy - Add hidden feature for accounting reconciliation
NEW: ACE Editor is restored at same cursor position after a save. NEW: ACE Editor is restored at same cursor position after a save.
NEW: Add "addMoreActionsButtons" hook to subscription form NEW: Add "addMoreActionsButtons" hook to subscription form
NEW: Add an option in GUI to show a Quick add button into top menu bar NEW: Add an option in GUI to show a Quick add button into top menu bar
NEW: Module Recruitment - Add a public page with all list of open job positions.
NEW: Module Recruitment - Add a tab with list of application on the jobposition file.
NEW: Add a workflow to auto link contract on a ticket NEW: Add a workflow to auto link contract on a ticket
NEW: Add column date of Signature on proposal list
NEW: Add column template invoice in invoice list NEW: Add column template invoice in invoice list
NEW: Add column "Total HT" to products array on document creation card NEW: Add column "Total HT" to products array on document creation card
NEW: ADD configuration for text color of button action NEW: Add configuration for text color of button action
NEW: Add constant to hide categories in TakePos
NEW: Add constant to show category description in TakePos
NEW: Add constant to show only the products in stock in TakePos
NEW: Add entity filter in exports
NEW: Show the event block on recurring invoices #20870 NEW: Show the event block on recurring invoices #20870
NEW: Add filter "opportunity status" on statistics of projects.
NEW: Add firstname, lastname and max number of attendees for module "Event Organization" NEW: Add firstname, lastname and max number of attendees for module "Event Organization"
NEW: add margin info in proposal and order list NEW: Add margin info in proposal and order list
NEW: Add massaction "Edit Extrafield" for Product
NEW: Add more fields to detect duplicate during import of thirdparties NEW: Add more fields to detect duplicate during import of thirdparties
NEW: Add option to foce delivery on email for purchase order receipt to yes NEW: Add option to foce delivery on email for purchase order receipt to yes
NEW: Add param boder table for md theme
NEW: Add param color button action
NEW: Add possibility to create contract from invoice NEW: Add possibility to create contract from invoice
NEW: Add possibility with constant MAIN_LOGIN_BADCHARUNAUTHORIZED to define bad character unauthorized into login name NEW: Add possibility with constant MAIN_LOGIN_BADCHARUNAUTHORIZED to define bad character unauthorized into login name
NEW: Add private and public notes on tax files. NEW: Add private and public notes on tax files
NEW: Add status "Obsolete" to KM articles
NEW: Add substitutions "user numbers" NEW: Add substitutions "user numbers"
NEW: Add the possibility to add sub-BOMs to BOM
NEW: allow a ticket to be automatically marked as read when created from backend.
NEW: allow cut&paste as real numeric value to excel NEW: allow cut&paste as real numeric value to excel
NEW: A public form to send a message and create a lead is available NEW: A public form to send a message and create a lead is available
NEW: automatically set totally received status in reception NEW: automatically set totally received status in reception
NEW: Auto set invoice paid when adding credit not and remain to pay is 0 NEW: Auto set invoice paid when adding credit not and remain to pay is 0
NEW: Availibility dictionnary has a new column unit and number NEW: Backup tool has an "lowmemory" option for mysqldump on large database
NEW: barcode rule to insert product in takepos
NEW: Can change value of AWP during the inventory
NEW: Can enter price with tax for predefined products on purchase objects NEW: Can enter price with tax for predefined products on purchase objects
NEW: Can filter on a thirdparty on product statistics
NEW: Can removed doc templates from setup page of thirdparty NEW: Can removed doc templates from setup page of thirdparty
NEW: Can set the parent company during the creation of thirdparty (action=add of societe/card.php)
NEW: Can use ! to make a search that exclude a string NEW: Can use ! to make a search that exclude a string
NEW: Change in theme colors does not need to use the refresh button
NEW: clean values and amount in FEC import NEW: clean values and amount in FEC import
NEW: const MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND for mailing mass action NEW: const MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND for mailing mass action
NEW: Contact filter project list NEW: Contact filter project list
NEW: Create contract from invoice NEW: Create contract from invoice
NEW: create third-party with contact if not found on public ticket NEW: Database: Can store the session into database (instead of beeing managed by PHP)
NEW: Database: Some core tables are created only at module activation
NEW: Default value for MAIN_SECURITY_CSRF_WITH_TOKEN is now 2 (GET are also protected agains CSRF attacks) NEW: Default value for MAIN_SECURITY_CSRF_WITH_TOKEN is now 2 (GET are also protected agains CSRF attacks)
NEW: deposit payment terms: add field into dictionary admin page to define default percentage of deposit. NEW: deposit payment terms: add field into dictionary admin page to define default percentage of deposit.
NEW: Dictionaries - add possibility to manage countries in EEC NEW: Dictionaries - add possibility to manage countries in EEC
NEW: display errors in a message box after generating documents NEW: Dictionaries - Availibility dictionnary has a new column unit and number
NEW: Display physical and virtual stock of the products when creating OF from a BOM NEW: Display errors in a message box after generating documents
NEW: Display product ref in "Object link" product tab for BOM
NEW: Enhance the import. Can use 'auto' for the ref (import of orders) NEW: Enhance the import. Can use 'auto' for the ref (import of orders)
NEW: Events on Proposal to Return to Draft NEW: Events on Proposal to Return to Draft
NEW: Exports - add entity filter in exports
NEW: Page to list expense report payments NEW: Page to list expense report payments
NEW: JS inventory autocalc input NEW: JS inventory autocalc input
NEW: language support for more emailing target selectors NEW: language support for more emailing target selectors
NEW: leave requests: add field into type dictionary to block request if balance is negative NEW: leave requests: add field into type dictionary to block request if balance is negative
NEW: MAIN_MAIL_AUTOCOPY_TO can accept several email and special keys
NEW: MAIN_SEARCH_CAT_OR_BY_DEFAULT const for search by category
NEW: Mass action "Close shipments" NEW: Mass action "Close shipments"
NEW: Module website now supports the multicompany module NEW: Module BOM - add tabs for nets BOM
NEW: More mode for THEME_TOPMENU_DISABLE_IMAGE (2, 3, ...) NEW: Module BOM - add the possibility to add sub-BOMs to BOM
NEW: Module Recruitment - Add a public page with list of all open job positions.
NEW: Module Recruitment - Add a tab with list of application on the jobposition file.
NEW: Add option to move checkbox column as first column on Thirdparty list (only few screens) NEW: Add option to move checkbox column as first column on Thirdparty list (only few screens)
NEW: Add tabs for nets Bom
NEW: on redirect of page in website module, GET parameters are kept.
NEW: optional display warning icons on ticket list
NEW: option to default check "notify tier at creation" in ticket module
NEW: option update prices on proposal cloning
NEW: payment conditions enabling semi-automatic deposit creation (Issue #18439) NEW: payment conditions enabling semi-automatic deposit creation (Issue #18439)
NEW: possibility to consume multiple batch NEW: possibility to consume multiple batch
NEW: Reverse movement product consumption NEW: Reverse movement product consumption
NEW: Send email to the supplier order contact NEW: Send email to the supplier order contact
NEW: New permission to report time on timesheet. NEW: add permission to report time on timesheet
NEW: Knowledge Management - add status "Obsolete" to KM articles
NEW: MRP - split consumption line on MO
NEW: MRP - display physical and virtual stock of the products when creating OF from a BOM
NEW: MRP - display product ref in "Object link" product tab for BOM
NEW: Orders - support user_modif in order
NEW: Products - add massaction "Edit Extrafield" for Product
NEW: Products - List - add thumbnail field in product list
NEW: Products - Statistics - can filter on a thirdparty
NEW: Projects - add filter "opportunity status" on statistics of projects.
NEW: Proposals - option update prices on proposal cloning
NEW: Proposals - List - add column date of Signature on proposal list
NEW: SEPA XML - option to place payment Type Info at Credit transfer Transaction level NEW: SEPA XML - option to place payment Type Info at Credit transfer Transaction level
NEW: Show number of votes into the label of tab "Results" of a survey NEW: Stocks - stock filter in reassort lists
NEW: Show product reference in Takepos NEW: Stocks - stock limit in stock export CSV
NEW: Some core tables are created only at module activation NEW: Stocks - Inventory - can change value of AWP during the inventory
NEW: split consumption line on MO
NEW: stock filter in reassort lists
NEW: stock limit in stock export CSV
NEW: Sub-bom are availables
NEW: Supplier order - Show ref supplier of reception in linked object block NEW: Supplier order - Show ref supplier of reception in linked object block
NEW: support user_modif in order NEW: Surveys - Show number of votes into the label of tab "Results" of a survey
NEW: TakePos - pagination on search results NEW: TakePOS - barcode rule to insert product in TakePOS
NEW: The backup tools has an "lowmemory" option for mysqldump on large database NEW: TakePOS - pagination on search results
NEW: TakePOS - show product reference
NEW: TakePOS - add constant to hide categories
NEW: TakePOS - add constant to show category description
NEW: TakePOS - add constant to show only the products in stock
NEW: Themes - add param color button action
NEW: Themes - Change in theme colors does not need to use the refresh button
NEW: Themes - more modes for THEME_TOPMENU_DISABLE_IMAGE (2, 3, ...)
NEW: Themes - MD - add param border table for md theme
NEW: Third-Parties - add rules "customer accountancy code" is mandatory to validate invoice
NEW: Third-Parties - can set the parent company during the creation of thirdparty (action=add of societe/card.php)
NEW: Tickets - allow a Ticket to be automatically marked as read when created from backend
NEW: Tickets - create Third-party with contact if not found on public ticket
NEW: Tickets - option to default check "notify tier at creation"
NEW: Tickets - Trigger: allow to automatically send messages on new tickets
NEW: Tickets - optional display warning icons on ticket list
NEW: Websites Module - supports now the multicompany module
NEW: Websites Module - on redirect of page in website module, GET parameters are kept.
NEW: The 'reposition' class works on ajax constantonoff that make redirects NEW: The 'reposition' class works on ajax constantonoff that make redirects
NEW: Thirdparty - Add rules "customer accountancy code" is mandatory to validate invoice
NEW: thumbnail field in product list
NEW: total mark rate in list NEW: total mark rate in list
NEW: uncheck "send message" by default on a ticket when private messages has been checked NEW: uncheck "send message" by default on a ticket when private messages has been checked
NEW: VAT Report by month - Show detail by rate and also by code NEW: VAT Report by month - Show detail by rate and also by code
NEW: Ticket triggers: allow to automatically send messages on new tickets
NEW: Accountancy - Add hidden feature for accounting reconciliation
NEW: Can store the session into database (instead of beeing managed by PHP)
NEW: Added MMK currency (Myanmar Kyat) NEW: Added MMK currency (Myanmar Kyat)
NEW: On a form to send an email, we show all emails of contacts of object
Modules Modules state
NEW: Module Partnership Management NEW: Module Partnership Management - stable
NEW: Experimental module Event Organization Management NEW: Module Event Organization Management - stable
For developers or integrators: For developers or integrators:
@ -137,48 +233,46 @@ For developers or integrators:
NEW: dol_uncompress() supports more extensions (.gz, .bz2, .zstd). Only .zip was supported before. NEW: dol_uncompress() supports more extensions (.gz, .bz2, .zstd). Only .zip was supported before.
NEW: Implement a generic method for Kaban views NEW: Implement a generic method for Kaban views
NEW: Upgrade chartjs library to 3.7.1 NEW: Upgrade chartjs library to 3.7.1
NEW: update rank line is possible on API for customer invoices, sales orders and supplier invoice
NEW: stripe element with more gateways NEW: stripe element with more gateways
NEW: solde() function evolution to be able to get solde until a chosen date NEW: solde() function evolution to be able to get solde until a chosen date
NEW: Suggest a way to run upgrade per entities. NEW: Suggest a way to run upgrade per entities.
NEW: Support html content for multiselect component. NEW: Support html content for multiselect component.
NEW: ModuleBuilder - Add tabs view in module builder NEW: ModuleBuilder - Add tabs view in module builder
NEW: ModuleBuilder - More feature that can be modifed after module generation NEW: ModuleBuilder - More feature that can be modifed after module generation
NEW: Hook getNomUrl available everywhere in tooltip of ref links
NEW: Identification of tr is possible with by attribute data-id on some pages NEW: Identification of tr is possible with by attribute data-id on some pages
NEW: Import with select boxes V2 NEW: Import with select boxes V2
NEW: Can update rank of invoice, proposal and order lines with API update
NEW: Can use current entity filter on 'chkbxlst' NEW: Can use current entity filter on 'chkbxlst'
NEW: Creation of the function select_bom() used to display bom select list NEW: Creation of the function select_bom() used to display bom select list
NEW: add printFieldListWhere hook in product reassort card
NEW: Add trigger and event on completely received status change NEW: Add trigger and event on completely received status change
NEW: Add utility function send backup by mail NEW: Add utility function send backup by mail
NEW: add WordPress OAuth to save a token (not SSO) NEW: add WordPress OAuth to save a token (not SSO)
NEW: A module can embed a sql script run at each Dolibarr upgrade NEW: A module can embed a SQL script run at each Dolibarr upgrade
NEW: API Proposals - Add POST lines
NEW: API REST filter states by country
NEW: Add option INVOICEREC_SET_AUTOFILL_DATE_START/END
NEW: Add option MAIN_API_DEBUG to save API logs into a file
NEW: Add param to keep the robot=index meta tag on public pages NEW: Add param to keep the robot=index meta tag on public pages
NEW: Add method hintindex() in database handlers. NEW: Add method hintindex() in database handlers.
NEW: add modifications for new function "$db->prefix()" NEW: add modifications for new function "$db->prefix()"
NEW: addMoreActionsButtonsList hook for button in list NEW: addMoreActionsButtonsList hook for button in list
NEW: Add API to get a template invoice
NEW: Standardize a lot of code. NEW: Standardize a lot of code.
NEW: #20736 Allow extrafields SQL filters on REST API product lookup
NEW: #19294 implement detailed timespent in task of project API
NEW: Add a protection into PHPunit to avoid to forget a var_dump NEW: Add a protection into PHPunit to avoid to forget a var_dump
API:
NEW: API Proposals - Add POST lines
NEW: API REST filter states by country
NEW: Add API to get a template invoice
NEW: Add datem and type parameters to API to create movements NEW: Add datem and type parameters to API to create movements
NEW: Add hidden option on contract PDF line to hide qty and price NEW: #19294 implement detailed timespent in task of project API
NEW: Option MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND to send last document in mass mailing action NEW: #20736 Allow extrafields SQL filters on REST API product lookup
NEW: Add hooks: selectContactListWhere hook, selectThirdpartyListWhere hook NEW: Can update rank of invoice, proposal and order lines with API update
NEW: TakePos - add hooks complete product display NEW: update rank line is possible on API for customer invoices, sales orders and supplier invoice
NEW: TakePos - add hooks for cart display NEW: Add option MAIN_API_DEBUG to save API logs into a file
NEW: TakePos - add hooks to complete ajax return array
Hooks:
NEW: Hook getNomUrl available everywhere in tooltip of ref links
NEW: Add hooks: selectContactListWhere hook, selectThirdpartyListWhere hook
NEW: Add hook before the public ticket list NEW: Add hook before the public ticket list
NEW: Add hook doaction in takepos invoice NEW: Add hook for Notif
NEW: Add Hook for Notif
NEW: Add hook for more buttons NEW: Add hook for more buttons
NEW: add hook printFieldListWhere in product ressort card
NEW: Add hook printFieldListWhere in "show_contacts" function NEW: Add hook printFieldListWhere in "show_contacts" function
NEW: Add hook printFieldWhere in load_state_board function NEW: Add hook printFieldWhere in load_state_board function
NEW: Add hooks contact tab badge and hooks parameter for avoid conflicts NEW: Add hooks contact tab badge and hooks parameter for avoid conflicts
@ -190,15 +284,28 @@ NEW: Add hooks on project task time page
NEW: Add hooks on salaries and sociales card NEW: Add hooks on salaries and sociales card
NEW: Add hooks select product list and select thirdparty list function NEW: Add hooks select product list and select thirdparty list function
NEW: Add hook to getSellPrice function NEW: Add hook to getSellPrice function
NEW: TakePos - add hooks complete product display
NEW: TakePos - add hooks for cart display
NEW: TakePos - add hooks to complete ajax return array
NEW: TakePOS - add hook doaction in TakePOS invoice
Config Options:
NEW: Add hidden option on contract PDF line to hide qty and price
NEW: Option MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND to send last document in mass mailing action
NEW: Option MAIN_API_DEBUG to save API logs into a file
NEW: Option MAIN_MAIL_AUTOCOPY_TO can accept several email and special keys
NEW: Option MAIN_SEARCH_CAT_OR_BY_DEFAULT const for search by category
NEW: Option INVOICEREC_SET_AUTOFILL_DATE_START/END
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* There is a new specific permission to be allowed to enter timesheets. If you use timesheet, don't forget to give the new permission (disable and * There is a new specific permission to be allowed to enter timesheets. If you use timesheet, don't forget to give the new permission (disable and
enable the module project if it is not visible). enable the module project if it is not visible).
* The default value for MAIN_SECURITY_CSRF_WITH_TOKEN has been set to 2. It means any POST and any GET request that contains the "action" or "massaction" * The default value for MAIN_SECURITY_CSRF_WITH_TOKEN has been set to 2. It means any POST and any GET request that contains the "action" or "massaction"
with a value of a sensitive action must also a valid token parameter (With previous value 1, only POST was concerned). Note: With value 3, any URL with a value of a sensitive action must also a valid token parameter (With previous value 1, only POST was concerned). Note: With value 3, any URL
with parameter "action" or "massaction" need the token, whatever is the value of the action. with parameter "action" or "massaction" need the token, whatever is the value of the action.
* verifCond('stringtoevaluate') now return false when string contains a bad syntax content instead of true. * verifCond('stringtoevaluate') now return false when string contains a bad syntax content instead of true.
* The deprecated method thirdparty_doc_create() has been removed. You can use the generateDocument() instead. * The deprecated method thirdparty_doc_create() has been removed. You can use the generateDocument() instead.
* All triggers with a name XXX_UPDATE have been renamed with name XXX_MODIFY for code consistency purpose. * All triggers with a name XXX_UPDATE have been renamed with name XXX_MODIFY for code consistency purpose.
* Rename build_path_from_id_categ() into buildPathFromId() and set method to private. * Rename build_path_from_id_categ() into buildPathFromId() and set method to private.
@ -207,6 +314,80 @@ Following changes may create regressions for some external modules, but were nec
* Method fetch_all of DolResource has been renamed into fetchAll() to match naming conventions. * Method fetch_all of DolResource has been renamed into fetchAll() to match naming conventions.
* The hook 'upgrade' and 'doUpgrade2" has been renamed 'doUpgradeBefore' and 'doUpgradeAfterDB'. A new trigger 'doUpgradeAfterFiles' has been introduced. * The hook 'upgrade' and 'doUpgrade2" has been renamed 'doUpgradeBefore' and 'doUpgradeAfterDB'. A new trigger 'doUpgradeAfterFiles' has been introduced.
* The context hook 'suppliercard' when on the supplier tab of a thirdparty has been renamed into 'thirdpartysupplier' * The context hook 'suppliercard' when on the supplier tab of a thirdparty has been renamed into 'thirdpartysupplier'
* Because the module Resources highly linked to the Agenda module, the menu for Resources module has been moved into top menu Agenda.
***** ChangeLog for 15.0.3 compared to 15.0.2 *****
FIX: 15.0: modules cannot declare more than 1 cron job using the same method with different parameters
FIX: 15 fix graph ficheinter status
FIX: #18704
FIX: #20444
FIX: #20448 missing preg_replace for vat rate when adding a free line
FIX: #20476 migration postgresql 13.0.x to 14.0.x packaging type
FIX: #20487 missing letter D in constant THIRDPARTIES_DISABLE_RELATED_OBJECT_TAB
FIX: #20527 Accountancy - Unbalanced entry proposed when an employee are declared on a social contribution
FIX: #20621 signature online with proposal with n page.
FIX: #20696
FIX: #20828
FIX: #20886 : manage durations in list_print_total.tpl.php
FIX: #20902
FIX: #21051
FIX: #21093
FIX: #21138
FIX: #21140
FIX: #21174
FIX: #21323
FIX: #21472 On the bank transfer lists, a change of page switches to the lists of the direct debit module
FIX: #21495
FIX: #21518
FIX: Accountancy - Label of VAT account is empty
FIX: Accountancy - Model account list - Problem of CSRF
FIX: Accountancy - Partitioning of the entity on an automatic binding
FIX: add missing thead, th and id on table
FIX: backport commit 5b3fcc5e43979b1b0789bf81fb8f1b2b59c93056, chkbxlst cannot be emptied
FIX: Bank account not set when creating invoice from order
FIX: Bank transfer - Link on code supplier invoice was bad
FIX: Can convert a partially closed down payment when close for
FIX: class center linkedObjectblock order date
FIX: count elements in invoice list (Issue #21444)
FIX: Customer price non numeric warning when 0 vat.
FIX: errors in getLinesArray()
FIX: False alert of WAF when there is "set" into some URL action=update.
FIX: Intervention graph by status on ficheinter Index page
FIX: Intervention url link into Commerce index
FIX: Fix get origin from other than supplier proposal when add a new supplier proposal
FIX: Fix show errors in card
FIX: fourn/commande/card.php Added "$object" parameter to $formfile->showdocuments call
FIX: french traductions for payment methods
FIX: hook for dol_format_address
FIX: Index page for "Sales" give wrong URL link to Intervention
FIX: issue Dolibarr #21495 for v15
FIX: label and get_substitutionarray_each_var_object on ODT generation
FIX: load product stock in inventory lines
FIX: missing morecss for multiselectarray
FIX: missins time spent list menu
FIX: new member subscription: bank account and payment mode might be hidden
FIX: ODT generation of BOM document
FIX: ODT tags for subobjects {object_subobject_yyy} was not working.
FIX: qty received label in Squille PDF model
FIX: rank duplicate on mass action invoice from multiple orders
FIX: regression + add $forceentity parameter
FIX: regression PR #20713
FIX: security breach if we have same ref number in multiple entities
FIX: selection of type of invoice
FIX: Send remind to pay invoice only on validated invoices
FIX: Show sellist type of extrafield when none category selected
FIX: signature online with proposal with n page.
FIX: sql error when PRODUCT_USE_SUPPLIER_PACKAGING enabled.
FIX: sql order
FIX: trash icon on crontask list to do not work
FIX: v15 linked object block center order date
FIX: Warning on attribut
FIX: We must remove empty values of $features array in fetchByProductCombination2ValuePairs() because some products can use only several attributes in their variations and not necessarily all. In this case, fetch doesn't work without my correction
FIX: with callback function
FIX: xml file for company with special chars in name
FIX: Zatca QR code must use company name/vat
***** ChangeLog for 15.0.2 compared to 15.0.1 ***** ***** ChangeLog for 15.0.2 compared to 15.0.1 *****
@ -341,7 +522,7 @@ For users:
NEW: Online proposal signature NEW: Online proposal signature
NEW: Can define some max limit on expense report (per period, per type or expense, ...) NEW: Can define some max limit on expense report (per period, per type or expense, ...)
NEW: Provide a special pages for bookmarks and multicompany for a better use of some mobile applications (like DoliDroid) NEW: Provide a special pages for bookmarks and multicompany for a better use of some mobile applications (like DoliDroid)
NEW: Allow the use of __NEWREF__ to get for example the new reference a draft order will get after validation. NEW: Allow the use of __NEWREF__ to get for example the new reference a draft order will get after validation.
NEW: Add option to disable globaly some notifications emails. NEW: Add option to disable globaly some notifications emails.
NEW: #18401 Add __NEWREF__ subtitute to get new object reference. NEW: #18401 Add __NEWREF__ subtitute to get new object reference.
@ -390,7 +571,7 @@ NEW: can enable/disable external calendar by default
NEW: Can hide sender name on PDF documents NEW: Can hide sender name on PDF documents
NEW: Can select lot from a combo list of existing batch numbers (in MRP consumtion) NEW: Can select lot from a combo list of existing batch numbers (in MRP consumtion)
NEW: Can set the default BOM on a product NEW: Can set the default BOM on a product
NEW: Can set/unset the usual working day of the week (friday, saturday, sunday) NEW: Can set/unset the usual working day of the week (friday, saturday, sunday)
NEW: Can show progression of task into combo list of tasks NEW: Can show progression of task into combo list of tasks
NEW: can upload the odt file for the product doc template NEW: can upload the odt file for the product doc template
NEW: Contract - Add From/to input on search date NEW: Contract - Add From/to input on search date
@ -454,7 +635,7 @@ For developers:
API: API:
NEW: #18319 REST API - Shipment: Add 'close' action / endpoint / POST method. NEW: #18319 REST API - Shipment: Add 'close' action / endpoint / POST method.
NEW: add API /approve and /makeOrder for purchase orders NEW: add API /approve and /makeOrder for purchase orders
NEW: API for knowledgemanagement NEW: API for knowledgemanagement
NEW: API get list of legal form of business NEW: API get list of legal form of business
NEW: API list of staff units NEW: API list of staff units
@ -489,21 +670,23 @@ NEW: we need to be able to put more filters on deleteByParentField() function
NEW: make it easier to set the `keyword`, `keywords` and `description` attributes of an ecm file object NEW: make it easier to set the `keyword`, `keywords` and `description` attributes of an ecm file object
NEW: Experimental feature to manage user sessions in database NEW: Experimental feature to manage user sessions in database
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* ALL EXTERNAL MODULES THAT WERE NOT CORRECTLY DEVELOPPED WILL NOT WORK ON V15 (All modules that forgot to manage the security token field * ALL EXTERNAL MODULES THAT WERE NOT CORRECTLY DEVELOPPED WILL NOT WORK ON V15 (All modules that forgot to manage the security token field
into forms will be broken. The security token field is expected since Dolibarr v9 but a lot of external modules did not implement it). into forms will be broken. The security token field is expected since Dolibarr v9 but a lot of external modules did not implement it).
* Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook. * Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook.
* Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale. * Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale.
* The method static ActionComm::getActions($db, ...) is no more static. Use $actioncomm->getActions(...) instead (without $db param). * The method static ActionComm::getActions($db, ...) is no more static. Use $actioncomm->getActions(...) instead (without $db param).
* The 'action=delete&file=...' has been replaced with 'action=deletefile&file=...' to avoid confusion with deletion of object lines. * The 'action=delete&file=...' has been replaced with 'action=deletefile&file=...' to avoid confusion with deletion of object lines.
* Method getDictvalue has been renamed into getDictionaryValue to match camel case rule. * Method getDictvalue has been renamed into getDictionaryValue to match camel case rule.
* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in * To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in
method executeCLI() available into core/class/utils.class.php method executeCLI() available into core/class/utils.class.php
* Class file expeditionbatch.class.php renamed to expeditionlinebatch.class.php * Class file expeditionbatch.class.php renamed to expeditionlinebatch.class.php
* ExpeditionLineBatch::fetchAll is not static anymore and first parameter $db is removed * ExpeditionLineBatch::fetchAll is not static anymore and first parameter $db is removed
* ExtraFields->showOutputField parameter 4 'extrafieldsobjectkey' is now required * ExtraFields->showOutputField parameter 4 'extrafieldsobjectkey' is now required
* CommonObject method add_object_linked now sets targettype to 'mymodule_myobject' instead of 'myobject', * CommonObject method add_object_linked now sets targettype to 'mymodule_myobject' instead of 'myobject',
you can use hook 'setLinkedObjectSourceTargetType' to set your usual targettype you can use hook 'setLinkedObjectSourceTargetType' to set your usual targettype
@ -792,10 +975,10 @@ For users:
---------- ----------
NEW: Module Recruitment to follow application to job positions is now stable. NEW: Module Recruitment to follow application to job positions is now stable.
NEW: Feature to make Stock Inventories NEW: Feature to make Stock Inventories
NEW: Several security issues after a second private bug hunting campaign. NEW: Several security issues after a second private bug hunting campaign.
NEW: A lot of fix into english text after a small proofreading campaign (still not perfect, but really better) NEW: A lot of fix into english text after a small proofreading campaign (still not perfect, but really better)
NEW: All main menu entries are using the picto of the module NEW: All main menu entries are using the picto of the module
NEW: Add a copy to clipboard button on some fields NEW: Add a copy to clipboard button on some fields
NEW: Add an example of scheduled job to send email reminder for unpaid invoices NEW: Add an example of scheduled job to send email reminder for unpaid invoices
NEW: Add some color and picto for the direction of movement NEW: Add some color and picto for the direction of movement
NEW: add the column "Channel" into the list of orders NEW: add the column "Channel" into the list of orders
@ -866,7 +1049,7 @@ NEW: can show the leave dates/holidays on the agenda view
NEW: Support color for types of event NEW: Support color for types of event
Bank Bank
NEW: Bank Entries : display user linked to a salary or a taxes NEW: Bank Entries : display user linked to a salary or a taxes
NEW: Add bulk actions for Bank Transfer NEW: Add bulk actions for Bank Transfer
ECM/GED ECM/GED
@ -889,7 +1072,7 @@ NEW: option to automatically create a login/user when a new subscription of a me
NEW: option to select membership type on the online payment page for membership subscription or renewal NEW: option to select membership type on the online payment page for membership subscription or renewal
Products Products
NEW: Add price min and price min including tax into product export NEW: Add price min and price min including tax into product export
NEW: Add a ref in product customer price NEW: Add a ref in product customer price
NEW: customer ref for product customer prices NEW: customer ref for product customer prices
NEW: Set status of all variants when changing status of parent NEW: Set status of all variants when changing status of parent
@ -942,8 +1125,8 @@ NEW: add option in Workflow module to set a shipment as closed
for Admins for Admins
NEW: Add a security center page with all information and advices related to the security of your instance NEW: Add a security center page with all information and advices related to the security of your instance
NEW: Add a performance center page with all information and advices related to the performance of your instance NEW: Add a performance center page with all information and advices related to the performance of your instance
Modules Modules
NEW: Module Recruitment is now stable NEW: Module Recruitment is now stable
@ -989,7 +1172,7 @@ NEW: API get the list of product ids only
NEW: add link to OpenAPI specifications XML file in REST API module setup: swagger.json file can be included into external tools like redoc NEW: add link to OpenAPI specifications XML file in REST API module setup: swagger.json file can be included into external tools like redoc
NEW: add native compression in REST APIs NEW: add native compression in REST APIs
NEW: Product Variants API, add variant stock to response by parameter NEW: Product Variants API, add variant stock to response by parameter
NEW: Product API route added to get product stock and product with or without variants #13739 #17390 NEW: Product API route added to get product stock and product with or without variants #13739 #17390
Hooks Hooks
NEW: hook printFieldListTitle for cabyprodserv.php NEW: hook printFieldListTitle for cabyprodserv.php
@ -1014,8 +1197,8 @@ Following changes may create regressions for some external modules, but were nec
* Removed deprecated substitution key __REFCLIENT__ (replaced with __REF_CLIENT__) * Removed deprecated substitution key __REFCLIENT__ (replaced with __REF_CLIENT__)
* Removed constant MAIN_COUNTRIES_IN_EEC. You can now set if country is in Europe or not from the dictionary of countries. * Removed constant MAIN_COUNTRIES_IN_EEC. You can now set if country is in Europe or not from the dictionary of countries.
* v14 seems to work correctly on PHP v8 but it generates a lot of verbose warnings. Currently, v14 i snot yet officialy supported with PHP 8. * v14 seems to work correctly on PHP v8 but it generates a lot of verbose warnings. Currently, v14 i snot yet officialy supported with PHP 8.
* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in * To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in
method executeCLI() available into core/class/utils.class.php method executeCLI() available into core/class/utils.class.php
***** ChangeLog for 13.0.5 compared to 13.0.4 ***** ***** ChangeLog for 13.0.5 compared to 13.0.4 *****
@ -1242,7 +1425,7 @@ NEW: Module "Credit transfer SEPA" to manage payment of vendors using bank credi
NEW: Module Intracomm report NEW: Module Intracomm report
NEW: Module Reception (for a more accurate management of your receptions) moved from experimental to stable. NEW: Module Reception (for a more accurate management of your receptions) moved from experimental to stable.
NEW: Module Recruitment to manage Job position and applications. NEW: Module Recruitment to manage Job position and applications.
NEW: Several security issues after a private bug bounty campaign. NEW: Several security issues after a private bug bounty campaign.
NEW: Accountancy - add chart of sub accounts NEW: Accountancy - add chart of sub accounts
NEW: Accountancy - add options to disable binding on sales, purchases & expense reports independently of the modules NEW: Accountancy - add options to disable binding on sales, purchases & expense reports independently of the modules
NEW: Accountancy balance - add a menu entry to show subtotal by group NEW: Accountancy balance - add a menu entry to show subtotal by group
@ -1378,7 +1561,7 @@ NEW: show user on external calender events (when found)
NEW: subject title with company name instead of application title in ticket message NEW: subject title with company name instead of application title in ticket message
NEW: Support for Samba4 AD NEW: Support for Samba4 AD
NEW: TakePOS appearance tab with more visual parameters NEW: TakePOS appearance tab with more visual parameters
NEW: TakePOS add alert before changing thirdparty NEW: TakePOS add alert before changing thirdparty
NEW: TakePOS add third order printer NEW: TakePOS add third order printer
NEW: TakePOS can change thirdparty with barcode scan NEW: TakePOS can change thirdparty with barcode scan
NEW: TakePOS can create a thirdparty customer from TakePOS frontend NEW: TakePOS can create a thirdparty customer from TakePOS frontend
@ -1389,9 +1572,9 @@ NEW: TakePOS display resiliate status for members
NEW: TakePOS Gift Receipt NEW: TakePOS Gift Receipt
NEW: TakePOS multicurrency compatibility NEW: TakePOS multicurrency compatibility
NEW: TakePOS multicurrency total NEW: TakePOS multicurrency total
NEW: TakePOS print payment method and change NEW: TakePOS print payment method and change
NEW: TakePOS restrict thirdparty to customer NEW: TakePOS restrict thirdparty to customer
NEW: TakePOS show available stock NEW: TakePOS show available stock
NEW: TakePOS Weighing Scale compatibility with TakePOS connector #14725 NEW: TakePOS Weighing Scale compatibility with TakePOS connector #14725
NEW: Thirdparty Import new fields: mother company,outstanding debt limit,bank account,incoterms NEW: Thirdparty Import new fields: mother company,outstanding debt limit,bank account,incoterms
NEW: Thirdparty module : box on customer/supplier tab for invoice outsantding amount late NEW: Thirdparty module : box on customer/supplier tab for invoice outsantding amount late
@ -1404,8 +1587,8 @@ NEW: VAT report - Invert constant to show by default zero VAT in reports
NEW: website page fields selection NEW: website page fields selection
NEW: website - global header of a website can also have dynamic content NEW: website - global header of a website can also have dynamic content
NEW: when creating a user from a member linked to a thirdparty, you can choose to create it as external or internal user NEW: when creating a user from a member linked to a thirdparty, you can choose to create it as external or internal user
NEW: add clone button on miscellaneous payment NEW: add clone button on miscellaneous payment
NEW: add option to put the product label in bold in the PDF templates if configured #15065 NEW: add option to put the product label in bold in the PDF templates if configured #15065
NEW: add option "If the feature to manage kits of module Stock is used, show details of subproducts of a kit on PDF." NEW: add option "If the feature to manage kits of module Stock is used, show details of subproducts of a kit on PDF."

View File

@ -56,6 +56,10 @@ Vous pouvez aussi utiliser un serveur Web et une base de données prise en charg
Pour mettre à jour Dolibarr depuis une vieille version vers celle ci: Pour mettre à jour Dolibarr depuis une vieille version vers celle ci:
- Faites une sauvegarde de votre instance [voir ce tutorial](https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr)
- Vérifiez que la nouvelle version est compatible avec la version PHP de votre serveur [voir PHP support](https://wiki.dolibarr.org/index.php/Releases).
- Ecrasez les vieux fichiers dans le vieux répertoire 'dolibarr' par les fichiers - Ecrasez les vieux fichiers dans le vieux répertoire 'dolibarr' par les fichiers
fournis dans ce nouveau package. fournis dans ce nouveau package.

View File

@ -81,7 +81,7 @@ If you don't have time to install it yourself, you can try some commercial 'read
Dolibarr supports upgrading, usually without the need for any (commercial) support (depending on if you use any commercial extensions). It supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate! Dolibarr supports upgrading, usually without the need for any (commercial) support (depending on if you use any commercial extensions). It supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate!
- At first make a backup of your Dolibarr files & then [see](https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr) - At first make a backup of your Dolibarr files & then [see](https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr)
- Check that your installed PHP version is supported by the new version [see PHP support](./doc/phpmatrix.md). - Check that your installed PHP version is supported by the new version [see PHP support](https://wiki.dolibarr.org/index.php/Releases).
- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package. - Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
- At first next access, Dolibarr will redirect you to the "install/" page to follow the upgrade process. - At first next access, Dolibarr will redirect you to the "install/" page to follow the upgrade process.
 If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file in the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*").  If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file in the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*").

View File

@ -13,32 +13,12 @@ It is here only to build Dolibarr packages, and those generated packages will no
There are several tools: There are several tools:
--------------------------------------------------------------------------------------------------
- To build full Dolibarr packages, launch the script - To build full Dolibarr packages, launch the script
> Launch command perl makepack-dolibarr.pl > Launch command perl makepack-dolibarr.pl
-------------------------------------------------------------------------------------------------- See makepack-howto.txt for prerequisites.
Prerequisites to build tgz, debian and rpm packages:
> apt-get install tar dpkg dpatch p7zip-full rpm zip
--------------------------------------------------------------------------------------------------
Prerequisites to build autoexe DoliWamp package:
> apt-get install wine q4wine
> Launch "wine cmd" to check a drive Z: pointing to / exists.
> Install InnoSetup
For example by running isetup-5.5.8.exe (https://www.jrsoftware.org) https://files.jrsoftware.org/is/5/
> Install WampServer into "C:\wamp64" to have Apache, PHP and MariaDB
For example by running wampserver3.2.0_x64.exe (https://www.wampserver.com).
See file build/exe/doliwamp.iss to know the doliwamp version currently setup.
> Add path to ISCC into PATH windows var:
Launch wine cmd, then regedit and add entry int HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment\PATH
> To build manually the .exe from Windows (running from makepack-dolibarr.pl script is however recommanded),
open file build/exe/doliwamp.iss and click on button "Compile".
The .exe file will be build into directory build.
-------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------

View File

@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
# Script used by the Dockerfile.
# See README.md to know how to create a Dolibarr env with docker
usermod -u ${HOST_USER_ID} www-data usermod -u ${HOST_USER_ID} www-data
groupmod -g ${HOST_USER_ID} www-data groupmod -g ${HOST_USER_ID} www-data

View File

@ -1 +1 @@
/doliwamp.tmp.iss /doliwamp.tmp.iss*

View File

@ -9,3 +9,5 @@ The build of .exe files need to have some windows executable files already insta
If you have technical knowledge in web administration and plan to share your server instance (Apache, Mysql or PHP) with other projects than Dolibarr or want to use Dolibarr other components (PostgreSQL), you should not use this assistant and make a manual installation of Dolibarr on your existing server by downloading the standard package (.tgz or .zip file). If you have technical knowledge in web administration and plan to share your server instance (Apache, Mysql or PHP) with other projects than Dolibarr or want to use Dolibarr other components (PostgreSQL), you should not use this assistant and make a manual installation of Dolibarr on your existing server by downloading the standard package (.tgz or .zip file).
!!! See file ../makepack-howto.txt

View File

@ -1,5 +1,4 @@
<?php <?php
/* !!! DO NOT EDIT THIS FILE, EDIT config.inc.php INSTEAD !!! */ /* !!! DO NOT EDIT THIS FILE, EDIT config.inc.php INSTEAD !!! */
// vim: expandtab sw=4 ts=4 sts=4: // vim: expandtab sw=4 ts=4 sts=4:
@ -139,7 +138,7 @@ $cfg['UseDbSearch'] = TRUE; // whether to enable the "database sea
$cfg['IgnoreMultiSubmitErrors'] = FALSE; // if set to true, PMA continues computing multiple-statement queries $cfg['IgnoreMultiSubmitErrors'] = FALSE; // if set to true, PMA continues computing multiple-statement queries
// even if one of the queries failed // even if one of the queries failed
$cfg['VerboseMultiSubmit'] = TRUE; // if set to true, PMA will show the affected rows of EACH statement on $cfg['VerboseMultiSubmit'] = TRUE; // if set to true, PMA will show the affected rows of EACH statement on
// multiple-statement queries. See the libraries/import.php file for // multiple-statement queries. See the libraries/import.php file for
// hardcoded defaults on how many queries a statement may contain! // hardcoded defaults on how many queries a statement may contain!
$cfg['AllowArbitraryServer'] = FALSE; // allow login to any user entered server in cookie based auth $cfg['AllowArbitraryServer'] = FALSE; // allow login to any user entered server in cookie based auth
@ -195,7 +194,7 @@ $cfg['CharEditing'] = 'input';
// textarea - allows newlines in fields // textarea - allows newlines in fields
$cfg['InsertRows'] = 2; // How many rows can be inserted at one time $cfg['InsertRows'] = 2; // How many rows can be inserted at one time
$cfg['ForeignKeyDropdownOrder'] = // Sort order for items in a foreign-key dropdown box. $cfg['ForeignKeyDropdownOrder'] = // Sort order for items in a foreign-key dropdown box.
array( 'content-id', 'id-content'); // 'content' is the referenced data, 'id' is the key value. array( 'content-id', 'id-content'); // 'content' is the referenced data, 'id' is the key value.
$cfg['ForeignKeyMaxLimit'] = 100; // A dropdown will be used if fewer items are present $cfg['ForeignKeyMaxLimit'] = 100; // A dropdown will be used if fewer items are present
@ -488,7 +487,7 @@ $cfg['ShowBrowseComments'] = TRUE; // shows stored relation-comments in
$cfg['ShowPropertyComments']= TRUE; // shows stored relation-comments in 'table property' mode. $cfg['ShowPropertyComments']= TRUE; // shows stored relation-comments in 'table property' mode.
$cfg['RepeatCells'] = 100; // repeat header names every X cells? (0 = deactivate) $cfg['RepeatCells'] = 100; // repeat header names every X cells? (0 = deactivate)
$cfg['EditInWindow'] = TRUE; // Set to TRUE if Edit link should open the query to edit in the query window (assuming Javascript is enabled), and to FALSE if we should edit in the right panel $cfg['EditInWindow'] = TRUE; // Set to TRUE if Edit link should open the query to edit in the query window (assuming Javascript is enabled), and to FALSE if we should edit in the right panel
$cfg['QueryWindowWidth'] = 550; // Width of Query window $cfg['QueryWindowWidth'] = 550; // Width of Query window
$cfg['QueryWindowHeight'] = 310; // Height of Query window $cfg['QueryWindowHeight'] = 310; // Height of Query window
$cfg['QueryHistoryDB'] = FALSE; // Set to TRUE if you want DB-based query history. $cfg['QueryHistoryDB'] = FALSE; // Set to TRUE if you want DB-based query history.
@ -561,7 +560,7 @@ $cfg['SQLQuery']['Refresh'] = TRUE; // Refresh the results page
*/ */
$cfg['UploadDir'] = ''; // Directory for uploaded files that can be executed by $cfg['UploadDir'] = ''; // Directory for uploaded files that can be executed by
// phpMyAdmin. For example './upload'. Leave empty for // phpMyAdmin. For example './upload'. Leave empty for
// no upload directory support. Use %u for username // no upload directory support. Use %u for username
// inclusion. // inclusion.
$cfg['SaveDir'] = ''; // Directory where phpMyAdmin can save exported data on $cfg['SaveDir'] = ''; // Directory where phpMyAdmin can save exported data on
// server. For example './save'. Leave empty for no save // server. For example './save'. Leave empty for no save
@ -645,7 +644,7 @@ $cfg['ColumnTypes'] = array(
); );
// Attributes // Attributes
// Note: the "ON UPDATE CURRENT_TIMESTAMP" attribute is added dynamically // Note: the "ON UPDATE CURRENT_TIMESTAMP" attribute is added dynamically
// for MySQL >= 4.1.2, in libraries/tbl_properties.inc.php // for MySQL >= 4.1.2, in libraries/tbl_properties.inc.php
$cfg['AttributeTypes'] = array( $cfg['AttributeTypes'] = array(

View File

@ -24,7 +24,6 @@ OutputBaseFilename=__FILENAMEEXEDOLIWAMP__
;OutputManifestFile=build\doliwampbuild.log ;OutputManifestFile=build\doliwampbuild.log
; Define full path from which all relative path are defined ; Define full path from which all relative path are defined
; You must modify this to put here your dolibarr root directory ; You must modify this to put here your dolibarr root directory
;SourceDir=Z:\home\ldestailleur\git\dolibarrxxx
SourceDir=..\..\.. SourceDir=..\..\..
AppId=doliwamp AppId=doliwamp
AppPublisher=DoliCloud AppPublisher=DoliCloud
@ -32,7 +31,7 @@ AppPublisherURL=https://www.dolicloud.com
AppSupportURL=https://www.dolibarr.org AppSupportURL=https://www.dolibarr.org
AppUpdatesURL=https://www.dolibarr.org AppUpdatesURL=https://www.dolibarr.org
AppComments=DoliWamp includes Dolibarr, Apache, PHP and Mysql software. AppComments=DoliWamp includes Dolibarr, Apache, PHP and Mysql software.
AppCopyright=Copyright (C) 2008-2022 Laurent Destailleur (NLTechno), Fabian Rodriguez (Le Goût du Libre) AppCopyright=Copyright (C) 2008-2022 Laurent Destailleur (DoliCloud), Fabian Rodriguez (Le Goût du Libre)
DefaultDirName=c:\dolibarr DefaultDirName=c:\dolibarr
DefaultGroupName=Dolibarr DefaultGroupName=Dolibarr
;LicenseFile=COPYING ;LicenseFile=COPYING
@ -81,7 +80,7 @@ Name: "desktopicon"; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:
Name: "{app}\logs" Name: "{app}\logs"
Name: "{app}\tmp" Name: "{app}\tmp"
Name: "{app}\dolibarr_documents" Name: "{app}\dolibarr_documents"
Name: "{app}\bin\apache\apache2.4.41\logs" Name: "{app}\bin\apache\apache2.4.51\logs"
[Files] [Files]
; Stop/start ; Stop/start
@ -101,16 +100,10 @@ Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversi
; Apache, Php, Mysql ; Apache, Php, Mysql
; Put here path of Wampserver applications ; Put here path of Wampserver applications
; Value OK: apache 2.2.6, php 5.2.5 (5.2.11, 5.3.0 and 5.3.1 fails if php_exif, php_pgsql, php_zip is on), mysql 5.0.45 ; Value OK: apache 2.4.51, php 7.3.33, mariadb10.6.5 (wampserver3.2.6_x64.exe)
; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45 Source: "C:\wamp64\bin\apache\apache2.4.51\*.*"; DestDir: "{app}\bin\apache\apache2.4.51"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
; Value OK: apache 2.4.9, php 5.5.12, mysql 5.0.45 instead of 5.6.17 (wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe) Source: "C:\wamp64\bin\php\php7.3.33\*.*"; DestDir: "{app}\bin\php\php7.3.33"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log"
; Value OK: apache 2.4.41, php 7.3.12, mariadb10.4.10 (wampserver3.2.0_x64.exe) Source: "C:\wamp64\bin\mariadb\mariadb10.6.5\*.*"; DestDir: "{app}\bin\mariadb\mariadb10.6.5"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe"
;Source: "C:\Program Files\Wamp\bin\apache\apache2.4.9\*.*"; DestDir: "{app}\bin\apache\apache2.4.9"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
Source: "C:\wamp64\bin\apache\apache2.4.41\*.*"; DestDir: "{app}\bin\apache\apache2.4.41"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
;Source: "C:\Program Files\Wamp\bin\php\php5.5.12\*.*"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log"
Source: "C:\wamp64\bin\php\php7.3.12\*.*"; DestDir: "{app}\bin\php\php7.3.12"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log"
;Source: "C:\Program Files\Wamp\bin\mysql\mysql5.0.45\*.*"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe"
Source: "C:\wamp64\bin\mariadb\mariadb10.4.10\*.*"; DestDir: "{app}\bin\mariadb\mariadb10.4.10"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe"
; Mysql data files (does not overwrite if exists) ; Mysql data files (does not overwrite if exists)
; We must copy them because the tool mysql_install_db.exe to generate them at first install does not return to prompt so make install hang ; We must copy them because the tool mysql_install_db.exe to generate them at first install does not return to prompt so make install hang
@ -125,12 +118,10 @@ Source: "*.*"; DestDir: "{app}\www\dolibarr"; Flags: ignoreversion; Excludes: ".
; Config files ; Config files
Source: "build\exe\doliwamp\dolibarr.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion; Source: "build\exe\doliwamp\dolibarr.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion;
;Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.9\conf"; Flags: ignoreversion; Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.51\conf"; Flags: ignoreversion;
Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.41\conf"; Flags: ignoreversion;
Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion; Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion;
Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mariadb\mariadb10.4.10"; Flags: ignoreversion; Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mariadb\mariadb10.6.5"; Flags: ignoreversion;
;Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion; Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php7.3.33"; Flags: ignoreversion;
Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php7.3.12"; Flags: ignoreversion;
Source: "build\exe\doliwamp\index.php.install"; DestDir: "{app}\www"; Flags: ignoreversion; Source: "build\exe\doliwamp\index.php.install"; DestDir: "{app}\www"; Flags: ignoreversion;
Source: "build\exe\doliwamp\install.forced.php.install"; DestDir: "{app}\www\dolibarr\htdocs\install"; Flags: ignoreversion; Source: "build\exe\doliwamp\install.forced.php.install"; DestDir: "{app}\www\dolibarr\htdocs\install"; Flags: ignoreversion;
Source: "build\exe\doliwamp\openssl.conf"; DestDir: "{app}"; Flags: ignoreversion; Source: "build\exe\doliwamp\openssl.conf"; DestDir: "{app}"; Flags: ignoreversion;
@ -236,12 +227,9 @@ procedure InitializeWizard();
begin begin
//version des applis, a modifier pour chaque version de WampServer 2 //version des applis, a modifier pour chaque version de WampServer 2
//apacheVersion := '2.4.9'; apacheVersion := '2.4.51';
//phpVersion := '5.5.12' ; phpVersion := '7.3.33' ;
apacheVersion := '2.4.41'; mysqlVersion := '10.6.5';
phpVersion := '7.3.12' ;
//mysqlVersion := '5.0.45';
mysqlVersion := '10.4.10';
smtpServer := 'localhost'; smtpServer := 'localhost';
apachePort := '80'; apachePort := '80';
@ -375,9 +363,9 @@ begin
// Migration of database // Migration of database
// datadir := pathWithSlashes+'/bin/mariadb/marradb10.4.10/data'; // datadir := pathWithSlashes+'/bin/mariadb/mariadb10.6.5/data';
// exedirold := pathWithSlashes+'/bin/mariadb/marradb10.4.10/'; // exedirold := pathWithSlashes+'/bin/mariadb/mariadb10.6.5/';
// exedirnew := pathWithSlashes+'/bin/mariadb/marradb10.4.10/'; // exedirnew := pathWithSlashes+'/bin/mariadb/mariadb10.6.5/';
// If we have a new database version, we should only copy old my.ini file into new directory // If we have a new database version, we should only copy old my.ini file into new directory
// and change only all basedir= strings to use new version. Like this, data dir is still correct. // and change only all basedir= strings to use new version. Like this, data dir is still correct.
@ -594,6 +582,17 @@ begin
end; end;
end; end;
if browser = 'iexplore.exe' then
begin
if FileExists (pfPath+'/Microsoft/Edge/Application/msedge.exe') then
begin
if MsgBox(CustomMessage('MicrosoftEdgeDetected'),mbConfirmation,MB_YESNO) = IDYES then
begin
browser := pfPath+'/Microsoft/Edge/Application/msedge.exe';
end;
end;
end;
if browser = 'iexplore.exe' then if browser = 'iexplore.exe' then
begin begin
if FileExists (pfPath+'/Internet Explorer/iexplore.exe') then if FileExists (pfPath+'/Internet Explorer/iexplore.exe') then
@ -1027,7 +1026,7 @@ Filename: "{app}\rundoliwamp.bat"; Description: {cm:LaunchNow}; Flags: shellexec
[UninstallDelete] [UninstallDelete]
Type: files; Name: "{app}\*.*" Type: files; Name: "{app}\*.*"
Type: files; Name: "{app}\bin\mariadb\mariadb10.4.10\*.*" Type: files; Name: "{app}\bin\mariadb\mariadb10.6.5\*.*"
Type: filesandordirs; Name: "{app}\alias" Type: filesandordirs; Name: "{app}\alias"
Type: filesandordirs; Name: "{app}\apps" Type: filesandordirs; Name: "{app}\apps"
Type: filesandordirs; Name: "{app}\bin\apache" Type: filesandordirs; Name: "{app}\bin\apache"

View File

@ -56,7 +56,7 @@ if (empty($argv[1])) {
$i=0; $i=0;
while ($i < $argc) { while ($i < $argc) {
if (! empty($argv[$i])) { if (!empty($argv[$i])) {
parse_str($argv[$i]); // set all params $release, $includecustom, $includeconstant, $buildzip ... parse_str($argv[$i]); // set all params $release, $includecustom, $includeconstant, $buildzip ...
} }
if (preg_match('/includeconstant=/', $argv[$i])) { if (preg_match('/includeconstant=/', $argv[$i])) {

View File

@ -65,7 +65,7 @@ $DIR||='.'; $DIR =~ s/([^\/\\])[\\\/]+$/$1/;
$SOURCE="$DIR/.."; $SOURCE="$DIR/..";
$DESTI="$SOURCE/build"; $DESTI="$SOURCE/build";
if ($SOURCE !~ /^\//) if ($SOURCE !~ /^\// && $SOURCE !~ /^[a-z]:/i)
{ {
print "Error: Launch the script $PROG.$Extension with its full path from /.\n"; print "Error: Launch the script $PROG.$Extension with its full path from /.\n";
print "$PROG.$Extension aborted.\n"; print "$PROG.$Extension aborted.\n";
@ -76,15 +76,23 @@ if (! $ENV{"DESTIBETARC"} || ! $ENV{"DESTISTABLE"})
{ {
print "Error: Missing environment variables.\n"; print "Error: Missing environment variables.\n";
print "You must define the environment variable DESTIBETARC and DESTISTABLE to point to the\ndirectories where you want to save the generated packages.\n"; print "You must define the environment variable DESTIBETARC and DESTISTABLE to point to the\ndirectories where you want to save the generated packages.\n";
print "$PROG.$Extension aborted.\n";
print "\n";
print "You can set them with\n";
print "On Linux:\n";
print "export DESTIBETARC='/tmp'; export DESTISTABLE='/tmp';\n";
print "On Windows:\n";
print "set DESTIBETARC=c:/tmp\n";
print "set DESTISTABLE=c:/tmp\n";
print "\n";
print "Example: DESTIBETARC='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/lastbuild'\n"; print "Example: DESTIBETARC='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/lastbuild'\n";
print "Example: DESTISTABLE='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/stable'\n"; print "Example: DESTISTABLE='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/stable'\n";
print "$PROG.$Extension aborted.\n";
sleep 2; sleep 2;
exit 1; exit 1;
} }
if (! -d $ENV{"DESTIBETARC"} || ! -d $ENV{"DESTISTABLE"}) if (! -d $ENV{"DESTIBETARC"} || ! -d $ENV{"DESTISTABLE"})
{ {
print "Error: Directory of environment variable DESTIBETARC or DESTISTABLE does not exist.\n"; print "Error: Directory of environment variable DESTIBETARC ($ENV{'DESTIBETARC'}) or DESTISTABLE ($ENV{'DESTISTABLE'}) does not exist.\n";
print "$PROG.$Extension aborted.\n"; print "$PROG.$Extension aborted.\n";
sleep 2; sleep 2;
exit 1; exit 1;
@ -94,7 +102,7 @@ if (! -d $ENV{"DESTIBETARC"} || ! -d $ENV{"DESTISTABLE"})
# -------------- # --------------
if ("$^O" =~ /linux/i || (-d "/etc" && -d "/var" && "$^O" !~ /cygwin/i)) { $OS='linux'; $CR=''; } if ("$^O" =~ /linux/i || (-d "/etc" && -d "/var" && "$^O" !~ /cygwin/i)) { $OS='linux'; $CR=''; }
elsif (-d "/etc" && -d "/Users") { $OS='macosx'; $CR=''; } elsif (-d "/etc" && -d "/Users") { $OS='macosx'; $CR=''; }
elsif ("$^O" =~ /cygwin/i || "$^O" =~ /win32/i) { $OS='windows'; $CR="\r"; } elsif ("$^O" =~ /cygwin/i || "$^O" =~ /win32/i || "$^O" =~ /msys/i) { $OS='windows'; $CR="\r"; }
if (! $OS) { if (! $OS) {
print "Error: Can't detect your OS.\n"; print "Error: Can't detect your OS.\n";
print "Can't continue.\n"; print "Can't continue.\n";
@ -390,7 +398,7 @@ if ($nboftargetok) {
$olddir=getcwd(); $olddir=getcwd();
chdir("$SOURCE"); chdir("$SOURCE");
print "Clean $SOURCE/htdocs\n"; print "Clean $SOURCE/htdocs/includes/autoload.php\n";
$ret=`rm -f $SOURCE/htdocs/includes/autoload.php`; $ret=`rm -f $SOURCE/htdocs/includes/autoload.php`;
$ret=`git ls-files . --exclude-standard --others`; $ret=`git ls-files . --exclude-standard --others`;
@ -624,7 +632,7 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/freefont-*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/freefont-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/ae_fonts_*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/ae_fonts_*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/vendor`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/vendor`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/webmozart`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/webmozart`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/autoload.php`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/autoload.php`;
@ -1074,28 +1082,52 @@ if ($nboftargetok) {
print "Remove target $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe...\n"; print "Remove target $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe...\n";
unlink "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"; unlink "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe";
print "Check that in your Wine setup, you have created a Z: drive that point to your / directory.\n"; if ($OS eq 'windows') {
print "Check that ISCC.exe is in your PATH.\n";
} else {
print "Check that in your Wine setup, you have created a Z: drive that point to your / directory.\n";
}
$SOURCEBACK=$SOURCE; $SOURCEBACK=$SOURCE;
$SOURCEBACK =~ s/\//\\/g; $SOURCEBACK =~ s/\//\\/g;
print "Prepare file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss from \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.iss\"\n"; print "Prepare file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\" from \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.iss\"\n";
$ret=`cat "$SOURCE/build/exe/doliwamp/doliwamp.iss" | sed -e 's/__FILENAMEEXEDOLIWAMP__/$FILENAMEEXEDOLIWAMP/g' > "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`;
#$ret=`cat "$SOURCE/build/exe/doliwamp/doliwamp.iss" | sed -e 's/__FILENAMEEXEDOLIWAMP__/$FILENAMEEXEDOLIWAMP/g' > "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`;
open(IN, '<' . $SOURCE."/build/exe/doliwamp/doliwamp.iss") or die $!;
open(OUT, '>' . "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss") or die $!;
while(<IN>)
{
$_ =~ s/__FILENAMEEXEDOLIWAMP__/$FILENAMEEXEDOLIWAMP/g;
print OUT $_;
}
close(IN);
close(OUT);
print "Compil exe $FILENAMEEXEDOLIWAMP.exe file from iss file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\"\n"; print "Compil exe $FILENAMEEXEDOLIWAMP.exe file from iss file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\" on OS $OS\n";
$cmd= "wine ISCC.exe \"Z:$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\"";
if ($OS eq 'windows') {
$cmd= "ISCC.exe \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\"";
} else {
#$cmd= "wine ISCC.exe \"Z:$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\"";
}
print "$cmd\n"; print "$cmd\n";
$ret= `$cmd`; $ret= `$cmd`;
#print "$ret\n"; print "ret=$ret\n";
# Move to final dir # Move to final dir
print "Move \"$SOURCE\\build\\$FILENAMEEXEDOLIWAMP.exe\" to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n"; print "Move \"$SOURCE\\build\\$FILENAMEEXEDOLIWAMP.exe\" to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n";
rename("$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe","$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"); rename("$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe","$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe");
print "Move $SOURCE/build/$FILENAMEEXEDOLIWAMP.exe to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n"; print "Move $SOURCE/build/$FILENAMEEXEDOLIWAMP.exe to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n";
$ret=`mv "$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe" "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"`;
use File::Copy;
#$ret=`mv "$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe" "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"`;
$ret=move("$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe", "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe");
print "Remove tmp file $SOURCE/build/exe/doliwamp/doliwamp.tmp.iss\n"; print "Remove tmp file $SOURCE/build/exe/doliwamp/doliwamp.tmp.iss\n";
$ret=`rm "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`; #$ret=`rm "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`;
$ret=unlink("$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss");
next; next;
} }
@ -1242,7 +1274,7 @@ if ($nboftargetok) {
print "\n----- Summary -----\n"; print "\n----- Summary -----\n";
foreach my $target (sort keys %CHOOSEDTARGET) { foreach my $target (sort keys %CHOOSEDTARGET) {
if ($target eq '-CHKSUM') { print "Checksum was generated"; next; } if ($target eq '-CHKSUM') { print "Checksum was generated\n"; next; }
if ($CHOOSEDTARGET{$target} < 0) { if ($CHOOSEDTARGET{$target} < 0) {
print "Package $target not built (bad requirement).\n"; print "Package $target not built (bad requirement).\n";
} else { } else {

View File

@ -1,7 +1,46 @@
----- Dolibarr Makepack How To ----- ----- Dolibarr Makepack How To -----
This documentation describe steps to build a BETA or RELEASE versions This documentation describe steps to build a BETA or RELEASE versions
of Dolibarr. There is a chapter for BETA version and a chapter for of Dolibarr. There is a chapter for BETA version and a chapter for RELEASE version.
RELEASE version.
***** Prerequisites For Linux *****
Prerequisites to build tgz, debian and rpm packages:
> apt-get install perl tar dpkg dpatch p7zip-full rpm zip php-cli
Prerequisites to build autoexe DoliWamp package from Linux (solution seems broken since Ubuntu 20.04):
> apt-get install wine q4wine
> Launch "wine cmd" to check a drive Z: pointing to / exists.
> Install InnoSetup
For example by running isetup-5.5.8.exe (https://www.jrsoftware.org) https://files.jrsoftware.org/is/5/
> Install WampServer into "C:\wamp64" to have Apache, PHP and MariaDB
For example by running wampserver3.2.6_x64.exe (https://www.wampserver.com).
See file build/exe/doliwamp.iss to know the doliwamp version currently setup.
> Add path to ISCC into PATH windows var:
Launch wine cmd, then regedit and add entry int HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment\PATH
> To build manually the .exe from Windows (running from makepack-dolibarr.pl script is however recommanded),
open file build/exe/doliwamp.iss and click on button "Compile".
The .exe file will be build into directory build.
***** Prerequisites For Windows *****
Prerequisites to build autoexe DoliWamp package from Windows:
> Install Perl for Windwos (https://strawberryperl.com/)
> Install isetup-5.5.8.exe (https://www.jrsoftware.org)
> Install WampServer-3.2.*-64.exe (Apache 2.4.51, PHP 7.3.33, MariaDB 10.6.5 for example. Version must match the values found into doliwamp.iss)
> Install GIT for Windows (https://git-scm.com/ => You must choose option "Add Git bash profile", "Git commit as-is")
> Install Dolibarr verions:
git clone https://github.com/dolibarr/dolibarr
> Add the path of PHP (C:\wamp64\bin\php\php7.3.33) and InnoSetup (C:\Program Files (x86)\Inno Setup 5) into the %PATH% of Windows.
> Create a config file c:\dolibarr\dolibarr\htdocs\conf\conf.php with content
<?php
$dolibarr_main_document_root="c:\dolibarr\dolibarr\htdocs";
$dolibarr_main_url_root='http://localhost';
***** Actions to do a BETA ***** ***** Actions to do a BETA *****
This files describe steps made by Dolibarr packaging team to make a This files describe steps made by Dolibarr packaging team to make a

View File

@ -227,6 +227,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/ticket %_datadir/dolibarr/htdocs/ticket
%_datadir/dolibarr/htdocs/user %_datadir/dolibarr/htdocs/user
%_datadir/dolibarr/htdocs/variants %_datadir/dolibarr/htdocs/variants
%_datadir/dolibarr/htdocs/webhook
%_datadir/dolibarr/htdocs/webservices %_datadir/dolibarr/htdocs/webservices
%_datadir/dolibarr/htdocs/website %_datadir/dolibarr/htdocs/website
%_datadir/dolibarr/htdocs/workstation %_datadir/dolibarr/htdocs/workstation

View File

@ -54,7 +54,7 @@ BuildRequires: desktop-file-utils
Group: Applications/Productivity Group: Applications/Productivity
Requires: apache-base, apache-mod_php, php-cgi, php-cli, php-bz2, php-gd, php-ldap, php-imap, php-mysqli, php-openssl, fonts-ttf-dejavu Requires: apache-base, apache-mod_php, php-cgi, php-cli, php-bz2, php-gd, php-ldap, php-imap, php-mysqli, php-openssl, fonts-ttf-dejavu
Requires: mysql, mysql-client Requires: mysql, mysql-client
%else%_datadir/dolibarr/htdocs/datapolicy %else
%if 0%{?suse_version} %if 0%{?suse_version}
# Voir http://en.opensuse.org/openSUSE:Packaging_Conventions_RPM_Macros # Voir http://en.opensuse.org/openSUSE:Packaging_Conventions_RPM_Macros
Group: Productivity/Office/Management Group: Productivity/Office/Management
@ -67,7 +67,7 @@ Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mbstring
Requires: mysql-server, mysql Requires: mysql-server, mysql
Requires: php-mysqli >= 4.1.0 Requires: php-mysqli >= 4.1.0
%endif %endif
%endif%_datadir/dolibarr/htdocs/eventorganization %endif
%endif %endif
@ -125,7 +125,7 @@ cui hai bisogno ed essere facile da usare.
%if 0%{?sles_version} %if 0%{?sles_version}
%{__rm} -rf $RPM_BUILD_ROOT %{__rm} -rf $RPM_BUILD_ROOT
%{__mkdir} $RPM_BUILD_ROOT%_datadir/dolibarr/htdocs/datapolicy %{__mkdir} $RPM_BUILD_ROOT%
%{__mkdir} $RPM_BUILD_ROOT%{_sysconfdir} %{__mkdir} $RPM_BUILD_ROOT%{_sysconfdir}
%{__mkdir} $RPM_BUILD_ROOT%{_sysconfdir}/%{name} %{__mkdir} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
%else %else
@ -308,6 +308,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/ticket %_datadir/dolibarr/htdocs/ticket
%_datadir/dolibarr/htdocs/user %_datadir/dolibarr/htdocs/user
%_datadir/dolibarr/htdocs/variants %_datadir/dolibarr/htdocs/variants
%_datadir/dolibarr/htdocs/webhook
%_datadir/dolibarr/htdocs/webservices %_datadir/dolibarr/htdocs/webservices
%_datadir/dolibarr/htdocs/website %_datadir/dolibarr/htdocs/website
%_datadir/dolibarr/htdocs/workstation %_datadir/dolibarr/htdocs/workstation

View File

@ -224,6 +224,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/ticket %_datadir/dolibarr/htdocs/ticket
%_datadir/dolibarr/htdocs/user %_datadir/dolibarr/htdocs/user
%_datadir/dolibarr/htdocs/variants %_datadir/dolibarr/htdocs/variants
%_datadir/dolibarr/htdocs/webhook
%_datadir/dolibarr/htdocs/webservices %_datadir/dolibarr/htdocs/webservices
%_datadir/dolibarr/htdocs/website %_datadir/dolibarr/htdocs/website
%_datadir/dolibarr/htdocs/workstation %_datadir/dolibarr/htdocs/workstation

View File

@ -66,7 +66,7 @@ ed essere facile da usare.
Programmo web, progettato per poter fornire solo ciò di Programmo web, progettato per poter fornire solo ciò di
cui hai bisogno ed essere facile da usare. cui hai bisogno ed essere facile da usare.
%_datadir/dolibarr/htdocs/webhook
#---- prep #---- prep
%prep %prep
@ -235,6 +235,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/ticket %_datadir/dolibarr/htdocs/ticket
%_datadir/dolibarr/htdocs/user %_datadir/dolibarr/htdocs/user
%_datadir/dolibarr/htdocs/variants %_datadir/dolibarr/htdocs/variants
%_datadir/dolibarr/htdocs/webhook
%_datadir/dolibarr/htdocs/webservices %_datadir/dolibarr/htdocs/webservices
%_datadir/dolibarr/htdocs/website %_datadir/dolibarr/htdocs/website
%_datadir/dolibarr/htdocs/workstation %_datadir/dolibarr/htdocs/workstation

View File

@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => {
action: bundle.inputData.action action: bundle.inputData.action
}; };
const url = bundle.authData.url + '/api/index.php/zapierapi/hook'; const url = bundle.authData.url + '/api/index.php/zapier/hook';
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
@ -32,7 +32,7 @@ const unsubscribeHook = (z, bundle) => {
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
const options = { const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id, url: bundle.authData.url + '/api/index.php/zapier/hook/' + bundle.subscribeData.id,
method: 'DELETE', method: 'DELETE',
}; };
@ -84,7 +84,7 @@ const getFallbackRealAction = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module; // const module = bundle.inputData.module;
// const options = { // const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/actions', // url: bundle.authData.url + '/api/index.php/zapier/getactionschoices/actions',
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));

View File

@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => {
action: bundle.inputData.action action: bundle.inputData.action
}; };
const url = bundle.authData.url + '/api/index.php/zapierapi/hook'; const url = bundle.authData.url + '/api/index.php/zapier/hook';
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
@ -32,7 +32,7 @@ const unsubscribeHook = (z, bundle) => {
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
const options = { const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id, url: bundle.authData.url + '/api/index.php/zapier/hook/' + bundle.subscribeData.id,
method: 'DELETE', method: 'DELETE',
}; };
@ -76,7 +76,7 @@ const getFallbackRealContact = (z, bundle) => {
// const getModulesChoices = (z/*, bundle*/) => { // const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const options = { // const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices', // url: bundle.authData.url + '/api/index.php/zapier/getmoduleschoices',
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));
@ -94,7 +94,7 @@ const getFallbackRealContact = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module; // const module = bundle.inputData.module;
// const options = { // const options = {
// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`, // url: url: bundle.authData.url + '/api/index.php/zapier/getactionschoices/thirparty`,
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));

View File

@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => {
action: bundle.inputData.action action: bundle.inputData.action
}; };
const url = bundle.authData.url + '/api/index.php/zapierapi/hook'; const url = bundle.authData.url + '/api/index.php/zapier/hook';
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
@ -32,7 +32,7 @@ const unsubscribeHook = (z, bundle) => {
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
const options = { const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id, url: bundle.authData.url + '/api/index.php/zapier/hook/' + bundle.subscribeData.id,
method: 'DELETE', method: 'DELETE',
}; };
@ -76,7 +76,7 @@ const getFallbackRealMember = (z, bundle) => {
// const getModulesChoices = (z/*, bundle*/) => { // const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const options = { // const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices', // url: bundle.authData.url + '/api/index.php/zapier/getmoduleschoices',
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));
@ -94,7 +94,7 @@ const getFallbackRealMember = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module; // const module = bundle.inputData.module;
// const options = { // const options = {
// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`, // url: url: bundle.authData.url + '/api/index.php/zapier/getactionschoices/thirparty`,
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));

View File

@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => {
action: bundle.inputData.action action: bundle.inputData.action
}; };
const url = bundle.authData.url + '/api/index.php/zapierapi/hook'; const url = bundle.authData.url + '/api/index.php/zapier/hook';
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
@ -32,7 +32,7 @@ const unsubscribeHook = (z, bundle) => {
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
const options = { const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id, url: bundle.authData.url + '/api/index.php/zapier/hook/' + bundle.subscribeData.id,
method: 'DELETE', method: 'DELETE',
}; };
@ -74,7 +74,7 @@ const getFallbackRealOrder = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module; // const module = bundle.inputData.module;
// const options = { // const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/orders', // url: bundle.authData.url + '/api/index.php/zapier/getactionschoices/orders',
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));

View File

@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => {
action: bundle.inputData.action action: bundle.inputData.action
}; };
const url = bundle.authData.url + '/api/index.php/zapierapi/hook'; const url = bundle.authData.url + '/api/index.php/zapier/hook';
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
@ -32,7 +32,7 @@ const unsubscribeHook = (z, bundle) => {
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
const options = { const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id, url: bundle.authData.url + '/api/index.php/zapier/hook/' + bundle.subscribeData.id,
method: 'DELETE', method: 'DELETE',
}; };
@ -83,7 +83,7 @@ const getFallbackRealThirdparty = (z, bundle) => {
// const getModulesChoices = (z/*, bundle*/) => { // const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const options = { // const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices', // url: bundle.authData.url + '/api/index.php/zapier/getmoduleschoices',
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));
@ -102,7 +102,7 @@ const getFallbackRealThirdparty = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module; // const module = bundle.inputData.module;
// const options = { // const options = {
// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`, // url: url: bundle.authData.url + '/api/index.php/zapier/getactionschoices/thirparty`,
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));

View File

@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => {
action: bundle.inputData.action action: bundle.inputData.action
}; };
const url = bundle.authData.url + '/api/index.php/zapierapi/hook'; const url = bundle.authData.url + '/api/index.php/zapier/hook';
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
@ -32,7 +32,7 @@ const unsubscribeHook = (z, bundle) => {
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
const options = { const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id, url: bundle.authData.url + '/api/index.php/zapier/hook/' + bundle.subscribeData.id,
method: 'DELETE', method: 'DELETE',
}; };
@ -76,7 +76,7 @@ const getFallbackRealTicket = (z, bundle) => {
// const getModulesChoices = (z/*, bundle*/) => { // const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const options = { // const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices', // url: bundle.authData.url + '/api/index.php/zapier/getmoduleschoices',
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));
@ -97,7 +97,7 @@ const getFallbackRealTicket = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module; // const module = bundle.inputData.module;
// const options = { // const options = {
// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`, // url: url: bundle.authData.url + '/api/index.php/zapier/getactionschoices/thirparty`,
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));

View File

@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => {
action: bundle.inputData.action action: bundle.inputData.action
}; };
const url = bundle.authData.url + '/api/index.php/zapierapi/hook'; const url = bundle.authData.url + '/api/index.php/zapier/hook';
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
@ -32,7 +32,7 @@ const unsubscribeHook = (z, bundle) => {
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
const options = { const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id, url: bundle.authData.url + '/api/index.php/zapier/hook/' + bundle.subscribeData.id,
method: 'DELETE', method: 'DELETE',
}; };
@ -73,7 +73,7 @@ const getFallbackRealUser = (z, bundle) => {
// const getModulesChoices = (z/*, bundle*/) => { // const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const options = { // const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices', // url: bundle.authData.url + '/api/index.php/zapier/getmoduleschoices',
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));
@ -93,7 +93,7 @@ const getFallbackRealUser = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module; // const module = bundle.inputData.module;
// const options = { // const options = {
// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`, // url: url: bundle.authData.url + '/api/index.php/zapier/getactionschoices/thirparty`,
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));

View File

@ -152,7 +152,7 @@ $user->rights->propal->creer=1;
$user->rights->propal->propal_advance->validate=1; $user->rights->propal->propal_advance->validate=1;
if (! empty($conf->global->PROPALE_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php")) { if (!empty($conf->global->PROPALE_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php")) {
require_once DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php"; require_once DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php";
} }

View File

@ -218,7 +218,7 @@ if ($date == 'all') {
} }
// Replace database handler // Replace database handler
if (! empty($argv[4])) { if (!empty($argv[4])) {
$db->close(); $db->close();
unset($db); unset($db);
$db=getDoliDBInstance($argv[4], $argv[5], $argv[6], $argv[7], $argv[8], $argv[9]); $db=getDoliDBInstance($argv[4], $argv[5], $argv[6], $argv[7], $argv[8], $argv[9]);

View File

@ -174,7 +174,7 @@ if [ -s "$mydir/initdemopostsql.sql" ]; then
echo A file initdemopostsql.sql was found, we execute it. echo A file initdemopostsql.sql was found, we execute it.
mysql -P$port $base < "$mydir/initdemopostsql.sql" mysql -P$port $base < "$mydir/initdemopostsql.sql"
else else
echo No file initdemopostsql.sql found, we extra sql action done. echo No file initdemopostsql.sql found, so no extra sql action done.
fi fi

View File

@ -12,3 +12,11 @@ Le client règle rapidement et on lui accorde un escompte de 3% (120 € * 3% =
411xxx 3,60 € TTC 411xxx 3,60 € TTC
Et ça marche à l’inverse avec un fournisseur sauf que l’on est en 775000 au lieu de 665000 pour escompte obtenus. Et ça marche à l’inverse avec un fournisseur sauf que l’on est en 775000 au lieu de 665000 pour escompte obtenus.
Un compte comptable de Tiers vente = Acount Receivable
Un compte comptable de Tiers achat = Acount Payable

Binary file not shown.

View File

@ -4,4 +4,5 @@ terms
(en) VAT = Value Added Tax (en) VAT = Value Added Tax
(fr) TVA = Taxe sur la Valeur Ajouté (fr) TVA = Taxe sur la Valeur Ajouté
(es) NIF / CIF (es) NIF / CIF
(de) USt / MwSt (de) USt / MwSt = UmsatzSteuer / Mehrwertsteuer
(it) IVA

View File

@ -0,0 +1,10 @@
VAT Rates
---------
https://www.taxrates.cc/index.html
https://en.wikipedia.org/wiki/List_of_countries_by_tax_rates
For India: VAT=IGST / CGST=Localtax1 / SGST=Localtax2
see:
https://cleartax.in/s/what-is-sgst-cgst-igst
https://www.mastersindia.co/blog/what-is-cgst-sgst-igst-and-ugst/

View File

@ -1,8 +0,0 @@
VAT Rates
---------
http://www.taxrates.cc/index.html
https://en.wikipedia.org/wiki/List_of_countries_by_tax_rates
For India: VAT=IGST/CGST=Localtax1/SGST=Localtax2: https://cleartax.in/s/what-is-sgst-cgst-igst

View File

@ -15,9 +15,10 @@
<exclude-pattern type="relative">htdocs/install/doctemplates/websites</exclude-pattern> <exclude-pattern type="relative">htdocs/install/doctemplates/websites</exclude-pattern>
<exclude-pattern type="relative">htdocs/conf.php</exclude-pattern> <exclude-pattern type="relative">htdocs/conf.php</exclude-pattern>
<exclude-pattern type="relative">*/nltechno*</exclude-pattern> <exclude-pattern type="relative">*/nltechno*</exclude-pattern>
<exclude-pattern type="relative">*/htdocs/includes</exclude-pattern>
<exclude-pattern type="relative">source</exclude-pattern> <exclude-pattern type="relative">source</exclude-pattern>
<exclude-pattern type="relative">.git</exclude-pattern> <exclude-pattern type="relative">.git</exclude-pattern>
<exclude-pattern>htdocs/includes</exclude-pattern>
<exclude-pattern>htdocs/install/doctemplates/websites</exclude-pattern>
<!-- List of all tests --> <!-- List of all tests -->
@ -135,7 +136,7 @@
<rule ref="Generic.Metrics.CyclomaticComplexity"> <rule ref="Generic.Metrics.CyclomaticComplexity">
<properties> <properties>
<property name="complexity" value="250" /> <property name="complexity" value="250" />
<property name="absoluteComplexity" value="300" /> <property name="absoluteComplexity" value="400" />
</properties> </properties>
</rule> </rule>
<rule ref="Generic.Metrics.NestingLevel"> <rule ref="Generic.Metrics.NestingLevel">

View File

@ -0,0 +1,20 @@
# Fail2Ban configuration file
#
# Regexp to catch known spambots and software alike. Please verify
# that it is your intent to block IPs which were driven by
# above mentioned bots.
[Definition]
# To test, you can inject this example into log
# echo `date +'%Y-%m-%d %H:%M:%S'`" INFO 1.2.3.4 --- Access to GET /public/clicktodial/cidlookup.php" >> /mypath/documents/dolibarr.log
#
# then
# fail2ban-client status web-dol-passforgotten
#
# To test rule file on a existing log file
# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-limitpublic.conf
failregex = ^ [A-Z\s]+ <HOST>\s+--- Access to .*/public/
ignoreregex =

View File

@ -8,21 +8,35 @@
enabled = true enabled = true
port = http,https port = http,https
filter = web-dolibarr-rulespassforgotten filter = web-dolibarr-rulespassforgotten
logpath = >> /mypath/documents/documents/dolibarr.log logpath = /mypath/documents/documents/dolibarr.log
action = %(action_mw)s action = %(action_mw)s
bantime = 4320000 ; 50 days bantime = 4320000 ; 50 days
findtime = 86400 ; 1 day findtime = 86400 ; 1 day
maxretry = 10 maxretry = 10
[web-dol-bruteforce] [web-dol-bruteforce]
; rule against bruteforce hacking (login + api) ; rule against bruteforce hacking (login + api)
enabled = true enabled = true
port = http,https port = http,https
filter = web-dolibarr-rulesbruteforce filter = web-dolibarr-rulesbruteforce
logpath = >> /mypath/documents/documents/dolibarr.log logpath = /mypath/documents/documents/dolibarr.log
action = %(action_mw)s action = %(action_mw)s
bantime = 86400 ; 1 day bantime = 86400 ; 1 day
findtime = 3600 ; 1 hour findtime = 3600 ; 1 hour
maxretry = 10 maxretry = 10
[web-dol-limitpublic]
; rule to add rate limit on some public pages
enabled = true
port = http,https
filter = web-dolibarr-limitpublic
logpath = /mypath/documents/documents/dolibarr.log
action = %(action_mw)s
bantime = 86400 ; 1 day
findtime = 86400 ; 1 day
maxretry = 500

View File

@ -10,6 +10,7 @@
# Syntax # Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ] if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then then
echo "Detect .sh and .spec files that does not contains any tab inside"
echo "Usage: fixnotabfiles.sh [list|fix]" echo "Usage: fixnotabfiles.sh [list|fix]"
fi fi

View File

@ -487,7 +487,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
$pkey = $line; $pkey = $line;
$linenumber ++; $linenumber ++;
if (! empty($lines[$linenumber])) { if (!empty($lines[$linenumber])) {
$line = $lines[$linenumber]; $line = $lines[$linenumber];
} else { } else {
$line = ''; $line = '';
@ -517,7 +517,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
if (substr($line, 0, 12) == "CREATE INDEX") { if (substr($line, 0, 12) == "CREATE INDEX") {
$matches = array(); $matches = array();
preg_match('/CREATE INDEX "?([a-zA-Z0-9_]*)"? ON "?([a-zA-Z0-9_\.]*)"? USING btree \((.*)\);/', $line, $matches); preg_match('/CREATE INDEX "?([a-zA-Z0-9_]*)"? ON "?([a-zA-Z0-9_\.]*)"? USING btree \((.*)\);/', $line, $matches);
if (! empty($matches[3])) { if (!empty($matches[3])) {
$indexname = $matches[1]; $indexname = $matches[1];
$tablename = str_replace('public.', '', $matches[2]); $tablename = str_replace('public.', '', $matches[2]);
$columns = $matches[3]; $columns = $matches[3];
@ -529,7 +529,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
if (substr($line, 0, 19) == "CREATE UNIQUE INDEX") { if (substr($line, 0, 19) == "CREATE UNIQUE INDEX") {
$matches = array(); $matches = array();
preg_match('/CREATE UNIQUE INDEX "?([a-zA-Z0-9_]*)"? ON "?([a-zA-Z0-9_\.]*)"? USING btree \((.*)\);/', $line, $matches); preg_match('/CREATE UNIQUE INDEX "?([a-zA-Z0-9_]*)"? ON "?([a-zA-Z0-9_\.]*)"? USING btree \((.*)\);/', $line, $matches);
if (! empty($matches[3])) { if (!empty($matches[3])) {
$indexname = $matches[1]; $indexname = $matches[1];
$tablename = str_replace('public.', '', $matches[2]); $tablename = str_replace('public.', '', $matches[2]);
$columns = str_replace('"', '', $matches[3]); $columns = str_replace('"', '', $matches[3]);

View File

@ -17,14 +17,14 @@ fi
# To detec # To detec
if [ "x$1" = "xlist" ] if [ "x$1" = "xlist" ]
then then
find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v "CRLF" | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep -v 'htdocs\/includes' | grep CRLF # find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v "CRLF" | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep -v 'htdocs\/includes' | grep CRLF
fi fi
# To convert # To convert
if [ "x$1" = "xfix" ] if [ "x$1" = "xfix" ]
then then
for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF | awk -F':' '{ print $1 }' ` for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v "CRLF" | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF | awk -F':' '{ print $1 }' `
do do
echo "Fix file $fic" echo "Fix file $fic"
dos2unix "$fic" dos2unix "$fic"

View File

@ -24,6 +24,7 @@ fi
if [ "x$1" = "xfix" ] if [ "x$1" = "xfix" ]
then then
find ./htdocs -type f -iname "*.php" -exec chmod a-x {} \; find ./htdocs -type f -iname "*.php" -exec chmod a-x {} \;
find ./htdocs/install/ -type d -exec chmod ug+rw {} \;
chmod a+x ./scripts/*/*.php chmod a+x ./scripts/*/*.php
chmod a+x ./scripts/*/*.sh chmod a+x ./scripts/*/*.sh
chmod g-w ./scripts/*/*.php chmod g-w ./scripts/*/*.php

View File

@ -39,13 +39,14 @@ optimize_image()
max_input_size=$(expr $max_input_size + $input_file_size) max_input_size=$(expr $max_input_size + $input_file_size)
if [ "${1##*.}" = "png" ]; then if [ "${1##*.}" = "png" ]; then
#optipng -o1 -clobber -quiet $1 -out $2.firstpass #optipng -o1 -clobber -quiet "$1" -out "$2.firstpass"
optipng -o1 -quiet $1 -out $2.firstpass echo optipng -o1 -quiet "$1" -out "$2.firstpass"
pngcrush -q -rem alla -reduce $2.firstpass $2 >/dev/null optipng -o1 -quiet "$1" -out "$2.firstpass"
rm -fr $2.firstpass pngcrush -q -rem alla -reduce "$2.firstpass" "$2" >/dev/null
rm -fr "$2.firstpass"
fi fi
if [ "${1##*.}" = "jpg" -o "${1##*.}" = "jpeg" ]; then if [ "${1##*.}" = "jpg" -o "${1##*.}" = "jpeg" ]; then
jpegtran -copy none -progressive $1 > $2 jpegtran -copy none -progressive "$1" > $2
fi fi
output_file_size=$(stat -c%s "$2") output_file_size=$(stat -c%s "$2")
@ -120,9 +121,11 @@ main()
# Search of all jpg/jpeg/png in $INPUT # Search of all jpg/jpeg/png in $INPUT
# We remove images from $OUTPUT if $OUTPUT is a subdirectory of $INPUT # We remove images from $OUTPUT if $OUTPUT is a subdirectory of $INPUT
echo "Scan $INPUT to find images" echo "Scan $INPUT to find images with find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v '/gource/' | grep -v '/includes/' | grep -v '/custom/' | grep -v '/documents/' | grep -v $OUTPUT"
IMAGES=$(find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v $OUTPUT) #echo "Scan $INPUT to find images with find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v '/gource/' | grep -v '/includes/' | grep -v '/custom/'"
IMAGES=$(find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v '/gource/' | grep -v '/includes/' | grep -v '/custom/' | grep -v '/documents/' | grep -v $OUTPUT)
#IMAGES=$(find $INPUT -regextype posix-extended -regex '.*\.(jpg|jpeg|png)' | grep -v '/gource/' | grep -v '/includes/' | grep -v '/custom/')
if [ "$QUIET" == "0" ]; then if [ "$QUIET" == "0" ]; then
echo --- Optimizing $INPUT --- echo --- Optimizing $INPUT ---
echo echo
@ -135,11 +138,11 @@ main()
printf '%*.*s' 0 $((linelength - ${#filename} - ${#sDone} )) "$pad" printf '%*.*s' 0 $((linelength - ${#filename} - ${#sDone} )) "$pad"
fi fi
optimize_image $CURRENT_IMAGE $OUTPUT/$filename optimize_image "$CURRENT_IMAGE" "$OUTPUT/$filename"
# Replace file # Replace file
if [[ "$INPLACE" == "1" ]]; then if [[ "$INPLACE" == "1" ]]; then
mv $OUTPUT/$filename $CURRENT_IMAGE mv "$OUTPUT/$filename" "$CURRENT_IMAGE"
fi fi
if [ "$QUIET" == "0" ]; then if [ "$QUIET" == "0" ]; then

View File

@ -1,5 +1,4 @@
<?php <?php
/*spl_autoload_register(function ($class_name) { /*spl_autoload_register(function ($class_name) {
//var_dump('class='.$class_name); //var_dump('class='.$class_name);
require $class_name; require $class_name;

View File

@ -309,11 +309,11 @@ class autoTranslator
{ {
// We want to be sure that src_lang and dest_lang are using 2 chars only // We want to be sure that src_lang and dest_lang are using 2 chars only
$tmp=explode('_', $src_lang); $tmp=explode('_', $src_lang);
if (! empty($tmp[1]) && $tmp[0] == $tmp[1]) { if (!empty($tmp[1]) && $tmp[0] == $tmp[1]) {
$src_lang=$tmp[0]; $src_lang=$tmp[0];
} }
$tmp=explode('_', $dest_lang); $tmp=explode('_', $dest_lang);
if (! empty($tmp[1]) && $tmp[0] == $tmp[1]) { if (!empty($tmp[1]) && $tmp[0] == $tmp[1]) {
$dest_lang=$tmp[0]; $dest_lang=$tmp[0];
} }
@ -349,7 +349,7 @@ class autoTranslator
// now, process the JSON string // now, process the JSON string
$json = json_decode($body, true); $json = json_decode($body, true);
if ((! empty($json['responseStatus']) && $json['responseStatus'] != 200) if ((!empty($json['responseStatus']) && $json['responseStatus'] != 200)
|| count($json['data']['translations']) == 0) { || count($json['data']['translations']) == 0) {
print "Error: ".$json['responseStatus']." ".$url."\n"; print "Error: ".$json['responseStatus']." ".$url."\n";
return false; return false;

View File

@ -221,7 +221,7 @@ foreach ($dups as $string => $pages) {
// Loop on each line keword was found into file. // Loop on each line keword was found into file.
$listoffilesforthisentry=array(); $listoffilesforthisentry=array();
foreach ($lines as $line => $translatedvalue) { foreach ($lines as $line => $translatedvalue) {
if (! empty($listoffilesforthisentry[$file])) { if (!empty($listoffilesforthisentry[$file])) {
$duplicateinsamefile=1; $duplicateinsamefile=1;
} }
$listoffilesforthisentry[$file]=1; $listoffilesforthisentry[$file]=1;
@ -300,7 +300,7 @@ if ($web) {
// STEP 2 - Search key not used // STEP 2 - Search key not used
if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($argv[1]) && $argv[1]=='unused=true')) { if ((!empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($argv[1]) && $argv[1]=='unused=true')) {
print "***** Strings in en_US that are never used:\n"; print "***** Strings in en_US that are never used:\n";
$unused=array(); $unused=array();

View File

@ -303,8 +303,8 @@ foreach ($filesToProcess as $fileToProcess) {
// String exists in both files and value into alternative language differs from main language but also from english files // String exists in both files and value into alternative language differs from main language but also from english files
// so we keep it. // so we keep it.
if ((! empty($aSecondary[$key]) && $aSecondary[$key] != $aPrimary[$key] if ((!empty($aSecondary[$key]) && $aSecondary[$key] != $aPrimary[$key]
&& ! empty($aEnglish[$key]) && $aSecondary[$key] != $aEnglish[$key]) && !empty($aEnglish[$key]) && $aSecondary[$key] != $aEnglish[$key])
|| in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/', $key) || preg_match('/^FormatHour/', $key) || in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/', $key) || preg_match('/^FormatHour/', $key)
) { ) {
//print "Key $key differs (aSecondary=".$aSecondary[$key].", aPrimary=".$aPrimary[$key].", aEnglish=".$aEnglish[$key].") so we add it into new secondary language (line: $cnt).\n"; //print "Key $key differs (aSecondary=".$aSecondary[$key].", aPrimary=".$aPrimary[$key].", aEnglish=".$aEnglish[$key].") so we add it into new secondary language (line: $cnt).\n";

View File

@ -23,6 +23,7 @@
* \brief List accounting account * \brief List accounting account
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -30,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "admin", "accountancy", "salaries")); $langs->loadLangs(array('accountancy', 'admin', 'bills', 'compta', 'salaries'));
$mesg = ''; $mesg = '';
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
@ -52,14 +53,14 @@ $confirm = GETPOST('confirm', 'alpha');
$chartofaccounts = GETPOST('chartofaccounts', 'int'); $chartofaccounts = GETPOST('chartofaccounts', 'int');
$permissiontoadd = !empty($user->rights->accounting->chartofaccount); $permissiontoadd = $user->hasRight('accounting', 'chartofaccount');
$permissiontodelete = !empty($user->rights->accounting->chartofaccount); $permissiontodelete = $user->hasRight('accounting', 'chartofaccount');
// Security check // Security check
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->chartofaccount)) { if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden(); accessforbidden();
} }
@ -97,6 +98,9 @@ if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
$accounting = new AccountingAccount($db); $accounting = new AccountingAccount($db);
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('accountancyadminaccount'));
/* /*
* Actions * Actions
@ -109,8 +113,8 @@ if (!GETPOST('confirmmassaction', 'alpha')) {
$massaction = ''; $massaction = '';
} }
$parameters = array(); $parameters = array('chartofaccounts' => $chartofaccounts, 'permissiontoadd' => $permissiontoadd, 'permissiontodelete' => $permissiontodelete);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been monowraponalldified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $accounting, $action); // Note that $action and $object may have been monowraponalldified by some hooks
if ($reshook < 0) { if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
} }
@ -294,7 +298,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
} }
// List of mass actions available // List of mass actions available
if ($user->rights->accounting->chartofaccount) { if ($user->hasRight('accounting', 'chartofaccount')) {
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete"); $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
} }
if (in_array($massaction, array('presend', 'predelete', 'closed'))) { if (in_array($massaction, array('presend', 'predelete', 'closed'))) {
@ -398,6 +402,11 @@ if ($resql) {
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" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
print '<br>'; print '<br>';
$parameters = array('chartofaccounts' => $chartofaccounts, 'permissiontoadd' => $permissiontoadd, 'permissiontodelete' => $permissiontodelete);
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $accounting, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '<br>'; print '<br>';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
@ -590,7 +599,7 @@ if ($resql) {
// Action // Action
print '<td class="center nowraponall">'; print '<td class="center nowraponall">';
if ($user->rights->accounting->chartofaccount) { if ($user->hasRight('accounting', 'chartofaccount')) {
print '<a class="editfielda" href="./card.php?action=update&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?'.$param).'">'; print '<a class="editfielda" href="./card.php?action=update&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?'.$param).'">';
print img_edit(); print img_edit();
print '</a>'; print '</a>';

View File

@ -32,6 +32,7 @@
* \brief Page to administer model of chart of accounts * \brief Page to administer model of chart of accounts
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
@ -39,12 +40,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
} }
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("errors", "admin", "companies", "resource", "holiday", "compta", "accountancy", "hrm")); $langs->loadLangs(array('accountancy', 'admin', 'companies', 'compta', 'errors', 'holiday', 'hrm', 'resource'));
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
@ -78,7 +79,7 @@ $search_country_id = GETPOST('search_country_id', 'int');
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->chartofaccount)) { if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden(); accessforbidden();
} }
@ -126,7 +127,7 @@ $tabrowid[31] = "";
// Condition to show dictionary in setup page // Condition to show dictionary in setup page
$tabcond = array(); $tabcond = array();
$tabcond[31] = !empty($conf->accounting->enabled); $tabcond[31] = isModEnabled('accounting');
// List of help for fields // List of help for fields
$tabhelp = array(); $tabhelp = array();
@ -674,7 +675,7 @@ if ($id) {
// Can an entry be erased or disabled ? // Can an entry be erased or disabled ?
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default $iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : ''); $url = $_SERVER["PHP_SELF"].'?token='.newToken().($page ? '&page='.$page : '').'&sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
if ($param) { if ($param) {
$url .= '&'.$param; $url .= '&'.$param;
} }

View File

@ -23,6 +23,7 @@
* \brief Card of accounting account * \brief Card of accounting account
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
@ -32,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
$error = 0; $error = 0;
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("bills", "accountancy", "compta")); $langs->loadLangs(array('accountancy', 'bills', 'compta'));
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
@ -48,7 +49,7 @@ $label = GETPOST('label', 'alpha');
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->chartofaccount)) { if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden(); accessforbidden();
} }
@ -66,7 +67,7 @@ if (GETPOST('cancel', 'alpha')) {
exit; exit;
} }
if ($action == 'add' && $user->rights->accounting->chartofaccount) { if ($action == 'add' && $user->hasRight('accounting', 'chartofaccount')) {
if (!$cancel) { if (!$cancel) {
if (!$account_number) { if (!$account_number) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors');
@ -127,7 +128,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) {
} }
} }
} }
} elseif ($action == 'edit' && $user->rights->accounting->chartofaccount) { } elseif ($action == 'edit' && $user->hasRight('accounting', 'chartofaccount')) {
if (!$cancel) { if (!$cancel) {
if (!$account_number) { if (!$account_number) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors');
@ -184,7 +185,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) {
header("Location: ".$urltogo); header("Location: ".$urltogo);
exit(); exit();
} }
} elseif ($action == 'delete' && $user->rights->accounting->chartofaccount) { } elseif ($action == 'delete' && $user->hasRight('accounting', 'chartofaccount')) {
$result = $object->fetch($id); $result = $object->fetch($id);
if (!empty($object->id)) { if (!empty($object->id)) {
@ -419,17 +420,15 @@ if ($action == 'create') {
*/ */
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if (!empty($user->rights->accounting->chartofaccount)) { if ($user->hasRight('accounting', 'chartofaccount')) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=update&token='.newToken().'&id='.$object->id.'">'.$langs->trans('Modify').'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=update&token='.newToken().'&id='.$object->id.'">'.$langs->trans('Modify').'</a>';
} else { } else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>'; print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
} }
if (!empty($user->rights->accounting->chartofaccount)) { // Delete
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans('Delete').'</a>'; $permissiontodelete = $user->hasRight('accounting', 'chartofaccount');
} else { print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';
}
print '</div>'; print '</div>';
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro> /* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2017-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -22,6 +22,7 @@
* \brief Page to assign mass categories to accounts * \brief Page to assign mass categories to accounts
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php';
@ -44,7 +45,7 @@ if ($cat_id == 0) {
} }
// Security check // Security check
if (empty($user->rights->accounting->chartofaccount)) { if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden(); accessforbidden();
} }
@ -124,7 +125,8 @@ if (!empty($cat_id)) {
$arraykeyvalue = array(); $arraykeyvalue = array();
foreach ($accountingcategory->lines_cptbk as $key => $val) { foreach ($accountingcategory->lines_cptbk as $key => $val) {
$arraykeyvalue[length_accountg($val->numero_compte)] = length_accountg($val->numero_compte).' ('.$val->label_compte.($val->doc_ref ? ' '.$val->doc_ref : '').')'; $doc_ref = !empty($val->doc_ref) ? $val->doc_ref : '';
$arraykeyvalue[length_accountg($val->numero_compte)] = length_accountg($val->numero_compte) . ' - ' . $val->label_compte . ($doc_ref ? ' '.$doc_ref : '');
} }
if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) { if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) {

View File

@ -22,6 +22,7 @@
* \brief Page to administer data tables * \brief Page to administer data tables
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
@ -42,7 +43,7 @@ $rowid = GETPOST('rowid', 'alpha');
$code = GETPOST('code', 'alpha'); $code = GETPOST('code', 'alpha');
// Security access // Security access
if (empty($user->rights->accounting->chartofaccount)) { if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden(); accessforbidden();
} }
@ -111,7 +112,7 @@ $tabrowid[32] = "";
// Condition to show dictionary in setup page // Condition to show dictionary in setup page
$tabcond = array(); $tabcond = array();
$tabcond[32] = !empty($conf->accounting->enabled); $tabcond[32] = isModEnabled('accounting');
// List of help for fields // List of help for fields
$tabhelp = array(); $tabhelp = array();
@ -875,7 +876,7 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co
$formadmin = new FormAdmin($db); $formadmin = new FormAdmin($db);
$formcompany = new FormCompany($db); $formcompany = new FormCompany($db);
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
} }
@ -885,9 +886,11 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co
$fieldname = 'country'; $fieldname = 'country';
if ($context == 'add') { if ($context == 'add') {
$fieldname = 'country_id'; $fieldname = 'country_id';
print $form->select_country(GETPOST('country_id', 'int'), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); $preselectcountrycode = GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : $mysoc->country_code;
print $form->select_country($preselectcountrycode, $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
} else { } else {
print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : $mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); $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 '</td>'; print '</td>';
} elseif ($fieldlist[$field] == 'country_id') { } elseif ($fieldlist[$field] == 'country_id') {

View File

@ -22,6 +22,7 @@
* \brief Setup page to configure accounting expert module * \brief Setup page to configure accounting expert module
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -31,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
$langs->loadLangs(array("compta", "admin", "accountancy")); $langs->loadLangs(array("compta", "admin", "accountancy"));
// Security check // Security check
if (empty($user->rights->accounting->chartofaccount)) { if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden(); accessforbidden();
} }

View File

@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
$langs->loadLangs(array("compta", "bills", "admin", "accountancy", "salaries", "loan")); $langs->loadLangs(array("compta", "bills", "admin", "accountancy", "salaries", "loan"));
// Security check // Security check
if (empty($user->rights->accounting->chartofaccount)) { if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden(); accessforbidden();
} }
@ -81,22 +81,22 @@ $list_account[] = '---Others---';
$list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT'; $list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT';
$list_account[] = 'ACCOUNTING_VAT_SOLD_ACCOUNT'; $list_account[] = 'ACCOUNTING_VAT_SOLD_ACCOUNT';
$list_account[] = 'ACCOUNTING_VAT_PAY_ACCOUNT'; $list_account[] = 'ACCOUNTING_VAT_PAY_ACCOUNT';
if (!empty($conf->banque->enabled)) { if (isModEnabled('banque')) {
$list_account[] = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH'; $list_account[] = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
} }
if (!empty($conf->don->enabled)) { if (isModEnabled('don')) {
$list_account[] = 'DONATION_ACCOUNTINGACCOUNT'; $list_account[] = 'DONATION_ACCOUNTINGACCOUNT';
} }
if (!empty($conf->adherent->enabled)) { if (isModEnabled('adherent')) {
$list_account[] = 'ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT'; $list_account[] = 'ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT';
} }
if (!empty($conf->loan->enabled)) { if (isModEnabled('loan')) {
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_CAPITAL'; $list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_CAPITAL';
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INTEREST'; $list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INTEREST';
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INSURANCE'; $list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INSURANCE';
} }
$list_account[] = 'ACCOUNTING_ACCOUNT_SUSPENSE'; $list_account[] = 'ACCOUNTING_ACCOUNT_SUSPENSE';
if (!empty($conf->societe->enabled)) { if (isModEnabled('societe')) {
$list_account[] = '---Deposits---'; $list_account[] = '---Deposits---';
} }
@ -133,6 +133,12 @@ if ($action == 'update') {
$error++; $error++;
} }
$constname = 'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT';
$constvalue = GETPOST($constname, 'int');
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
@ -155,6 +161,20 @@ if ($action == 'setACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT') {
} }
} }
if ($action == 'setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT') {
$setDisableAuxiliaryAccountOnSupplierDeposit = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnSupplierDeposit, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
/* /*
* View * View
@ -266,7 +286,7 @@ print $formaccounting->select_account(getDolGlobalString('ACCOUNTING_ACCOUNT_CUS
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
if (!empty($conf->societe->enabled) && getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT') && getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT') != '-1') { if (isModEnabled('societe') && getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT') && getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT') != '-1') {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>' . img_picto('', 'bill', 'class="pictofixedwidth"') . $langs->trans("UseAuxiliaryAccountOnCustomerDeposit") . '</td>'; print '<td>' . img_picto('', 'bill', 'class="pictofixedwidth"') . $langs->trans("UseAuxiliaryAccountOnCustomerDeposit") . '</td>';
if (getDolGlobalInt('ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT')) { if (getDolGlobalInt('ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT')) {
@ -281,6 +301,33 @@ if (!empty($conf->societe->enabled) && getDolGlobalString('ACCOUNTING_ACCOUNT_CU
print '</tr>'; print '</tr>';
} }
// Supplier deposit account
print '<tr class="oddeven value">';
// Param
print '<td>';
print img_picto('', 'supplier_invoice', 'class="pictofixedwidth"') . $langs->trans('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT');
print '</td>';
// Value
print '<td class="right">'; // Do not force class=right, or it align also the content of the select box
print $formaccounting->select_account(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT'), 'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT', 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts');
print '</td>';
print '</tr>';
if (isModEnabled('societe') && getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT') && getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT') != '-1') {
print '<tr class="oddeven">';
print '<td>' . img_picto('', 'supplier_invoice', 'class="pictofixedwidth"') . $langs->trans("UseAuxiliaryAccountOnSupplierDeposit") . '</td>';
if (getDolGlobalInt('ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT')) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
}
print "</table>\n"; print "</table>\n";
print "</div>\n"; print "</div>\n";

View File

@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
$langs->loadLangs(array("compta", "bills", "admin", "accountancy")); $langs->loadLangs(array("compta", "bills", "admin", "accountancy"));
// Security access // Security access
if (empty($user->rights->accounting->chartofaccount)) { if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden(); accessforbidden();
} }

View File

@ -21,6 +21,7 @@
* \brief Setup page to configure fiscal year * \brief Setup page to configure fiscal year
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php';
@ -52,7 +53,7 @@ $langs->loadLangs(array("admin", "compta"));
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->fiscalyear->write)) { // If we can read accounting records, we should be able to see fiscal year. if (!$user->hasRight('accounting', 'fiscalyear', 'write')) { // If we can read accounting records, we should be able to see fiscal year.
accessforbidden(); accessforbidden();
} }
@ -121,7 +122,7 @@ if ($result) {
$i = 0; $i = 0;
$addbutton .= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->rights->accounting->fiscalyear->write); $addbutton .= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->hasRight('accounting', 'fiscalyear', 'write'));
$title = $langs->trans('AccountingPeriods'); $title = $langs->trans('AccountingPeriods');

View File

@ -22,6 +22,7 @@
* \brief Page to show a fiscal year * \brief Page to show a fiscal year
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fiscalyear.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fiscalyear.lib.php';
@ -34,7 +35,7 @@ $langs->loadLangs(array("admin", "compta"));
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->fiscalyear->write)) { if (!$user->hasRight('accounting', 'fiscalyear', 'write')) {
accessforbidden(); accessforbidden();
} }
@ -299,12 +300,12 @@ if ($action == 'create') {
/* /*
* Action bar * Action bar
*/ */
if (!empty($user->rights->accounting->fiscalyear->write)) { if ($user->hasRight('accounting', 'fiscalyear', 'write')) {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$id.'">'.$langs->trans('Modify').'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$id.'">'.$langs->trans('Modify').'</a>';
// print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&token='.newToken().'&id=' . $id . '">' . $langs->trans('Delete') . '</a>'; //print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
print '</div>'; print '</div>';
} }

View File

@ -21,6 +21,7 @@
* \brief Page to show info of a fiscal year * \brief Page to show info of a fiscal year
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fiscalyear.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fiscalyear.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
@ -33,7 +34,7 @@ $langs->loadLangs(array("admin", "compta"));
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->fiscalyear->write)) { if (!$user->hasRight('accounting', 'fiscalyear', 'write')) {
accessforbidden(); accessforbidden();
} }

View File

@ -29,6 +29,7 @@
* \brief Setup page to configure accounting expert module * \brief Setup page to configure accounting expert module
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -38,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->loadLangs(array("compta", "bills", "admin", "accountancy", "other")); $langs->loadLangs(array("compta", "bills", "admin", "accountancy", "other"));
// Security access // Security access
if (empty($user->rights->accounting->chartofaccount)) { if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden(); accessforbidden();
} }
@ -265,6 +266,9 @@ if (!$user->admin) {
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>'; print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>';
} }
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
print '<div class="info">' . $langs->trans("ConstantIsOn", "FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS") . '</div>';
}
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
print '<div class="info">' . $langs->trans("ConstantIsOn", "ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY") . '</div>'; print '<div class="info">' . $langs->trans("ConstantIsOn", "ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY") . '</div>';
} }

View File

@ -26,6 +26,7 @@ if (!defined('CSRFCHECK_WITH_TOKEN')) {
define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
} }
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
@ -45,7 +46,7 @@ $rowid = GETPOST('rowid', 'alpha');
$code = GETPOST('code', 'alpha'); $code = GETPOST('code', 'alpha');
// Security access // Security access
if (empty($user->rights->accounting->chartofaccount)) { if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden(); accessforbidden();
} }
@ -123,7 +124,7 @@ $tabrowid[35] = "";
// Condition to show dictionary in setup page // Condition to show dictionary in setup page
$tabcond = array(); $tabcond = array();
$tabcond[35] = !empty($conf->accounting->enabled); $tabcond[35] = isModEnabled('accounting');
// List of help for fields // List of help for fields
$tabhelp = array(); $tabhelp = array();

View File

@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
if (!empty($conf->categorie->enabled)) { if (isModEnabled('categorie')) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
} }
@ -42,10 +42,10 @@ if (!empty($conf->categorie->enabled)) {
$langs->loadLangs(array("companies", "compta", "accountancy", "products")); $langs->loadLangs(array("companies", "compta", "accountancy", "products"));
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->bind->write)) { if (!$user->hasRight('accounting', 'bind', 'write')) {
accessforbidden(); accessforbidden();
} }
@ -522,7 +522,7 @@ if ($resql) {
// Filter on categories // Filter on categories
$moreforfilter = ''; $moreforfilter = '';
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedwidth"'); $moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedwidth"');
$categoriesProductArr = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', '', 64, 0, 1); $categoriesProductArr = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', '', 64, 0, 1);
@ -533,7 +533,7 @@ if ($resql) {
} }
//Show/hide child products. Hidden by default //Show/hide child products. Hidden by default
if (!empty($conf->variants->enabled) && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) { if (isModEnabled('variants') && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= '<input type="checkbox" id="search_show_childproducts" name="search_show_childproducts"'.($show_childproducts ? 'checked="checked"' : '').'>'; $moreforfilter .= '<input type="checkbox" id="search_show_childproducts" name="search_show_childproducts"'.($show_childproducts ? 'checked="checked"' : '').'>';
$moreforfilter .= ' <label for="search_show_childproducts">'.$langs->trans('ShowChildProducts').'</label>'; $moreforfilter .= ' <label for="search_show_childproducts">'.$langs->trans('ShowChildProducts').'</label>';

View File

@ -23,6 +23,7 @@
* \brief List of accounting sub-account (auxiliary accounts) * \brief List of accounting sub-account (auxiliary accounts)
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -47,7 +48,7 @@ $search_type = GETPOST('search_type', 'int');
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->chartofaccount)) { if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden(); accessforbidden();
} }

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016-2021 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2016-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -24,6 +24,7 @@
* \brief Balance of book keeping * \brief Balance of book keeping
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
@ -40,6 +41,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$langs->loadLangs(array("accountancy", "compta")); $langs->loadLangs(array("accountancy", "compta"));
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$optioncss = GETPOST('optioncss', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ09');
// Load variable for pagination // Load variable for pagination
@ -142,13 +144,13 @@ if (!empty($search_ledger_code)) {
} }
} }
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }
@ -158,7 +160,8 @@ if (empty($user->rights->accounting->mouvements->lire)) {
* Action * Action
*/ */
$parameters = array('socid'=>$socid); $parameters = array();
$arrayfields = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) { if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* *
@ -25,6 +25,7 @@
* \brief Page to show book-entry * \brief Page to show book-entry
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
@ -79,13 +80,13 @@ if (!empty($update)) {
$object = new BookKeeping($db); $object = new BookKeeping($db);
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }
@ -332,7 +333,9 @@ if ($action == 'valid') {
$html = new Form($db); $html = new Form($db);
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
llxHeader('', $langs->trans("CreateMvts")); $title = $langs->trans("CreateMvts");
llxHeader('', $title);
// Confirmation to delete the command // Confirmation to delete the command
if ($action == 'delete') { if ($action == 'delete') {
@ -341,7 +344,7 @@ if ($action == 'delete') {
} }
if ($action == 'create') { if ($action == 'create') {
print load_fiche_titre($langs->trans("CreateMvts")); print load_fiche_titre($title);
$object = new BookKeeping($db); $object = new BookKeeping($db);
$next_num_mvt = $object->getNextNumMvt('_tmp'); $next_num_mvt = $object->getNextNumMvt('_tmp');
@ -540,21 +543,24 @@ if ($action == 'create') {
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Date document export // Don't show in tmp mode, inevitably empty
print '<tr>'; if ($mode != "_tmp") {
print '<td class="titlefield">'.$langs->trans("DateExport").'</td>'; // Date document export
print '<td>'; print '<tr>';
print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : '&nbsp;'; print '<td class="titlefield">' . $langs->trans("DateExport") . '</td>';
print '</td>'; print '<td>';
print '</tr>'; print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : '&nbsp;';
print '</td>';
print '</tr>';
// Date document validation // Date document validation
print '<tr>'; print '<tr>';
print '<td class="titlefield">'.$langs->trans("DateValidation").'</td>'; print '<td class="titlefield">' . $langs->trans("DateValidation") . '</td>';
print '<td>'; print '<td>';
print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : '&nbsp;'; print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : '&nbsp;';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
}
// Validate // Validate
/* /*

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* *
@ -25,6 +25,7 @@
* \brief List operation of book keeping * \brief List operation of book keeping
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -154,7 +155,7 @@ $hookmanager->initHooks(array('bookkeepinglist'));
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
$form = new Form($db); $form = new Form($db);
if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->rights->accounting->mouvements->export) { if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->hasRight('accounting', 'mouvements', 'export')) {
if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values') && !GETPOST('search_accountancy_code_start')) { if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values') && !GETPOST('search_accountancy_code_start')) {
$query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; $query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$query .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1"; $query .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";
@ -197,7 +198,7 @@ $arrayfields = array(
't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0), 't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0), 't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1), 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
't.date_validated'=>array('label'=>$langs->trans("DateValidationAndLock"), 'checked'=>1), 't.date_validated'=>array('label'=>$langs->trans("DateValidationAndLock"), 'checked'=>1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100), 't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100),
); );
@ -214,13 +215,13 @@ if (empty($listofformat[$formatexportset])) {
$error = 0; $error = 0;
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }
@ -234,7 +235,7 @@ $param = '';
if (GETPOST('cancel', 'alpha')) { if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = ''; $action = 'list'; $massaction = '';
} }
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunlettering' && $massaction != 'predeletebookkeepingwriting') { if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunletteringauto' && $massaction != 'preunletteringmanual' && $massaction != 'predeletebookkeepingwriting') {
$massaction = ''; $massaction = '';
} }
@ -433,7 +434,7 @@ if (empty($reshook)) {
$param .= '&search_import_key='.urlencode($search_import_key); $param .= '&search_import_key='.urlencode($search_import_key);
} }
//if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouvements->supprimer_tous) { //if ($action == 'delbookkeepingyearconfirm' && !$user->hasRight('accounting', 'mouvements', 'supprimer_tous')) {
// $delmonth = GETPOST('delmonth', 'int'); // $delmonth = GETPOST('delmonth', 'int');
// $delyear = GETPOST('delyear', 'int'); // $delyear = GETPOST('delyear', 'int');
// if ($delyear == -1) { // if ($delyear == -1) {
@ -479,50 +480,67 @@ if (empty($reshook)) {
// Mass actions // Mass actions
$objectclass = 'Bookkeeping'; $objectclass = 'Bookkeeping';
$objectlabel = 'Bookkeeping'; $objectlabel = 'Bookkeeping';
$permissiontoread = $user->rights->societe->lire; $permissiontoread = $user->hasRight('societe', 'lire');
$permissiontodelete = $user->rights->societe->supprimer; $permissiontodelete = $user->hasRight('societe', 'supprimer');
$permissiontoadd = $user->rights->societe->creer; $permissiontoadd = $user->rights->societe->creer;
$uploaddir = $conf->societe->dir_output; $uploaddir = $conf->societe->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
if (!$error && $action == 'deletebookkeepingwriting' && $confirm == "yes" && $user->rights->accounting->mouvements->supprimer) { if (!$error && $action == 'deletebookkeepingwriting' && $confirm == "yes" && $user->hasRight('accounting', 'mouvements', 'supprimer')) {
$db->begin();
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
$lettering = new Lettering($db);
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true);
if ($nb_lettering < 0) {
setEventMessages('', $lettering->errors, 'errors');
$error++;
}
}
$nbok = 0; $nbok = 0;
foreach ($toselect as $toselectid) { if (!$error) {
$result = $object->fetch($toselectid); foreach ($toselect as $toselectid) {
if ($result > 0 && (!isset($object->date_validation) || $object->date_validation === '')) { $result = $object->fetch($toselectid);
$result = $object->deleteMvtNum($object->piece_num); if ($result > 0 && (!isset($object->date_validation) || $object->date_validation === '')) {
if ($result > 0) { $result = $object->deleteMvtNum($object->piece_num);
$nbok++; if ($result > 0) {
} else { $nbok++;
} else {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
break;
}
} elseif ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$error++; $error++;
break; break;
} }
} elseif ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
break;
} }
} }
// Message for elements well deleted
if ($nbok > 1) {
setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
} elseif ($nbok > 0) {
setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs');
} elseif (!$error) {
setEventMessages($langs->trans("NoRecordDeleted"), null, 'mesgs');
}
if (!$error) { if (!$error) {
$db->commit();
// Message for elements well deleted
if ($nbok > 1) {
setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
} elseif ($nbok > 0) {
setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs');
} else {
setEventMessages($langs->trans("NoRecordDeleted"), null, 'mesgs');
}
header("Location: ".$_SERVER["PHP_SELF"]."?noreset=1".($param ? '&'.$param : '')); header("Location: ".$_SERVER["PHP_SELF"]."?noreset=1".($param ? '&'.$param : ''));
exit; exit;
} else {
$db->rollback();
} }
} }
// others mass actions // others mass actions
if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->rights->accounting->mouvements->creer) { if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
if ($massaction == 'lettering') { if ($massaction == 'letteringauto') {
$lettering = new Lettering($db); $lettering = new Lettering($db);
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect); $nb_lettering = $lettering->bookkeepingLetteringAll($toselect);
if ($nb_lettering < 0) { if ($nb_lettering < 0) {
@ -543,7 +561,17 @@ if (empty($reshook)) {
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param); header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
exit(); exit();
} }
} elseif ($action == 'unlettering' && $confirm == "yes") { } elseif ($massaction == 'letteringmanual') {
$lettering = new Lettering($db);
$result = $lettering->updateLettering($toselect);
if ($result < 0) {
setEventMessages('', $lettering->errors, 'errors');
} else {
setEventMessages($langs->trans('AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs');
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
exit();
}
} elseif ($action == 'unletteringauto' && $confirm == "yes") {
$lettering = new Lettering($db); $lettering = new Lettering($db);
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true); $nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true);
if ($nb_lettering < 0) { if ($nb_lettering < 0) {
@ -564,6 +592,16 @@ if (empty($reshook)) {
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param); header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
exit(); exit();
} }
} elseif ($action == 'unletteringmanual' && $confirm == "yes") {
$lettering = new Lettering($db);
$nb_lettering = $lettering->deleteLettering($toselect);
if ($result < 0) {
setEventMessages('', $lettering->errors, 'errors');
} else {
setEventMessages($langs->trans('AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs');
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
exit();
}
} }
} }
} }
@ -651,22 +689,29 @@ if (!empty($sortfield)) {
// Export into a file with format defined into setup (FEC, CSV, ...) // Export into a file with format defined into setup (FEC, CSV, ...)
// Must be after definition of $sql // Must be after definition of $sql
if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->export) { if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements', 'export')) {
// TODO Replace the fetchAll to get all ->line followed by call to ->export(). It consumew too much memory on large export. Replace this with the query($sql) and loop on each line to export them. // TODO Replace the fetchAll to get all ->line followed by call to ->export(). It consumes too much memory on large export.
// Replace this with the query($sql) and loop on each line to export them.
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', (empty($conf->global->ACCOUNTING_REEXPORT) ? 0 : 1)); $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', (empty($conf->global->ACCOUNTING_REEXPORT) ? 0 : 1));
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} else { } else {
// Export files // Export files then exit
$accountancyexport = new AccountancyExport($db); $accountancyexport = new AccountancyExport($db);
$mimetype = $accountancyexport->getMimeType($formatexportset);
top_httphead($mimetype, 1);
// Output data on screen
$accountancyexport->export($object->lines, $formatexportset); $accountancyexport->export($object->lines, $formatexportset);
$notifiedexportdate = GETPOST('notifiedexportdate', 'alpha'); $notifiedexportdate = GETPOST('notifiedexportdate', 'alpha');
$notifiedvalidationdate = GETPOST('notifiedvalidationdate', 'alpha'); $notifiedvalidationdate = GETPOST('notifiedvalidationdate', 'alpha');
if (!empty($accountancyexport->errors)) { if (!empty($accountancyexport->errors)) {
setEventMessages('', $accountancyexport->errors, 'errors'); dol_print_error('', '', $accountancyexport->errors);
} elseif (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) { } elseif (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) {
// Specify as export : update field date_export or date_validated // Specify as export : update field date_export or date_validated
$error = 0; $error = 0;
@ -700,11 +745,10 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex
if (!$error) { if (!$error) {
$db->commit(); $db->commit();
// setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExportedOrValidated"), null, 'mesgs');
} else { } else {
$error++; $error++;
$db->rollback(); $db->rollback();
setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated"), null, 'errors'); dol_print_error('', $langs->trans("NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated"));
} }
} }
exit; exit;
@ -769,16 +813,18 @@ if ($action == 'export_file') {
$form_question['separator'] = array('name'=>'separator', 'type'=>'separator'); $form_question['separator'] = array('name'=>'separator', 'type'=>'separator');
// If 0 or not set, we NOT check by default. if (!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) {
$checked = (isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE) || !empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE)); // If 0 or not set, we NOT check by default.
$form_question['notifiedvalidationdate'] = array( $checked = (isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE) || !empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE));
'name' => 'notifiedvalidationdate', $form_question['notifiedvalidationdate'] = array(
'type' => 'checkbox', 'name' => 'notifiedvalidationdate',
'label' => $langs->trans('NotifiedValidationDate', $langs->transnoentitiesnoconv("MenuAccountancyClosure")), 'type' => 'checkbox',
'value' => $checked, 'label' => $langs->trans('NotifiedValidationDate', $langs->transnoentitiesnoconv("MenuAccountancyClosure")),
); 'value' => $checked,
);
$form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator'); $form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator');
}
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 300, 600); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 300, 600);
} }
@ -837,16 +883,16 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
// List of mass actions available // List of mass actions available
$arrayofmassactions = array(); $arrayofmassactions = array();
/*
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->rights->accounting->mouvements->creer) { if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->rights->accounting->mouvements->creer) {
$arrayofmassactions['lettering'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('Lettering'); $arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto');
$arrayofmassactions['preunlettering'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('Unlettering'); $arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringAuto');
$arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual');
$arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringManual');
} }
*/ if ($user->hasRight('accounting', 'mouvements', 'supprimer')) {
if ($user->rights->accounting->mouvements->supprimer) {
$arrayofmassactions['predeletebookkeepingwriting'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); $arrayofmassactions['predeletebookkeepingwriting'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
} }
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('preunlettering', 'predeletebookkeepingwriting'))) { if (GETPOST('nomassaction', 'int') || in_array($massaction, array('preunletteringauto', 'preunletteringmanual', 'predeletebookkeepingwriting'))) {
$arrayofmassactions = array(); $arrayofmassactions = array();
} }
$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions); $massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
@ -858,8 +904,8 @@ if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.urlencode($optioncss).'">'; print '<input type="hidden" name="optioncss" value="'.urlencode($optioncss).'">';
} }
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.urlencode($sortfield).'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.urlencode($sortorder).'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
if (count($filter)) { if (count($filter)) {
@ -879,8 +925,8 @@ if (empty($reshook)) {
} }
$newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>'; $newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>';
if (!empty($user->rights->accounting->mouvements->export)) { if ($user->hasRight('accounting', 'mouvements', 'export')) {
$newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param ? '&'.$param : ''), $user->rights->accounting->mouvements->export); $newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : ''), $user->hasRight('accounting', 'mouvements', 'export'));
} }
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
@ -891,13 +937,15 @@ if (empty($reshook)) {
if (!empty($socid)) { if (!empty($socid)) {
$url .= '&socid='.$socid; $url .= '&socid='.$socid;
} }
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', $url, '', $user->rights->accounting->mouvements->creer); $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', $url, '', $user->hasRight('accounting', 'mouvements', 'creer'));
} }
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
if ($massaction == 'preunlettering') { if ($massaction == 'preunletteringauto') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnlettering"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unlettering", null, '', 0, 200, 500, 1); print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringAuto"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringauto", null, '', 0, 200, 500, 1);
} elseif ($massaction == 'preunletteringmanual') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringManual"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringmanual", null, '', 0, 200, 500, 1);
} elseif ($massaction == 'predeletebookkeepingwriting') { } elseif ($massaction == 'predeletebookkeepingwriting') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeleteBookkeepingWriting"), $langs->trans("ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)), "deletebookkeepingwriting", null, '', 0, 200, 500, 1); print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeleteBookkeepingWriting"), $langs->trans("ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)), "deletebookkeepingwriting", null, '', 0, 200, 500, 1);
} }
@ -980,14 +1028,14 @@ if (!empty($arrayfields['t.subledger_account']['checked'])) {
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', $langs->trans('to'), 'maxwidth250', 'subledgeraccount'); print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', $langs->trans('to'), 'maxwidth250', 'subledgeraccount');
print '</div>'; print '</div>';
} else { } else {
print '<input type="text" class="maxwidth75" name="search_accountancy_aux_code" value="'.$search_accountancy_aux_code.'">'; print '<input type="text" class="maxwidth75" name="search_accountancy_aux_code" value="'.dol_escape_htmltag($search_accountancy_aux_code).'">';
} }
print '</td>'; print '</td>';
} }
// Label operation // Label operation
if (!empty($arrayfields['t.label_operation']['checked'])) { if (!empty($arrayfields['t.label_operation']['checked'])) {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" size="7" class="flat" name="search_mvt_label" value="'.$search_mvt_label.'"/>'; print '<input type="text" size="7" class="flat" name="search_mvt_label" value="'.dol_escape_htmltag($search_mvt_label).'"/>';
print '</td>'; print '</td>';
} }
// Debit // Debit
@ -1005,7 +1053,7 @@ if (!empty($arrayfields['t.credit']['checked'])) {
// Lettering code // Lettering code
if (!empty($arrayfields['t.lettering_code']['checked'])) { if (!empty($arrayfields['t.lettering_code']['checked'])) {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>'; print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.dol_escape_htmltag($search_lettering_code).'"/>';
print '<br><span class="nowrap"><input type="checkbox" name="search_not_reconciled" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>'; print '<br><span class="nowrap"><input type="checkbox" name="search_not_reconciled" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
print '</td>'; print '</td>';
} }
@ -1113,10 +1161,10 @@ if (!empty($arrayfields['t.tms']['checked'])) {
print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, '', $sortfield, $sortorder, 'center ');
} }
if (!empty($arrayfields['t.date_export']['checked'])) { if (!empty($arrayfields['t.date_export']['checked'])) {
print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export,t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
} }
if (!empty($arrayfields['t.date_validated']['checked'])) { if (!empty($arrayfields['t.date_validated']['checked'])) {
print_liste_field_titre($arrayfields['t.date_validated']['label'], $_SERVER['PHP_SELF'], "t.date_validated", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre($arrayfields['t.date_validated']['label'], $_SERVER['PHP_SELF'], "t.date_validated,t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
} }
if (!empty($arrayfields['t.import_key']['checked'])) { if (!empty($arrayfields['t.import_key']['checked'])) {
print_liste_field_titre($arrayfields['t.import_key']['label'], $_SERVER["PHP_SELF"], "t.import_key", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre($arrayfields['t.import_key']['label'], $_SERVER["PHP_SELF"], "t.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
@ -1134,6 +1182,9 @@ $totalarray = array();
$totalarray['nbfield'] = 0; $totalarray['nbfield'] = 0;
$total_debit = 0; $total_debit = 0;
$total_credit = 0; $total_credit = 0;
$totalarray['val'] = array ();
$totalarray['val']['totaldebit'] = 0;
$totalarray['val']['totalcredit'] = 0;
while ($i < min($num, $limit)) { while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);

View File

@ -25,6 +25,7 @@
* \brief List operation of ledger ordered by account number * \brief List operation of ledger ordered by account number
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -166,7 +167,7 @@ $arrayfields = array(
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1), 't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1), 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1), 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1), 't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100), 't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100),
); );
@ -187,13 +188,13 @@ if ($search_date_end && empty($search_date_endyear)) {
$search_date_endday = $tmparray['mday']; $search_date_endday = $tmparray['mday'];
} }
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }
@ -208,7 +209,7 @@ if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $action = 'list';
$massaction = ''; $massaction = '';
} }
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunlettering' && $massaction != 'predeletebookkeepingwriting') { if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunletteringauto' && $massaction != 'preunletteringmanual' && $massaction != 'predeletebookkeepingwriting') {
$massaction = ''; $massaction = '';
} }
@ -394,50 +395,67 @@ if (empty($reshook)) {
// Mass actions // Mass actions
$objectclass = 'Bookkeeping'; $objectclass = 'Bookkeeping';
$objectlabel = 'Bookkeeping'; $objectlabel = 'Bookkeeping';
$permissiontoread = $user->rights->societe->lire; $permissiontoread = $user->hasRight('societe', 'lire');
$permissiontodelete = $user->rights->societe->supprimer; $permissiontodelete = $user->hasRight('societe', 'supprimer');
$permissiontoadd = $user->rights->societe->creer; $permissiontoadd = $user->rights->societe->creer;
$uploaddir = $conf->societe->dir_output; $uploaddir = $conf->societe->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
if (!$error && $action == 'deletebookkeepingwriting' && $confirm == "yes" && $user->rights->accounting->mouvements->supprimer) { if (!$error && $action == 'deletebookkeepingwriting' && $confirm == "yes" && $user->hasRight('accounting', 'mouvements', 'supprimer')) {
$db->begin();
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
$lettering = new Lettering($db);
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true);
if ($nb_lettering < 0) {
setEventMessages('', $lettering->errors, 'errors');
$error++;
}
}
$nbok = 0; $nbok = 0;
foreach ($toselect as $toselectid) { if (!$error) {
$result = $object->fetch($toselectid); foreach ($toselect as $toselectid) {
if ($result > 0 && (!isset($object->date_validation) || $object->date_validation === '')) { $result = $object->fetch($toselectid);
$result = $object->deleteMvtNum($object->piece_num); if ($result > 0 && (!isset($object->date_validation) || $object->date_validation === '')) {
if ($result > 0) { $result = $object->deleteMvtNum($object->piece_num);
$nbok++; if ($result > 0) {
} else { $nbok++;
} else {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
break;
}
} elseif ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$error++; $error++;
break; break;
} }
} elseif ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
break;
} }
} }
// Message for elements well deleted
if ($nbok > 1) {
setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
} elseif ($nbok > 0) {
setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs');
} elseif (!$error) {
setEventMessages($langs->trans("NoRecordDeleted"), null, 'mesgs');
}
if (!$error) { if (!$error) {
$db->commit();
// Message for elements well deleted
if ($nbok > 1) {
setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
} elseif ($nbok > 0) {
setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs');
} elseif (!$error) {
setEventMessages($langs->trans("NoRecordDeleted"), null, 'mesgs');
}
header("Location: ".$_SERVER["PHP_SELF"]."?noreset=1".($param ? '&'.$param : '')); header("Location: ".$_SERVER["PHP_SELF"]."?noreset=1".($param ? '&'.$param : ''));
exit; exit;
} else {
$db->rollback();
} }
} }
// others mass actions // others mass actions
if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->rights->accounting->mouvements->creer) { if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
if ($massaction == 'lettering') { if ($massaction == 'letteringauto') {
$lettering = new Lettering($db); $lettering = new Lettering($db);
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect); $nb_lettering = $lettering->bookkeepingLetteringAll($toselect);
if ($nb_lettering < 0) { if ($nb_lettering < 0) {
@ -458,7 +476,17 @@ if (empty($reshook)) {
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param); header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
exit(); exit();
} }
} elseif ($action == 'unlettering' && $confirm == "yes") { } elseif ($massaction == 'letteringmanual') {
$lettering = new Lettering($db);
$result = $lettering->updateLettering($toselect);
if ($result < 0) {
setEventMessages('', $lettering->errors, 'errors');
} else {
setEventMessages($langs->trans('AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs');
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
exit();
}
} elseif ($action == 'unletteringauto' && $confirm == "yes") {
$lettering = new Lettering($db); $lettering = new Lettering($db);
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true); $nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true);
if ($nb_lettering < 0) { if ($nb_lettering < 0) {
@ -479,6 +507,16 @@ if (empty($reshook)) {
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param); header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
exit(); exit();
} }
} elseif ($action == 'unletteringmanual' && $confirm == "yes") {
$lettering = new Lettering($db);
$nb_lettering = $lettering->deleteLettering($toselect);
if ($result < 0) {
setEventMessages('', $lettering->errors, 'errors');
} else {
setEventMessages($langs->trans('AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs');
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
exit();
}
} }
} }
} }
@ -578,14 +616,16 @@ print $formconfirm;
// List of mass actions available // List of mass actions available
$arrayofmassactions = array(); $arrayofmassactions = array();
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->rights->accounting->mouvements->creer) { if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
$arrayofmassactions['lettering'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('Lettering'); $arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto');
$arrayofmassactions['preunlettering'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('Unlettering'); $arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringAuto');
$arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual');
$arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringManual');
} }
if ($user->rights->accounting->mouvements->supprimer) { if ($user->hasRight('accounting', 'mouvements', 'supprimer')) {
$arrayofmassactions['predeletebookkeepingwriting'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); $arrayofmassactions['predeletebookkeepingwriting'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
} }
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('preunlettering', 'predeletebookkeepingwriting'))) { if (GETPOST('nomassaction', 'int') || in_array($massaction, array('preunletteringauto', 'preunletteringmanual', 'predeletebookkeepingwriting'))) {
$arrayofmassactions = array(); $arrayofmassactions = array();
} }
$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions); $massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
@ -625,8 +665,10 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
if ($massaction == 'preunlettering') { if ($massaction == 'preunletteringauto') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnlettering"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unlettering", null, '', 0, 200, 500, 1); print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringAuto"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringauto", null, '', 0, 200, 500, 1);
} elseif ($massaction == 'preunletteringmanual') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringManual"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringmanual", null, '', 0, 200, 500, 1);
} elseif ($massaction == 'predeletebookkeepingwriting') { } elseif ($massaction == 'predeletebookkeepingwriting') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeleteBookkeepingWriting"), $langs->trans("ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)), "deletebookkeepingwriting", null, '', 0, 200, 500, 1); print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeleteBookkeepingWriting"), $langs->trans("ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)), "deletebookkeepingwriting", null, '', 0, 200, 500, 1);
} }
@ -824,17 +866,22 @@ print $hookmanager->resPrint;
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
$total_debit = 0;
$total_credit = 0;
$sous_total_debit = 0;
$sous_total_credit = 0;
$displayed_account_number = null; // Start with undefined to be able to distinguish with empty $displayed_account_number = null; // Start with undefined to be able to distinguish with empty
// Loop on record // Loop on record
// -------------------------------------------------------------------- // --------------------------------------------------------------------
$i = 0; $i = 0;
$totalarray = array(); $totalarray = array();
$totalarray['val'] = array ();
$totalarray['nbfield'] = 0;
$total_debit = 0;
$total_credit = 0;
$sous_total_debit = 0;
$sous_total_credit = 0;
$totalarray['val']['totaldebit'] = 0;
$totalarray['val']['totalcredit'] = 0;
while ($i < min($num, $limit)) { while ($i < min($num, $limit)) {
$line = $object->lines[$i]; $line = $object->lines[$i];

View File

@ -785,12 +785,13 @@ class AccountancyCategory // extends CommonObject
} }
/** /**
* Return list of custom groups that are active * Return list of custom groups.
* *
* @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups * @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups
* @param int $active 1= active, 0=not active
* @return array|int Array of groups or -1 if error * @return array|int Array of groups or -1 if error
*/ */
public function getCats($categorytype = -1) public function getCats($categorytype = -1, $active = 1)
{ {
global $conf, $mysoc; global $conf, $mysoc;
@ -801,7 +802,7 @@ class AccountancyCategory // extends CommonObject
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type, c.sens"; $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type, c.sens";
$sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c"; $sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
$sql .= " WHERE c.active = 1"; $sql .= " WHERE c.active = " . (int) $active;
$sql .= " AND c.entity = ".$conf->entity; $sql .= " AND c.entity = ".$conf->entity;
if ($categorytype >= 0) { if ($categorytype >= 0) {
$sql .= " AND c.category_type = 1"; $sql .= " AND c.category_type = 1";

View File

@ -286,6 +286,28 @@ class AccountancyExport
} }
/**
* Return the MIME type of a file
*
* @param int $formatexportset Id of export format
* @return string MIME type.
*/
public function getMimeType($formatexportset)
{
$mime = 'text/csv';
switch ($formatexportset) {
case self::$EXPORT_TYPE_FEC:
$mime = 'text/tab-separated-values';
break;
default:
$mime = 'text/csv';
break;
}
return $mime;
}
/** /**
* Function who chose which export to use with the default config, and make the export into a file * Function who chose which export to use with the default config, and make the export into a file
* *
@ -1347,7 +1369,7 @@ class AccountancyExport
} }
print $nature_piece.$separator; print $nature_piece.$separator;
// RACI // RACI
// if (! empty($line->subledger_account)) { // if (!empty($line->subledger_account)) {
// if ($line->doc_type == 'supplier_invoice') { // if ($line->doc_type == 'supplier_invoice') {
// $racine_subledger_account = '40'; // $racine_subledger_account = '40';
// } elseif ($line->doc_type == 'customer_invoice') { // } elseif ($line->doc_type == 'customer_invoice') {
@ -1610,7 +1632,7 @@ class AccountancyExport
} }
print $nature_piece.$separator; print $nature_piece.$separator;
// RACI // RACI
// if (! empty($line->subledger_account)) { // if (!empty($line->subledger_account)) {
// if ($line->doc_type == 'supplier_invoice') { // if ($line->doc_type == 'supplier_invoice') {
// $racine_subledger_account = '40'; // $racine_subledger_account = '40';
// } elseif ($line->doc_type == 'customer_invoice') { // } elseif ($line->doc_type == 'customer_invoice') {

View File

@ -811,9 +811,9 @@ class AccountingAccount extends CommonObject
$suggestedaccountingaccountfor = ''; $suggestedaccountingaccountfor = '';
if ((($buyer->country_code == $seller->country_code) || empty($buyer->country_code))) { if ((($buyer->country_code == $seller->country_code) || empty($buyer->country_code))) {
// If buyer in same country than seller (if not defined, we assume it is same country) // If buyer in same country than seller (if not defined, we assume it is same country)
if ($type=='customer' && !empty($product->accountancy_code_sell)) { if ($type == 'customer' && !empty($product->accountancy_code_sell)) {
$code_p = $product->accountancy_code_sell; $code_p = $product->accountancy_code_sell;
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) { } elseif ($type == 'supplier' && !empty($product->accountancy_code_buy)) {
$code_p = $product->accountancy_code_buy; $code_p = $product->accountancy_code_buy;
} }
$suggestedid = $accountingAccount['dom']; $suggestedid = $accountingAccount['dom'];
@ -821,36 +821,36 @@ class AccountingAccount extends CommonObject
} else { } else {
if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) { if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) {
// European intravat sale, but with VAT // European intravat sale, but with VAT
if ($type=='customer' && !empty($product->accountancy_code_sell)) { if ($type == 'customer' && !empty($product->accountancy_code_sell)) {
$code_p = $product->accountancy_code_sell; $code_p = $product->accountancy_code_sell;
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) { } elseif ($type == 'supplier' && !empty($product->accountancy_code_buy)) {
$code_p = $product->accountancy_code_buy; $code_p = $product->accountancy_code_buy;
} }
$suggestedid = $accountingAccount['dom']; $suggestedid = $accountingAccount['dom'];
$suggestedaccountingaccountfor = 'eecwithvat'; $suggestedaccountingaccountfor = 'eecwithvat';
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($buyer->tva_intra)) { } elseif ($isSellerInEEC && $isBuyerInEEC && empty($buyer->tva_intra)) {
// European intravat sale, without VAT intra community number // European intravat sale, without VAT intra community number
if ($type=='customer' && !empty($product->accountancy_code_sell)) { if ($type == 'customer' && !empty($product->accountancy_code_sell)) {
$code_p = $product->accountancy_code_sell; $code_p = $product->accountancy_code_sell;
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) { } elseif ($type == 'supplier' && !empty($product->accountancy_code_buy)) {
$code_p = $product->accountancy_code_buy; $code_p = $product->accountancy_code_buy;
} }
$suggestedid = $accountingAccount['dom']; // There is a doubt for this case. Is it an error on vat or we just forgot to fill vat number ? $suggestedid = $accountingAccount['dom']; // There is a doubt for this case. Is it an error on vat or we just forgot to fill vat number ?
$suggestedaccountingaccountfor = 'eecwithoutvatnumber'; $suggestedaccountingaccountfor = 'eecwithoutvatnumber';
} elseif ($isSellerInEEC && $isBuyerInEEC && !empty($product->accountancy_code_sell_intra)) { } elseif ($isSellerInEEC && $isBuyerInEEC && !empty($product->accountancy_code_sell_intra)) {
// European intravat sale // European intravat sale
if ($type=='customer' && !empty($product->accountancy_code_sell_intra)) { if ($type == 'customer' && !empty($product->accountancy_code_sell_intra)) {
$code_p = $product->accountancy_code_sell_intra; $code_p = $product->accountancy_code_sell_intra;
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy_intra)) { } elseif ($type == 'supplier' && !empty($product->accountancy_code_buy_intra)) {
$code_p = $product->accountancy_code_buy_intra; $code_p = $product->accountancy_code_buy_intra;
} }
$suggestedid = $accountingAccount['intra']; $suggestedid = $accountingAccount['intra'];
$suggestedaccountingaccountfor = 'eec'; $suggestedaccountingaccountfor = 'eec';
} else { } else {
// Foreign sale // Foreign sale
if ($type=='customer' && !empty($product->accountancy_code_sell_export)) { if ($type == 'customer' && !empty($product->accountancy_code_sell_export)) {
$code_p = $product->accountancy_code_sell_export; $code_p = $product->accountancy_code_sell_export;
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy_export)) { } elseif ($type == 'supplier' && !empty($product->accountancy_code_buy_export)) {
$code_p = $product->accountancy_code_buy_export; $code_p = $product->accountancy_code_buy_export;
} }
$suggestedid = $accountingAccount['export']; $suggestedid = $accountingAccount['export'];
@ -863,15 +863,19 @@ class AccountingAccount extends CommonObject
if (!empty($buyer->code_compta_product)) { if (!empty($buyer->code_compta_product)) {
$code_t = $buyer->code_compta_product; $code_t = $buyer->code_compta_product;
$suggestedid = $accountingAccount['thirdparty']; $suggestedid = $accountingAccount['thirdparty'];
$suggestedaccountingaccountfor = 'thridparty'; $suggestedaccountingaccountfor = 'thirdparty';
} }
} }
// Manage Deposit // Manage Deposit
if ($factureDet->desc == "(DEPOSIT)" || $facture->type == $facture::TYPE_DEPOSIT) { if ($factureDet->desc == "(DEPOSIT)" || $facture->type == $facture::TYPE_DEPOSIT) {
$accountdeposittoventilated = new self($this->db); $accountdeposittoventilated = new self($this->db);
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1); if ($type == 'customer') {
if ($result < 0) { $result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
} elseif ($type == 'supplier') {
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT, 1);
}
if (isset($result) && $result < 0) {
return -1; return -1;
} }

View File

@ -281,7 +281,7 @@ class AccountingJournal extends CommonObject
} }
$label_link = $this->code; $label_link = $this->code;
if ($withlabel) { if ($withlabel && !empty($this->label)) {
$label_link .= ' - '.($nourl ? '<span class="opacitymedium">' : '').$langs->transnoentities($this->label).($nourl ? '</span>' : ''); $label_link .= ' - '.($nourl ? '<span class="opacitymedium">' : '').$langs->transnoentities($this->label).($nourl ? '</span>' : '');
} }
@ -429,7 +429,7 @@ class AccountingJournal extends CommonObject
{ {
global $conf, $langs; global $conf, $langs;
if (empty($conf->asset->enabled)) { if (!isModEnabled('asset')) {
return array(); return array();
} }
@ -441,26 +441,40 @@ class AccountingJournal extends CommonObject
$langs->loadLangs(array("assets")); $langs->loadLangs(array("assets"));
// Clean parameters // Clean parameters
if (empty($type)) $type = 'view'; if (empty($type)) {
if (empty($in_bookkeeping)) $in_bookkeeping = 'notyet'; $type = 'view';
}
if (empty($in_bookkeeping)) {
$in_bookkeeping = 'notyet';
}
$sql = ""; $sql = "";
if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
// FIXME sql error with Mysql 5.7
/*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
$sql .= "WITH in_accounting_bookkeeping(fk_docdet) AS ("; $sql .= "WITH in_accounting_bookkeeping(fk_docdet) AS (";
$sql .= " SELECT DISTINCT fk_docdet"; $sql .= " SELECT DISTINCT fk_docdet";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
$sql .= " WHERE doc_type = 'asset'"; $sql .= " WHERE doc_type = 'asset'";
$sql .= ")"; $sql .= ") ";
} }*/
$sql .= "SELECT ad.fk_asset AS rowid, a.ref AS asset_ref, a.label AS asset_label, a.acquisition_value_ht AS asset_acquisition_value_ht"; $sql .= "SELECT ad.fk_asset AS rowid, a.ref AS asset_ref, a.label AS asset_label, a.acquisition_value_ht AS asset_acquisition_value_ht";
$sql .= ", a.disposal_date AS asset_disposal_date, a.disposal_amount_ht AS asset_disposal_amount_ht, a.disposal_subject_to_vat AS asset_disposal_subject_to_vat"; $sql .= ", a.disposal_date AS asset_disposal_date, a.disposal_amount_ht AS asset_disposal_amount_ht, a.disposal_subject_to_vat AS asset_disposal_subject_to_vat";
$sql .= ", ad.rowid AS depreciation_id, ad.depreciation_mode, ad.ref AS depreciation_ref, ad.depreciation_date, ad.depreciation_ht, ad.accountancy_code_debit, ad.accountancy_code_credit"; $sql .= ", ad.rowid AS depreciation_id, ad.depreciation_mode, ad.ref AS depreciation_ref, ad.depreciation_date, ad.depreciation_ht, ad.accountancy_code_debit, ad.accountancy_code_credit";
$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation as ad"; $sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation as ad";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "asset as a ON a.rowid = ad.fk_asset"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "asset as a ON a.rowid = ad.fk_asset";
if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') { // 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 .= " LEFT JOIN in_accounting_bookkeeping as iab ON iab.fk_docdet = ad.rowid";
} }*/
$sql .= " WHERE a.entity IN (" . getEntity('asset', 0) . ')'; // We don't share object for accountancy, we use source object sharing $sql .= " WHERE a.entity IN (" . getEntity('asset', 0) . ')'; // We don't share object for accountancy, we use source object sharing
// Compatibility with Mysql 5.7
if ($in_bookkeeping == 'already') {
$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') {
$sql .= " AND NOT EXISTS (SELECT iab.fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')";
}
$sql .= " AND ad.ref != ''"; // not reversal lines $sql .= " AND ad.ref != ''"; // not reversal lines
if ($date_start && $date_end) { if ($date_start && $date_end) {
$sql .= " AND ad.depreciation_date >= '" . $this->db->idate($date_start) . "' AND ad.depreciation_date <= '" . $this->db->idate($date_end) . "'"; $sql .= " AND ad.depreciation_date >= '" . $this->db->idate($date_start) . "' AND ad.depreciation_date <= '" . $this->db->idate($date_end) . "'";
@ -470,9 +484,10 @@ class AccountingJournal extends CommonObject
$sql .= " AND ad.depreciation_date >= '" . $this->db->idate($conf->global->ACCOUNTING_DATE_START_BINDING) . "'"; $sql .= " AND ad.depreciation_date >= '" . $this->db->idate($conf->global->ACCOUNTING_DATE_START_BINDING) . "'";
} }
// Already in bookkeeping or not // Already in bookkeeping or not
if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') { // 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 .= " AND iab.fk_docdet IS" . ($in_bookkeeping == 'already' ? " NOT" : "") . " NULL";
} }*/
$sql .= " ORDER BY ad.depreciation_date"; $sql .= " ORDER BY ad.depreciation_date";
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
@ -867,7 +882,7 @@ class AccountingJournal extends CommonObject
} }
} }
// //
// if (!$error_for_line && !empty($conf->asset->enabled) && $this->nature == 1 && $bookkeeping->fk_doc > 0) { // if (!$error_for_line && isModEnabled('asset') && $this->nature == 1 && $bookkeeping->fk_doc > 0) {
// // Set last cumulative depreciation // // Set last cumulative depreciation
// require_once DOL_DOCUMENT_ROOT . '/asset/class/asset.class.php'; // require_once DOL_DOCUMENT_ROOT . '/asset/class/asset.class.php';
// $asset = new Asset($this->db); // $asset = new Asset($this->db);

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2014-2017 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2014-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2015-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-2020 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2015-2020 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* *
@ -169,6 +169,16 @@ class BookKeeping extends CommonObject
*/ */
public $piece_num; public $piece_num;
/**
* @var integer|string date of movement validated & lock
*/
public $date_validation;
/**
* @var integer|string date of movement who are noticed like exported
*/
public $date_export;
/** /**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/ */
@ -788,8 +798,7 @@ class BookKeeping extends CommonObject
$this->piece_num = $obj->piece_num; $this->piece_num = $obj->piece_num;
$this->date_creation = $this->db->jdate($obj->date_creation); $this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_export = $this->db->jdate($obj->date_export); $this->date_export = $this->db->jdate($obj->date_export);
$this->date_validation = $this->db->jdate($obj->date_validated); $this->date_validation = isset($obj->date_validated) ? $this->db->jdate($obj->date_validated) : '';
$this->date_validation = $this->db->jdate($obj->date_validation);
} }
$this->db->free($resql); $this->db->free($resql);
@ -901,7 +910,8 @@ class BookKeeping extends CommonObject
} }
// Affichage par compte comptable // Affichage par compte comptable
if (!empty($option)) { if (!empty($option)) {
$sql .= ' AND t.subledger_account IS NOT NULL'; $sql .= " AND t.subledger_account IS NOT NULL";
$sql .= " AND t.subledger_account <> ''";
$sortfield = 't.subledger_account'.($sortfield ? ','.$sortfield : ''); $sortfield = 't.subledger_account'.($sortfield ? ','.$sortfield : '');
$sortorder = 'ASC'.($sortfield ? ','.$sortfield : ''); $sortorder = 'ASC'.($sortfield ? ','.$sortfield : '');
} else { } else {
@ -1123,14 +1133,13 @@ class BookKeeping extends CommonObject
/** /**
* Load object in memory from the database * Load object in memory from the database
* *
* @param string $sortorder Sort Order * @param string $sortorder Sort Order
* @param string $sortfield Sort field * @param string $sortfield Sort field
* @param int $limit offset limit * @param int $limit offset limit
* @param int $offset offset limit * @param int $offset offset limit
* @param array $filter filter array * @param array $filter filter array
* @param string $filtermode filter mode (AND or OR) * @param string $filtermode filter mode (AND or OR)
* * @return int <0 if KO, >0 if OK
* @return int <0 if KO, >0 if OK
*/ */
public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
{ {
@ -1151,7 +1160,7 @@ class BookKeeping extends CommonObject
foreach ($filter as $key => $value) { foreach ($filter as $key => $value) {
if ($key == 't.doc_date') { if ($key == 't.doc_date') {
$sqlwhere[] = $key." = '".$this->db->idate($value)."'"; $sqlwhere[] = $key." = '".$this->db->idate($value)."'";
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') { } elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=' || $key == 't.doc_date>' || $key == 't.doc_date<') {
$sqlwhere[] = $key."'".$this->db->idate($value)."'"; $sqlwhere[] = $key."'".$this->db->idate($value)."'";
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') { } elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
$sqlwhere[] = $key."'".$this->db->escape($value)."'"; $sqlwhere[] = $key."'".$this->db->escape($value)."'";
@ -1667,7 +1676,9 @@ class BookKeeping extends CommonObject
$this->doc_type = $obj->doc_type; $this->doc_type = $obj->doc_type;
$this->date_creation = $this->db->jdate($obj->date_creation); $this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_modification = $this->db->jdate($obj->date_modification); $this->date_modification = $this->db->jdate($obj->date_modification);
$this->date_export = $this->db->jdate($obj->date_export); if ($mode != "_tmp") {
$this->date_export = $this->db->jdate($obj->date_export);
}
$this->date_validation = $this->db->jdate($obj->date_validation); $this->date_validation = $this->db->jdate($obj->date_validation);
} else { } else {
$this->error = "Error ".$this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
@ -1764,7 +1775,9 @@ class BookKeeping extends CommonObject
$line->piece_num = $obj->piece_num; $line->piece_num = $obj->piece_num;
$line->date_creation = $obj->date_creation; $line->date_creation = $obj->date_creation;
$line->date_modification = $obj->date_modification; $line->date_modification = $obj->date_modification;
$line->date_export = $obj->date_export; if ($mode != "_tmp") {
$line->date_export = $obj->date_export;
}
$line->date_validation = $obj->date_validation; $line->date_validation = $obj->date_validation;
$this->linesmvt[] = $line; $this->linesmvt[] = $line;

View File

@ -33,11 +33,52 @@ include_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php";
*/ */
class Lettering extends BookKeeping class Lettering extends BookKeeping
{ {
/** public static $doc_type_infos = array(
* @var BookKeeping[] Bookkeeping cached 'customer_invoice' => array(
*/ 'payment_table' => 'paiement',
public static $bookkeeping_cached = array(); 'payment_table_fk_bank' => 'fk_bank',
'doc_payment_table' => 'paiement_facture',
'doc_payment_table_fk_payment' => 'fk_paiement',
'doc_payment_table_fk_doc' => 'fk_facture',
'linked_info' => array(
array(
'table' => 'paiement_facture',
'fk_doc' => 'fk_facture',
'fk_link' => 'fk_paiement',
'prefix' => 'p',
),
array(
'table' => 'societe_remise_except',
'fk_doc' => 'fk_facture_source',
'fk_link' => 'fk_facture',
'prefix' => 'a',
'is_fk_link_is_also_fk_doc' => true,
),
),
),
'supplier_invoice' => array(
'payment_table' => 'paiementfourn',
'payment_table_fk_bank' => 'fk_bank',
'doc_payment_table' => 'paiementfourn_facturefourn',
'doc_payment_table_fk_payment' => 'fk_paiementfourn',
'doc_payment_table_fk_doc' => 'fk_facturefourn',
'linked_info' => array(
array(
'table' => 'paiementfourn_facturefourn',
'fk_doc' => 'fk_facturefourn',
'fk_link' => 'fk_paiementfourn',
'prefix' => 'p',
),
array(
'table' => 'societe_remise_except',
'fk_doc' => 'fk_invoice_supplier_source',
'fk_link' => 'fk_invoice_supplier',
'prefix' => 'a',
'is_fk_link_is_also_fk_doc' => true,
),
),
),
);
/** /**
* letteringThirdparty * letteringThirdparty
@ -250,26 +291,17 @@ class Lettering extends BookKeeping
$lettre = 'AAA'; $lettre = 'AAA';
$sql = "SELECT DISTINCT ab2.lettering_code"; $sql = "SELECT DISTINCT ab2.lettering_code";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping As ab"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url AS bu ON bu.fk_bank = ab.fk_doc"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab2 ON ab2.subledger_account = ab.subledger_account";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url AS bu2 ON bu2.url_id = bu.url_id"; $sql .= " WHERE ab.rowid IN (" . $this->db->sanitize(implode(',', $ids)) . ")";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab2 ON ab2.fk_doc = bu2.fk_bank"; $sql .= " AND ab2.lettering_code != ''";
$sql .= " WHERE ab.rowid IN (" . $this->db->sanitize(implode(',', $ids)) . ")"; $sql .= " ORDER BY ab2.lettering_code DESC";
$sql .= " AND ab.doc_type = 'bank'"; $sql .= " LIMIT 1 ";
$sql .= " AND ab2.doc_type = 'bank'";
$sql .= " AND bu.type = 'company'";
$sql .= " AND bu2.type = 'company'";
$sql .= " AND ab.subledger_account != ''";
$sql .= " AND ab2.subledger_account != ''";
$sql .= " AND ab.lettering_code IS NULL";
$sql .= " AND ab2.lettering_code != ''";
$sql .= " ORDER BY ab2.lettering_code DESC";
$sql .= " LIMIT 1 ";
$resqla = $this->db->query($sql); $resqla = $this->db->query($sql);
if ($resqla) { if ($resqla) {
$obj = $this->db->fetch_object($resqla); $obj = $this->db->fetch_object($resqla);
$lettre = (empty($obj->lettering_code) ? 'AAA' : $obj->lettering_code); $lettre = (empty($obj->lettering_code) ? $lettre : $obj->lettering_code);
if (!empty($obj->lettering_code)) { if (!empty($obj->lettering_code)) {
$lettre++; $lettre++;
} }
@ -301,7 +333,7 @@ class Lettering extends BookKeeping
if (!$error) { if (!$error) {
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
$sql .= " lettering_code='".$this->db->escape($lettre)."'"; $sql .= " lettering_code='".$this->db->escape($lettre)."'";
$sql .= " , date_lettering = '".$this->db->idate($now)."'"; // todo correct date it's false $sql .= ", date_lettering = '".$this->db->idate($now)."'"; // todo correct date it's false
$sql .= " WHERE rowid IN (".$this->db->sanitize(implode(',', $ids)).") AND lettering_code IS NULL AND subledger_account != ''"; $sql .= " WHERE rowid IN (".$this->db->sanitize(implode(',', $ids)).") AND lettering_code IS NULL AND subledger_account != ''";
dol_syslog(get_class($this)."::update", LOG_DEBUG); dol_syslog(get_class($this)."::update", LOG_DEBUG);
@ -336,7 +368,7 @@ class Lettering extends BookKeeping
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
$sql .= " lettering_code = NULL"; $sql .= " lettering_code = NULL";
$sql .= " , date_lettering = NULL"; $sql .= ", date_lettering = NULL";
$sql .= " WHERE rowid IN (".$this->db->sanitize(implode(',', $ids)).")"; $sql .= " WHERE rowid IN (".$this->db->sanitize(implode(',', $ids)).")";
$sql .= " AND subledger_account != ''"; $sql .= " AND subledger_account != ''";
@ -374,16 +406,7 @@ class Lettering extends BookKeeping
$errors = array(); $errors = array();
$nb_lettering = 0; $nb_lettering = 0;
$result = $this->bookkeepingLettering($bookkeeping_ids, 'customer_invoice', $unlettering); $result = $this->bookkeepingLettering($bookkeeping_ids, $unlettering);
if ($result < 0) {
$error++;
$errors = array_merge($errors, $this->errors);
$nb_lettering += abs($result) - 2;
} else {
$nb_lettering += $result;
}
$result = $this->bookkeepingLettering($bookkeeping_ids, 'supplier_invoice', $unlettering);
if ($result < 0) { if ($result < 0) {
$error++; $error++;
$errors = array_merge($errors, $this->errors); $errors = array_merge($errors, $this->errors);
@ -404,11 +427,10 @@ class Lettering extends BookKeeping
* Lettering bookkeeping lines * Lettering bookkeeping lines
* *
* @param array $bookkeeping_ids Lettering specific list of bookkeeping id * @param array $bookkeeping_ids Lettering specific list of bookkeeping id
* @param string $type Type of bookkeeping type to lettering ('customer_invoice' or 'supplier_invoice')
* @param bool $unlettering Do unlettering * @param bool $unlettering Do unlettering
* @return int <0 if error (nb lettered = result -1), 0 if noting to lettering, >0 if OK (nb lettered) * @return int <0 if error (nb lettered = result -1), 0 if noting to lettering, >0 if OK (nb lettered)
*/ */
public function bookkeepingLettering($bookkeeping_ids, $type = 'customer_invoice', $unlettering = false) public function bookkeepingLettering($bookkeeping_ids, $unlettering = false)
{ {
global $langs; global $langs;
@ -416,11 +438,14 @@ class Lettering extends BookKeeping
// Clean parameters // Clean parameters
$bookkeeping_ids = is_array($bookkeeping_ids) ? $bookkeeping_ids : array(); $bookkeeping_ids = is_array($bookkeeping_ids) ? $bookkeeping_ids : array();
$type = trim($type);
$error = 0; $error = 0;
$nb_lettering = 0; $nb_lettering = 0;
$grouped_lines = $this->getLinkedLines($bookkeeping_ids, $type); $grouped_lines = $this->getLinkedLines($bookkeeping_ids);
if (!is_array($grouped_lines)) {
return -2;
}
foreach ($grouped_lines as $lines) { foreach ($grouped_lines as $lines) {
$group_error = 0; $group_error = 0;
$total = 0; $total = 0;
@ -478,52 +503,214 @@ class Lettering extends BookKeeping
/** /**
* Lettering bookkeeping lines * Lettering bookkeeping lines
* *
* @param array $bookkeeping_ids Lettering specific list of bookkeeping id * @param array $bookkeeping_ids Lettering specific list of bookkeeping id
* @param string $type Type of bookkeeping type to lettering ('customer_invoice' or 'supplier_invoice') * @param bool $only_has_subledger_account Get only lines who have subledger account
* @return array|int <0 if error otherwise all linked lines by block * @return array|int <0 if error otherwise all linked lines by block
*/ */
public function getLinkedLines($bookkeeping_ids, $type = 'customer_invoice') public function getLinkedLines($bookkeeping_ids, $only_has_subledger_account = true)
{ {
global $conf, $langs; global $conf, $langs;
$this->errors = array(); $this->errors = array();
// Clean parameters // Clean parameters
$bookkeeping_ids = is_array($bookkeeping_ids) ? $bookkeeping_ids : array(); $bookkeeping_ids = is_array($bookkeeping_ids) ? $bookkeeping_ids : array();
$type = trim($type);
if ($type == 'customer_invoice') { // Get all bookkeeping lines
$doc_type = 'customer_invoice'; $sql = "SELECT DISTINCT ab.doc_type, ab.fk_doc";
$bank_url_type = 'payment'; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab";
$payment_element = 'paiement_facture'; $sql .= " WHERE ab.entity IN (" . getEntity('accountancy') . ")";
$fk_payment_element = 'fk_paiement'; $sql .= " AND ab.fk_doc > 0";
$fk_element = 'fk_facture'; if (!empty($bookkeeping_ids)) {
$account_number = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; // Get all bookkeeping lines of piece number
} elseif ($type == 'supplier_invoice') { $sql .= " AND EXISTS (";
$doc_type = 'supplier_invoice'; $sql .= " SELECT rowid";
$bank_url_type = 'payment_supplier'; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS pn";
$payment_element = 'paiementfourn_facturefourn'; $sql .= " WHERE pn.entity IN (" . getEntity('accountancy') . ")";
$fk_payment_element = 'fk_paiementfourn'; $sql .= " AND pn.rowid IN (" . $this->db->sanitize(implode(',', $bookkeeping_ids)) . ")";
$fk_element = 'fk_facturefourn'; $sql .= " AND pn.piece_num = ab.piece_num";
$account_number = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; $sql .= " )";
} else { }
if ($only_has_subledger_account) $sql .= " AND ab.subledger_account != ''";
dol_syslog(__METHOD__ . " - Get all bookkeeping lines", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->errors[] = "Error " . $this->db->lasterror();
return -1;
}
$bookkeeping_lines_by_type = array();
while ($obj = $this->db->fetch_object($resql)) {
$bookkeeping_lines_by_type[$obj->doc_type][$obj->fk_doc] = $obj->fk_doc;
}
$this->db->free($resql);
if (empty($bookkeeping_lines_by_type)) {
return array();
}
if (!empty($bookkeeping_lines_by_type['bank'])) {
$new_bookkeeping_lines_by_type = $this->getDocTypeAndFkDocFromBankLines($bookkeeping_lines_by_type['bank']);
if (!is_array($new_bookkeeping_lines_by_type)) {
return -1;
}
foreach ($new_bookkeeping_lines_by_type as $doc_type => $fk_docs) {
foreach ($fk_docs as $fk_doc) {
$bookkeeping_lines_by_type[$doc_type][$fk_doc] = $fk_doc;
}
}
}
$grouped_lines = array();
foreach (self::$doc_type_infos as $doc_type => $doc_type_info) {
if (!is_array($bookkeeping_lines_by_type[$doc_type])) {
continue;
}
// Get all document ids grouped
$doc_grouped = $this->getLinkedDocumentByGroup($bookkeeping_lines_by_type[$doc_type], $doc_type);
if (!is_array($doc_grouped)) {
return -1;
}
// Group all lines by document/piece number
foreach ($doc_grouped as $doc_ids) {
$bank_ids = $this->getBankLinesFromFkDocAndDocType($doc_ids, $doc_type);
if (!is_array($bank_ids)) {
return -1;
}
// Get all bookkeeping lines linked
$sql = "SELECT DISTINCT ab.rowid, ab.piece_num, ab.debit, ab.credit, ab.lettering_code";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab";
$sql .= " WHERE ab.entity IN (" . getEntity('accountancy') . ")";
$sql .= " AND (";
if (!empty($bank_ids)) {
$sql .= " EXISTS (";
$sql .= " SELECT bpn.rowid";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS bpn";
$sql .= " WHERE bpn.entity IN (" . getEntity('accountancy') . ")";
$sql .= " AND bpn.doc_type = 'bank'";
$sql .= " AND bpn.fk_doc IN (" . $this->db->sanitize(implode(',', $bank_ids)) . ")";
$sql .= " AND bpn ON bpn.piece_num = ab.piece_num";
$sql .= " ) OR ";
}
$sql .= " EXISTS (";
$sql .= " SELECT dpn.rowid";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS dpn";
$sql .= " WHERE dpn.entity IN (" . getEntity('accountancy') . ")";
$sql .= " AND dpn.doc_type = '" . $this->db->escape($doc_type) . "'";
$sql .= " AND dpn.fk_doc IN (" . $this->db->sanitize(implode(',', $doc_ids)) . ")";
$sql .= " AND dpn.piece_num = ab.piece_num";
$sql .= " )";
$sql .= ")";
if ($only_has_subledger_account) $sql .= " AND ab.subledger_account != ''";
dol_syslog(__METHOD__ . " - Get all bookkeeping lines linked", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->errors[] = "Error " . $this->db->lasterror();
return -1;
}
$group = array();
while ($obj = $this->db->fetch_object($resql)) {
$group[$obj->rowid] = array(
'id' => $obj->rowid,
'piece_num' => $obj->piece_num,
'debit' => $obj->debit,
'credit' => $obj->credit,
'lettering_code' => $obj->lettering_code,
);
}
$this->db->free($resql);
if (!empty($group)) $grouped_lines[] = $group;
}
}
return $grouped_lines;
}
/**
* Get all fk_doc by doc_type from list of bank ids
*
* @param array $bank_ids List of bank ids
* @return array|int <0 if error otherwise all fk_doc by doc_type
*/
public function getDocTypeAndFkDocFromBankLines($bank_ids)
{
dol_syslog(__METHOD__ . " - bank_ids=".json_encode($bank_ids), LOG_DEBUG);
// Clean parameters
$bank_ids = is_array($bank_ids) ? $bank_ids : array();
if (empty($bank_ids)) {
return array();
}
$bookkeeping_lines_by_type = array();
foreach (self::$doc_type_infos as $doc_type => $doc_type_info) {
// Get all fk_doc by doc_type from bank ids
$sql = "SELECT DISTINCT dp." . $doc_type_info['doc_payment_table_fk_doc'] . " AS fk_doc";
$sql .= " FROM " . MAIN_DB_PREFIX . $doc_type_info['payment_table'] . " AS p";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $doc_type_info['doc_payment_table'] . " AS dp ON dp." . $doc_type_info['doc_payment_table_fk_payment'] . " = p.rowid";
$sql .= " WHERE p." . $doc_type_info['payment_table_fk_bank'] . " IN (" . $this->db->sanitize(implode(',', $bank_ids)) . ")";
$sql .= " AND dp." . $doc_type_info['doc_payment_table_fk_doc'] . " > 0";
dol_syslog(__METHOD__ . " - Get all fk_doc by doc_type from list of bank ids for '" . $doc_type . "'", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->errors[] = "Error " . $this->db->lasterror();
return -1;
}
while ($obj = $this->db->fetch_object($resql)) {
$bookkeeping_lines_by_type[$doc_type][$obj->fk_doc] = $obj->fk_doc;
}
$this->db->free($resql);
}
return $bookkeeping_lines_by_type;
}
/**
* Get all bank ids from list of document ids of a type
*
* @param array $document_ids List of document id
* @param string $doc_type Type of document ('customer_invoice' or 'supplier_invoice', ...)
* @return array|int <0 if error otherwise all all bank ids from list of document ids of a type
*/
public function getBankLinesFromFkDocAndDocType($document_ids, $doc_type)
{
global $langs;
dol_syslog(__METHOD__ . " - bank_ids=".json_encode($document_ids) . ", doc_type=$doc_type", LOG_DEBUG);
// Clean parameters
$document_ids = is_array($document_ids) ? $document_ids : array();
$doc_type = trim($doc_type);
if (empty($document_ids)) {
return array();
}
if (!is_array(self::$doc_type_infos[$doc_type])) {
$langs->load('errors'); $langs->load('errors');
$this->errors[] = $langs->trans('ErrorBadParameters'); $this->errors[] = $langs->trans('ErrorBadParameters');
return -1; return -1;
} }
$payment_ids = array(); $doc_type_info = self::$doc_type_infos[$doc_type];
$bank_ids = array();
// Get all payment id from bank lines // Get all fk_doc by doc_type from bank ids
$sql = "SELECT DISTINCT bu.url_id AS payment_id"; $sql = "SELECT DISTINCT p." . $doc_type_info['payment_table_fk_bank'] . " AS fk_doc";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab"; $sql .= " FROM " . MAIN_DB_PREFIX . $doc_type_info['payment_table'] . " AS p";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url AS bu ON bu.fk_bank = ab.fk_doc"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $doc_type_info['doc_payment_table'] . " AS dp ON dp." . $doc_type_info['doc_payment_table_fk_payment'] . " = p.rowid";
$sql .= " WHERE ab.doc_type = 'bank'"; $sql .= " WHERE dp." . $doc_type_info['doc_payment_table_fk_doc'] . " IN (" . $this->db->sanitize(implode(',', $document_ids)) . ")";
// $sql .= " AND ab.subledger_account != ''"; $sql .= " AND p." . $doc_type_info['payment_table_fk_bank'] . " > 0";
// $sql .= " AND ab.numero_compte = '" . $this->db->escape($account_number) . "'";
$sql .= " AND bu.type = '" . $this->db->escape($bank_url_type) . "'";
if (!empty($bookkeeping_ids)) $sql .= " AND ab.rowid IN (" . $this->db->sanitize(implode(',', $bookkeeping_ids)) . ")";
dol_syslog(__METHOD__ . " - Get all payment id from bank lines", LOG_DEBUG); dol_syslog(__METHOD__ . " - Get all bank ids from list of document ids of a type '" . $doc_type . "'", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) { if (!$resql) {
$this->errors[] = "Error " . $this->db->lasterror(); $this->errors[] = "Error " . $this->db->lasterror();
@ -531,218 +718,137 @@ class Lettering extends BookKeeping
} }
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {
$payment_ids[$obj->payment_id] = $obj->payment_id; $bank_ids[$obj->fk_doc] = $obj->fk_doc;
} }
$this->db->free($resql); $this->db->free($resql);
// Get all payment id from payment lines return $bank_ids;
$sql = "SELECT DISTINCT pe.$fk_payment_element AS payment_id";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "$payment_element AS pe ON pe.$fk_element = ab.fk_doc";
$sql .= " WHERE ab.doc_type = '" . $this->db->escape($doc_type) . "'";
// $sql .= " AND ab.subledger_account != ''";
// $sql .= " AND ab.numero_compte = '" . $this->db->escape($account_number) . "'";
$sql .= " AND pe.$fk_payment_element IS NOT NULL";
if (!empty($bookkeeping_ids)) $sql .= " AND ab.rowid IN (" . $this->db->sanitize(implode(',', $bookkeeping_ids)) . ")";
dol_syslog(__METHOD__ . " - Get all payment id from bank lines", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->errors[] = "Error " . $this->db->lasterror();
return -1;
}
while ($obj = $this->db->fetch_object($resql)) {
$payment_ids[$obj->payment_id] = $obj->payment_id;
}
$this->db->free($resql);
if (empty($payment_ids)) {
return array();
}
// Get all payments linked by group
$payment_by_group = $this->getLinkedPaymentByGroup($payment_ids, $type);
$groups = array();
foreach ($payment_by_group as $payment_list) {
$lines = array();
// Get bank lines
$sql = "SELECT DISTINCT ab.rowid, ab.piece_num, ab.lettering_code, ab.debit, ab.credit";
$sql .= " FROM " . MAIN_DB_PREFIX . "bank_url AS bu";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab ON ab.fk_doc = bu.fk_bank";
$sql .= " WHERE bu.url_id IN (" . $this->db->sanitize(implode(',', $payment_list)) . ")";
$sql .= " AND bu.type = '" . $this->db->escape($bank_url_type) . "'";
$sql .= " AND ab.doc_type = 'bank'";
$sql .= " AND ab.subledger_account != ''";
$sql .= " AND ab.numero_compte = '" . $this->db->escape($account_number) . "'";
dol_syslog(__METHOD__ . " - Get bank lines", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->errors[] = "Error " . $this->db->lasterror();
return -1;
}
while ($obj = $this->db->fetch_object($resql)) {
$lines[$obj->rowid] = array('id' => $obj->rowid, 'piece_num' => $obj->piece_num, 'lettering_code' => $obj->lettering_code, 'debit' => $obj->debit, 'credit' => $obj->credit);
}
$this->db->free($resql);
// Get payment lines
$sql = "SELECT DISTINCT ab.rowid, ab.piece_num, ab.lettering_code, ab.debit, ab.credit";
$sql .= " FROM " . MAIN_DB_PREFIX . "$payment_element AS pe";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab ON ab.fk_doc = pe.$fk_element";
$sql .= " WHERE pe.$fk_payment_element IN (" . $this->db->sanitize(implode(',', $payment_list)) . ")";
$sql .= " AND ab.doc_type = '" . $this->db->escape($doc_type) . "'";
$sql .= " AND ab.subledger_account != ''";
$sql .= " AND ab.numero_compte = '" . $this->db->escape($account_number) . "'";
dol_syslog(__METHOD__ . " - Get payment lines", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->errors[] = "Error " . $this->db->lasterror();
return -1;
}
while ($obj = $this->db->fetch_object($resql)) {
$lines[$obj->rowid] = array('id' => $obj->rowid, 'piece_num' => $obj->piece_num, 'lettering_code' => $obj->lettering_code, 'debit' => $obj->debit, 'credit' => $obj->credit);
}
$this->db->free($resql);
if (!empty($lines)) {
$groups[] = $lines;
}
}
return $groups;
} }
/** /**
* Linked payment by group * Get all linked document ids by group and type
* *
* @param array $payment_ids list of payment id * @param array $document_ids List of document id
* @param string $type Type of bookkeeping type to lettering ('customer_invoice' or 'supplier_invoice') * @param string $doc_type Type of document ('customer_invoice' or 'supplier_invoice', ...)
* @return array|int <0 if error otherwise all linked lines by block * @return array|int <0 if error otherwise all linked document ids by group and type [ [ 'doc_type' => [ doc_id, ... ], ... ], ... ]
*/ */
public function getLinkedPaymentByGroup($payment_ids, $type) public function getLinkedDocumentByGroup($document_ids, $doc_type)
{ {
global $langs; global $langs;
// Clean parameters // Clean parameters
$payment_ids = is_array($payment_ids) ? $payment_ids : array(); $document_ids = is_array($document_ids) ? $document_ids : array();
$type = trim($type); $doc_type = trim($doc_type);
if (empty($payment_ids)) { if (empty($document_ids)) {
return array(); return array();
} }
if (!is_array(self::$doc_type_infos[$doc_type])) {
if ($type == 'customer_invoice') {
$payment_element = 'paiement_facture';
$fk_payment_element = 'fk_paiement';
$fk_element = 'fk_facture';
} elseif ($type == 'supplier_invoice') {
$payment_element = 'paiementfourn_facturefourn';
$fk_payment_element = 'fk_paiementfourn';
$fk_element = 'fk_facturefourn';
} else {
$langs->load('errors'); $langs->load('errors');
$this->errors[] = $langs->trans('ErrorBadParameters'); $this->errors[] = $langs->trans('ErrorBadParameters');
return -1; return -1;
} }
// Get payment lines $doc_type_info = self::$doc_type_infos[$doc_type];
$sql = "SELECT DISTINCT pe2.$fk_payment_element, pe2.$fk_element";
$sql .= " FROM " . MAIN_DB_PREFIX . "$payment_element AS pe";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "$payment_element AS pe2 ON pe2.$fk_element = pe.$fk_element";
$sql .= " WHERE pe.$fk_payment_element IN (" . $this->db->sanitize(implode(',', $payment_ids)) . ")";
dol_syslog(__METHOD__ . " - Get payment lines", LOG_DEBUG); // Get document lines
$resql = $this->db->query($sql); $current_document_ids = array();
if (!$resql) { $link_by_element = array();
$this->errors[] = "Error " . $this->db->lasterror(); $element_by_link = array();
return -1; foreach ($doc_type_info['linked_info'] as $linked_info) {
$sql = "SELECT DISTINCT tl2." . $linked_info['fk_link'] . " AS fk_link, tl2." . $linked_info['fk_doc'] . " AS fk_doc";
$sql .= " FROM " . MAIN_DB_PREFIX . $linked_info['table'] . " AS tl";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $linked_info['table'] . " AS tl2 ON tl2." . $linked_info['fk_link'] . " = tl." . $linked_info['fk_link'];
$sql .= " WHERE tl." . $linked_info['fk_doc'] . " IN (" . $this->db->sanitize(implode(',', $document_ids)) . ")";
dol_syslog(__METHOD__ . " - Get document lines", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->errors[] = "Error " . $this->db->lasterror();
return -1;
}
$is_fk_link_is_also_fk_doc = !empty($linked_info['is_fk_link_is_also_fk_doc']);
while ($obj = $this->db->fetch_object($resql)) {
$current_document_ids[$obj->fk_doc] = $obj->fk_doc;
$link_key = $linked_info['prefix'] . $obj->fk_link;
$element_by_link[$link_key][$obj->fk_doc] = $obj->fk_doc;
$link_by_element[$obj->fk_doc][$link_key] = $link_key;
if ($is_fk_link_is_also_fk_doc) {
$element_by_link[$link_key][$obj->fk_link] = $obj->fk_link;
$link_by_element[$obj->fk_link][$link_key] = $link_key;
}
}
$this->db->free($resql);
} }
$current_payment_ids = array(); if (count(array_diff($document_ids, $current_document_ids))) {
$payment_by_element = array(); return $this->getLinkedDocumentByGroup($current_document_ids, $doc_type);
$element_by_payment = array();
while ($obj = $this->db->fetch_object($resql)) {
$current_payment_ids[$obj->$fk_payment_element] = $obj->$fk_payment_element;
$element_by_payment[$obj->$fk_payment_element][$obj->$fk_element] = $obj->$fk_element;
$payment_by_element[$obj->$fk_element][$obj->$fk_payment_element] = $obj->$fk_payment_element;
}
$this->db->free($resql);
if (count(array_diff($payment_ids, $current_payment_ids))) {
return $this->getLinkedPaymentByGroup($current_payment_ids, $type);
} }
return $this->getGroupElements($payment_by_element, $element_by_payment); return $this->getGroupElements($link_by_element, $element_by_link);
} }
/** /**
* Get payment ids grouped by payment id and element id in common * Get element ids grouped by link or element in common
* *
* @param array $payment_by_element List of payment ids by element id * @param array $link_by_element List of payment ids by link key
* @param array $element_by_payment List of element ids by payment id * @param array $element_by_link List of element ids by link key
* @param int $element_id Element Id (used for recursive function) * @param string $link_key Link key (used for recursive function)
* @param array $current_group Current group (used for recursive function) * @param array $current_group Current group (used for recursive function)
* @return array List of payment ids grouped by payment id and element id in common * @return array List of element ids grouped by link or element in common
*/ */
public function getGroupElements(&$payment_by_element, &$element_by_payment, $element_id = 0, &$current_group = array()) public function getGroupElements(&$link_by_element, &$element_by_link, $link_key = '', &$current_group = array())
{ {
$grouped_payments = array(); $grouped_elements = array();
if ($element_id > 0 && !isset($payment_by_element[$element_id])) { if (!empty($link_key) && !isset($element_by_link[$link_key])) {
// Return if specific element id not found // Return if specific link key not found
return $grouped_payments; return $grouped_elements;
} }
$save_payment_by_element = null; if (empty($link_key)) {
$save_element_by_payment = null;
if ($element_id == 0) {
// Save list when is the begin of recursive function // Save list when is the begin of recursive function
$save_payment_by_element = $payment_by_element; $save_link_by_element = $link_by_element;
$save_element_by_payment = $element_by_payment; $save_element_by_link = $element_by_link;
} }
do { do {
// Get current element id, get this payment id list and delete the entry // Get current element id, get this payment id list and delete the entry
$current_element_id = $element_id > 0 ? $element_id : array_keys($payment_by_element)[0]; $current_link_key = !empty($link_key) ? $link_key : array_keys($element_by_link)[0];
$payment_ids = $payment_by_element[$current_element_id]; $element_ids = $element_by_link[$current_link_key];
unset($payment_by_element[$current_element_id]); unset($element_by_link[$current_link_key]);
foreach ($payment_ids as $payment_id) { foreach ($element_ids as $element_id) {
// Continue if payment id in not found // Continue if element id in not found
if (!isset($element_by_payment[$payment_id])) continue; if (!isset($link_by_element[$element_id])) continue;
// Set the payment in the current group // Set the element in the current group
$current_group[$payment_id] = $payment_id; $current_group[$element_id] = $element_id;
// Get current element ids, get this payment id list and delete the entry // Get current link keys, get this element id list and delete the entry
$element_ids = $element_by_payment[$payment_id]; $link_keys = $link_by_element[$element_id];
unset($element_by_payment[$payment_id]); unset($link_by_element[$element_id]);
// Set payment id on the current group for each element id of the payment // Set element id on the current group for each link key of the element
foreach ($element_ids as $id) { foreach ($link_keys as $key) {
$this->getGroupElements($payment_by_element, $element_by_payment, $id, $current_group); $this->getGroupElements($link_by_element, $element_by_link, $key, $current_group);
} }
} }
if ($element_id == 0) { if (empty($link_key)) {
// Save current group and reset the current group when is the begin of recursive function // Save current group and reset the current group when is the begin of recursive function
$grouped_payments[] = $current_group; $grouped_elements[] = $current_group;
$current_group = array(); $current_group = array();
} }
} while (!empty($payment_by_element) && $element_id == 0); } while (!empty($element_by_link) && empty($link_key));
if ($element_id == 0) { if (empty($link_key)) {
// Restore list when is the begin of recursive function // Restore list when is the begin of recursive function
$payment_by_element = $save_payment_by_element; $link_by_element = $save_link_by_element;
$element_by_payment = $save_element_by_payment; $element_by_link = $save_element_by_link;
} }
return $grouped_payments; return $grouped_elements;
} }
} }

View File

@ -21,6 +21,7 @@
* \brief Home closure page * \brief Home closure page
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -57,13 +58,13 @@ $search_date_end = dol_get_last_day($year_end, $month_end);
$year_current = $year_start; $year_current = $year_start;
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->fiscalyear->write)) { if (!$user->hasRight('accounting', 'fiscalyear', 'write')) {
accessforbidden(); accessforbidden();
} }
@ -75,7 +76,7 @@ if (empty($user->rights->accounting->fiscalyear->write)) {
$now = dol_now(); $now = dol_now();
if ($action == 'validate_movements_confirm' && !empty($user->rights->accounting->fiscalyear->write)) { if ($action == 'validate_movements_confirm' && $user->hasRight('accounting', 'fiscalyear', 'write')) {
$date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); $date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
$date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); $date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
@ -112,6 +113,7 @@ if ($action == 'validate_movements_confirm' && !empty($user->rights->accounting-
} }
} }
/* /*
* View * View
*/ */
@ -178,20 +180,40 @@ for ($i = 1; $i <= 12; $i++) {
} }
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>'; print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
$sql = "SELECT COUNT(b.rowid) as detail,"; if (getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) {
for ($i = 1; $i <= 12; $i++) { // TODO Analyse is done by finding record not into a closed period
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; $sql = "SELECT COUNT(b.rowid) as detail,";
if ($j > 12) { for ($i = 1; $i <= 12; $i++) {
$j -= 12; $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) {
$j -= 12;
}
$sql .= " SUM(".$db->ifsql("MONTH(b.doc_date)=".$j, "1", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
} }
$sql .= " SUM(".$db->ifsql("MONTH(b.doc_date)=".$j, "1", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).","; $sql .= " COUNT(b.rowid) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
$sql .= " WHERE b.doc_date >= '".$db->idate($search_date_start)."'";
$sql .= " AND b.doc_date <= '".$db->idate($search_date_end)."'";
$sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy
// Loop on each closed period
$sql .= " AND b.doc_date BETWEEN 0 AND 0";
} else {
// Analyse closed record using the unitary flag/date on each record
$sql = "SELECT COUNT(b.rowid) as detail,";
for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) {
$j -= 12;
}
$sql .= " SUM(".$db->ifsql("MONTH(b.doc_date)=".$j, "1", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
}
$sql .= " COUNT(b.rowid) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
$sql .= " WHERE b.doc_date >= '".$db->idate($search_date_start)."'";
$sql .= " AND b.doc_date <= '".$db->idate($search_date_end)."'";
$sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy
$sql .= " AND date_validated IS NULL";
} }
$sql .= " COUNT(b.rowid) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
$sql .= " WHERE b.doc_date >= '".$db->idate($search_date_start)."'";
$sql .= " AND b.doc_date <= '".$db->idate($search_date_end)."'";
$sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy
$sql .= " AND date_validated IS NULL";
dol_syslog('htdocs/accountancy/closure/index.php', LOG_DEBUG); dol_syslog('htdocs/accountancy/closure/index.php', LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);

View File

@ -38,13 +38,13 @@ $codeventil = GETPOST('codeventil', 'int');
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }
@ -54,7 +54,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
* Actions * Actions
*/ */
if ($action == 'ventil' && $user->rights->accounting->bind->write) { if ($action == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) {
if (!$cancel) { if (!$cancel) {
if ($codeventil < 0) { if ($codeventil < 0) {
$codeventil = 0; $codeventil = 0;

View File

@ -26,6 +26,7 @@
* \brief Home customer journalization page * \brief Home customer journalization page
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -40,13 +41,13 @@ $validatemonth = GETPOST('validatemonth', 'int');
$validateyear = GETPOST('validateyear', 'int'); $validateyear = GETPOST('validateyear', 'int');
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->bind->write)) { if (!$user->hasRight('accounting', 'bind', 'write')) {
accessforbidden(); accessforbidden();
} }
@ -77,13 +78,13 @@ $action = GETPOST('action', 'aZ09');
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version'); $chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }
@ -92,7 +93,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
* Actions * Actions
*/ */
if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accounting->bind->write) { if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('accounting', 'bind', 'write')) {
// Clean database by removing binding done on non existing or no more existing accounts // Clean database by removing binding done on non existing or no more existing accounts
$db->begin(); $db->begin();
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as fd"; $sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as fd";
@ -622,7 +623,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
print '</div>'; print '</div>';
if (!empty($conf->margin->enabled)) { if (isModEnabled('margin')) {
print "<br>\n"; print "<br>\n";
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';

View File

@ -85,13 +85,13 @@ if (!$sortorder) {
} }
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }
@ -126,7 +126,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_tvaintra = ''; $search_tvaintra = '';
} }
if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->accounting->bind->write) { if (is_array($changeaccount) && count($changeaccount) > 0 && $user->hasRight('accounting', 'bind', 'write')) {
$error = 0; $error = 0;
if (!(GETPOST('account_parent', 'int') >= 0)) { if (!(GETPOST('account_parent', 'int') >= 0)) {

View File

@ -104,13 +104,13 @@ $accountingAccount = new AccountingAccount($db);
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version'); $chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }

View File

@ -42,7 +42,7 @@ $codeventil = GETPOST('codeventil', 'int');
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {

View File

@ -24,6 +24,7 @@
* \brief Home expense report ventilation * \brief Home expense report ventilation
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -58,7 +59,7 @@ $year_current = $year_start;
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {

View File

@ -79,7 +79,7 @@ if (!$sortorder) {
} }
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {
@ -417,7 +417,7 @@ if ($result) {
print '<td class="center">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>'; print '<td class="center">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>';
// Accounting account affected // Accounting account affected
print '<td class="center">'; print '<td>';
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1); print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
print ' <a class="editfielda reposition marginleftonly marginrightonly" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">'; print ' <a class="editfielda reposition marginleftonly marginrightonly" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
print img_edit(); print img_edit();

View File

@ -97,7 +97,7 @@ $accounting = new AccountingAccount($db);
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version'); $chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {

View File

@ -23,6 +23,8 @@
* \brief Home accounting module * \brief Home accounting module
*/ */
// Load Dolibarr environment
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -39,17 +41,17 @@ if ($user->socid > 0) {
accessforbidden(); accessforbidden();
} }
/* /*
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->accounting->mouvements->lire)) { if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden(); accessforbidden();
} }
*/ */
if (empty($conf->comptabilite->enabled) && empty($conf->accounting->enabled) && empty($conf->asset->enabled) && empty($conf->intracommreport->enabled)) { if (!isModEnabled('comptabilite') && !isModEnabled('accounting') && !isModEnabled('asset') && !isModEnabled('intracommreport')) {
accessforbidden(); accessforbidden();
} }
if (empty($user->rights->compta->resultat->lire) && empty($user->rights->accounting->comptarapport->lire) && empty($user->rights->accounting->mouvements->lire) && empty($user->rights->asset->read) && empty($user->rights->intracommreport->read)) { if (!$user->hasRight('compta', 'resultat', 'lire') && !$user->hasRight('accounting', 'comptarapport', 'lire') && !$user->hasRight('accounting', 'mouvements', 'lire') && !$user->hasRight('asset', 'read') && !$user->hasRight('intracommreport', 'read')) {
accessforbidden(); accessforbidden();
} }
@ -77,7 +79,7 @@ if (GETPOST('addbox')) {
* View * View
*/ */
$help_url = ''; $help_url = 'EN:Module_Double_Entry_Accounting#Setup';
llxHeader('', $langs->trans("AccountancyArea"), $help_url); llxHeader('', $langs->trans("AccountancyArea"), $help_url);
@ -86,7 +88,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
print '<span class="opacitymedium">'.$langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices")."</span>\n"; print '<span class="opacitymedium">'.$langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices")."</span>\n";
print "<br>"; print "<br>";
} elseif (!empty($conf->accounting->enabled)) { } elseif (isModEnabled('accounting')) {
$step = 0; $step = 0;
$resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb) $resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
@ -117,7 +119,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
print "<br>\n"; print "<br>\n";
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n"; print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
if (!empty($user->rights->accounting->chartofaccount)) { if ($user->hasRight('accounting', 'chartofaccount')) {
print "<br>\n"; print "<br>\n"; print "<br>\n"; print "<br>\n";
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n"; print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
@ -165,7 +167,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
print $s; print $s;
print "<br>\n"; print "<br>\n";
if (!empty($conf->tax->enabled)) { if (isModEnabled('tax')) {
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>'; $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
$step++; $step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}'); $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
@ -173,7 +175,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
print $s; print $s;
print "<br>\n"; print "<br>\n";
} }
if (!empty($conf->expensereport->enabled)) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several. if (isModEnabled('expensereport')) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
$step++; $step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}'); $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>', $s); $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>', $s);
@ -212,7 +214,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
print $s; print $s;
print "<br>\n"; print "<br>\n";
if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled)) { if (isModEnabled('expensereport') || isModEnabled('deplacement')) {
$step++; $step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '{s}')."\n"; $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '{s}')."\n";
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong></a>', $s); $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong></a>', $s);

View File

@ -83,7 +83,7 @@ $now = dol_now();
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {

View File

@ -58,7 +58,7 @@ if ($in_bookkeeping == '') {
$now = dol_now(); $now = dol_now();
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {
@ -328,7 +328,7 @@ if ($action == 'writebookkeeping') {
foreach ($arrayofvat[$key] as $k => $mt) { foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) { if ($mt) {
$accountingaccount->fetch($k, null, true); // TODO Use a cache for label $accountingaccount->fetch(null, $k, true); // TODO Use a cache for label
$account_label = $accountingaccount->label; $account_label = $accountingaccount->label;
// get compte id and label // get compte id and label

View File

@ -61,7 +61,7 @@ $hookmanager->initHooks(array('purchasesjournal'));
$parameters = array(); $parameters = array();
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {
@ -133,7 +133,7 @@ if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " WHERE f.fk_statut > 0"; $sql .= " WHERE f.fk_statut > 0";
$sql .= " AND fd.fk_code_ventilation > 0"; $sql .= " AND fd.fk_code_ventilation > 0";
$sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy $sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_SITUATION.")"; $sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_SITUATION.")";
} else { } else {
$sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_DEPOSIT.",".FactureFournisseur::TYPE_SITUATION.")"; $sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_DEPOSIT.",".FactureFournisseur::TYPE_SITUATION.")";
@ -294,9 +294,7 @@ if ($action == 'writebookkeeping') {
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name']; $companystatic->name = $tabcompany[$key]['name'];
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur']; $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
$companystatic->code_client = $tabcompany[$key]['code_client'];
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
$companystatic->fournisseur = 1; $companystatic->fournisseur = 1;
@ -381,7 +379,7 @@ if ($action == 'writebookkeeping') {
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) { if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
$lettering_static = new Lettering($db); $lettering_static = new Lettering($db);
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id), 'supplier_invoice'); $nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
} }
} }
} }
@ -405,8 +403,18 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur; $bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->subledger_account = ''; if (!empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT)) {
$bookkeeping->subledger_label = ''; if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT')) {
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
} else {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
}
} else {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
}
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $label_account; $bookkeeping->label_compte = $label_account;
@ -457,7 +465,7 @@ if ($action == 'writebookkeeping') {
foreach ($arrayofvat[$key] as $k => $mt) { foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) { if ($mt) {
$accountingaccount->fetch($k, null, true); // TODO Use a cache for label $accountingaccount->fetch(null, $k, true); // TODO Use a cache for label
$label_account = $accountingaccount->label; $label_account = $accountingaccount->label;
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
@ -626,9 +634,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
foreach ($tabfac as $key => $val) { foreach ($tabfac as $key => $val) {
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name']; $companystatic->name = $tabcompany[$key]['name'];
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur']; $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
$companystatic->code_client = $tabcompany[$key]['code_client'];
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
$companystatic->fournisseur = 1; $companystatic->fournisseur = 1;
@ -757,8 +763,8 @@ if (empty($action) || $action == 'view') {
$periodlink = ''; $periodlink = '';
$exportlink = ''; $exportlink = '';
$builddate = dol_now(); $builddate = dol_now();
$description .= $langs->trans("DescJournalOnlyBindedVisible").'<br>'; $description = $langs->trans("DescJournalOnlyBindedVisible").'<br>';
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= $langs->trans("DepositsAreNotIncluded"); $description .= $langs->trans("DepositsAreNotIncluded");
} else { } else {
$description .= $langs->trans("DepositsAreIncluded"); $description .= $langs->trans("DepositsAreIncluded");
@ -837,9 +843,7 @@ if (empty($action) || $action == 'view') {
foreach ($tabfac as $key => $val) { foreach ($tabfac as $key => $val) {
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name']; $companystatic->name = $tabcompany[$key]['name'];
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur']; $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
$companystatic->code_client = $tabcompany[$key]['code_client'];
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
$companystatic->fournisseur = 1; $companystatic->fournisseur = 1;
@ -952,6 +956,13 @@ if (empty($action) || $action == 'view') {
print "</td>"; print "</td>";
// Subledger account // Subledger account
print "<td>"; print "<td>";
if (!empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT)) {
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT')) {
print length_accounta($tabcompany[$key]['code_compta']);
}
} elseif (($accountoshow == "") || $accountoshow == 'NotDefined') {
print '<span class="error">' . $langs->trans("ThirdpartyAccountNotDefined") . '</span>';
}
print '</td>'; print '</td>';
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name']; $companystatic->name = $tabcompany[$key]['name'];

View File

@ -30,6 +30,7 @@
* \brief Page with sells journal * \brief Page with sells journal
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@ -63,7 +64,7 @@ $hookmanager->initHooks(array('sellsjournal'));
$parameters = array(); $parameters = array();
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {
@ -310,9 +311,7 @@ if ($action == 'writebookkeeping') {
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name']; $companystatic->name = $tabcompany[$key]['name'];
$companystatic->code_compta = $tabcompany[$key]['code_compta']; $companystatic->code_compta = $tabcompany[$key]['code_compta'];
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
$companystatic->code_client = $tabcompany[$key]['code_client']; $companystatic->code_client = $tabcompany[$key]['code_client'];
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
$companystatic->client = 3; $companystatic->client = 3;
$invoicestatic->id = $key; $invoicestatic->id = $key;
@ -394,7 +393,7 @@ if ($action == 'writebookkeeping') {
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) { if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
$lettering_static = new Lettering($db); $lettering_static = new Lettering($db);
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id), 'customer_invoice'); $nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
} }
} }
} }
@ -479,7 +478,7 @@ if ($action == 'writebookkeeping') {
foreach ($arrayofvat[$key] as $k => $mt) { foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) { if ($mt) {
$accountingaccount->fetch($k, null, true); // TODO Use a cache for label $accountingaccount->fetch(null, $k, true); // TODO Use a cache for label
$label_account = $accountingaccount->label; $label_account = $accountingaccount->label;
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
@ -600,9 +599,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name']; $companystatic->name = $tabcompany[$key]['name'];
$companystatic->code_compta = $tabcompany[$key]['code_compta']; $companystatic->code_compta = $tabcompany[$key]['code_compta'];
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
$companystatic->code_client = $tabcompany[$key]['code_client']; $companystatic->code_client = $tabcompany[$key]['code_client'];
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
$companystatic->client = 3; $companystatic->client = 3;
$invoicestatic->id = $key; $invoicestatic->id = $key;
@ -790,9 +787,7 @@ if (empty($action) || $action == 'view') {
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name']; $companystatic->name = $tabcompany[$key]['name'];
$companystatic->code_compta = $tabcompany[$key]['code_compta']; $companystatic->code_compta = $tabcompany[$key]['code_compta'];
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
$companystatic->code_client = $tabcompany[$key]['code_client']; $companystatic->code_client = $tabcompany[$key]['code_client'];
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
$companystatic->client = 3; $companystatic->client = 3;
$invoicestatic->id = $key; $invoicestatic->id = $key;

View File

@ -21,6 +21,7 @@
* \brief Page of a journal * \brief Page of a journal
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -51,7 +52,7 @@ if ($result > 0) {
} elseif ($result < 0) { } elseif ($result < 0) {
dol_print_error('', $object->error, $object->errors); dol_print_error('', $object->error, $object->errors);
} elseif ($result == 0) { } elseif ($result == 0) {
accessforbidden($langs->trans('ErrorRecordNotFound')); accessforbidden('ErrorRecordNotFound');
} }
$hookmanager->initHooks(array('globaljournal', $object->nature.'journal')); $hookmanager->initHooks(array('globaljournal', $object->nature.'journal'));
@ -83,7 +84,7 @@ if (!is_array($journal_data)) {
} }
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {
@ -201,6 +202,9 @@ if ($object->nature == 2 || $object->nature == 3) {
} else { } else {
$description .= $langs->trans("DepositsAreIncluded"); $description .= $langs->trans("DepositsAreIncluded");
} }
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= $langs->trans("SupplierDepositsAreNotIncluded");
}
} }
$listofchoices = array('notyet' => $langs->trans("NotYetInGeneralLedger"), 'already' => $langs->trans("AlreadyInGeneralLedger")); $listofchoices = array('notyet' => $langs->trans("NotYetInGeneralLedger"), 'already' => $langs->trans("AlreadyInGeneralLedger"));
@ -236,7 +240,7 @@ if ($some_mandatory_steps_of_setup_were_not_done) {
print ' : ' . $langs->trans("AccountancyAreaDescMisc", 4, '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . "-" . $langs->transnoentitiesnoconv("MenuDefaultAccounts") . '</strong>'); print ' : ' . $langs->trans("AccountancyAreaDescMisc", 4, '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . "-" . $langs->transnoentitiesnoconv("MenuDefaultAccounts") . '</strong>');
print '</div>'; print '</div>';
} }
print '<div class="tabsAction tabsActionNoBottom">'; print '<div class="tabsAction tabsActionNoBottom centerimp">';
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') { if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') {
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />'; print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
} }
@ -289,19 +293,21 @@ print '<td class="right">' . $langs->trans("Debit") . '</td>';
print '<td class="right">' . $langs->trans("Credit") . '</td>'; print '<td class="right">' . $langs->trans("Credit") . '</td>';
print "</tr>\n"; print "</tr>\n";
foreach ($journal_data as $element_id => $element) { if (is_array($journal_data) && !empty($journal_data)) {
foreach ($element['blocks'] as $lines) { foreach ($journal_data as $element_id => $element) {
foreach ($lines as $line) { foreach ($element['blocks'] as $lines) {
print '<tr class="oddeven">'; foreach ($lines as $line) {
print '<td>' . $line['date'] . '</td>'; print '<tr class="oddeven">';
print '<td>' . $line['piece'] . '</td>'; print '<td>' . $line['date'] . '</td>';
print '<td>' . $line['account_accounting'] . '</td>'; print '<td>' . $line['piece'] . '</td>';
print '<td>' . $line['subledger_account'] . '</td>'; print '<td>' . $line['account_accounting'] . '</td>';
print '<td>' . $line['label_operation'] . '</td>'; print '<td>' . $line['subledger_account'] . '</td>';
if ($object->nature == 4) print '<td class="center">' . $line['payment_mode'] . '</td>'; print '<td>' . $line['label_operation'] . '</td>';
print '<td class="right nowraponall">' . $line['debit'] . '</td>'; if ($object->nature == 4) print '<td class="center">' . $line['payment_mode'] . '</td>';
print '<td class="right nowraponall">' . $line['credit'] . '</td>'; print '<td class="right nowraponall">' . $line['debit'] . '</td>';
print '</tr>'; print '<td class="right nowraponall">' . $line['credit'] . '</td>';
print '</tr>';
}
} }
} }
} }

View File

@ -42,7 +42,7 @@ $codeventil = GETPOST('codeventil', 'int');
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {

View File

@ -24,6 +24,7 @@
* \brief Home supplier journalization page * \brief Home supplier journalization page
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';

View File

@ -89,7 +89,7 @@ if (!$sortorder) {
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {

View File

@ -106,7 +106,7 @@ $accountingAccount = new AccountingAccount($db);
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version'); $chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (!isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {
@ -342,7 +342,7 @@ if (strlen(trim($search_country))) {
if (strlen(trim($search_tvaintra))) { if (strlen(trim($search_tvaintra))) {
$sql .= natural_search("s.tva_intra", $search_tvaintra); $sql .= natural_search("s.tva_intra", $search_tvaintra);
} }
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_SITUATION.")"; $sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_SITUATION.")";
} else { } else {
$sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_DEPOSIT.",".FactureFournisseur::TYPE_SITUATION.")"; $sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_DEPOSIT.",".FactureFournisseur::TYPE_SITUATION.")";

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2015-2018 Alexandre Spangaro <aspangaro@open-dsi.fr> /* Copyright (C) 2015-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com> * Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
// $formatexportset ùust be defined // $formatexportset must be defined
// Protection to avoid direct call of template // Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) { if (empty($conf) || !is_object($conf)) {
@ -24,11 +24,11 @@ if (empty($conf) || !is_object($conf)) {
exit; exit;
} }
$code = $conf->global->MAIN_INFO_ACCOUNTANT_CODE; $code = getDolGlobalString('MAIN_INFO_ACCOUNTANT_CODE');
$prefix = $conf->global->ACCOUNTING_EXPORT_PREFIX_SPEC; $prefix = getDolGlobalString('ACCOUNTING_EXPORT_PREFIX_SPEC');
$format = $conf->global->ACCOUNTING_EXPORT_FORMAT; $format = getDolGlobalString('ACCOUNTING_EXPORT_FORMAT');
$nodateexport = $conf->global->ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME; $nodateexport = getDolGlobalInt('ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME');
$siren = $conf->global->MAIN_INFO_SIREN; $siren = getDolGlobalString('MAIN_INFO_SIREN');
$date_export = "_".dol_print_date(dol_now(), '%Y%m%d%H%M%S'); $date_export = "_".dol_print_date(dol_now(), '%Y%m%d%H%M%S');
$endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d'); $endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d');

View File

@ -30,6 +30,7 @@
* \brief Page to setup the module Foundation * \brief Page to setup the module Foundation
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
@ -111,7 +112,7 @@ if ($action == 'set_default') {
if (isModEnabled('facture')) { if (isModEnabled('facture')) {
$res4 = dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); $res4 = dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
$res5 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); $res5 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { if (isModEnabled("product") || isModEnabled("service")) {
$res6 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); $res6 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
} }
} }
@ -238,13 +239,13 @@ print "</td></tr>\n";
// Insert subscription into bank account // Insert subscription into bank account
print '<tr class="oddeven"><td>'.$langs->trans("MoreActionsOnSubscription").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MoreActionsOnSubscription").'</td>';
$arraychoices = array('0'=>$langs->trans("None")); $arraychoices = array('0'=>$langs->trans("None"));
if (!empty($conf->banque->enabled)) { if (isModEnabled("banque")) {
$arraychoices['bankdirect'] = $langs->trans("MoreActionBankDirect"); $arraychoices['bankdirect'] = $langs->trans("MoreActionBankDirect");
} }
if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && isModEnabled('facture')) { if (isModEnabled("banque") && isModEnabled("societe") && isModEnabled('facture')) {
$arraychoices['invoiceonly'] = $langs->trans("MoreActionInvoiceOnly"); $arraychoices['invoiceonly'] = $langs->trans("MoreActionInvoiceOnly");
} }
if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && isModEnabled('facture')) { if (isModEnabled("banque") && isModEnabled("societe") && isModEnabled('facture')) {
$arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice"); $arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice");
} }
print '<td>'; print '<td>';
@ -258,7 +259,7 @@ print "</tr>\n";
// Use vat for invoice creation // Use vat for invoice creation
if (isModEnabled('facture')) { if (isModEnabled('facture')) {
print '<tr class="oddeven"><td>'.$langs->trans("VATToUseForSubscriptions").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("VATToUseForSubscriptions").'</td>';
if (!empty($conf->banque->enabled)) { if (isModEnabled("banque")) {
print '<td>'; print '<td>';
print $form->selectarray('ADHERENT_VAT_FOR_SUBSCRIPTIONS', array('0'=>$langs->trans("NoVatOnSubscription"), 'defaultforfoundationcountry'=>$langs->trans("Default")), (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) ? '0' : $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0); print $form->selectarray('ADHERENT_VAT_FOR_SUBSCRIPTIONS', array('0'=>$langs->trans("NoVatOnSubscription"), 'defaultforfoundationcountry'=>$langs->trans("Default")), (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) ? '0' : $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0);
print '</td>'; print '</td>';
@ -269,7 +270,7 @@ if (isModEnabled('facture')) {
} }
print "</tr>\n"; print "</tr>\n";
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { if (isModEnabled("product") || isModEnabled("service")) {
print '<tr class="oddeven"><td>'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").'</td>';
print '<td>'; print '<td>';
$selected = (empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) ? '' : $conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS); $selected = (empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) ? '' : $conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);

View File

@ -29,6 +29,7 @@
* \brief Page to setup the module Foundation * \brief Page to setup the module Foundation
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';

View File

@ -24,6 +24,7 @@
* \brief Page to setup extra fields of members * \brief Page to setup extra fields of members
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
@ -81,14 +82,6 @@ require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print dol_get_fiche_end(); print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '<div class="tabsAction">';
print '<a class="butAction reposition" href="'.$_SERVER["PHP_SELF"].'?action=create">'.$langs->trans("NewAttribute").'</a>';
print "</div>";
}
// Creation of an optional field // Creation of an optional field
if ($action == 'create') { if ($action == 'create') {
print '<div name="topofform"></div><br>'; print '<div name="topofform"></div><br>';

View File

@ -27,6 +27,7 @@
* \brief Page to setup extra fields of members * \brief Page to setup extra fields of members
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
@ -84,14 +85,6 @@ require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print dol_get_fiche_end(); print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '<div class="tabsAction">';
print '<a class="butAction reposition" href="'.$_SERVER["PHP_SELF"].'?action=create">'.$langs->trans("NewAttribute").'</a>';
print "</div>";
}
// Creation of an optional field // Creation of an optional field
if ($action == 'create') { if ($action == 'create') {
print "<br>"; print "<br>";

View File

@ -24,6 +24,7 @@
* \brief File of main public page for member module * \brief File of main public page for member module
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@ -58,6 +59,7 @@ if ($action == 'update') {
$public = GETPOST('MEMBER_ENABLE_PUBLIC'); $public = GETPOST('MEMBER_ENABLE_PUBLIC');
$amount = price2num(GETPOST('MEMBER_NEWFORM_AMOUNT'), 'MT', 2); $amount = price2num(GETPOST('MEMBER_NEWFORM_AMOUNT'), 'MT', 2);
$editamount = GETPOST('MEMBER_NEWFORM_EDITAMOUNT'); $editamount = GETPOST('MEMBER_NEWFORM_EDITAMOUNT');
$publiccounters = GETPOST('MEMBER_COUNTERS_ARE_PUBLIC');
$payonline = GETPOST('MEMBER_NEWFORM_PAYONLINE'); $payonline = GETPOST('MEMBER_NEWFORM_PAYONLINE');
$forcetype = GETPOST('MEMBER_NEWFORM_FORCETYPE', 'int'); $forcetype = GETPOST('MEMBER_NEWFORM_FORCETYPE', 'int');
$forcemorphy = GETPOST('MEMBER_NEWFORM_FORCEMORPHY', 'aZ09'); $forcemorphy = GETPOST('MEMBER_NEWFORM_FORCEMORPHY', 'aZ09');
@ -65,6 +67,7 @@ if ($action == 'update') {
$res = dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC", $public, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC", $public, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT", $amount, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT", $amount, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT", $editamount, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT", $editamount, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "MEMBER_COUNTERS_ARE_PUBLIC", $publiccounters, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE", $payonline, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE", $payonline, 'chaine', 0, '', $conf->entity);
if ($forcetype < 0) { if ($forcetype < 0) {
$res = dolibarr_del_const($db, "MEMBER_NEWFORM_FORCETYPE", $conf->entity); $res = dolibarr_del_const($db, "MEMBER_NEWFORM_FORCETYPE", $conf->entity);
@ -167,10 +170,30 @@ if (empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
print $enabledisablehtml; print $enabledisablehtml;
print '<input type="hidden" id="MEMBER_ENABLE_PUBLIC" name="MEMBER_ENABLE_PUBLIC" value="'.(empty($conf->global->MEMBER_ENABLE_PUBLIC) ? 0 : 1).'">'; print '<input type="hidden" id="MEMBER_ENABLE_PUBLIC" name="MEMBER_ENABLE_PUBLIC" value="'.(empty($conf->global->MEMBER_ENABLE_PUBLIC) ? 0 : 1).'">';
print '<br><br>';
print '<br>';
if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) { if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
print '<br>';
//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;
} else {
$entity_qr = '';
}
// Define $urlwithroot
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
print '<div class="urllink">';
print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/members/new.php'.$entity_qr.'">';
print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/members/new.php'.$entity_qr.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
print '</div>';
print ajax_autoselect('publicurlmember');
print '<br>'; print '<br>';
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
@ -178,14 +201,14 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>'; print '<td>'.$langs->trans("Parameter").'</td>';
print '<td class="right">'.$langs->trans("Value").'</td>'; print '<td>'.$langs->trans("Value").'</td>';
print "</tr>\n"; print "</tr>\n";
// Force Type // Force Type
$adht = new AdherentType($db); $adht = new AdherentType($db);
print '<tr class="oddeven drag" id="trforcetype"><td>'; print '<tr class="oddeven drag" id="trforcetype"><td>';
print $langs->trans("ForceMemberType"); print $langs->trans("ForceMemberType");
print '</td><td class="right">'; print '</td><td>';
$listofval = array(); $listofval = array();
$listofval += $adht->liste_array(1); $listofval += $adht->liste_array(1);
$forcetype = empty($conf->global->MEMBER_NEWFORM_FORCETYPE) ? -1 : $conf->global->MEMBER_NEWFORM_FORCETYPE; $forcetype = empty($conf->global->MEMBER_NEWFORM_FORCETYPE) ? -1 : $conf->global->MEMBER_NEWFORM_FORCETYPE;
@ -197,7 +220,7 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
$morphys["mor"] = $langs->trans("Moral"); $morphys["mor"] = $langs->trans("Moral");
print '<tr class="oddeven drag" id="trforcenature"><td>'; print '<tr class="oddeven drag" id="trforcenature"><td>';
print $langs->trans("ForceMemberNature"); print $langs->trans("ForceMemberNature");
print '</td><td class="right">'; print '</td><td>';
$forcenature = empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY) ? 0 : $conf->global->MEMBER_NEWFORM_FORCEMORPHY; $forcenature = empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY) ? 0 : $conf->global->MEMBER_NEWFORM_FORCEMORPHY;
print $form->selectarray("MEMBER_NEWFORM_FORCEMORPHY", $morphys, $forcenature, 1); print $form->selectarray("MEMBER_NEWFORM_FORCEMORPHY", $morphys, $forcenature, 1);
print "</td></tr>\n"; print "</td></tr>\n";
@ -205,31 +228,38 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
// Amount // Amount
print '<tr class="oddeven" id="tramount"><td>'; print '<tr class="oddeven" id="tramount"><td>';
print $langs->trans("DefaultAmount"); print $langs->trans("DefaultAmount");
print '</td><td class="right">'; print '</td><td>';
print '<input type="text" class="right width75" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" value="'.(!empty($conf->global->MEMBER_NEWFORM_AMOUNT) ? $conf->global->MEMBER_NEWFORM_AMOUNT : '').'">'; print '<input type="text" class="right width50" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" value="'.(!empty($conf->global->MEMBER_NEWFORM_AMOUNT) ? $conf->global->MEMBER_NEWFORM_AMOUNT : '').'">';
print "</td></tr>\n"; print "</td></tr>\n";
// Can edit // Can edit
print '<tr class="oddeven" id="tredit"><td>'; print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("CanEditAmount"); print $langs->trans("CanEditAmount");
print '</td><td class="right">'; print '</td><td>';
print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT", (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) ? $conf->global->MEMBER_NEWFORM_EDITAMOUNT : 0), 1); print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT", (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) ? $conf->global->MEMBER_NEWFORM_EDITAMOUNT : 0), 1);
print "</td></tr>\n"; print "</td></tr>\n";
// SHow counter of validated members publicly
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("MemberCountersArePublic");
print '</td><td>';
print $form->selectyesno("MEMBER_COUNTERS_ARE_PUBLIC", (!empty($conf->global->MEMBER_COUNTERS_ARE_PUBLIC) ? $conf->global->MEMBER_COUNTERS_ARE_PUBLIC : 0), 1);
print "</td></tr>\n";
// Jump to an online payment page // Jump to an online payment page
print '<tr class="oddeven" id="trpayment"><td>'; print '<tr class="oddeven" id="trpayment"><td>';
print $langs->trans("MEMBER_NEWFORM_PAYONLINE"); print $langs->trans("MEMBER_NEWFORM_PAYONLINE");
print '</td><td class="right">'; print '</td><td>';
$listofval = array(); $listofval = array();
$listofval['-1'] = $langs->trans('No'); $listofval['-1'] = $langs->trans('No');
$listofval['all'] = $langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')'; $listofval['all'] = $langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')';
if (!empty($conf->paybox->enabled)) { if (isModEnabled('paybox')) {
$listofval['paybox'] = 'Paybox'; $listofval['paybox'] = 'Paybox';
} }
if (!empty($conf->paypal->enabled)) { if (isModEnabled('paypal')) {
$listofval['paypal'] = 'PayPal'; $listofval['paypal'] = 'PayPal';
} }
if (!empty($conf->stripe->enabled)) { if (isModEnabled('stripe')) {
$listofval['stripe'] = 'Stripe'; $listofval['stripe'] = 'Stripe';
} }
print $form->selectarray("MEMBER_NEWFORM_PAYONLINE", $listofval, (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) ? $conf->global->MEMBER_NEWFORM_PAYONLINE : ''), 0); print $form->selectarray("MEMBER_NEWFORM_PAYONLINE", $listofval, (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) ? $conf->global->MEMBER_NEWFORM_PAYONLINE : ''), 0);
@ -248,29 +278,6 @@ print dol_get_fiche_end();
print '</form>'; print '</form>';
if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
print '<br>';
//print $langs->trans('FollowingLinksArePublic').'<br>';
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>';
if (!empty($conf->multicompany->enabled)) {
$entity_qr = '?entity='.$conf->entity;
} else {
$entity_qr = '';
}
// Define $urlwithroot
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
print '<div class="urllink">';
print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/members/new.php'.$entity_qr.'">';
print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/members/new.php'.$entity_qr.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
print '</div>';
print ajax_autoselect('publicurlmember');
}
// End of page // End of page
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -21,23 +21,26 @@
*/ */
/** /**
* \file htdocs/adherents/agenda.php * \file htdocs/adherents/agenda.php
* \ingroup member * \ingroup member
* \brief Page of members events * \brief Page of members events
*/ */
// Load Dolibarr environment
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("companies", "members")); $langs->loadLangs(array('companies', 'members'));
// Get Parameters
$id = GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('rowid', 'int'); $id = GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('rowid', 'int');
// Pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma');
@ -71,6 +74,7 @@ $objcanvas = null;
// Security check // Security check
$result = restrictedArea($user, 'adherent', $id); $result = restrictedArea($user, 'adherent', $id);
// Initialize technical objects
$object = new Adherent($db); $object = new Adherent($db);
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result > 0) { if ($result > 0) {
@ -115,9 +119,7 @@ $contactstatic = new Contact($db);
$form = new Form($db); $form = new Form($db);
/*
* Customer and/or supplier category sheet
*/
if ($object->id > 0) { if ($object->id > 0) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
@ -130,7 +132,7 @@ if ($object->id > 0) {
llxHeader("", $title, $help_url); llxHeader("", $title, $help_url);
if (!empty($conf->notification->enabled)) { if (isModEnabled('notification')) {
$langs->load("mails"); $langs->load("mails");
} }
$head = member_prepare_head($object); $head = member_prepare_head($object);

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