Merge branch '17.0' of https://github.com/Dolibarr/dolibarr into FIX_read_evaluation_of_user_and_subordinates_with_read_right

This commit is contained in:
Gauthier VERDOL 2022-12-17 13:37:32 +01:00
commit cfd669fb06
2769 changed files with 225318 additions and 36461 deletions

View File

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

View File

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

View File

@ -2,10 +2,9 @@
# from Dolibarr GitHub repository.
# 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
dist: xenial
#dist: bionic
dist: bionic
language: php
@ -18,22 +17,43 @@ services:
- mysql
- 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:
# Force postgresql to 9.4 (the oldest availablable on xenial)
postgresql: '9.4'
# Force postgresql version
postgresql: '10'
apt:
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/
- pgdg-xenial
- sourceline: 'ppa:ondrej/php'
packages:
# We need a webserver to test the webservices
# Let's install Apache with.
- 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
- 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:
global:
# Set to true for very verbose output
@ -44,21 +64,21 @@ jobs:
#allow_failures:
#- php: nightly
include:
- stage: PHP 5.6-7.4
- stage: PHP 7.0-8.1
if: type = push
php: '5.6'
php: '7.1'
env: DB=postgresql
- stage: PHP 5.6-7.4
- stage: PHP 7.0-8.1
if: type = pull_request OR type = push
php: '7.4.22'
php: '8.1'
env: DB=mysql
- stage: PHP Dev
if: type = push AND branch = develop
php: nightly
php: nightly
env: DB=mysql
- stage: PHP Dev
if: type = push AND branch = 15.0
php: nightly
if: type = push AND branch = 17.0
php: nightly
env: DB=mysql
notifications:
@ -72,13 +92,6 @@ notifications:
on_failure: always
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:
- |
@ -94,13 +107,6 @@ install:
- |
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
composer -n require phpunit/phpunit ^6 \
php-parallel-lint/php-parallel-lint ^1 \
@ -108,7 +114,7 @@ install:
php-parallel-lint/php-var-dump-check ~0.4 \
squizlabs/php_codesniffer ^3
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 \
php-parallel-lint/php-parallel-lint ^1.2 \
php-parallel-lint/php-console-highlighter ^0 \
@ -116,8 +122,8 @@ install:
squizlabs/php_codesniffer ^3
fi
# phpunit 9 is required for php 8
if [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
composer -n require --ignore-platform-reqs phpunit/phpunit ^7 \
if [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
composer -n require --ignore-platform-reqs phpunit/phpunit ^8 \
php-parallel-lint/php-parallel-lint ^1.2 \
php-parallel-lint/php-console-highlighter ^0 \
php-parallel-lint/php-var-dump-check ~0.4 \
@ -246,17 +252,22 @@ before_script:
- 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
- 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
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
- 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
- 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
# configure apache virtual hosts
- sudo cp -f build/travis-ci/apache.conf /etc/apache2/sites-available/000-default.conf
@ -284,12 +295,12 @@ script:
set -e
#parallel-lint --exclude htdocs/includes --blame .
# 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 \
--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/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
set +e
echo
@ -299,7 +310,7 @@ script:
# Ensure we catch errors
set -e
# 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 .;
fi
set +e
@ -310,7 +321,7 @@ script:
# Ensure we catch errors
set -e
# 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 .
fi
set +e
@ -436,6 +447,9 @@ script:
php upgrade.php 15.0.0 16.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade15001600.log
php upgrade2.php 15.0.0 16.0.0 > $TRAVIS_BUILD_DIR/upgrade15001600-2.log
php step5.php 15.0.0 16.0.0 > $TRAVIS_BUILD_DIR/upgrade15001600-3.log
php upgrade.php 16.0.0 17.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade16001700.log
php upgrade2.php 16.0.0 17.0.0 > $TRAVIS_BUILD_DIR/upgrade16001700-2.log
php step5.php 16.0.0 17.0.0 > $TRAVIS_BUILD_DIR/upgrade16001700-3.log
ls -alrt $TRAVIS_BUILD_DIR/
- |
@ -468,6 +482,9 @@ after_script:
ls $TRAVIS_BUILD_DIR/documents
#cat $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:
- |
@ -476,16 +493,16 @@ after_success:
after_failure:
- |
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
# Upgrade log files
# This part of code is executed only if the command that fails are enclosed with set +e
# Show upgrade log files
for ficlog in `ls $TRAVIS_BUILD_DIR/*.log`
do
echo "Debugging informations for file $ficlog"
#cat $ficlog
done
# Apache log file
# Show Apache log file
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
# Dolibarr log file
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
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]
file_filter = htdocs/langs/<lang>/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
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
@ -23,7 +23,6 @@ Licence of dependencies of third-party components used by Dolibarr (all compatib
Component Version License GPL Compatible Usage
-------------------------------------------------------------------------------------
PHP libraries:
ADOdb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
EvalMath 1.0 BSD Yes Safe math expressions evaluation
Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
GeoIP2 0.2.0 Apache License 2.0 Yes Lib to make geoip convert
@ -31,10 +30,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)
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
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
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
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
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)
@ -52,7 +52,7 @@ Ace 1.4.14 BSD Yes
ChartJS 3.7.1 MIT License Yes JS library for graph
CKEditor 4.18 LGPL-2.1+ Yes Editor WYSIWYG
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 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

431
ChangeLog
View File

@ -3,6 +3,211 @@ English Dolibarr ChangeLog
--------------------------------------------------------------
***** 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
NEW: #21780 Add pid field to Cronjob class and store PID on job execution
NEW: #19680 Add option PRODUCT_ALLOW_EXTERNAL_DOWNLOAD to automatically have uploaded files shared publicly by a link
NEW: #20650 can move the checkbox column on left (experimental option)
NEW: #21000 Added columns 'alias_name' on project, supplier invoice, supplier order, supplier proposals and task list
NEW: #21395 Added option for dark theme mode in display - color and theme
NEW: #21397 added option to auto define barcode numbers for third-parties in barcode module setup
NEW: #21399
NEW: #21442 Enhancement of module builder init
NEW: #21654 add bank account number used on invoices for debit
NEW: #22048 Added notes to productlot module
NEW: #22298 Bank - Add salaries & vat in the tab of planned entries of a bank account
NEW: #22328
NEW: #22424
NEW: #22500 member module set up made easier
NEW: #22527 projects and thirdparties can be viewed as conversation ("Message" view), like events/agenda.
NEW: #22546 can now set user supervisors using mass action in htdocs/user
NEW: #22594 can chose if VAT ID is unique or not for third parties
NEW: #22622 all partnerships displayed on tab partnership of a thirdparty and member
NEW: #22676 massaction for updating product prices
NEW: #22735 Massaction to affect users on projects
NEW: #25594 can chose if VAT ID is unique or not for third parties
NEW: #4482 adding js to hide/show advanced option on the export data page
NEW: Accountancy - Add a graphic option to enable lettering function - FPC21
NEW: Accountancy - Add a way to clean some words when you generate thirdparty accounting account
NEW: Accountancy - Added an option during export to export or not the lettering FPC21
NEW: Accountancy - Manage supplier deposit with specific account
NEW: Accountancy - Model Digitaria - Add a way to clean some words when you generate thirdparty accounting account FPC22
NEW: Add a button "Test collect" in email collector
NEW: Add a constant to disallow modification of the product reference.
NEW: Add a method doAutoRenewContracts that can be used as a cron task.
NEW: Add " as enclosure by default for CSV export. Keep removing CR/LF.
NEW: add attached file in presend email form of thirdparty card
NEW: Add a way to enter LICENSE file content in property of website
NEW: Add badge in admin extrafields setup
NEW: add constant PROPAL_BYPASS_VALIDATED_STATUS
NEW: Add date event (!= date project) and location on event organization
NEW: Add employment anniversary in birthday box
NEW: Add extrafield type "IP" to store IP addresses
NEW: Add fail2ban rules examples to limit access to /public pages
NEW: Add filter "Product subject to lot/Serial" in stock per lot/serial
NEW: Add hidden option MAIN_EMAIL_SUPPORT_ACK to restore Email ack checkbox (feature abandonned by mailers)
NEW: Add IMAP port setting on email collector module
NEW: Adding JAPAN Chart-of-Account and regions/departments
NEW: Adding NIF verification for Algeria
NEW: Add link to create an element from the category page
NEW: add margin infos to takepos invoice lines
NEW: Add max size send for "backup and link to mail" option
NEW: Add method httponly_accessforbidden()
NEW: Add more advices into the Setup security page
NEW: Add new global variable for keeping the previous signature information on proposale (case of reopen a proposale)
NEW: Add objectLink on expedition
NEW: Add oldcopy to Ticket so triggers intercepting TICKET_MODIFY have access to old values of the updated properties
NEW: Add option FICHINTER_ALLOW_EXTERNAL_DOWNLOAD
NEW: Add option --force on CLI cron_run_jobs.php
NEW: Add option "Show price on the generated documents for receptions"
NEW: Add performance index (name for company and contact) and llx_bank_url(url_id)
NEW: Add picto property on sub-module for password generation
NEW: add redirect on action confirm addconsumedline and addproduceline
NEW: Add a new advanced permission "read price"
NEW: Add substitution key __SENDEREMAIL_SIGNATURE__
NEW: Add the referrer-policy to "same-origin" by default on all public pages.
NEW: Add the SMTP header References on ticket email created by email
NEW: Add the thirdparty column to the time list (projet/tasks/time.php)
NEW: Add trigger to record the event of sending an email from a project #20912
NEW: Allow download link option in module configuration (propal,invoice,supplier proposal, order)
NEW: Bank - Add salaries & vat in tab planned entries
NEW: Bulk action to remove a category in list/search website pages
NEW: Can copy/paste images into emails sent.
NEW: Can edit label of an emailing even once sent
NEW: Can edit property css, cssview, csslist on extrafields
NEW: Can enter the unit price including the vat
NEW: Can invoice task time per different services
NEW: Can join several files by default on email form
NEW: Can send an email on scheduled job error
NEW: Can set a commercial discount by entering amount including VAT
NEW: Can set a monthly frequency (or multiple) in cron tasks.
NEW: Can set start and end dates and comment on button "Activate all services"
NEW: can sort and preselected best supplier price
NEW: Can use products categories to make inventory
NEW: Change filter type on tickets list into a multiselect combo
NEW: conf TIMESPENT_ALWAYS_UPDATE_THM, when it's on we always check current thm of user to update it in task time line
NEW: constant PROPAL_NEW_AS_SIGNED
NEW: show date delivery planned on orders linked to company and product
NEW: Default template of contract is not mandatory
NEW: Default values in extrafields are not more limited to 255 char.
NEW: display currency in takepos menu
NEW: Enable online signature for interventions
NEW: Encrypt all sensitive constants in llx_const
NEW: extrafield price with currency
NEW: filter on reception dates (from / to) in cheque paiement card
NEW: Members: default_lang for members
NEW: Members: Table of membership types
NEW: Members: add free membership amounts at the membership type level
NEW: TakePOS: Header Scroll in TakePOS
NEW: TakePOS: add price to product box in TakePOS
NEW: TakePOS: add setup parameters, can setup terminal name
NEW: TakePOS: support of Stripe Terminal with TakePOS
NEW: TakePOS: Receipt preview in TakePOS setup
NEW: TakePOS: different product list on smartphone
NEW: Website: can delete a whole website if disabled
NEW: Website: can remove a website template
NEW: Website: can set header "Strict-Transport-Security" in web sites.
NEW: Website: can switch status of website and page from the website toolbar
NEW: Website: Templates of websites are now directories and not zip into core repo
NEW: Website: add 4 other templates in website module
NEW: If we select another view list mode, we keep it
NEW: Init module bookcal
NEW: Introduce dolEncrypt and dolDecrypt to be able to encrypt data in db
NEW: Invoice - Add french mention on pdf when vat debit option is on
NEW: invoice export : add accounting affectation
NEW: label on products categories filter
NEW: The link "add to bookmark" is always on top in the bookmark popup
NEW: MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS const to show category customer filter
NEW: Make module WebservicesClient deprecated. Use module WebHook instead.
NEW: manage no email with thirdparties (better for GDPR)
NEW: Manage Position (Rank) on Contract Lines
NEW: Manage VAT on all lines on purchases cycle
NEW: manage virtual stock at a future date
NEW: On a bank reconciled line, we can modify the bank receipt
NEW: On a form to send an email, we show all emails of all contacts of object
NEW: Option PRODUCTBATCH_SHOW_WAREHOUSE_ON_SHIPMENT showing wh on PDF
NEW: Option PRODUIT_DESC_IN_FORM accept (desktop only or +smartphone)
NEW: Page for mass stock transfer can be used with no source stock
NEW: parent company column and filter in invoice and order list
NEW: Add show "Sales rep" option for PDF
NEW: Picto for shared link is clickable
NEW: possibility to select scopes with checkbox for Oauth tokens
NEW: private and public note on user, thirdparty and contact list
NEW: product categories filter on inventory list
NEW: Product supplier price: autofill default supplier VAT
NEW: Project - Add author on list
NEW: Public counters feature
NEW: Reception - Add a from/to on search on date field
NEW: Start a simple support of recurrent events on agenda
NEW: Resize parent company column in order list
NEW: Saved token of OAUTH module are now encrypted into llx_oauth_token
NEW: Save one click to select on delivery ack, on emails.
NEW: scheduled job to send unpaid invoice reminder can now use the cc and bcc from email template
NEW: set thirdparty type with company modify trigger
NEW: Show also scheduled task never finished in scheduled task widget
NEW: show badge with number of extrafields in setup
NEW: show category tree in sellist and chkbxlst for common object
NEW: Show picto and color into combo for selection of tags
NEW: show product label on inventory
NEW: show sell-by and eat-by dates only if not empty
NEW: show SellBy/EatBy dates for each batch product in shipment card
NEW: skip accept/refuse process for proposals (option PROPAL_SKIP_ACCEPT_REFUSE)
NEW: SMTP using oauth2 authentication
NEW: can substitue project title in mail template
NEW: Supplier order list - Add column private and public note
NEW: Support IP type in extrafields
NEW: The purge of files can purge only if older than a number of seconds
NEW: Update ActionComm type_code on email message ticket
NEW: VAT - Admin - Add information on deadline day for submission of VAT declaration
NEW: expand/collapse permissions on user permission page
NEW: Show delivery mode on PDF for proposals
NEW: Add the target to select attendees of event for emailings
Modules
NEW: Experimental module Asset
For developers or integrators:
------------------------------
NEW: ModuleBuilder can generate code of class from an existing SQL table
NEW: #22370 Modulebuilder supports 'alwayseditable' (like extrafields)
NEW: #20912 Add trigger to record the event of sending an email from a project
NEW: #21750 Added "Get lines and Post lines from BOM" at the REST Service
NEW: Removed completely the need for the library adodbtime
NEW: hook on agenda pages
NEW: hook to complete payment in TakePOS
NEW: hook "changeHelpURL" to modify target of the help button
NEW: hook formConfirm on action comm card
NEW: hook to modify supplier product html select
NEW: Add new hook for show virtual stock details on product stock card
NEW: Add new hooks for actioncomm
NEW: conf->global->SYSLOG_FILE_ONEPERSESSION accept a string
NEW: translate for contact type API, setup/ticket API, shipping method API
NEW: All ajax pages have now a top_httphead()
NEW: support multilang in Civilities API
NEW: Add API for the partnership module
NEW: Add "Get lines and Post lines from BOM" in the API
NEW: Replace fk_categories_product with categories_product in inventory
NEW: Rewrite of SQL request. Removed the join on category (for filter on categ), replaced with a EXISTS/NOT
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* Minimal PHP version is now PHP 7.0 instead of PHP 5.6
* 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() have been set to deprecated for naming consitency, use fetchAll() instead.
* Code standardization: '$user->rights->propale' is now '$user->rights->propal' everywhere.
* Deprecated method set_billed() on shipment and reception class has been removed. Use setBilled() instead.
* Tables llx_prelevement_facture and llx_prelevement_facture_demande have been renamed into llx_prelevement and llx_prelevement_demande.
* Rename MAIN_LIST_ALLOW_NOTES into MAIN_LIST_HIDE_NOTES and rename MAIN_LIST_ALLOW_PRIVATE_NOTES into MAIN_LIST_HIDE_PRIVATE_NOTES
* Rename the substitution for project label instead of project title in substitution variables
***** ChangeLog for 16.0.3 compared to 16.0.2 *****
@ -160,118 +365,115 @@ NEW: PHP 8.0 and 8.1 compatibility:
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: #20292 Include German public holidays
NEW: Can show ZATCA QRCode on PDFs
NEW: Can show Swiss QR Code on PDFs
NEW: Can show ZATCA QR-Code on PDFs
NEW: Can show Swiss QR-Code on PDFs
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: 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 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 hidden feature for accounting reconciliation
NEW: ACE Editor is restored at same cursor position after a save.
NEW: Add "addMoreActionsButtons" hook to subscription form
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 column date of Signature on proposal list
NEW: Add column template invoice in invoice list
NEW: Add column "Total HT" to products array on document creation card
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: Add configuration for text color of button action
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 margin info in proposal and order list
NEW: Add massaction "Edit Extrafield" for Product
NEW: Add margin info in proposal and order list
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 param boder table for md theme
NEW: Add param color button action
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 private and public notes on tax files.
NEW: Add status "Obsolete" to KM articles
NEW: Add private and public notes on tax files
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: A public form to send a message and create a lead is available
NEW: automatically set totally received status in reception
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: barcode rule to insert product in takepos
NEW: Can change value of AWP during the inventory
NEW: Backup tool has an "lowmemory" option for mysqldump on large database
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 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: Change in theme colors does not need to use the refresh button
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: Contact filter project list
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: 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: display errors in a message box after generating documents
NEW: Display physical and virtual stock of the products when creating OF from a BOM
NEW: Display product ref in "Object link" product tab for BOM
NEW: Dictionaries - Availibility dictionnary has a new column unit and number
NEW: Display errors in a message box after generating documents
NEW: Enhance the import. Can use 'auto' for the ref (import of orders)
NEW: Events on Proposal to Return to Draft
NEW: Exports - add entity filter in exports
NEW: Page to list expense report payments
NEW: JS inventory autocalc input
NEW: language support for more emailing target selectors
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: Module website now supports the multicompany module
NEW: More mode for THEME_TOPMENU_DISABLE_IMAGE (2, 3, ...)
NEW: Module BOM - add tabs for nets BOM
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 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: possibility to consume multiple batch
NEW: Reverse movement product consumption
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: Show number of votes into the label of tab "Results" of a survey
NEW: Show product reference in Takepos
NEW: Some core tables are created only at module activation
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: Stocks - stock filter in reassort lists
NEW: Stocks - stock limit in stock export CSV
NEW: Stocks - Inventory - can change value of AWP during the inventory
NEW: Supplier order - Show ref supplier of reception in linked object block
NEW: support user_modif in order
NEW: TakePos - pagination on search results
NEW: The backup tools has an "lowmemory" option for mysqldump on large database
NEW: Surveys - Show number of votes into the label of tab "Results" of a survey
NEW: TakePOS - barcode rule to insert product in TakePOS
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: Thirdparty - Add rules "customer accountancy code" is mandatory to validate invoice
NEW: thumbnail field in product list
NEW: total mark rate in list
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: 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: On a form to send an email, we show all emails of contacts of object
Modules
NEW: Module Partnership Management
NEW: Module Event Organization Management
Modules state
NEW: Module Partnership Management - stable
NEW: Module Event Organization Management - stable
For developers or integrators:
@ -279,48 +481,46 @@ For developers or integrators:
NEW: dol_uncompress() supports more extensions (.gz, .bz2, .zstd). Only .zip was supported before.
NEW: Implement a generic method for Kaban views
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: solde() function evolution to be able to get solde until a chosen date
NEW: Suggest a way to run upgrade per entities.
NEW: Support html content for multiselect component.
NEW: ModuleBuilder - Add tabs view in module builder
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: 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: 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 utility function send backup by mail
NEW: add WordPress OAuth to save a token (not SSO)
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: A module can embed a SQL script run at each Dolibarr upgrade
NEW: Add param to keep the robot=index meta tag on public pages
NEW: Add method hintindex() in database handlers.
NEW: add modifications for new function "$db->prefix()"
NEW: addMoreActionsButtonsList hook for button in list
NEW: Add API to get a template invoice
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
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 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: Add hooks: selectContactListWhere hook, selectThirdpartyListWhere hook
NEW: TakePos - add hooks complete product display
NEW: TakePos - add hooks for cart display
NEW: TakePos - add hooks to complete ajax return array
NEW: #19294 implement detailed timespent in task of project API
NEW: #20736 Allow extrafields SQL filters on REST API product lookup
NEW: Can update rank of invoice, proposal and order lines with API update
NEW: update rank line is possible on API for customer invoices, sales orders and supplier invoice
NEW: Add option MAIN_API_DEBUG to save API logs into a file
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 doaction in takepos invoice
NEW: Add Hook for Notif
NEW: Add hook for Notif
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 printFieldWhere in load_state_board function
NEW: Add hooks contact tab badge and hooks parameter for avoid conflicts
@ -332,15 +532,28 @@ NEW: Add hooks on project task time page
NEW: Add hooks on salaries and sociales card
NEW: Add hooks select product list and select thirdparty list 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:
* 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).
* 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 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.
* 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.
@ -360,10 +573,8 @@ 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_…
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: #20527 Accountancy Unbalanced entry proposed when an employee are declared on social contribution
FIX: #20621 signature online with proposal with n page.
FIX: #20696
FIX: #20828
@ -399,7 +610,7 @@ FIX: fourn/commande/card.php Added "$object" parameter to $formfile->showdocumen
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: 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
@ -559,7 +770,7 @@ For users:
NEW: Online proposal signature
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: Add option to disable globaly some notifications emails.
NEW: #18401 Add __NEWREF__ subtitute to get new object reference.
@ -608,7 +819,7 @@ NEW: can enable/disable external calendar by default
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 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 upload the odt file for the product doc template
NEW: Contract - Add From/to input on search date
@ -672,7 +883,7 @@ For developers:
API:
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 get list of legal form of business
NEW: API list of staff units
@ -707,21 +918,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: 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:
* 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).
* 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.
* 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.
* 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
method executeCLI() available into core/class/utils.class.php
* 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
* Class file expeditionbatch.class.php renamed to expeditionlinebatch.class.php
* ExpeditionLineBatch::fetchAll is not static anymore and first parameter $db is removed
* 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
@ -1010,10 +1223,10 @@ For users:
----------
NEW: Module Recruitment to follow application to job positions is now stable.
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: 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 some color and picto for the direction of movement
NEW: add the column "Channel" into the list of orders
@ -1084,7 +1297,7 @@ NEW: can show the leave dates/holidays on the agenda view
NEW: Support color for types of event
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
ECM/GED
@ -1107,7 +1320,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
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: customer ref for product customer prices
NEW: Set status of all variants when changing status of parent
@ -1160,8 +1373,8 @@ NEW: add option in Workflow module to set a shipment as closed
for Admins
NEW: Add a security center page with all information and advices related to the security of your instance
NEW: Add a performance center page with all information and advices related to the performance of your instance
NEW: Add a security center page with all information and 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
Modules
NEW: Module Recruitment is now stable
@ -1207,7 +1420,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 native compression in REST APIs
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
NEW: hook printFieldListTitle for cabyprodserv.php
@ -1232,8 +1445,8 @@ Following changes may create regressions for some external modules, but were nec
* 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.
* 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
method executeCLI() available into core/class/utils.class.php
* 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
***** ChangeLog for 13.0.5 compared to 13.0.4 *****
@ -1460,7 +1673,7 @@ NEW: Module "Credit transfer SEPA" to manage payment of vendors using bank credi
NEW: Module Intracomm report
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: 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 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
@ -1596,7 +1809,7 @@ NEW: show user on external calender events (when found)
NEW: subject title with company name instead of application title in ticket message
NEW: Support for Samba4 AD
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 can change thirdparty with barcode scan
NEW: TakePOS can create a thirdparty customer from TakePOS frontend
@ -1607,9 +1820,9 @@ NEW: TakePOS display resiliate status for members
NEW: TakePOS Gift Receipt
NEW: TakePOS multicurrency compatibility
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 show available stock
NEW: TakePOS show available stock
NEW: TakePOS Weighing Scale compatibility with TakePOS connector #14725
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
@ -1622,8 +1835,8 @@ NEW: VAT report - Invert constant to show by default zero VAT in reports
NEW: website page fields selection
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: 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 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 "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:
- 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
fournis dans ce nouveau package.

View File

@ -6,9 +6,8 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
| Version | Supported |
| ---------- | ---------------------- |
| <= 15.0.0 | :x: |
| >= 15.0.1+ | :white_check_mark: except CSRF attacks|
| >= 16.0.0 | :white_check_mark: |
| <= 16.0.2 | :x: |
| >= 16.0.3 | :white_check_mark: |
| >= develop | :white_check_mark: |
## Reporting a Vulnerability

View File

@ -19,7 +19,6 @@ Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm |
php-pear, php-mail-mime,
# php-tcpdf,
# libfpdf-tpl-php, php-fpdf,
# libphp-adodb,
# libnusoap-php,
# libphp-pclzip,
# Required javascript libraries

View File

@ -61,31 +61,6 @@ License: GPL-3+
------------------------------------------------------------
Files: htdocs/includes/adodbtime/*
Copyright: 2003-2005, John Lim
unknown, jackbbs
License: BSD-3-Clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
.
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
.
Neither the name of the John Lim nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.
Comment:
Those files are not shipped in the binary package since we use
the library as packaged in "libphp-adodb".
------------------------------------------------------------
Files: htdocs/includes/ckeditor/*
Copyright: 2003-2012 CKSource - Frederico Knabben
License: GPL-2+

View File

@ -146,7 +146,6 @@ case "$1" in
#else
# File already exist. We add params not found.
#echo Add new params to overwrite path to use shared libraries/fonts
#grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "<?php \$dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; ?>" >> $config
##grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
#grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
#grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ] || echo "<?php \$dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; ?>" >> $config

View File

@ -31,7 +31,6 @@ $force_install_distrib='debian';
// - not removed from package (see rm in rules file),
// - declared into dependencies (see Depends in control file)
//$force_dolibarr_lib_TCPDF_PATH='';
//$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';
//$force_dolibarr_lib_GEOIP_PATH='';
//$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap';
//$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip';

View File

@ -89,7 +89,6 @@ override_dh_install:
rm -fr build/zip
# clean from all PHP embedded libraries (we use package dependencies instead)
# rm -fr htdocs/includes/adodbtime
# rm -fr htdocs/includes/geoip
# rm -fr htdocs/includes/nusoap
# rm -fr htdocs/includes/odtphp/zip/pclzip

View File

@ -1,2 +0,0 @@
htdocs/install/doctemplates/websites/website_template-corporate.zip
htdocs/install/doctemplates/websites/website_template-stellar.zip

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).
!!! See file ../makepack-howto.txt

View File

@ -1,5 +1,4 @@
<?php
/* !!! DO NOT EDIT THIS FILE, EDIT config.inc.php INSTEAD !!! */
// 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
// even if one of the queries failed
$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!
$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
$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.
$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['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['QueryWindowHeight'] = 310; // Height of Query window
$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
// phpMyAdmin. For example './upload'. Leave empty for
// no upload directory support. Use %u for username
// no upload directory support. Use %u for username
// inclusion.
$cfg['SaveDir'] = ''; // Directory where phpMyAdmin can save exported data on
// server. For example './save'. Leave empty for no save
@ -645,7 +644,7 @@ $cfg['ColumnTypes'] = array(
);
// 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
$cfg['AttributeTypes'] = array(

View File

@ -55,14 +55,24 @@ if (empty($argv[1])) {
$i=0;
$result=array();
while ($i < $argc) {
if (! empty($argv[$i])) {
parse_str($argv[$i]); // set all params $release, $includecustom, $includeconstant, $buildzip ...
if (!empty($argv[$i])) {
parse_str($argv[$i], $result); // set all params $release, $includecustom, $includeconstant, $buildzip ...
}
if (preg_match('/includeconstant=/', $argv[$i])) {
$tmp=explode(':', $includeconstant, 3); // $includeconstant has been set with previous parse_str()
if (!empty($result["release"])) {
$release = $result["release"];
}
if (!empty($result["includecustom"])) {
$includecustom = $result["includecustom"];
}
if (!empty($result["includeconstant"])) {
$includeconstants[$i] = $result["includeconstant"];
}
if (preg_match('/includeconstant=/', strval($argv[$i]))) {
$tmp=explode(':', $result['includeconstant'], 3); // $includeconstant has been set with previous parse_str()
if (count($tmp) != 3) {
print "Error: Bad parameter includeconstant=".$includeconstant."\n";
print "Error: Bad parameter includeconstant=".$result['includeconstant'] ."\n";
exit -1;
}
$includeconstants[$tmp[0]][$tmp[1]] = $tmp[2];
@ -71,7 +81,7 @@ while ($i < $argc) {
}
if (empty($release)) {
print "Error: Missing release paramater\n";
print "Error: Missing release parameter\n";
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
exit -1;
}

View File

@ -293,6 +293,7 @@ foreach my $PROJECT (@PROJECTLIST) {
}
print "Clean $BUILDROOT\n";
$ret=`rm -fr $BUILDROOT/$PROJECTLC/.cache`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/.git`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/.project`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/.settings`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/index.php`;

View File

@ -8,13 +8,13 @@ of Dolibarr. There is a chapter for BETA version and a chapter for RELEASE versi
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:
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.0_x64.exe (https://www.wampserver.com).
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
@ -25,9 +25,21 @@ Prerequisites to build autoexe DoliWamp package:
***** Prerequisites For Windows *****
Install Perl
Install WampServer-3.2.*-64.exe
isetup-5.5.8.exe
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 *****

View File

@ -25,7 +25,7 @@ BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Group: Applications/Productivity
Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mysqli, php-adodb, php-nusoap, dejavu-sans-fonts
Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mysqli, php-nusoap, dejavu-sans-fonts
Requires: mysql-server, mysql
#BuildRequires: desktop-file-utils
@ -104,7 +104,6 @@ cui hai bisogno ed essere facile da usare.
%{__cp} -pr htdocs $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__cp} -pr scripts $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/ckeditor/_source
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/adodbtime
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/nusoap
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/fonts
@ -165,6 +164,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/blockedlog
%_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/bookcal
%_datadir/dolibarr/htdocs/bom
%_datadir/dolibarr/htdocs/categories
%_datadir/dolibarr/htdocs/collab
@ -274,7 +274,6 @@ if [ -s $config ] && grep -q "File generated by" $config
then
# File already exist. We add params not found.
echo Add new params to overwrite path to use shared libraries/fonts
grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "<?php \$dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; ?>" >> $config
grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "<?php \$dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; ?>" >> $config
#grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config

View File

@ -46,7 +46,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version}
Group: Applications/Productivity
Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mysqli, php-adodb, php-nusoap, dejavu-sans-fonts, php-mbstring, php-xml
Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mysqli, php-nusoap, dejavu-sans-fonts, php-mbstring, php-xml
Requires: mysql-server, mysql
BuildRequires: desktop-file-utils
%else
@ -169,7 +169,6 @@ cui hai bisogno ed essere facile da usare.
%{__cp} -pr scripts $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/ckeditor/_source
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version}
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/adodbtime
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/nusoap
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/htdocs/includes/fonts
%else
@ -246,6 +245,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/blockedlog
%_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/bookcal
%_datadir/dolibarr/htdocs/bom
%_datadir/dolibarr/htdocs/categories
%_datadir/dolibarr/htdocs/collab
@ -425,7 +425,6 @@ if [ -s $config ] && grep -q "File generated by" $config
then
# File already exist. We add params not found.
echo Add new params to overwrite path to use shared libraries/fonts
grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "<?php \$dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; ?>" >> $config
grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "<?php \$dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; ?>" >> $config
#grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config

View File

@ -162,6 +162,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/blockedlog
%_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/bookcal
%_datadir/dolibarr/htdocs/bom
%_datadir/dolibarr/htdocs/categories
%_datadir/dolibarr/htdocs/collab
@ -271,7 +272,6 @@ if [ -s $config ] && grep -q "File generated by" $config
then
# File already exist. We add params not found.
echo Add new params to overwrite path to use shared libraries/fonts
grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "<?php \$dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; ?>" >> $config
grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "<?php \$dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; ?>" >> $config
#grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config

View File

@ -67,7 +67,7 @@ Programmo web, progettato per poter fornire solo ciò di
cui hai bisogno ed essere facile da usare.
#---- prep
#---- prepo
%prep
%setup -q
%patch0 -p0 -b .patch
@ -172,6 +172,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/blockedlog
%_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/bookcal
%_datadir/dolibarr/htdocs/bom
%_datadir/dolibarr/htdocs/categories
%_datadir/dolibarr/htdocs/collab
@ -281,7 +282,6 @@ if [ -s $config ] && grep -q "File generated by" $config
then
# File already exist. We add params not found.
echo Add new params to overwrite path to use shared libraries/fonts
grep -q -c "dolibarr_lib_ADODB_PATH" $config || [ ! -d "/usr/share/php/adodb" ] || echo "<?php \$dolibarr_lib_ADODB_PATH='/usr/share/php/adodb'; ?>" >> $config
grep -q -c "dolibarr_lib_FPDI_PATH" $config || [ ! -d "/usr/share/php/fpdi" ] || echo "<?php \$dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi'; ?>" >> $config
#grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config

View File

@ -20,7 +20,6 @@ $force_install_lockinstall='444';
$force_install_distrib='rpmfedora';
// Value to overwrite path to use shared libraries/fonts instead of embedded one
$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';
//$force_dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi';
//$force_dolibarr_lib_GEOIP_PATH='';
$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap';

View File

@ -20,7 +20,6 @@ $force_install_lockinstall='444';
$force_install_distrib='rpmmandriva';
// Value to overwrite path to use shared libraries/fonts instead of embedded one
$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';
//$force_dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi';
//$force_dolibarr_lib_GEOIP_PATH='';
$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap';

View File

@ -20,7 +20,6 @@ $force_install_lockinstall='444';
$force_install_distrib='rpmopensuse';
// Value to overwrite path to use shared libraries/fonts instead of embedded one
//$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';
//$force_dolibarr_lib_FPDI_PATH='/usr/share/php/fpdi';
//$force_dolibarr_lib_GEOIP_PATH='';
//$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap';

View File

@ -283,6 +283,9 @@ RESTLER:
elseif (count($value) && isset($value[0]) && is_numeric($value[0]))
* Add CommentParser.php line 406 & 407 to remove a warning on api request in php 8.1
empty($value[0]) ? null :
empty($value[1]) ? null :
+With swagger 2 provided into /explorer:
----------------------------------------

View File

@ -1,28 +1,29 @@
# ldapsearch_sample1.txt
# ldapsearch is into package ldap-utils on debian.
#
# Use this sample to search into a ldap
# Use this samples to test a ldap_bind or to make a search into a ldap
#
# Anonymous access
# ldapsearch -h hostname -p 389
# ldapsearch -h hostname -p 389
#
# Login access (using a Bind DN)
# ldapsearch -h hostname -p 389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password
# ldapsearch -H ldap://hostname:389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password
# ldapsearch -d1 -H ldap://hostname:389 -x -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password
# ldapsearch -H ldap://hostname:389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password
# Such access must succeed to use LDAP as login module.
# ldapsearch -h hostname -p 389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password
# ldapsearch -H ldap://hostname:389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password
# ldapsearch -d1 -H ldap://hostname:389 -x -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password
# ldapsearch -H ldap://hostname:389 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password
#
# Login access in SSL (using a Bind DN)
# ldapsearch -H ldaps://hostnamme:636 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -b "cn=users,dc=ldap,dc=test,dc=local
# ldapsearch -H ldaps://hostnamme:636 -z 0 -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -b "cn=users,dc=ldap,dc=test,dc=local"
# If it fails, you may try to use "hostname" that is real name of certificate.
# You must also check that /etc/ldap/ldap.conf contains the line TLS_CACERT /etc/ssl/certs/ca-certificates.crt
# What to search
# ldapsearch -h hostname -p 389 -x -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -b "cn=users,dc=ldap,dc=test,dc=local"
# ldapsearch -h hostname -p 389 -x -D "cn=manager,o=somecompany.com" -w password -b "ou=people,dc=teclib,dc=infra"
# ldapsearch -h hostname -p 389 -x -D "cn=manager,o=somecompany.com" -w password -b "o=somecompany.com" "(objectclass=*)"
# ldapsearch -h hostname -p 389 -x -D "uid=root,cn=users,dc=ldap,dc=test,dc=local" -w password -b "cn=users,dc=ldap,dc=test,dc=local"
# ldapsearch -h hostname -p 389 -x -D "cn=manager,o=somecompany.com" -w password -b "ou=people,dc=teclib,dc=infra"
# ldapsearch -h hostname -p 389 -x -D "cn=manager,o=somecompany.com" -w password -b "o=somecompany.com" "(objectclass=*)"
#
# Example to test a ldap search:
# ldapsearch -h hostname -p 389 -x -z 5 -b 'OU=Collaborateurs,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -D 'CN=UserAdmin,OU=Informatique,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -w password
# ldapsearch -h hostname -p 389 -x -z 5 -b 'OU=Collaborateurs,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -D 'CN=UserAdmin,OU=Informatique,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -w password

View File

@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => {
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 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 need to complete. You can also register middleware to control this.
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',
};
@ -84,7 +84,7 @@ const getFallbackRealAction = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module;
// 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));

View File

@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => {
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 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 need to complete. You can also register middleware to control this.
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',
};
@ -76,7 +76,7 @@ const getFallbackRealContact = (z, bundle) => {
// const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process.
// 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));
@ -94,7 +94,7 @@ const getFallbackRealContact = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module;
// 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));

View File

@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => {
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 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 need to complete. You can also register middleware to control this.
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',
};
@ -76,7 +76,7 @@ const getFallbackRealMember = (z, bundle) => {
// const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process.
// 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));
@ -94,7 +94,7 @@ const getFallbackRealMember = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module;
// 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));

View File

@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => {
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 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 need to complete. You can also register middleware to control this.
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',
};
@ -74,7 +74,7 @@ const getFallbackRealOrder = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module;
// 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));

View File

@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => {
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 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 need to complete. You can also register middleware to control this.
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',
};
@ -83,7 +83,7 @@ const getFallbackRealThirdparty = (z, bundle) => {
// const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process.
// 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));
@ -102,7 +102,7 @@ const getFallbackRealThirdparty = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module;
// 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));

View File

@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => {
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 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 need to complete. You can also register middleware to control this.
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',
};
@ -76,7 +76,7 @@ const getFallbackRealTicket = (z, bundle) => {
// const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process.
// 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));
@ -97,7 +97,7 @@ const getFallbackRealTicket = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module;
// 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));

View File

@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => {
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 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 need to complete. You can also register middleware to control this.
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',
};
@ -73,7 +73,7 @@ const getFallbackRealUser = (z, bundle) => {
// const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process.
// 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));
@ -93,7 +93,7 @@ const getFallbackRealUser = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module;
// 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));

View File

@ -152,7 +152,7 @@ $user->rights->propal->creer=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";
}

View File

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

File diff suppressed because one or more lines are too long

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
Et ça marche à linverse avec un fournisseur sauf que lon 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
(fr) TVA = Taxe sur la Valeur Ajouté
(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

@ -3,7 +3,14 @@
#php_admin_value mail.force_extra_parameters "-f postmaster@mydomain.com"
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com"
php_admin_value open_basedir /tmp/:/home/.../htdocs:/home/.../dolibarr_documents:
# Add this to use a custom apparmor profile when using apache php handler
<IfModule mod_apparmor.c>
AADefaultHatName sellyoursaas-instances
</IfModule>
ServerName myvirtualalias
ServerAlias myvirtualalias
@ -82,9 +89,9 @@
# /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
# If both key and certificate are stored in the same file, only the
# SSLCertificateFile directive is needed.
SSLCertificateFile /etc/letsencrypt/live/www.mydomain.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.mydomain.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/www.mydomain.com/chain.pem
#SSLCertificateFile /etc/letsencrypt/live/www.mydomain.com/cert.pem
#SSLCertificateKeyFile /etc/letsencrypt/live/www.mydomain.com/privkey.pem
#SSLCertificateChainFile /etc/letsencrypt/live/www.mydomain.com/chain.pem
#RewriteEngine on
#RewriteCond %{SERVER_PORT} ^80$

View File

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

View File

@ -0,0 +1,19 @@
# Fail2Ban configuration file
#
# Regexp to detect forbidden access on pages (public or not) so we can add mitigation on IP making too much
# access to your a Dolibarr instance.
[Definition]
# To test, you can inject this example into log
# echo `myvirtualhost.com:443 1.2.3.4 - - [15/Dec/2022:09:57:47 +0000] "GET /public/abc" 403 123 "-" "Mozilla" >> /var/log/apache2/access.log
#
# then
# fail2ban-client status web-accesslog-limit403
#
# To test rule file on a existing log file
# fail2ban-regex /var/log/apache2/access.log /etc/fail2ban/filter.d/web-accesslog-limit403.conf
failregex = <HOST> - - .*HTTP/[0-9]+(.[0-9]+)?" 403
ignoreregex =

View File

@ -0,0 +1,19 @@
# Fail2Ban configuration file
#
# Regexp to detect access on public pages so we can add mitigation on IP making too much
# access to your a Dolibarr instance.
[Definition]
# To test, you can inject this example into log
# echo `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-dolibarr-limitpublic
#
# To test rule file on a existing log file
# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-limitpublic.conf
failregex = ^ [A-Z\s]+ <HOST>\s+--- Access to .*/public/
ignoreregex =

View File

@ -1,8 +1,7 @@
# 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.
# Regexp to detect try to check a couple login/password so we can add mitigation
# on IP making too much tries.
[Definition]
@ -11,7 +10,7 @@
# echo `date +'%Y-%m-%d %H:%M:%S'`" INFO 1.2.3.4 functions_dolibarr::check_user_password_abcd Authentication KO" >> /mypath/documents/dolibarr.log
#
# then
# fail2ban-client status web-dol-bruteforce
# fail2ban-client status web-dolibarr-rulesbruteforce
#
# To test rule file on a existing log file
# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf

View File

@ -1,8 +1,7 @@
# 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.
# Regexp to detect access on passwordforgotten.php page so we can add mitigation on IP making too much
# access to this Dolibarr page.
[Definition]
@ -11,7 +10,7 @@
# echo `date +'%Y-%m-%d %H:%M:%S'`" INFO 1.2.3.4 --- Access to GET /passwordforgotten.php - action=buildnewpassword, massaction=" >> /mypath/documents/dolibarr.log
#
# then
# fail2ban-client status web-dol-passforgotten
# fail2ban-client status web-dolibarr-rulespassforgotten
#
# To test rule file on a existing log file
# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf

View File

@ -8,21 +8,35 @@
enabled = true
port = http,https
filter = web-dolibarr-rulespassforgotten
logpath = >> /mypath/documents/documents/dolibarr.log
logpath = /mypath/documents/documents/dolibarr.log
action = %(action_mw)s
bantime = 4320000 ; 50 days
findtime = 86400 ; 1 day
maxretry = 10
[web-dol-bruteforce]
; rule against bruteforce hacking (login + api)
enabled = true
port = http,https
filter = web-dolibarr-rulesbruteforce
logpath = >> /mypath/documents/documents/dolibarr.log
logpath = /mypath/documents/documents/dolibarr.log
action = %(action_mw)s
bantime = 86400 ; 1 day
findtime = 3600 ; 1 hour
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

@ -487,7 +487,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
$pkey = $line;
$linenumber ++;
if (! empty($lines[$linenumber])) {
if (!empty($lines[$linenumber])) {
$line = $lines[$linenumber];
} else {
$line = '';
@ -517,7 +517,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
if (substr($line, 0, 12) == "CREATE INDEX") {
$matches = array();
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];
$tablename = str_replace('public.', '', $matches[2]);
$columns = $matches[3];
@ -529,7 +529,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
if (substr($line, 0, 19) == "CREATE UNIQUE INDEX") {
$matches = array();
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];
$tablename = str_replace('public.', '', $matches[2]);
$columns = str_replace('"', '', $matches[3]);

View File

@ -1,5 +1,8 @@
#!/bin/sh
#
# Count number of different contributors and number of commits for a given year.
#
if [ "x$1" = "x" ]; then
echo "Usage: $0 YEAR"
exit

View File

@ -1,6 +1,10 @@
#/bin/bash
Releases=("3.8" "3.9" "4.0" "5.0" "6.0" " 7.0" "develop")
Dates=("2013-01-01", "2014-01-01", "2015-01-01", "2016-07-01", "2017-02-01", "2017-07-01", "2018-02-01", "2050-01-01")
#
# Count number of commits per user and per versions (using date for version detection)
#
Releases=("16.0" "develop")
Dates=("2022-01-01" "2022-08-31" "2050-01-01")
let "counter = 1"
for i in "${Releases[@]}"

View File

@ -0,0 +1,16 @@
#/bin/bash
#
# Count number of lines modified per user for a given branch
#
if [ "x$2" = "x" ]; then
echo "Usage: $0 tagnamestart|START tagnameend|HEAD"
exit
fi
echo "git log $1..$2 --shortstat | grep ... | perl ... > /tmp/github_lines_perusers.tmp"
git log $1..$2 --shortstat | grep -e 'Author:' -e 'Date:' -e ' changed' -e ' insertion' -e ' deletion' | perl -n -e '/^(.*)$/; $line = $1; if ($line =~ /(changed|insertion|deletion)/) { $line =~ s/[^0-9\s]//g; my @arr=split /\s+/, $line; $tot=0; for (1..@arr) { $tot += $arr[$_]; }; print $tot."\n"; } else { print $line."\n"; };' > /tmp/github_lines_perusers.tmp
cat /tmp/github_lines_perusers.tmp | awk 'BEGIN { FS="\n"; print "user and nb of lines"; lastuser=""; } { if ($1 ~ /Author:/) { lastuser=$1 }; if ($1 ~ /^[0-9]+$/) { aaa[lastuser]+=$1; } } END { for (var in aaa) print var," ",aaa[var]; } '

View File

@ -121,9 +121,11 @@ main()
# Search of all jpg/jpeg/png in $INPUT
# We remove images from $OUTPUT if $OUTPUT is a subdirectory of $INPUT
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 $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/' | grep -v '/documents/' | 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
echo --- Optimizing $INPUT ---
echo

View File

@ -1,5 +1,4 @@
<?php
/*spl_autoload_register(function ($class_name) {
//var_dump('class='.$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
$tmp=explode('_', $src_lang);
if (! empty($tmp[1]) && $tmp[0] == $tmp[1]) {
if (!empty($tmp[1]) && $tmp[0] == $tmp[1]) {
$src_lang=$tmp[0];
}
$tmp=explode('_', $dest_lang);
if (! empty($tmp[1]) && $tmp[0] == $tmp[1]) {
if (!empty($tmp[1]) && $tmp[0] == $tmp[1]) {
$dest_lang=$tmp[0];
}
@ -349,7 +349,7 @@ class autoTranslator
// now, process the JSON string
$json = json_decode($body, true);
if ((! empty($json['responseStatus']) && $json['responseStatus'] != 200)
if ((!empty($json['responseStatus']) && $json['responseStatus'] != 200)
|| count($json['data']['translations']) == 0) {
print "Error: ".$json['responseStatus']." ".$url."\n";
return false;

View File

@ -221,7 +221,7 @@ foreach ($dups as $string => $pages) {
// Loop on each line keword was found into file.
$listoffilesforthisentry=array();
foreach ($lines as $line => $translatedvalue) {
if (! empty($listoffilesforthisentry[$file])) {
if (!empty($listoffilesforthisentry[$file])) {
$duplicateinsamefile=1;
}
$listoffilesforthisentry[$file]=1;
@ -300,7 +300,7 @@ if ($web) {
// 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";
$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
// so we keep it.
if ((! empty($aSecondary[$key]) && $aSecondary[$key] != $aPrimary[$key]
&& ! empty($aEnglish[$key]) && $aSecondary[$key] != $aEnglish[$key])
if ((!empty($aSecondary[$key]) && $aSecondary[$key] != $aPrimary[$key]
&& !empty($aEnglish[$key]) && $aSecondary[$key] != $aEnglish[$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";

View File

@ -23,6 +23,7 @@
* \brief List accounting account
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.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';
// Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "admin", "accountancy", "salaries"));
$langs->loadLangs(array('accountancy', 'admin', 'bills', 'compta', 'salaries'));
$mesg = '';
$action = GETPOST('action', 'aZ09');
@ -52,14 +53,14 @@ $confirm = GETPOST('confirm', 'alpha');
$chartofaccounts = GETPOST('chartofaccounts', 'int');
$permissiontoadd = !empty($user->rights->accounting->chartofaccount);
$permissiontodelete = !empty($user->rights->accounting->chartofaccount);
$permissiontoadd = $user->hasRight('accounting', 'chartofaccount');
$permissiontodelete = $user->hasRight('accounting', 'chartofaccount');
// Security check
if ($user->socid > 0) {
accessforbidden();
}
if (empty($user->rights->accounting->chartofaccount)) {
if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden();
}
@ -97,6 +98,9 @@ if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
$accounting = new AccountingAccount($db);
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('accountancyadminaccount'));
/*
* Actions
@ -109,8 +113,8 @@ if (!GETPOST('confirmmassaction', 'alpha')) {
$massaction = '';
}
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been monowraponalldified by some hooks
$parameters = array('chartofaccounts' => $chartofaccounts, 'permissiontoadd' => $permissiontoadd, 'permissiontodelete' => $permissiontodelete);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $accounting, $action); // Note that $action and $object may have been monowraponalldified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
@ -294,7 +298,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
}
// 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");
}
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 '<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>';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
@ -590,7 +599,7 @@ if ($resql) {
// Action
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 img_edit();
print '</a>';

View File

@ -32,6 +32,7 @@
* \brief Page to administer model of chart of accounts
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
@ -44,7 +45,7 @@ if (isModEnabled('accounting')) {
}
// 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';
$confirm = GETPOST('confirm', 'alpha');
@ -78,7 +79,7 @@ $search_country_id = GETPOST('search_country_id', 'int');
if ($user->socid > 0) {
accessforbidden();
}
if (empty($user->rights->accounting->chartofaccount)) {
if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden();
}

View File

@ -23,6 +23,7 @@
* \brief Card of accounting account
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.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;
// Load translation files required by the page
$langs->loadLangs(array("bills", "accountancy", "compta"));
$langs->loadLangs(array('accountancy', 'bills', 'compta'));
$action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
@ -48,7 +49,7 @@ $label = GETPOST('label', 'alpha');
if ($user->socid > 0) {
accessforbidden();
}
if (empty($user->rights->accounting->chartofaccount)) {
if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden();
}
@ -66,7 +67,7 @@ if (GETPOST('cancel', 'alpha')) {
exit;
}
if ($action == 'add' && $user->rights->accounting->chartofaccount) {
if ($action == 'add' && $user->hasRight('accounting', 'chartofaccount')) {
if (!$cancel) {
if (!$account_number) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors');
@ -84,7 +85,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) {
// Clean code
// To manage zero or not at the end of the accounting account
if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1) {
if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
$account_number = $account_number;
} else {
$account_number = clean_account($account_number);
@ -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 (!$account_number) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors');
@ -147,7 +148,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) {
// Clean code
// To manage zero or not at the end of the accounting account
if (isset($conf->global->ACCOUNTING_MANAGE_ZERO) && $conf->global->ACCOUNTING_MANAGE_ZERO == 1) {
if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
$account_number = $account_number;
} else {
$account_number = clean_account($account_number);
@ -184,7 +185,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) {
header("Location: ".$urltogo);
exit();
}
} elseif ($action == 'delete' && $user->rights->accounting->chartofaccount) {
} elseif ($action == 'delete' && $user->hasRight('accounting', 'chartofaccount')) {
$result = $object->fetch($id);
if (!empty($object->id)) {
@ -419,17 +420,15 @@ if ($action == 'create') {
*/
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>';
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
}
if (!empty($user->rights->accounting->chartofaccount)) {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans('Delete').'</a>';
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';
}
// Delete
$permissiontodelete = $user->hasRight('accounting', 'chartofaccount');
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
print '</div>';
}

View File

@ -22,6 +22,7 @@
* \brief Page to assign mass categories to accounts
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php';
@ -44,7 +45,7 @@ if ($cat_id == 0) {
}
// Security check
if (empty($user->rights->accounting->chartofaccount)) {
if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden();
}

View File

@ -22,6 +22,7 @@
* \brief Page to administer data tables
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.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');
// Security access
if (empty($user->rights->accounting->chartofaccount)) {
if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden();
}

View File

@ -22,6 +22,7 @@
* \brief Setup page to configure accounting expert module
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -31,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
$langs->loadLangs(array("compta", "admin", "accountancy"));
// Security check
if (empty($user->rights->accounting->chartofaccount)) {
if (!$user->hasRight('accounting', 'chartofaccount')) {
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"));
// Security check
if (empty($user->rights->accounting->chartofaccount)) {
if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden();
}
@ -133,6 +133,12 @@ if ($action == 'update') {
$error++;
}
$constname = 'ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT';
$constvalue = GETPOST($constname, 'int');
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
if (!$error) {
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
@ -281,6 +301,33 @@ if (isModEnabled('societe') && getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_D
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 "</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"));
// Security access
if (empty($user->rights->accounting->chartofaccount)) {
if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden();
}

View File

@ -21,6 +21,7 @@
* \brief Setup page to configure fiscal year
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php';
@ -52,7 +53,7 @@ $langs->loadLangs(array("admin", "compta"));
if ($user->socid > 0) {
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();
}
@ -121,7 +122,7 @@ if ($result) {
$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');

View File

@ -22,6 +22,7 @@
* \brief Page to show a fiscal year
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fiscalyear.lib.php';
@ -34,7 +35,7 @@ $langs->loadLangs(array("admin", "compta"));
if ($user->socid > 0) {
accessforbidden();
}
if (empty($user->rights->accounting->fiscalyear->write)) {
if (!$user->hasRight('accounting', 'fiscalyear', 'write')) {
accessforbidden();
}
@ -299,12 +300,12 @@ if ($action == 'create') {
/*
* Action bar
*/
if (!empty($user->rights->accounting->fiscalyear->write)) {
if ($user->hasRight('accounting', 'fiscalyear', 'write')) {
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="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>';
}

View File

@ -21,6 +21,7 @@
* \brief Page to show info of a fiscal year
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fiscalyear.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) {
accessforbidden();
}
if (empty($user->rights->accounting->fiscalyear->write)) {
if (!$user->hasRight('accounting', 'fiscalyear', 'write')) {
accessforbidden();
}

View File

@ -29,6 +29,7 @@
* \brief Setup page to configure accounting expert module
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/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"));
// Security access
if (empty($user->rights->accounting->chartofaccount)) {
if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden();
}
@ -246,6 +247,20 @@ if ($action == 'setdisablebindingonexpensereports') {
}
}
if ($action == 'setenablelettering') {
$setenablelettering = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_LETTERING", $setenablelettering, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
/*
* View
@ -465,6 +480,27 @@ print '</tr>';
print '</table>';
// Lettering params
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans('Options').' '.$langs->trans('Lettering').'</td>';
print "</tr>\n";
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_ENABLE_LETTERING").'</td>';
if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
print '</table>';
print '<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans('Modify').'"></div>';
print '</form>';

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
}
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.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');
// Security access
if (empty($user->rights->accounting->chartofaccount)) {
if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden();
}
@ -610,12 +611,6 @@ if ($id) {
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
$iserasable = 0;
$canbedisabled = 0;
} elseif ($obj->code == 'RECEP') {
$iserasable = 0;
$canbedisabled = 0;
} elseif ($obj->code == 'EF0') {
$iserasable = 0;
$canbedisabled = 0;
}
}

View File

@ -45,7 +45,7 @@ $langs->loadLangs(array("companies", "compta", "accountancy", "products"));
if (!isModEnabled('accounting')) {
accessforbidden();
}
if (empty($user->rights->accounting->bind->write)) {
if (!$user->hasRight('accounting', 'bind', 'write')) {
accessforbidden();
}
@ -522,7 +522,7 @@ if ($resql) {
// Filter on categories
$moreforfilter = '';
if (isModEnabled('categorie') && $user->rights->categorie->lire) {
if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedwidth"');
$categoriesProductArr = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', '', 64, 0, 1);

View File

@ -23,6 +23,7 @@
* \brief List of accounting sub-account (auxiliary accounts)
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.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) {
accessforbidden();
}
if (empty($user->rights->accounting->chartofaccount)) {
if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden();
}

View File

@ -24,6 +24,7 @@
* \brief Balance of book keeping
*/
// Load Dolibarr environment
require '../../main.inc.php';
// Class
@ -149,7 +150,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) {
accessforbidden();
}
if (empty($user->rights->accounting->mouvements->lire)) {
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden();
}
@ -503,6 +504,10 @@ if ($action != 'export_csv') {
print "<td></td>\n";
print '</tr>';
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>";
print '</form>';
}

View File

@ -25,6 +25,7 @@
* \brief Page to show book-entry
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
@ -85,7 +86,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) {
accessforbidden();
}
if (empty($user->rights->accounting->mouvements->lire)) {
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden();
}
@ -332,7 +333,9 @@ if ($action == 'valid') {
$html = new Form($db);
$formaccounting = new FormAccounting($db);
llxHeader('', $langs->trans("CreateMvts"));
$title = $langs->trans("CreateMvts");
llxHeader('', $title);
// Confirmation to delete the command
if ($action == 'delete') {
@ -341,7 +344,7 @@ if ($action == 'delete') {
}
if ($action == 'create') {
print load_fiche_titre($langs->trans("CreateMvts"));
print load_fiche_titre($title);
$object = new BookKeeping($db);
$next_num_mvt = $object->getNextNumMvt('_tmp');
@ -614,6 +617,7 @@ if ($action == 'create') {
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
// List of movements
print load_fiche_titre($langs->trans("ListeMvts"), '', '');
print '<form action="'.$_SERVER["PHP_SELF"].'?piece_num='.$object->piece_num.'" method="post">';
@ -641,8 +645,8 @@ if ($action == 'create') {
print_liste_field_titre("AccountAccountingShort");
print_liste_field_titre("SubledgerAccount");
print_liste_field_titre("LabelOperation");
print_liste_field_titre("Debit", "", "", "", "", 'class="right"');
print_liste_field_titre("Credit", "", "", "", "", 'class="right"');
print_liste_field_titre("AccountingDebit", "", "", "", "", 'class="right"');
print_liste_field_titre("AccountingCredit", "", "", "", "", 'class="right"');
if (empty($object->date_validation)) {
print_liste_field_titre("Action", "", "", "", "", 'width="60"', "", "", 'center ');
} else {
@ -661,14 +665,14 @@ if ($action == 'create') {
}
foreach ($object->linesmvt as $line) {
print '<tr class="oddeven">';
print '<tr class="oddeven" data-lineid="'.((int) $line->id).'">';
$total_debit += $line->debit;
$total_credit += $line->credit;
if ($action == 'update' && $line->id == $id) {
print '<!-- td columns in edit mode -->';
print '<td>';
print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, '');
print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500');
print '</td>';
print '<td>';
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because:
@ -694,7 +698,7 @@ if ($action == 'create') {
if ($action == "" || $action == 'add') {
print '<!-- td columns in add mode -->';
print '<td>';
print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, '');
print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500');
print '</td>';
print '<td>';
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because:
@ -711,7 +715,7 @@ if ($action == 'create') {
print '<td><input type="text" class="minwidth200" name="label_operation" value="' . $label_operation . '"/></td>';
print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>';
print '<td class="right"><input type="text" size="6" class="right" name="credit" value=""/></td>';
print '<td class="center"><input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '"></td>';
print '<td class="center"><input type="submit" class="button small" name="save" value="' . $langs->trans("Add") . '"></td>';
}
} else {
print '<!-- td columns in display mode -->';
@ -729,8 +733,8 @@ if ($action == 'create') {
}
print '</td>';
print '<td>'.$line->label_operation.'</td>';
print '<td class="right nowraponall amount">'.price($line->debit).'</td>';
print '<td class="right nowraponall amount">'.price($line->credit).'</td>';
print '<td class="right nowraponall amount">'.($line->debit != 0 ? price($line->debit) : '').'</td>';
print '<td class="right nowraponall amount">'.($line->credit != 0 ? price($line->credit) : '').'</td>';
print '<td class="center nowraponall">';
if (empty($line->date_export) && empty($line->date_validation)) {

View File

@ -25,6 +25,7 @@
* \brief List operation of book keeping
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -154,7 +155,7 @@ $hookmanager->initHooks(array('bookkeepinglist'));
$formaccounting = new FormAccounting($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')) {
$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";
@ -191,8 +192,8 @@ $arrayfields = array(
't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1),
't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.debit'=>array('label'=>$langs->trans("AccountingDebit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("AccountingCredit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
@ -220,7 +221,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) {
accessforbidden();
}
if (empty($user->rights->accounting->mouvements->lire)) {
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden();
}
@ -234,7 +235,7 @@ $param = '';
if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunlettering' && $massaction != 'predeletebookkeepingwriting') {
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunletteringauto' && $massaction != 'preunletteringmanual' && $massaction != 'predeletebookkeepingwriting') {
$massaction = '';
}
@ -437,7 +438,7 @@ if (empty($reshook)) {
$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');
// $delyear = GETPOST('delyear', 'int');
// if ($delyear == -1) {
@ -483,50 +484,67 @@ if (empty($reshook)) {
// Mass actions
$objectclass = 'Bookkeeping';
$objectlabel = 'Bookkeeping';
$permissiontoread = $user->rights->societe->lire;
$permissiontodelete = $user->rights->societe->supprimer;
$permissiontoread = $user->hasRight('societe', 'lire');
$permissiontodelete = $user->hasRight('societe', 'supprimer');
$permissiontoadd = $user->rights->societe->creer;
$uploaddir = $conf->societe->dir_output;
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;
foreach ($toselect as $toselectid) {
$result = $object->fetch($toselectid);
if ($result > 0 && (!isset($object->date_validation) || $object->date_validation === '')) {
$result = $object->deleteMvtNum($object->piece_num);
if ($result > 0) {
$nbok++;
} else {
if (!$error) {
foreach ($toselect as $toselectid) {
$result = $object->fetch($toselectid);
if ($result > 0 && (!isset($object->date_validation) || $object->date_validation === '')) {
$result = $object->deleteMvtNum($object->piece_num);
if ($result > 0) {
$nbok++;
} else {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
break;
}
} elseif ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
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) {
$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 : ''));
exit;
} else {
$db->rollback();
}
}
// others mass actions
if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->rights->accounting->mouvements->creer) {
if ($massaction == 'lettering') {
if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
if ($massaction == 'letteringauto') {
$lettering = new Lettering($db);
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect);
if ($nb_lettering < 0) {
@ -547,7 +565,17 @@ if (empty($reshook)) {
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
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);
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true);
if ($nb_lettering < 0) {
@ -568,6 +596,16 @@ if (empty($reshook)) {
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
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();
}
}
}
}
@ -655,22 +693,40 @@ if (!empty($sortfield)) {
// Export into a file with format defined into setup (FEC, CSV, ...)
// Must be after definition of $sql
if ($action == 'export_fileconfirm' && $user->rights->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.
if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements', 'export')) {
// 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));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
// Export files
// Export files then exit
$accountancyexport = new AccountancyExport($db);
$notexportlettering = GETPOST('notexportlettering', 'alpha');
if (!empty($notexportlettering)) {
if (is_array($object->lines)) {
foreach ($object->lines as $k => $movement) {
unset($object->lines[$k]->lettering_code);
unset($object->lines[$k]->date_lettering);
}
}
}
$mimetype = $accountancyexport->getMimeType($formatexportset);
top_httphead($mimetype, 1);
// Output data on screen
$accountancyexport->export($object->lines, $formatexportset);
$notifiedexportdate = GETPOST('notifiedexportdate', 'alpha');
$notifiedvalidationdate = GETPOST('notifiedvalidationdate', 'alpha');
if (!empty($accountancyexport->errors)) {
setEventMessages('', $accountancyexport->errors, 'errors');
dol_print_error('', '', $accountancyexport->errors);
} elseif (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) {
// Specify as export : update field date_export or date_validated
$error = 0;
@ -704,11 +760,10 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex
if (!$error) {
$db->commit();
// setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExportedOrValidated"), null, 'mesgs');
} else {
$error++;
$db->rollback();
setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated"), null, 'errors');
dol_print_error('', $langs->trans("NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated"));
}
}
exit;
@ -762,6 +817,19 @@ $formconfirm = '';
if ($action == 'export_file') {
$form_question = array();
if (getDolGlobalInt("ACCOUNTING_ENABLE_LETTERING")) {
// If 1, we check by default.
$checked = !empty($conf->global->ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING) ? 'true' : 'false';
$form_question['notexportlettering'] = array(
'name' => 'notexportlettering',
'type' => 'checkbox',
'label' => $langs->trans('NotExportLettering'),
'value' => $checked,
);
$form_question['separator'] = array('name'=>'separator', 'type'=>'separator');
}
// If 1 or not set, we check by default.
$checked = (!isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) || !empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE));
$form_question['notifiedexportdate'] = array(
@ -771,7 +839,7 @@ if ($action == 'export_file') {
'value' => (!empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) ? 'false' : 'true'),
);
$form_question['separator'] = array('name'=>'separator', 'type'=>'separator');
$form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator');
if (!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) {
// If 0 or not set, we NOT check by default.
@ -783,10 +851,10 @@ if ($action == 'export_file') {
'value' => $checked,
);
$form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator');
$form_question['separator3'] = array('name'=>'separator3', 'type'=>'separator');
}
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 300, 600);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 350, 600);
}
//if ($action == 'delbookkeepingyear') {
@ -843,16 +911,16 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
// List of mass actions available
$arrayofmassactions = array();
/*
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->rights->accounting->mouvements->creer) {
$arrayofmassactions['lettering'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('Lettering');
$arrayofmassactions['preunlettering'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('Unlettering');
$arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto');
$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");
}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('preunlettering', 'predeletebookkeepingwriting'))) {
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('preunletteringauto', 'preunletteringmanual', 'predeletebookkeepingwriting'))) {
$arrayofmassactions = array();
}
$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
@ -891,8 +959,8 @@ if (empty($reshook)) {
}
$newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>';
if (!empty($user->rights->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);
if ($user->hasRight('accounting', 'mouvements', 'export')) {
$newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : ''), $user->hasRight('accounting', 'mouvements', 'export'));
}
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
@ -903,13 +971,15 @@ if (empty($reshook)) {
if (!empty($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);
if ($massaction == 'preunlettering') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnlettering"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unlettering", null, '', 0, 200, 500, 1);
if ($massaction == 'preunletteringauto') {
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') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeleteBookkeepingWriting"), $langs->trans("ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)), "deletebookkeepingwriting", null, '', 0, 200, 500, 1);
}
@ -929,7 +999,7 @@ if ($massactionbutton && $contextpage != 'poslist') {
$moreforfilter = '';
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$moreforfilter .= $hookmanager->resPrint;
} else {
@ -941,7 +1011,13 @@ print '<table class="tagtable liste centpercent">';
// Filters lines
print '<tr class="liste_titre_filter">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre center">';
$searchpicto = $form->showFilterButtons('left');
print $searchpicto;
print '</td>';
}
// Movement number
if (!empty($arrayfields['t.piece_num']['checked'])) {
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
@ -949,7 +1025,7 @@ if (!empty($arrayfields['t.piece_num']['checked'])) {
// Code journal
if (!empty($arrayfields['t.code_journal']['checked'])) {
print '<td class="liste_titre center">';
print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1, 'small maxwidth150');
print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1, 'small maxwidth75');
print '</td>';
}
// Date document
@ -992,14 +1068,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 '</div>';
} 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>';
}
// Label operation
if (!empty($arrayfields['t.label_operation']['checked'])) {
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>';
}
// Debit
@ -1017,7 +1093,7 @@ if (!empty($arrayfields['t.credit']['checked'])) {
// Lettering code
if (!empty($arrayfields['t.lettering_code']['checked'])) {
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 '</td>';
}
@ -1077,13 +1153,18 @@ if (!empty($arrayfields['t.import_key']['checked'])) {
print '</td>';
}
// Action column
print '<td class="liste_titre center">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre center">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
}
print "</tr>\n";
print '<tr class="liste_titre">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
}
if (!empty($arrayfields['t.piece_num']['checked'])) {
print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
}
@ -1125,15 +1206,17 @@ if (!empty($arrayfields['t.tms']['checked'])) {
print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, '', $sortfield, $sortorder, 'center ');
}
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'])) {
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'])) {
print_liste_field_titre($arrayfields['t.import_key']['label'], $_SERVER["PHP_SELF"], "t.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
}
print "</tr>\n";
@ -1143,10 +1226,10 @@ $line = new BookKeepingLine();
// --------------------------------------------------------------------
$i = 0;
$totalarray = array();
$totalarray['val'] = array ();
$totalarray['nbfield'] = 0;
$total_debit = 0;
$total_credit = 0;
$totalarray['val'] = array ();
$totalarray['val']['totaldebit'] = 0;
$totalarray['val']['totalcredit'] = 0;
@ -1188,6 +1271,18 @@ while ($i < min($num, $limit)) {
$total_credit += $line->credit;
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowraponall center">';
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($line->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$line->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.'"'.($selected ? ' checked="checked"' : '').' />';
}
print '</td>';
}
// Piece number
if (!empty($arrayfields['t.piece_num']['checked'])) {
@ -1392,15 +1487,17 @@ while ($i < min($num, $limit)) {
}
// Action column
print '<td class="nowraponall center">';
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($line->id, $arrayofselected)) {
$selected = 1;
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowraponall center">';
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($line->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$line->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.'"'.($selected ? ' checked="checked"' : '').' />';
}
print '<input id="cb'.$line->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.'"'.($selected ? ' checked="checked"' : '').' />';
print '</td>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
@ -1415,6 +1512,10 @@ while ($i < min($num, $limit)) {
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>";
print '</div>';
@ -1429,4 +1530,5 @@ print '</form>';
// End of page
llxFooter();
$db->close();

View File

@ -25,6 +25,7 @@
* \brief List operation of ledger ordered by account number
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -162,8 +163,8 @@ $arrayfields = array(
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.debit'=>array('label'=>$langs->trans("AccountingDebit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("AccountingCredit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
@ -193,7 +194,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) {
accessforbidden();
}
if (empty($user->rights->accounting->mouvements->lire)) {
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden();
}
@ -208,7 +209,7 @@ if (GETPOST('cancel', 'alpha')) {
$action = 'list';
$massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunlettering' && $massaction != 'predeletebookkeepingwriting') {
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunletteringauto' && $massaction != 'preunletteringmanual' && $massaction != 'predeletebookkeepingwriting') {
$massaction = '';
}
@ -394,50 +395,67 @@ if (empty($reshook)) {
// Mass actions
$objectclass = 'Bookkeeping';
$objectlabel = 'Bookkeeping';
$permissiontoread = $user->rights->societe->lire;
$permissiontodelete = $user->rights->societe->supprimer;
$permissiontoread = $user->hasRight('societe', 'lire');
$permissiontodelete = $user->hasRight('societe', 'supprimer');
$permissiontoadd = $user->rights->societe->creer;
$uploaddir = $conf->societe->dir_output;
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;
foreach ($toselect as $toselectid) {
$result = $object->fetch($toselectid);
if ($result > 0 && (!isset($object->date_validation) || $object->date_validation === '')) {
$result = $object->deleteMvtNum($object->piece_num);
if ($result > 0) {
$nbok++;
} else {
if (!$error) {
foreach ($toselect as $toselectid) {
$result = $object->fetch($toselectid);
if ($result > 0 && (!isset($object->date_validation) || $object->date_validation === '')) {
$result = $object->deleteMvtNum($object->piece_num);
if ($result > 0) {
$nbok++;
} else {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
break;
}
} elseif ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
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) {
$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 : ''));
exit;
} else {
$db->rollback();
}
}
// others mass actions
if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->rights->accounting->mouvements->creer) {
if ($massaction == 'lettering') {
if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
if ($massaction == 'letteringauto') {
$lettering = new Lettering($db);
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect);
if ($nb_lettering < 0) {
@ -458,7 +476,17 @@ if (empty($reshook)) {
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
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);
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true);
if ($nb_lettering < 0) {
@ -479,6 +507,16 @@ if (empty($reshook)) {
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
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
$arrayofmassactions = array();
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->rights->accounting->mouvements->creer) {
$arrayofmassactions['lettering'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('Lettering');
$arrayofmassactions['preunlettering'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('Unlettering');
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
$arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto');
$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");
}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('preunlettering', 'predeletebookkeepingwriting'))) {
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('preunletteringauto', 'preunletteringmanual', 'predeletebookkeepingwriting'))) {
$arrayofmassactions = array();
}
$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
@ -631,8 +671,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);
if ($massaction == 'preunlettering') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnlettering"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unlettering", null, '', 0, 200, 500, 1);
if ($massaction == 'preunletteringauto') {
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') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeleteBookkeepingWriting"), $langs->trans("ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)), "deletebookkeepingwriting", null, '', 0, 200, 500, 1);
}
@ -650,7 +692,7 @@ if ($massaction == 'preunlettering') {
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
if ($massactionbutton && $contextpage != 'poslist') {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
}
@ -704,15 +746,21 @@ print '<table class="tagtable liste centpercent">';
// Filters lines
print '<tr class="liste_titre_filter">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre center">';
$searchpicto = $form->showFilterButtons('left');
print $searchpicto;
print '</td>';
}
// Movement number
if (!empty($arrayfields['t.piece_num']['checked'])) {
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
print '<td class="liste_titre"><input type="text" name="search_mvt_num" class="width50" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
}
// Code journal
if (!empty($arrayfields['t.code_journal']['checked'])) {
print '<td class="liste_titre center">';
print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1);
print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1, 'maxwidth75');
print '</td>';
}
// Date document
@ -783,15 +831,20 @@ $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // N
print $hookmanager->resPrint;
// Action column
print '<td class="liste_titre center">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre center">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
}
print "</tr>\n";
print '<tr class="liste_titre">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
}
if (!empty($arrayfields['t.piece_num']['checked'])) {
print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder, 'tdoverflowmax80imp ');
}
if (!empty($arrayfields['t.code_journal']['checked'])) {
print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
@ -827,7 +880,9 @@ if (!empty($arrayfields['t.import_key']['checked'])) {
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
}
print "</tr>\n";
$displayed_account_number = null; // Start with undefined to be able to distinguish with empty
@ -940,7 +995,18 @@ while ($i < min($num, $limit)) {
}
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowraponall center">';
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($line->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb' . $line->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $line->id . '"' . ($selected ? ' checked="checked"' : '') . ' />';
}
print '</td>';
}
// Piece number
if (!empty($arrayfields['t.piece_num']['checked'])) {
print '<td>';
@ -958,7 +1024,7 @@ while ($i < min($num, $limit)) {
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $line->code_journal);
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
print '<td class="center">'.$journaltoshow.'</td>';
print '<td class="center tdoverflowmax80">'.$journaltoshow.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
@ -1054,7 +1120,7 @@ while ($i < min($num, $limit)) {
// Amount debit
if (!empty($arrayfields['t.debit']['checked'])) {
print '<td class="right nowraponall amount">'.($line->debit ? price($line->debit) : '').'</td>';
print '<td class="right nowraponall amount">'.($line->debit != 0 ? price($line->debit) : '').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
@ -1066,7 +1132,7 @@ while ($i < min($num, $limit)) {
// Amount credit
if (!empty($arrayfields['t.credit']['checked'])) {
print '<td class="right nowraponall amount">'.($line->credit ? price($line->credit) : '').'</td>';
print '<td class="right nowraponall amount">'.($line->credit != 0 ? price($line->credit) : '').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
@ -1113,15 +1179,17 @@ while ($i < min($num, $limit)) {
print $hookmanager->resPrint;
// Action column
print '<td class="nowraponall center">';
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($line->id, $arrayofselected)) {
$selected = 1;
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowraponall center">';
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($line->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb' . $line->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $line->id . '"' . ($selected ? ' checked="checked"' : '') . ' />';
}
print '<input id="cb' . $line->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $line->id . '"' . ($selected ? ' checked="checked"' : '') . ' />';
print '</td>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
@ -1165,6 +1233,10 @@ if ($num > 0 && $colspan > 0) {
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>";
print '</div>';

View File

@ -452,56 +452,6 @@ class AccountancyCategory // extends CommonObject
}
}
/**
* Function to fill ->lines_cptbk with accounting account used (into bookkeeping) and not yet into a custom group
*
* @param int $id Id of custom group
* @return int <0 if KO, 0 if not found, >0 if OK
*/
/*
public function getCptBK($id)
{
global $conf;
$sql = "SELECT DISTINCT t.numero_compte, t.label_operation, t.doc_ref";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t";
$sql .= " WHERE t.numero_compte NOT IN ("; // account not into a custom group
$sql .= " SELECT t.account_number";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = ".((int) $id)." AND t.entity = ".$conf->entity.")";
$sql .= " AND t.numero_compte IN ("; // account into current chart of account
$sql .= " SELECT DISTINCT aa.account_number";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = ".((int) $conf->global->CHARTOFACCOUNTS);
$sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = ".$conf->entity.")";
$sql .= " GROUP BY t.numero_compte, t.label_operation, t.doc_ref";
$sql .= " ORDER BY t.numero_compte";
$this->lines_cptbk = array();
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
if ($num) {
while ($obj = $this->db->fetch_object($resql)) {
$this->lines_cptbk[] = $obj;
}
}
return $num;
} else {
$this->error = "Error ".$this->db->lasterror();
$this->errors[] = $this->error;
dol_syslog(__METHOD__." ".implode(','.$this->errors), LOG_ERR);
return -1;
}
}
*/
/**
* Function to fill ->lines_cptbk with accounting account (defined in chart of account) and not yet into a custom group
*
@ -743,7 +693,7 @@ class AccountancyCategory // extends CommonObject
}
$listofaccount .= "'".$cptcursor."'";
}
$sql .= " AND t.numero_compte IN (".$this->db->sanitize($listofaccount).")";
$sql .= " AND t.numero_compte IN (".$this->db->sanitize($listofaccount, 1).")";
} else {
$sql .= " AND t.numero_compte = '".$this->db->escape($cpt)."'";
}

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
*
@ -1356,7 +1378,7 @@ class AccountancyExport
}
print $nature_piece.$separator;
// RACI
// if (! empty($line->subledger_account)) {
// if (!empty($line->subledger_account)) {
// if ($line->doc_type == 'supplier_invoice') {
// $racine_subledger_account = '40';
// } elseif ($line->doc_type == 'customer_invoice') {
@ -1619,7 +1641,7 @@ class AccountancyExport
}
print $nature_piece.$separator;
// RACI
// if (! empty($line->subledger_account)) {
// if (!empty($line->subledger_account)) {
// if ($line->doc_type == 'supplier_invoice') {
// $racine_subledger_account = '40';
// } elseif ($line->doc_type == 'customer_invoice') {

View File

@ -730,7 +730,7 @@ class AccountingAccount extends CommonObject
* @param Product $product Product object sell or buy
* @param Facture|FactureFournisseur $facture Facture
* @param FactureLigne|SupplierInvoiceLine $factureDet Facture Det
* @param array $accountingAccount Array of Account account
* @param array $accountingAccount Array of Accounting account
* @param string $type Customer / Supplier
* @return array|int Accounting accounts suggested or < 0 if technical error.
*/
@ -811,9 +811,9 @@ class AccountingAccount extends CommonObject
$suggestedaccountingaccountfor = '';
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 ($type=='customer' && !empty($product->accountancy_code_sell)) {
if ($type == 'customer' && !empty($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;
}
$suggestedid = $accountingAccount['dom'];
@ -821,36 +821,36 @@ class AccountingAccount extends CommonObject
} else {
if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) {
// 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;
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) {
} elseif ($type == 'supplier' && !empty($product->accountancy_code_buy)) {
$code_p = $product->accountancy_code_buy;
}
$suggestedid = $accountingAccount['dom'];
$suggestedaccountingaccountfor = 'eecwithvat';
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($buyer->tva_intra)) {
// 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;
} elseif ($type=='supplier' && !empty($product->accountancy_code_buy)) {
} elseif ($type == 'supplier' && !empty($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 ?
$suggestedaccountingaccountfor = 'eecwithoutvatnumber';
} elseif ($isSellerInEEC && $isBuyerInEEC && !empty($product->accountancy_code_sell_intra)) {
// 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;
} 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;
}
$suggestedid = $accountingAccount['intra'];
$suggestedaccountingaccountfor = 'eec';
} else {
// 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;
} 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;
}
$suggestedid = $accountingAccount['export'];
@ -868,16 +868,44 @@ class AccountingAccount extends CommonObject
}
// Manage Deposit
if ($factureDet->desc == "(DEPOSIT)" || $facture->type == $facture::TYPE_DEPOSIT) {
$accountdeposittoventilated = new self($this->db);
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
if ($result < 0) {
return -1;
if (getDolGlobalString('ACCOUNTING_ACCOUNT_' . strtoupper($type) . '_DEPOSIT')) {
if ($factureDet->desc == "(DEPOSIT)" || $facture->type == $facture::TYPE_DEPOSIT) {
$accountdeposittoventilated = new self($this->db);
if ($type == 'customer') {
$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;
}
$code_l = $accountdeposittoventilated->ref;
$code_p = '';
$code_t = '';
$suggestedid = $accountdeposittoventilated->rowid;
$suggestedaccountingaccountfor = 'deposit';
}
$code_l = $accountdeposittoventilated->ref;
$suggestedid = $accountdeposittoventilated->rowid;
$suggestedaccountingaccountfor = 'deposit';
// For credit note invoice, if origin invoice is a deposit invoice, force also on specific customer/supplier deposit account
if (!empty($facture->fk_facture_source)) {
$invoiceSource = new $facture($this->db);
$invoiceSource->fetch($facture->fk_facture_source);
if ($facture->type == $facture::TYPE_CREDIT_NOTE && $invoiceSource->type == $facture::TYPE_DEPOSIT) {
$accountdeposittoventilated = new self($this->db);
if ($type == 'customer') {
$accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
} elseif ($type == 'supplier') {
$accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT, 1);
}
$code_l = $accountdeposittoventilated->ref;
$code_p = '';
$code_t = '';
$suggestedid = $accountdeposittoventilated->rowid;
$suggestedaccountingaccountfor = 'deposit';
}
}
}
// If $suggestedid could not be guessed yet, we set it from the generic default accounting code $code_l

View File

@ -231,7 +231,7 @@ class AccountingJournal extends CommonObject
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $withlabel 0=No label, 1=Include label of journal
* @param int $withlabel 0=No label, 1=Include label of journal, 2=Include nature of journal
* @param int $nourl 1=Disable url
* @param string $moretitle Add more text to title tooltip
* @param int $notooltip 1=Disable tooltip
@ -281,9 +281,14 @@ class AccountingJournal extends CommonObject
}
$label_link = $this->code;
if ($withlabel && !empty($this->label)) {
if ($withlabel != 2 && !empty($this->label)) {
$label_link .= ' - '.($nourl ? '<span class="opacitymedium">' : '').$langs->transnoentities($this->label).($nourl ? '</span>' : '');
}
if ($withlabel == 2 && !empty($this->nature)) {
$key = $langs->trans("AccountingJournalType".strtoupper($this->nature));
$transferlabel = ($this->nature && $key != "AccountingJournalType".strtoupper($langs->trans($this->nature)) ? $key : $this->label);
$label_link .= ' - '.($nourl ? '<span class="opacitymedium">' : '').$transferlabel.($nourl ? '</span>' : '');
}
$result .= $linkstart;
if ($withpicto) {
@ -982,8 +987,8 @@ class AccountingJournal extends CommonObject
$langs->transnoentitiesnoconv("LedgerAccount"),
$langs->transnoentitiesnoconv("SubledgerAccount"),
$langs->transnoentitiesnoconv("Label"),
$langs->transnoentitiesnoconv("Debit"),
$langs->transnoentitiesnoconv("Credit"),
$langs->transnoentitiesnoconv("AccountingDebit"),
$langs->transnoentitiesnoconv("AccountingCredit"),
$langs->transnoentitiesnoconv("Journal"),
$langs->transnoentitiesnoconv("Note"),
);
@ -993,8 +998,8 @@ class AccountingJournal extends CommonObject
$langs->transnoentitiesnoconv("Piece"),
$langs->transnoentitiesnoconv("AccountAccounting"),
$langs->transnoentitiesnoconv("LabelOperation"),
$langs->transnoentitiesnoconv("Debit"),
$langs->transnoentitiesnoconv("Credit"),
$langs->transnoentitiesnoconv("AccountingDebit"),
$langs->transnoentitiesnoconv("AccountingCredit"),
);
} elseif ($this->nature == 1) {
$header = array(
@ -1002,8 +1007,8 @@ class AccountingJournal extends CommonObject
$langs->transnoentitiesnoconv("Piece"),
$langs->transnoentitiesnoconv("AccountAccounting"),
$langs->transnoentitiesnoconv("LabelOperation"),
$langs->transnoentitiesnoconv("Debit"),
$langs->transnoentitiesnoconv("Credit"),
$langs->transnoentitiesnoconv("AccountingDebit"),
$langs->transnoentitiesnoconv("AccountingCredit"),
);
}

View File

@ -33,11 +33,52 @@ include_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php";
*/
class Lettering extends BookKeeping
{
/**
* @var BookKeeping[] Bookkeeping cached
*/
public static $bookkeeping_cached = array();
public static $doc_type_infos = array(
'customer_invoice' => array(
'payment_table' => 'paiement',
'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
@ -250,26 +291,17 @@ class Lettering extends BookKeeping
$lettre = 'AAA';
$sql = "SELECT DISTINCT ab2.lettering_code";
$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 . "bank_url AS bu2 ON bu2.url_id = bu.url_id";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab2 ON ab2.fk_doc = bu2.fk_bank";
$sql .= " WHERE ab.rowid IN (" . $this->db->sanitize(implode(',', $ids)) . ")";
$sql .= " AND ab.doc_type = 'bank'";
$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 ";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab2 ON ab2.subledger_account = ab.subledger_account";
$sql .= " WHERE ab.rowid IN (" . $this->db->sanitize(implode(',', $ids)) . ")";
$sql .= " AND ab2.lettering_code != ''";
$sql .= " ORDER BY ab2.lettering_code DESC";
$sql .= " LIMIT 1 ";
$resqla = $this->db->query($sql);
if ($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)) {
$lettre++;
}
@ -301,7 +333,7 @@ class Lettering extends BookKeeping
if (!$error) {
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
$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 != ''";
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 .= " lettering_code = NULL";
$sql .= " , date_lettering = NULL";
$sql .= ", date_lettering = NULL";
$sql .= " WHERE rowid IN (".$this->db->sanitize(implode(',', $ids)).")";
$sql .= " AND subledger_account != ''";
@ -374,16 +406,7 @@ class Lettering extends BookKeeping
$errors = array();
$nb_lettering = 0;
$result = $this->bookkeepingLettering($bookkeeping_ids, 'customer_invoice', $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);
$result = $this->bookkeepingLettering($bookkeeping_ids, $unlettering);
if ($result < 0) {
$error++;
$errors = array_merge($errors, $this->errors);
@ -404,11 +427,10 @@ class Lettering extends BookKeeping
* Lettering bookkeeping lines
*
* @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
* @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;
@ -416,11 +438,14 @@ class Lettering extends BookKeeping
// Clean parameters
$bookkeeping_ids = is_array($bookkeeping_ids) ? $bookkeeping_ids : array();
$type = trim($type);
$error = 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) {
$group_error = 0;
$total = 0;
@ -478,52 +503,214 @@ class Lettering extends BookKeeping
/**
* Lettering bookkeeping lines
*
* @param array $bookkeeping_ids Lettering specific list of bookkeeping id
* @param string $type Type of bookkeeping type to lettering ('customer_invoice' or 'supplier_invoice')
* @return array|int <0 if error otherwise all linked lines by block
* @param array $bookkeeping_ids Lettering specific list of bookkeeping id
* @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
*/
public function getLinkedLines($bookkeeping_ids, $type = 'customer_invoice')
public function getLinkedLines($bookkeeping_ids, $only_has_subledger_account = true)
{
global $conf, $langs;
$this->errors = array();
// Clean parameters
$bookkeeping_ids = is_array($bookkeeping_ids) ? $bookkeeping_ids : array();
$type = trim($type);
if ($type == 'customer_invoice') {
$doc_type = 'customer_invoice';
$bank_url_type = 'payment';
$payment_element = 'paiement_facture';
$fk_payment_element = 'fk_paiement';
$fk_element = 'fk_facture';
$account_number = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
} elseif ($type == 'supplier_invoice') {
$doc_type = 'supplier_invoice';
$bank_url_type = 'payment_supplier';
$payment_element = 'paiementfourn_facturefourn';
$fk_payment_element = 'fk_paiementfourn';
$fk_element = 'fk_facturefourn';
$account_number = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
} else {
// Get all bookkeeping lines
$sql = "SELECT DISTINCT ab.doc_type, ab.fk_doc";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab";
$sql .= " WHERE ab.entity IN (" . getEntity('accountancy') . ")";
$sql .= " AND ab.fk_doc > 0";
if (!empty($bookkeeping_ids)) {
// Get all bookkeeping lines of piece number
$sql .= " AND EXISTS (";
$sql .= " SELECT rowid";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS pn";
$sql .= " WHERE pn.entity IN (" . getEntity('accountancy') . ")";
$sql .= " AND pn.rowid IN (" . $this->db->sanitize(implode(',', $bookkeeping_ids)) . ")";
$sql .= " AND pn.piece_num = ab.piece_num";
$sql .= " )";
}
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.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');
$this->errors[] = $langs->trans('ErrorBadParameters');
return -1;
}
$payment_ids = array();
$doc_type_info = self::$doc_type_infos[$doc_type];
$bank_ids = array();
// Get all payment id from bank lines
$sql = "SELECT DISTINCT bu.url_id AS payment_id";
$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 .= " WHERE ab.doc_type = 'bank'";
// $sql .= " AND ab.subledger_account != ''";
// $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)) . ")";
// Get all fk_doc by doc_type from bank ids
$sql = "SELECT DISTINCT p." . $doc_type_info['payment_table_fk_bank'] . " 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 dp." . $doc_type_info['doc_payment_table_fk_doc'] . " IN (" . $this->db->sanitize(implode(',', $document_ids)) . ")";
$sql .= " AND p." . $doc_type_info['payment_table_fk_bank'] . " > 0";
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);
if (!$resql) {
$this->errors[] = "Error " . $this->db->lasterror();
@ -531,218 +718,137 @@ class Lettering extends BookKeeping
}
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);
// Get all payment id from payment lines
$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;
return $bank_ids;
}
/**
* Linked payment by group
* Get all linked document ids by group and type
*
* @param array $payment_ids list of payment id
* @param string $type Type of bookkeeping type to lettering ('customer_invoice' or 'supplier_invoice')
* @return array|int <0 if error otherwise all linked lines by block
* @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 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;
// Clean parameters
$payment_ids = is_array($payment_ids) ? $payment_ids : array();
$type = trim($type);
$document_ids = is_array($document_ids) ? $document_ids : array();
$doc_type = trim($doc_type);
if (empty($payment_ids)) {
if (empty($document_ids)) {
return array();
}
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 {
if (!is_array(self::$doc_type_infos[$doc_type])) {
$langs->load('errors');
$this->errors[] = $langs->trans('ErrorBadParameters');
return -1;
}
// Get payment lines
$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)) . ")";
$doc_type_info = self::$doc_type_infos[$doc_type];
dol_syslog(__METHOD__ . " - Get payment lines", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->errors[] = "Error " . $this->db->lasterror();
return -1;
// Get document lines
$current_document_ids = array();
$link_by_element = array();
$element_by_link = array();
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();
$payment_by_element = array();
$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);
if (count(array_diff($document_ids, $current_document_ids))) {
return $this->getLinkedDocumentByGroup($current_document_ids, $doc_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 $element_by_payment List of element ids by payment id
* @param int $element_id Element Id (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
* @param array $link_by_element List of payment ids by link key
* @param array $element_by_link List of element ids by link key
* @param string $link_key Link key (used for recursive function)
* @param array $current_group Current group (used for recursive function)
* @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();
if ($element_id > 0 && !isset($payment_by_element[$element_id])) {
// Return if specific element id not found
return $grouped_payments;
$grouped_elements = array();
if (!empty($link_key) && !isset($element_by_link[$link_key])) {
// Return if specific link key not found
return $grouped_elements;
}
$save_payment_by_element = null;
$save_element_by_payment = null;
if ($element_id == 0) {
if (empty($link_key)) {
// Save list when is the begin of recursive function
$save_payment_by_element = $payment_by_element;
$save_element_by_payment = $element_by_payment;
$save_link_by_element = $link_by_element;
$save_element_by_link = $element_by_link;
}
do {
// 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];
$payment_ids = $payment_by_element[$current_element_id];
unset($payment_by_element[$current_element_id]);
$current_link_key = !empty($link_key) ? $link_key : array_keys($element_by_link)[0];
$element_ids = $element_by_link[$current_link_key];
unset($element_by_link[$current_link_key]);
foreach ($payment_ids as $payment_id) {
// Continue if payment id in not found
if (!isset($element_by_payment[$payment_id])) continue;
foreach ($element_ids as $element_id) {
// Continue if element id in not found
if (!isset($link_by_element[$element_id])) continue;
// Set the payment in the current group
$current_group[$payment_id] = $payment_id;
// Set the element in the current group
$current_group[$element_id] = $element_id;
// Get current element ids, get this payment id list and delete the entry
$element_ids = $element_by_payment[$payment_id];
unset($element_by_payment[$payment_id]);
// Get current link keys, get this element id list and delete the entry
$link_keys = $link_by_element[$element_id];
unset($link_by_element[$element_id]);
// Set payment id on the current group for each element id of the payment
foreach ($element_ids as $id) {
$this->getGroupElements($payment_by_element, $element_by_payment, $id, $current_group);
// Set element id on the current group for each link key of the element
foreach ($link_keys as $key) {
$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
$grouped_payments[] = $current_group;
$grouped_elements[] = $current_group;
$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
$payment_by_element = $save_payment_by_element;
$element_by_payment = $save_element_by_payment;
$link_by_element = $save_link_by_element;
$element_by_link = $save_element_by_link;
}
return $grouped_payments;
return $grouped_elements;
}
}

View File

@ -21,6 +21,7 @@
* \brief Home closure page
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -63,7 +64,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) {
accessforbidden();
}
if (empty($user->rights->accounting->fiscalyear->write)) {
if (!$user->hasRight('accounting', 'fiscalyear', 'write')) {
accessforbidden();
}
@ -75,7 +76,7 @@ if (empty($user->rights->accounting->fiscalyear->write)) {
$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_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));

View File

@ -44,7 +44,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) {
accessforbidden();
}
if (empty($user->rights->accounting->mouvements->lire)) {
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden();
}
@ -54,7 +54,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
* Actions
*/
if ($action == 'ventil' && $user->rights->accounting->bind->write) {
if ($action == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) {
if (!$cancel) {
if ($codeventil < 0) {
$codeventil = 0;

View File

@ -26,6 +26,7 @@
* \brief Home customer journalization page
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -46,7 +47,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) {
accessforbidden();
}
if (empty($user->rights->accounting->bind->write)) {
if (!$user->hasRight('accounting', 'bind', 'write')) {
accessforbidden();
}
@ -83,7 +84,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) {
accessforbidden();
}
if (empty($user->rights->accounting->mouvements->lire)) {
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden();
}
@ -92,7 +93,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
* 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
$db->begin();
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as fd";
@ -141,7 +142,7 @@ if ($action == 'validatehistory') {
}*/
// Customer Invoice lines (must be same request than into page list.php for manual binding)
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype,";
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype, f.fk_facture_source,";
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
@ -206,37 +207,38 @@ if ($action == 'validatehistory') {
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
$objp = $db->fetch_object($result);
$thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name;
$thirdpartystatic->client = $objp->client;
$thirdpartystatic->fournisseur = $objp->fournisseur;
$thirdpartystatic->code_client = $objp->code_client;
$thirdpartystatic->code_compta_client = $objp->code_compta_client;
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
$thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code;
$thirdpartystatic->tva_intra = $objp->tva_intra;
$thirdpartystatic->code_compta_product = $objp->company_code_sell; // The accounting account for product stored on thirdparty object (for level3 suggestion)
$thirdpartystatic->id = !empty($objp->socid) ? $objp->socid : 0;
$thirdpartystatic->name = !empty($objp->name) ? $objp->name : "";
$thirdpartystatic->client = !empty($objp->client) ? $objp->client : "";
$thirdpartystatic->fournisseur = !empty($objp->fournisseur) ? $objp->fournisseur : "";
$thirdpartystatic->code_client = !empty($objp->code_client) ? $objp->code_client : "";
$thirdpartystatic->code_compta_client = !empty($objp->code_compta_client) ? $objp->code_compta_client : "";
$thirdpartystatic->code_fournisseur = !empty($objp->code_fournisseur) ? $objp->code_fournisseur : "";
$thirdpartystatic->code_compta_fournisseur = !empty($objp->code_compta_fournisseur) ? $objp->code_compta_fournisseur : "";
$thirdpartystatic->email = !empty($objp->email) ? $objp->email : "";
$thirdpartystatic->country_code = !empty($objp->country_code) ? $objp->country_code : "";
$thirdpartystatic->tva_intra = !empty($objp->tva_intra) ? $objp->tva_intra : "";
$thirdpartystatic->code_compta_product = !empty($objp->company_code_sell) ? $objp->company_code_sell : ""; // The accounting account for product stored on thirdparty object (for level3 suggestion)
$product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id;
$product_static->type = $objp->type;
$product_static->label = $objp->product_label;
$product_static->status = $objp->status;
$product_static->status_buy = $objp->status_buy;
$product_static->status = !empty($objp->status) ? $objp->status : 0;
$product_static->status_buy = !empty($objp->status_buy) ? $objp->status_buy : 0;
$product_static->accountancy_code_sell = $objp->code_sell;
$product_static->accountancy_code_sell_intra = $objp->code_sell_intra;
$product_static->accountancy_code_sell_export = $objp->code_sell_export;
$product_static->accountancy_code_buy = $objp->code_buy;
$product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
$product_static->accountancy_code_buy_export = $objp->code_buy_export;
$product_static->accountancy_code_buy = !empty($objp->code_buy) ? $objp->code_buy : "";
$product_static->accountancy_code_buy_intra = !empty($objp->code_buy_intra) ? $objp->code_buy_intra : "";
$product_static->accountancy_code_buy_export = !empty($objp->code_buy_export) ? $objp->code_buy_export : "";
$product_static->tva_tx = $objp->tva_tx_prod;
$facture_static->ref = $objp->ref;
$facture_static->id = $objp->facid;
$facture_static->type = $objp->ftype;
$facture_static->date = $objp->datef;
$facture_static->date = $db->jdate($objp->datef);
$facture_static->fk_facture_source = $objp->fk_facture_source;
$facture_static_det->id = $objp->rowid;
$facture_static_det->total_ht = $objp->total_ht;

View File

@ -91,7 +91,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) {
accessforbidden();
}
if (empty($user->rights->accounting->mouvements->lire)) {
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden();
}
@ -126,7 +126,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$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;
if (!(GETPOST('account_parent', 'int') >= 0)) {
@ -189,7 +189,7 @@ print '<script type="text/javascript">
/*
* Customer Invoice lines
*/
$sql = "SELECT f.rowid as facid, f.ref as ref, f.type, f.datef, f.ref_client,";
$sql = "SELECT f.rowid as facid, f.ref as ref, f.type as ftype, f.datef, f.ref_client,";
$sql .= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
$sql .= " s.rowid as socid, s.nom as name, s.code_client,";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
@ -199,7 +199,7 @@ if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " s.code_compta as code_compta_client,";
$sql .= " s.code_compta_fournisseur,";
}
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label,";
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.tobuy, p.tosell,";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,";
} else {

View File

@ -110,7 +110,7 @@ if (!isModEnabled('accounting')) {
if ($user->socid > 0) {
accessforbidden();
}
if (empty($user->rights->accounting->mouvements->lire)) {
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden();
}
@ -229,7 +229,7 @@ if (empty($chartaccountcode)) {
}
// Customer Invoice lines
$sql = "SELECT f.rowid as facid, f.ref, f.datef, f.type as ftype,";
$sql = "SELECT f.rowid as facid, f.ref, f.datef, f.type as ftype, f.fk_facture_source,";
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
@ -496,7 +496,7 @@ if ($result) {
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth125', 'code2', 1, 0, 1, null, 1);
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100', 'code2', 1, 0, 1);
//print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
print '</td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
@ -579,6 +579,7 @@ if ($result) {
$facture_static->id = $objp->facid;
$facture_static->type = $objp->ftype;
$facture_static->date = $db->jdate($objp->datef);
$facture_static->fk_facture_source = $objp->fk_facture_source;
$facture_static_det->id = $objp->rowid;
$facture_static_det->total_ht = $objp->total_ht;
@ -725,7 +726,7 @@ if ($result) {
// Suggested accounting account
print '<td>';
print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facture_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facture_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth150 maxwidthonsmartphone', 'cachewithshowemptyone');
print '</td>';
// Column with checkbox

View File

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

View File

@ -417,7 +417,7 @@ if ($result) {
print '<td class="center">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>';
// Accounting account affected
print '<td class="center">';
print '<td>';
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 img_edit();

View File

@ -503,7 +503,7 @@ if ($result) {
// Suggested accounting account
print '<td>';
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
print '</td>';
print '<td class="center">';

View File

@ -23,6 +23,8 @@
* \brief Home accounting module
*/
// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -42,14 +44,14 @@ if ($user->socid > 0) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if (empty($user->rights->accounting->mouvements->lire)) {
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden();
}
*/
if (!isModEnabled('comptabilite') && !isModEnabled('accounting') && !isModEnabled('asset') && !isModEnabled('intracommreport')) {
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();
}
@ -77,7 +79,7 @@ if (GETPOST('addbox')) {
* View
*/
$help_url = '';
$help_url = 'EN:Module_Double_Entry_Accounting#Setup';
llxHeader('', $langs->trans("AccountancyArea"), $help_url);
@ -121,7 +123,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 "<br>\n";
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
if (!empty($user->rights->accounting->chartofaccount)) {
if ($user->hasRight('accounting', 'chartofaccount')) {
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
print '<hr>';
print "<br>\n";

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2022 Open-DSI <support@open-dsi.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2017-2021 Frédéric France <frederic.france@netlogic.fr>
@ -912,8 +912,8 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"'.$langs->transnoentitiesnoconv("LedgerAccount").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("SubledgerAccount").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("Label").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("Debit").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("Credit").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("AccountingDebit").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("AccountingCredit").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("Journal").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("Note").'"'.$sep;
print "\n";
@ -1032,9 +1032,11 @@ if (empty($action) || $action == 'view') {
$salarystatic = new Salary($db);
$variousstatic = new PaymentVarious($db);
llxHeader('', $langs->trans("FinanceJournal"));
$title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1);
$nom = $langs->trans("FinanceJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
llxHeader('', dol_string_nohtmltag($title));
$nom = $title;
$builddate = dol_now();
//$description = $langs->trans("DescFinanceJournal") . '<br>';
$description = $langs->trans("DescJournalOnlyBindedVisible").'<br>';
@ -1052,6 +1054,7 @@ if (empty($action) || $action == 'view') {
journalHead($nom, '', $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
$desc = '';
// Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."bank_account WHERE entity = ".((int) $conf->entity)." AND fk_accountancy_journal IS NULL AND clos=0";
@ -1074,7 +1077,7 @@ if (empty($action) || $action == 'view') {
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
|| empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
print '<br><div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ($desc ? '' : '<br>').'<div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
$desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}');
$desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>', $desc);
print $desc;
@ -1125,16 +1128,16 @@ if (empty($action) || $action == 'view') {
$i = 0;
print '<div class="div-table-responsive">';
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print "<td>".$langs->trans("Date")."</td>";
print "<td>".$langs->trans("Piece").' ('.$langs->trans("ObjectsRef").")</td>";
print "<td>".$langs->trans("AccountAccounting")."</td>";
print "<td>".$langs->trans("SubledgerAccount")."</td>";
print "<td>".$langs->trans("LabelOperation")."</td>";
print '<td class="center">'.$langs->trans("PaymentMode")."</td>";
print '<td class="right">'.$langs->trans("Debit")."</td>";
print '<td class="right">'.$langs->trans("Credit")."</td>";
print '<td class="right">'.$langs->trans("AccountingDebit")."</td>";
print '<td class="right">'.$langs->trans("AccountingCredit")."</td>";
print "</tr>\n";
$r = '';
@ -1224,22 +1227,22 @@ if (empty($action) || $action == 'view') {
$account_ledger = $k;
// Try to force general ledger account depending on type
if ($tabtype[$key] == 'payment') {
$account_ledger = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
$account_ledger = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER');
}
if ($tabtype[$key] == 'payment_supplier') {
$account_ledger = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
$account_ledger = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER');
}
if ($tabtype[$key] == 'payment_expensereport') {
$account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
$account_ledger = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT');
}
if ($tabtype[$key] == 'payment_salary') {
$account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
$account_ledger = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT');
}
if ($tabtype[$key] == 'payment_vat') {
$account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT;
$account_ledger = getDolGlobalString('ACCOUNTING_VAT_PAY_ACCOUNT');
}
if ($tabtype[$key] == 'member') {
$account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT;
$account_ledger = getDolGlobalString('ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT');
}
if ($tabtype[$key] == 'payment_various') {
$account_ledger = $tabpay[$key]["account_various"];
@ -1278,7 +1281,7 @@ if (empty($action) || $action == 'view') {
}
}
print '<td class="maxwidth300" title="'.dol_escape_htmltag(dol_string_nohtmltag($accounttoshow)).'">';
print $accounttoshow;
print $accounttoshow; // This is a HTML string
print "</td>";
// Subledger account
@ -1307,7 +1310,7 @@ if (empty($action) || $action == 'view') {
}
}
print '<td class="maxwidth300">';
print $accounttoshowsubledger;
print $accounttoshowsubledger; // This is a html string
print "</td>";
print "<td>".$reflabel."</td>";
@ -1412,9 +1415,19 @@ function getSourceDocRef($val, $typerecord)
$sqlmid = '';
if ($typerecord == 'payment') {
$sqlmid = 'SELECT payfac.fk_facture as id, f.ref as ref';
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f";
$sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=".((int) $val["paymentid"]);
if (getDolGlobalInt('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) {
$sqlmid = "SELECT payfac.fk_facture as id, ".$db->ifsql('f1.rowid IS NULL', 'f.ref', 'f1.ref')." as ref";
$sqlmid .= " FROM ".$db->prefix()."paiement_facture as payfac";
$sqlmid .= " LEFT JOIN ".$db->prefix()."facture as f ON f.rowid = payfac.fk_facture";
$sqlmid .= " LEFT JOIN ".$db->prefix()."societe_remise_except as sre ON sre.fk_facture_source = payfac.fk_facture";
$sqlmid .= " LEFT JOIN ".$db->prefix()."facture as f1 ON f1.rowid = sre.fk_facture";
$sqlmid .= " WHERE payfac.fk_paiement=".((int) $val['paymentid']);
} else {
$sqlmid = "SELECT payfac.fk_facture as id, f.ref as ref";
$sqlmid .= " FROM ".$db->prefix()."paiement_facture as payfac";
$sqlmid .= " INNER JOIN ".$db->prefix()."facture as f ON f.rowid = payfac.fk_facture";
$sqlmid .= " WHERE payfac.fk_paiement=".((int) $val['paymentid']);
}
$ref = $langs->transnoentitiesnoconv("Invoice");
} elseif ($typerecord == 'payment_supplier') {
$sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref';

View File

@ -445,8 +445,8 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"'.$langs->transnoentitiesnoconv("Piece").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("AccountAccounting").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("LabelOperation").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("Debit").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("Credit").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("AccountingDebit").'"'.$sep;
print '"'.$langs->transnoentitiesnoconv("AccountingCredit").'"'.$sep;
print "\n";
foreach ($taber as $key => $val) {
@ -496,14 +496,16 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
}
if (empty($action) || $action == 'view') {
llxHeader('', $langs->trans("ExpenseReportsJournal"));
$title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1);
$nom = $langs->trans("ExpenseReportsJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
llxHeader('', dol_string_nohtmltag($title));
$nom = $title;
$nomlink = '';
$periodlink = '';
$exportlink = '';
$builddate = dol_now();
$description .= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
$description = $langs->trans("DescJournalOnlyBindedVisible").'<br>';
$listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
$period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0);
@ -567,8 +569,8 @@ if (empty($action) || $action == 'view') {
print "<td>".$langs->trans("AccountAccounting")."</td>";
print "<td>".$langs->trans("SubledgerAccount")."</td>";
print "<td>".$langs->trans("LabelOperation")."</td>";
print '<td class="right">'.$langs->trans("Debit")."</td>";
print '<td class="right">'.$langs->trans("Credit")."</td>";
print '<td class="right">'.$langs->trans("AccountingDebit")."</td>";
print '<td class="right">'.$langs->trans("AccountingCredit")."</td>";
print "</tr>\n";
$r = '';

View File

@ -379,7 +379,7 @@ if ($action == 'writebookkeeping') {
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
$lettering_static = new Lettering($db);
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id), 'supplier_invoice');
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
}
}
}
@ -403,8 +403,18 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
if (!empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT)) {
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->label_compte = $label_account;
@ -746,9 +756,11 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
}
if (empty($action) || $action == 'view') {
llxHeader('', $langs->trans("PurchasesJournal"));
$title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1);
$nom = $langs->trans("PurchasesJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
llxHeader('', dol_string_nohtmltag($title));
$nom = $title;
$nomlink = '';
$periodlink = '';
$exportlink = '';
@ -821,8 +833,8 @@ if (empty($action) || $action == 'view') {
print "<td>".$langs->trans("AccountAccounting")."</td>";
print "<td>".$langs->trans("SubledgerAccount")."</td>";
print "<td>".$langs->trans("LabelOperation")."</td>";
print '<td class="center">'.$langs->trans("Debit")."</td>";
print '<td class="center">'.$langs->trans("Credit")."</td>";
print '<td class="center">'.$langs->trans("AccountingDebit")."</td>";
print '<td class="center">'.$langs->trans("AccountingCredit")."</td>";
print "</tr>\n";
$r = '';
@ -946,6 +958,13 @@ if (empty($action) || $action == 'view') {
print "</td>";
// Subledger account
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>';
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];

View File

@ -30,6 +30,7 @@
* \brief Page with sells journal
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@ -392,7 +393,7 @@ if ($action == 'writebookkeeping') {
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
$lettering_static = new Lettering($db);
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id), 'customer_invoice');
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
}
}
}
@ -698,9 +699,11 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
if (empty($action) || $action == 'view') {
llxHeader('', $langs->trans("SellsJournal"));
$title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1);
$nom = $langs->trans("SellsJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
llxHeader('', dol_string_nohtmltag($title));
$nom = $title;
$nomlink = '';
$periodlink = '';
$exportlink = '';
@ -773,8 +776,8 @@ if (empty($action) || $action == 'view') {
print "<td>".$langs->trans("AccountAccounting")."</td>";
print "<td>".$langs->trans("SubledgerAccount")."</td>";
print "<td>".$langs->trans("LabelOperation")."</td>";
print '<td class="center">'.$langs->trans("Debit")."</td>";
print '<td class="center">'.$langs->trans("Credit")."</td>";
print '<td class="center">'.$langs->trans("AccountingDebit")."</td>";
print '<td class="center">'.$langs->trans("AccountingCredit")."</td>";
print "</tr>\n";
$r = '';

View File

@ -21,6 +21,7 @@
* \brief Page of a journal
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -51,7 +52,7 @@ if ($result > 0) {
} elseif ($result < 0) {
dol_print_error('', $object->error, $object->errors);
} elseif ($result == 0) {
accessforbidden($langs->trans('ErrorRecordNotFound'));
accessforbidden('ErrorRecordNotFound');
}
$hookmanager->initHooks(array('globaljournal', $object->nature.'journal'));
@ -164,22 +165,18 @@ if ($reload) {
$form = new Form($db);
if ($object->nature == 2) {
$title = $langs->trans("SellsJournal");
$some_mandatory_steps_of_setup_were_not_done = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "" || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1';
$account_accounting_not_defined = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "" || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1';
} elseif ($object->nature == 3) {
$title = $langs->trans("PurchasesJournal");
$some_mandatory_steps_of_setup_were_not_done = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "" || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1';
$account_accounting_not_defined = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "" || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1';
} elseif ($object->nature == 4) {
$title = $langs->trans("FinanceJournal");
$some_mandatory_steps_of_setup_were_not_done = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "" || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "" || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
|| empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1';
$account_accounting_not_defined = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "" || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "" || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1';
} elseif ($object->nature == 5) {
$title = $langs->trans("ExpenseReportsJournal");
$some_mandatory_steps_of_setup_were_not_done = empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1';
$account_accounting_not_defined = empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1';
} else {
@ -188,8 +185,11 @@ if ($object->nature == 2) {
$account_accounting_not_defined = false;
}
$title = $langs->trans("GenerationOfAccountingEntries") . ' - ' . $object->getNomUrl(0, 2, 1, '', 1);
$nom = $title . ' | ' . $object->getNomUrl(0, 1, 1, '', 1);
llxHeader('', dol_string_nohtmltag($title));
$nom = $title;
$nomlink = '';
$periodlink = '';
$exportlink = '';
@ -212,8 +212,6 @@ $period .= ' - ' . $langs->trans("JournalizationInLedgerStatus") . ' ' . $form-
$varlink = 'id_journal=' . $id_journal;
llxHeader('', $title);
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
if ($object->nature == 4) { // Bank journal
@ -288,8 +286,8 @@ print '<td>' . $langs->trans("AccountAccounting") . '</td>';
print '<td>' . $langs->trans("SubledgerAccount") . '</td>';
print '<td>' . $langs->trans("LabelOperation") . '</td>';
if ($object->nature == 4) print '<td class="center">' . $langs->trans("PaymentMode") . '</td>'; // bank
print '<td class="right">' . $langs->trans("Debit") . '</td>';
print '<td class="right">' . $langs->trans("Credit") . '</td>';
print '<td class="right">' . $langs->trans("AccountingDebit") . '</td>';
print '<td class="right">' . $langs->trans("AccountingCredit") . '</td>';
print "</tr>\n";
if (is_array($journal_data) && !empty($journal_data)) {

View File

@ -24,6 +24,7 @@
* \brief Home supplier journalization page
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -139,7 +140,7 @@ if ($action == 'validatehistory') {
}*/
// Supplier Invoice Lines (must be same request than into page list.php for manual binding)
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype, f.fk_facture_source,";
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
@ -232,7 +233,10 @@ if ($action == 'validatehistory') {
$facture_static->ref = $objp->ref;
$facture_static->id = $objp->facid;
$facture_static->type = $objp->ftype;
$facture_static->date = $objp->datef;
$facture_static->ref_supplier = $objp->ref_supplier;
$facture_static->label = $objp->invoice_label;
$facture_static->date = $db->jdate($objp->datef);
$facture_static->fk_facture_source = $objp->fk_facture_source;
$facture_static_det->id = $objp->rowid;
$facture_static_det->total_ht = $objp->total_ht;

View File

@ -49,7 +49,7 @@ $search_societe = GETPOST('search_societe', 'alpha');
$search_lineid = GETPOST('search_lineid', 'int');
$search_ref = GETPOST('search_ref', 'alpha');
$search_invoice = GETPOST('search_invoice', 'alpha');
$search_ref_supplier = GETPOST('search_ref_supplier', 'alpha');
//$search_ref_supplier = GETPOST('search_ref_supplier', 'alpha');
$search_label = GETPOST('search_label', 'alpha');
$search_desc = GETPOST('search_desc', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha');
@ -113,7 +113,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_lineid = '';
$search_ref = '';
$search_invoice = '';
$search_ref_supplier = '';
//$search_ref_supplier = '';
$search_label = '';
$search_desc = '';
$search_amount = '';
@ -194,9 +194,9 @@ print '<script type="text/javascript">
/*
* Supplier Invoice lines
*/
$sql = "SELECT f.rowid as facid, f.ref as ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.fk_soc,";
$sql = "SELECT f.rowid as facid, f.ref as ref, f.ref_supplier, f.type as ftype, f.libelle as invoice_label, f.datef, f.fk_soc,";
$sql .= " l.rowid, l.fk_product, l.product_type as line_type, l.description, l.total_ht , l.qty, l.tva_tx, l.vat_src_code,";
$sql .= " aa.label as label_account, aa.labelshort as labelshort_account, aa.account_number,";
$sql .= " aa.rowid as fk_compte, aa.label as label_account, aa.labelshort as labelshort_account, aa.account_number,";
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tobuy, p.tosell,";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,";
@ -236,11 +236,11 @@ if ($search_lineid) {
$sql .= natural_search("l.rowid", $search_lineid, 1);
}
if (strlen(trim($search_invoice))) {
$sql .= natural_search("f.ref", $search_invoice);
$sql .= natural_search(array("f.ref", "f.ref_supplier"), $search_invoice);
}
if (strlen(trim($search_ref_supplier))) {
/*if (strlen(trim($search_ref_supplier))) {
$sql .= natural_search("f.ref_supplier", $search_ref_supplier);
}
}*/
if (strlen(trim($search_label))) {
$sql .= natural_search("f.libelle", $search_label);
}
@ -333,9 +333,9 @@ if ($result) {
if ($search_ref) {
$param .= "&search_ref=".urlencode($search_ref);
}
if ($search_ref_supplier) {
/*if ($search_ref_supplier) {
$param .= '&search_ref_supplier='.urlencode($search_ref_supplier);
}
}*/
if ($search_label) {
$param .= "&search_label=".urlencode($search_label);
}
@ -400,7 +400,7 @@ if ($result) {
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
print '<td class="liste_titre center">';
print '<div class="nowrap">';
@ -416,11 +416,11 @@ if ($result) {
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth150', 'code2', 1, 0, 1);
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100', 'code2', 1, 0, 1);
// print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
print '</td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
print '<td class="liste_titre center"><input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).'"></td>';
print '<td class="liste_titre center">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
@ -429,7 +429,7 @@ if ($result) {
print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
@ -478,8 +478,8 @@ if ($result) {
$productstatic->status = $objp->tosell;
$productstatic->status_buy = $objp->tobuy;
$productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_sell_buy_intra;
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_sell_buy_export;
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_buy_intra;
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export;
$accountingaccountstatic->rowid = $objp->fk_compte;
$accountingaccountstatic->label = $objp->label_account;
@ -492,12 +492,18 @@ if ($result) {
print '<td>'.$objp->rowid.'</td>';
// Ref Invoice
print '<td class="nowraponall">'.$facturefournisseur_static->getNomUrl(1).'</td>';
print '<td class="nowraponall">'.$facturefournisseur_static->getNomUrl(1);
if ($objp->ref_supplier) {
print '<br><span class="opacitymedium small">'.dol_escape_htmltag($objp->ref_supplier).'</span>';
}
print '</td>';
// Ref supplier invoice
/*
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
print $objp->ref_supplier;
print '</td>';
*/
// Supplier invoice label
print '<td class="tdoverflowonsmartphone small" title="'.dol_escape_htmltag($objp->invoice_label).'">';

View File

@ -232,7 +232,7 @@ if (empty($chartaccountcode)) {
}
// Supplier Invoice Lines
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype, f.fk_facture_source,";
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
@ -289,14 +289,14 @@ if ($search_lineid) {
$sql .= natural_search("l.rowid", $search_lineid, 1);
}
if (strlen(trim($search_invoice))) {
$sql .= natural_search("f.ref", $search_invoice);
$sql .= natural_search(array("f.ref", "f.ref_supplier"), $search_invoice);
}
if (strlen(trim($search_ref))) {
$sql .= natural_search("p.ref", $search_ref);
}
if (strlen(trim($search_ref_supplier))) {
/*if (strlen(trim($search_ref_supplier))) {
$sql .= natural_search("f.ref_supplier", $search_ref_supplier);
}
}*/
if (strlen(trim($search_label))) {
$sql .= natural_search(array("p.label", "f.libelle"), $search_label);
}
@ -490,7 +490,7 @@ if ($result) {
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
print '<td class="liste_titre center">';
print '<div class="nowrap">';
@ -506,7 +506,7 @@ if ($result) {
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth125', 'code2', 1, 0, 1, null, 1);
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100', 'code2', 1, 0, 1);
//print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
print '</td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
@ -521,7 +521,7 @@ if ($result) {
print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
@ -592,6 +592,7 @@ if ($result) {
$facturefourn_static->ref_supplier = $objp->ref_supplier;
$facturefourn_static->label = $objp->invoice_label;
$facturefourn_static->date = $db->jdate($objp->datef);
$facturefourn_static->fk_facture_source = $objp->fk_facture_source;
$facturefourn_static_det->id = $objp->rowid;
$facturefourn_static_det->total_ht = $objp->total_ht;
@ -647,16 +648,20 @@ if ($result) {
print '<td>'.$facturefourn_static_det->id.'</td>';
// Ref Invoice
print '<td class="nowraponall">'.$facturefourn_static->getNomUrl(1).'</td>';
// Ref supplier invoice
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
print $objp->ref_supplier;
print '<td class="nowraponall">'.$facturefourn_static->getNomUrl(1);
if ($objp->ref_supplier) {
print '<br><span class="opacitymedium small">'.dol_escape_htmltag($objp->ref_supplier).'</span>';
}
print '</td>';
// Ref supplier invoice
/*print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
print $objp->ref_supplier;
print '</td>';*/
// Supplier invoice label
print '<td class="tdoverflowmax125 small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
print $objp->invoice_label;
print '<td class="tdoverflowmax100 small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
print dol_escape_htmltag($objp->invoice_label);
print '</td>';
// Date
@ -668,11 +673,11 @@ if ($result) {
print $product_static->getNomUrl(1);
}
if ($product_static->label) {
print '<br><span class="opacitymedium small">'.$product_static->label.'</span>';
print '<br><span class="opacitymedium small">'.dol_escape_htmltag($product_static->label).'</span>';
}
print '</td>';
// Description
// Description of line
print '<td class="tdoverflowonsmartphone small">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facturefourn_static_det->desc, 1));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
@ -685,11 +690,11 @@ if ($result) {
// Vat rate
$code_vat_differ = '';
if ($objp->vat_tx_l != $objp->vat_tx_p && price2num($objp->vat_tx_p) && price2num($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
$code_vat_differ = 'warning bold';
}
//if ($objp->vat_tx_l != $objp->vat_tx_p && price2num($objp->vat_tx_p) && price2num($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
// $code_vat_differ = 'warning bold';
//}
print '<td class="right'.($code_vat_differ?' '.$code_vat_differ:'').'">';
print vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''));
print vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''), false, 0, 0, 1);
print '</td>';
// Thirdparty
@ -749,7 +754,7 @@ if ($result) {
// Suggested accounting account
print '<td>';
print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facturefourn_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facturefourn_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth150 maxwidthonsmartphone', 'cachewithshowemptyone');
print '</td>';
// Column with checkbox

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