Merge branch 'develop' of github.com:Dolibarr/dolibarr into NEW_conf_thirdparty_tag
This commit is contained in:
commit
b0d05b4824
@ -1,16 +0,0 @@
|
|||||||
build
|
|
||||||
build.xml
|
|
||||||
ChangeLog
|
|
||||||
composer.json
|
|
||||||
CONTRIBUTING.md
|
|
||||||
COPYING
|
|
||||||
COPYRIGHT
|
|
||||||
dev
|
|
||||||
doc
|
|
||||||
Dockerfile
|
|
||||||
INSTALL
|
|
||||||
README-FR.md
|
|
||||||
README.md
|
|
||||||
robots.txt
|
|
||||||
scripts
|
|
||||||
test
|
|
||||||
257
.travis.yml
257
.travis.yml
@ -3,7 +3,7 @@
|
|||||||
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
|
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
|
||||||
|
|
||||||
# We use dist: precise to have php 5.3 available
|
# We use dist: precise to have php 5.3 available
|
||||||
dist: precise
|
dist: trusty
|
||||||
sudo: required
|
sudo: required
|
||||||
|
|
||||||
language: php
|
language: php
|
||||||
@ -31,12 +31,12 @@ addons:
|
|||||||
- pgloader
|
- pgloader
|
||||||
|
|
||||||
php:
|
php:
|
||||||
- '5.3'
|
|
||||||
- '5.4'
|
- '5.4'
|
||||||
- '5.5'
|
- '5.5'
|
||||||
- '5.6'
|
- '5.6'
|
||||||
- '7.0'
|
- '7.0'
|
||||||
- '7.1'
|
- '7.1'
|
||||||
|
- '7.2'
|
||||||
#- hhvm only with dist: trusty
|
#- hhvm only with dist: trusty
|
||||||
- nightly
|
- nightly
|
||||||
|
|
||||||
@ -63,14 +63,14 @@ matrix:
|
|||||||
- php: nightly
|
- php: nightly
|
||||||
# We exclude some combinations not usefull to save Travis CPU
|
# We exclude some combinations not usefull to save Travis CPU
|
||||||
exclude:
|
exclude:
|
||||||
- php: '5.4'
|
|
||||||
env: DB=postgresql
|
|
||||||
- php: '5.5'
|
- php: '5.5'
|
||||||
env: DB=postgresql
|
env: DB=postgresql
|
||||||
- php: '5.6'
|
- php: '5.6'
|
||||||
env: DB=postgresql
|
env: DB=postgresql
|
||||||
- php: '7.0'
|
- php: '7.0'
|
||||||
env: DB=postgresql
|
env: DB=postgresql
|
||||||
|
- php: '7.1'
|
||||||
|
env: DB=postgresql
|
||||||
- php: hhvm
|
- php: hhvm
|
||||||
env: DB=postgresql
|
env: DB=postgresql
|
||||||
- php: nightly
|
- php: nightly
|
||||||
@ -79,7 +79,7 @@ matrix:
|
|||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
on_success: never # [always|never|change] default: change
|
on_success: never # [always|never|change] default: change
|
||||||
on_failure: change # [always|never|change] default: always
|
on_failure: never # [always|never|change] default: always
|
||||||
irc:
|
irc:
|
||||||
channels:
|
channels:
|
||||||
- "chat.freenode.net#dolibarr"
|
- "chat.freenode.net#dolibarr"
|
||||||
@ -120,10 +120,13 @@ install:
|
|||||||
|
|
||||||
- |
|
- |
|
||||||
echo "Installing PHP Unit"
|
echo "Installing PHP Unit"
|
||||||
if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ] || [ "$TRAVIS_PHP_VERSION" = '5.5' ]; then
|
if [ "$TRAVIS_PHP_VERSION" = '5.4' ] || [ "$TRAVIS_PHP_VERSION" = '5.5' ]; then
|
||||||
composer -n require phpunit/phpunit ^4
|
composer -n require phpunit/phpunit ^4
|
||||||
fi
|
fi
|
||||||
if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ]; then
|
||||||
|
composer -n require phpunit/phpunit ^5
|
||||||
|
fi
|
||||||
|
if [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
||||||
composer -n require phpunit/phpunit ^5
|
composer -n require phpunit/phpunit ^5
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
@ -139,135 +142,141 @@ install:
|
|||||||
echo
|
echo
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- |
|
- |
|
||||||
echo Start travis
|
echo Start travis
|
||||||
echo Current dir is `pwd`
|
echo Current dir is `pwd`
|
||||||
echo Home dir is `echo ~`
|
echo Home dir is `echo ~`
|
||||||
echo TRAVIS_BUILD_DIR is $TRAVIS_BUILD_DIR
|
echo TRAVIS_BUILD_DIR is $TRAVIS_BUILD_DIR
|
||||||
|
|
||||||
- |
|
- |
|
||||||
echo "Re-enabling Xdebug for PHP CodeSniffer and PHP Unit"
|
echo "Re-enabling Xdebug for PHP CodeSniffer and PHP Unit"
|
||||||
phpenv config-add /tmp/xdebug.ini
|
phpenv config-add /tmp/xdebug.ini
|
||||||
echo
|
|
||||||
|
|
||||||
- |
|
|
||||||
echo "Setting up PHP"
|
|
||||||
echo
|
|
||||||
echo "Set timezone"
|
|
||||||
echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
|
||||||
if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ]; then
|
|
||||||
#echo
|
|
||||||
#echo "Enabling APC for PHP <= 5.4"
|
|
||||||
# Documentation says it should be available for PHP <= 5.6 but it's not for 5.5 and 5.6!
|
|
||||||
#echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
|
||||||
echo
|
echo
|
||||||
echo "Enabling Memcached for PHP <= 5.4"
|
|
||||||
# Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0, 7.1 and nightly!
|
|
||||||
echo 'extension = memcached.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
|
||||||
fi
|
|
||||||
phpenv rehash
|
|
||||||
echo
|
|
||||||
|
|
||||||
- |
|
- |
|
||||||
if [ "$DEBUG" = true ]; then
|
echo "Setting up PHP"
|
||||||
echo "Debugging informations"
|
echo
|
||||||
|
echo "Set timezone"
|
||||||
|
echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
||||||
|
if [ "$TRAVIS_PHP_VERSION" = '5.4' ]; then
|
||||||
|
#echo
|
||||||
|
#echo "Enabling APC for PHP <= 5.4"
|
||||||
|
# Documentation says it should be available for PHP <= 5.6 but it's not for 5.5 and 5.6!
|
||||||
|
#echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
||||||
|
echo
|
||||||
|
echo "Enabling Memcached for PHP <= 5.4"
|
||||||
|
# Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0, 7.1, 7.2 and nightly!
|
||||||
|
echo 'extension = memcached.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
||||||
|
fi
|
||||||
|
phpenv rehash
|
||||||
|
echo
|
||||||
|
|
||||||
|
- |
|
||||||
|
echo "Versions information"
|
||||||
# Check PHP
|
# Check PHP
|
||||||
php -i
|
echo "PHP version"
|
||||||
|
php -i | head -
|
||||||
# Check PHP CodeSniffer installation
|
# Check PHP CodeSniffer installation
|
||||||
|
echo "PHPCS version"
|
||||||
which phpcs
|
which phpcs
|
||||||
phpcs --version
|
phpcs --version | head -
|
||||||
phpcs -i
|
phpcs -i | head -
|
||||||
# Check PHPUnit installation
|
# Check PHPUnit installation
|
||||||
|
echo "PHPUnit version"
|
||||||
which phpunit
|
which phpunit
|
||||||
phpunit --version
|
phpunit --version | head -
|
||||||
# Check MySQL
|
# Check Apache version
|
||||||
mysql --version
|
echo "Apache version"
|
||||||
mysql -e "SELECT VERSION();"
|
apache2 -v | head -
|
||||||
|
# Check MariaDb
|
||||||
|
echo "MariaDb version"
|
||||||
|
mysql --version | head -
|
||||||
|
mysql -e "SELECT VERSION();" | head -
|
||||||
echo
|
echo
|
||||||
fi
|
|
||||||
|
|
||||||
- |
|
- |
|
||||||
echo "Setting up database"
|
echo "Setting up database"
|
||||||
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then
|
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then
|
||||||
echo "MySQL"
|
echo "MySQL"
|
||||||
mysql -e 'DROP DATABASE IF EXISTS travis;'
|
mysql -e 'DROP DATABASE IF EXISTS travis;'
|
||||||
mysql -e 'CREATE DATABASE IF NOT EXISTS travis;'
|
mysql -e 'CREATE DATABASE IF NOT EXISTS travis;'
|
||||||
mysql -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;'
|
mysql -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;'
|
||||||
mysql -e 'FLUSH PRIVILEGES;'
|
mysql -e 'FLUSH PRIVILEGES;'
|
||||||
mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||||
fi
|
fi
|
||||||
if [ "$DB" = 'postgresql' ]; then
|
if [ "$DB" = 'postgresql' ]; then
|
||||||
#pgsql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
#pgsql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||||
#pgloader mysql://root:pass@127.0.0.1/base postgresql://dolibarrowner@127.0.0.1/dolibarr
|
#pgloader mysql://root:pass@127.0.0.1/base postgresql://dolibarrowner@127.0.0.1/dolibarr
|
||||||
pgloader mysql://root@127.0.0.1/travis postgresql:///travis
|
pgloader mysql://root@127.0.0.1/travis postgresql:///travis
|
||||||
fi
|
fi
|
||||||
# TODO: SQLite
|
# TODO: SQLite
|
||||||
echo
|
echo
|
||||||
|
|
||||||
- |
|
- |
|
||||||
export CONF_FILE=htdocs/conf/conf.php
|
export CONF_FILE=htdocs/conf/conf.php
|
||||||
echo "Setting up Dolibarr $CONF_FILE"
|
echo "Setting up Dolibarr $CONF_FILE"
|
||||||
echo '<?php ' > $CONF_FILE
|
echo '<?php ' > $CONF_FILE
|
||||||
echo '$'dolibarr_main_url_root=\'http://127.0.0.1\'';' >> $CONF_FILE
|
echo '$'dolibarr_main_url_root=\'http://127.0.0.1\'';' >> $CONF_FILE
|
||||||
echo '$'dolibarr_main_document_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $CONF_FILE
|
echo '$'dolibarr_main_document_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $CONF_FILE
|
||||||
echo '$'dolibarr_main_data_root=\'$TRAVIS_BUILD_DIR/documents\'';' >> $CONF_FILE
|
echo '$'dolibarr_main_data_root=\'$TRAVIS_BUILD_DIR/documents\'';' >> $CONF_FILE
|
||||||
echo '$'dolibarr_main_db_host=\'127.0.0.1\'';' >> $CONF_FILE
|
echo '$'dolibarr_main_db_host=\'127.0.0.1\'';' >> $CONF_FILE
|
||||||
echo '$'dolibarr_main_db_name=\'travis\'';' >> $CONF_FILE
|
echo '$'dolibarr_main_db_name=\'travis\'';' >> $CONF_FILE
|
||||||
echo '$'dolibarr_main_db_user=\'travis\'';' >> $CONF_FILE
|
echo '$'dolibarr_main_db_user=\'travis\'';' >> $CONF_FILE
|
||||||
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then
|
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then
|
||||||
echo '$'dolibarr_main_db_type=\'mysqli\'';' >> $CONF_FILE
|
echo '$'dolibarr_main_db_type=\'mysqli\'';' >> $CONF_FILE
|
||||||
fi
|
fi
|
||||||
if [ "$DB" = 'postgresql' ]; then
|
if [ "$DB" = 'postgresql' ]; then
|
||||||
echo '$'dolibarr_main_db_type=\'pgsql\'';' >> $CONF_FILE
|
echo '$'dolibarr_main_db_type=\'pgsql\'';' >> $CONF_FILE
|
||||||
fi
|
fi
|
||||||
# TODO: SQLite
|
# TODO: SQLite
|
||||||
echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> $CONF_FILE
|
echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> $CONF_FILE
|
||||||
cat $CONF_FILE
|
cat $CONF_FILE
|
||||||
echo
|
echo
|
||||||
|
|
||||||
- |
|
- |
|
||||||
echo "Create documents directory and set permissions"
|
echo "Create documents directory and set permissions"
|
||||||
# and admin/temp subdirectory needed for unit tests
|
# and admin/temp subdirectory needed for unit tests
|
||||||
mkdir -p documents/admin/temp
|
mkdir -p documents/admin/temp
|
||||||
echo "first line" > documents/dolibarr.log
|
echo "first line" > documents/dolibarr.log
|
||||||
echo
|
echo
|
||||||
|
|
||||||
- |
|
|
||||||
echo "Setting up Apache + FPM"
|
- echo "Setting up Apache + FPM"
|
||||||
|
- sudo apt-get update
|
||||||
|
- sudo apt-get install apache2 libapache2-mod-fastcgi
|
||||||
# enable php-fpm
|
# enable php-fpm
|
||||||
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf
|
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
|
||||||
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
- |
|
||||||
# Copy the included pool
|
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
||||||
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf
|
# Copy the included pool
|
||||||
fi
|
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
|
||||||
if [ "$DEBUG" = true ]; then
|
fi
|
||||||
cat ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf
|
- sudo a2enmod rewrite actions fastcgi alias
|
||||||
fi
|
- echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||||
sudo a2enmod rewrite actions fastcgi alias
|
- sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars
|
||||||
echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
- sudo chown -R travis:travis /var/lib/apache2/fastcgi
|
||||||
if [ "$DEBUG" = true ]; then
|
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
|
||||||
cat ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
# configure apache virtual hosts for precise
|
||||||
fi
|
#- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/default
|
||||||
~/.phpenv/versions/$PHP_VERSION_NAME/sbin/php-fpm
|
#- sudo cat /etc/apache2/sites-available/default
|
||||||
# configure apache virtual hosts
|
# configure apache virtual hosts for trusty
|
||||||
sudo cp -f build/travis-ci/apache.conf /etc/apache2/sites-available/default
|
- sudo cp -f build/travis-ci/apache.conf /etc/apache2/sites-available/000-default.conf
|
||||||
sudo sed -e "s?%TRAVIS_BUILD_DIR%?$TRAVIS_BUILD_DIR?g" --in-place /etc/apache2/sites-available/default
|
- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
|
||||||
if [ "$DEBUG" = true ]; then
|
- sudo cat /etc/apache2/sites-available/000-default.conf
|
||||||
sudo cat /etc/apache2/sites-available/default
|
- sudo service apache2 restart
|
||||||
fi
|
|
||||||
sudo service apache2 restart
|
|
||||||
echo
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- |
|
- |
|
||||||
echo "Checking webserver availability"
|
echo "Checking webserver availability by a wget -O - http://127.0.0.1"
|
||||||
# Ensure we catch errors
|
# Ensure we catch errors
|
||||||
set -e
|
set -e
|
||||||
wget http://127.0.0.1
|
# The wget should return a page with line '<meta name="generator" content="Dolibarr installer">
|
||||||
if [ "$DEBUG" = true ]; then
|
wget -O - http://127.0.0.1 > test.html
|
||||||
cat index.html
|
head test.html
|
||||||
fi
|
|
||||||
set +e
|
set +e
|
||||||
echo
|
echo
|
||||||
|
|
||||||
@ -313,30 +322,36 @@ script:
|
|||||||
php upgrade2.php 3.9.0 4.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade390400-2.log
|
php upgrade2.php 3.9.0 4.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade390400-2.log
|
||||||
php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log
|
php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log
|
||||||
php upgrade.php 4.0.0 5.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade400500.log
|
php upgrade.php 4.0.0 5.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade400500.log
|
||||||
php upgrade2.php 4.0.0 5.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade400500-2.log
|
php upgrade2.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-2.log
|
||||||
php step5.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-3.log
|
php step5.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-3.log
|
||||||
php upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.log
|
php upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.log
|
||||||
php upgrade2.php 5.0.0 6.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade500600-2.log
|
php upgrade2.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-2.log
|
||||||
php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log
|
php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log
|
||||||
php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log
|
php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log
|
||||||
php upgrade2.php 6.0.0 7.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade600700-2.log
|
php upgrade2.php 6.0.0 7.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade600700-2.log
|
||||||
php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log
|
php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log
|
||||||
|
php upgrade.php 7.0.0 8.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade700800.log
|
||||||
|
php upgrade2.php 7.0.0 8.0.0 MAIN_MODULE_TICKETSUP > $TRAVIS_BUILD_DIR/upgrade700800-2.log
|
||||||
|
php step5.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-3.log
|
||||||
cd -
|
cd -
|
||||||
set +e
|
set +e
|
||||||
echo
|
echo
|
||||||
#cat $TRAVIS_BUILD_DIR/upgrade400500-2.log
|
#cat $TRAVIS_BUILD_DIR/upgrade400500-2.log
|
||||||
|
#cat $TRAVIS_BUILD_DIR/upgrade500600.log
|
||||||
|
#cat $TRAVIS_BUILD_DIR/upgrade500600-2.log
|
||||||
|
#cat $TRAVIS_BUILD_DIR/upgrade500600-3.log
|
||||||
#cat /tmp/dolibarr_install.log
|
#cat /tmp/dolibarr_install.log
|
||||||
|
|
||||||
- |
|
- |
|
||||||
echo "Unit testing"
|
echo "Unit testing"
|
||||||
# Ensure we catch errors. Set this to +e if you want to go to the end to see log file.
|
# Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file.
|
||||||
set -e
|
set -e
|
||||||
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
- |
|
- |
|
||||||
#echo "Output dolibarr.log"
|
#echo "Output dolibarr.log"
|
||||||
#echo cat documents/dolibarr.log
|
#cat documents/dolibarr.log
|
||||||
|
|
||||||
after_script:
|
after_script:
|
||||||
- |
|
- |
|
||||||
|
|||||||
12
.tx/config
12
.tx/config
@ -152,12 +152,6 @@ source_file = htdocs/langs/en_US/hrm.lang
|
|||||||
source_lang = en_US
|
source_lang = en_US
|
||||||
type = MOZILLAPROPERTIES
|
type = MOZILLAPROPERTIES
|
||||||
|
|
||||||
[dolibarr.incoterm]
|
|
||||||
file_filter = htdocs/langs/<lang>/incoterm.lang
|
|
||||||
source_file = htdocs/langs/en_US/incoterm.lang
|
|
||||||
source_lang = en_US
|
|
||||||
type = MOZILLAPROPERTIES
|
|
||||||
|
|
||||||
[dolibarr.install]
|
[dolibarr.install]
|
||||||
file_filter = htdocs/langs/<lang>/install.lang
|
file_filter = htdocs/langs/<lang>/install.lang
|
||||||
source_file = htdocs/langs/en_US/install.lang
|
source_file = htdocs/langs/en_US/install.lang
|
||||||
@ -356,6 +350,12 @@ source_file = htdocs/langs/en_US/supplier_proposal.lang
|
|||||||
source_lang = en_US
|
source_lang = en_US
|
||||||
type = MOZILLAPROPERTIES
|
type = MOZILLAPROPERTIES
|
||||||
|
|
||||||
|
[dolibarr.ticketsup]
|
||||||
|
file_filter = htdocs/langs/<lang>/ticketsup.lang
|
||||||
|
source_file = htdocs/langs/en_US/ticketsup.lang
|
||||||
|
source_lang = en_US
|
||||||
|
type = MOZILLAPROPERTIES
|
||||||
|
|
||||||
[dolibarr.trips]
|
[dolibarr.trips]
|
||||||
file_filter = htdocs/langs/<lang>/trips.lang
|
file_filter = htdocs/langs/<lang>/trips.lang
|
||||||
source_file = htdocs/langs/en_US/trips.lang
|
source_file = htdocs/langs/en_US/trips.lang
|
||||||
|
|||||||
84
CODE_OF_CONDUCT.md
Normal file
84
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
# Code of Conduct
|
||||||
|
|
||||||
|
## 1. Purpose
|
||||||
|
|
||||||
|
A primary goal of Dolibarr is to be inclusive to the largest number of contributors, with the most varied and diverse backgrounds possible. As such, we are committed to providing a friendly, safe and welcoming environment for all, regardless of gender, sexual orientation, ability, ethnicity, socioeconomic status, and religion (or lack thereof).
|
||||||
|
|
||||||
|
This code of conduct outlines our expectations for all those who participate in our community, as well as the consequences for unacceptable behavior.
|
||||||
|
|
||||||
|
We invite all those who participate in Dolibarr to help us create safe and positive experiences for everyone.
|
||||||
|
|
||||||
|
## 2. Open Source Citizenship
|
||||||
|
|
||||||
|
A supplemental goal of this Code of Conduct is to increase open source citizenship by encouraging participants to recognize and strengthen the relationships between our actions and their effects on our community.
|
||||||
|
|
||||||
|
Communities mirror the societies in which they exist and positive action is essential to counteract the many forms of inequality and abuses of power that exist in society.
|
||||||
|
|
||||||
|
If you see someone who is making an extra effort to ensure our community is welcoming, friendly, and encourages all participants to contribute to the fullest extent, we want to know.
|
||||||
|
|
||||||
|
## 3. Expected Behavior
|
||||||
|
|
||||||
|
The following behaviors are expected and requested of all community members:
|
||||||
|
|
||||||
|
* Participate in an authentic and active way. In doing so, you contribute to the health and longevity of this community.
|
||||||
|
* Exercise consideration and respect in your speech and actions.
|
||||||
|
* Attempt collaboration before conflict.
|
||||||
|
* Refrain from demeaning, discriminatory, or harassing behavior and speech.
|
||||||
|
* Be mindful of your surroundings and of your fellow participants. Alert community leaders if you notice a dangerous situation, someone in distress, or violations of this Code of Conduct, even if they seem inconsequential.
|
||||||
|
* Remember that community event venues may be shared with members of the public; please be respectful to all patrons of these locations.
|
||||||
|
|
||||||
|
## 4. Unacceptable Behavior
|
||||||
|
|
||||||
|
The following behaviors are considered harassment and are unacceptable within our community:
|
||||||
|
|
||||||
|
* Violence, threats of violence or violent language directed against another person.
|
||||||
|
* Sexist, racist, homophobic, transphobic, ableist or otherwise discriminatory jokes and language.
|
||||||
|
* Posting or displaying sexually explicit or violent material.
|
||||||
|
* Posting or threatening to post other people’s personally identifying information ("doxing").
|
||||||
|
* Personal insults, particularly those related to gender, sexual orientation, race, religion, or disability.
|
||||||
|
* Inappropriate photography or recording.
|
||||||
|
* Inappropriate physical contact. You should have someone’s consent before touching them.
|
||||||
|
* Unwelcome sexual attention. This includes, sexualized comments or jokes; inappropriate touching, groping, and unwelcomed sexual advances.
|
||||||
|
* Deliberate intimidation, stalking or following (online or in person).
|
||||||
|
* Advocating for, or encouraging, any of the above behavior.
|
||||||
|
* Sustained disruption of community events, including talks and presentations.
|
||||||
|
|
||||||
|
## 5. Consequences of Unacceptable Behavior
|
||||||
|
|
||||||
|
Unacceptable behavior from any community member, including sponsors and those with decision-making authority, will not be tolerated.
|
||||||
|
|
||||||
|
Anyone asked to stop unacceptable behavior is expected to comply immediately.
|
||||||
|
|
||||||
|
If a community member engages in unacceptable behavior, the community organizers may take any action they deem appropriate, up to and including a temporary ban or permanent expulsion from the community without warning (and without refund in the case of a paid event).
|
||||||
|
|
||||||
|
## 6. Reporting Guidelines
|
||||||
|
|
||||||
|
If you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community organizer as soon as possible. contact@dolibarr.org.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Additionally, community organizers are available to help community members engage with local law enforcement or to otherwise help those experiencing unacceptable behavior feel safe. In the context of in-person events, organizers will also provide escorts as desired by the person experiencing distress.
|
||||||
|
|
||||||
|
## 7. Addressing Grievances
|
||||||
|
|
||||||
|
If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify Dolibarr with a concise description of your grievance. Your grievance will be handled in accordance with our existing governing policies.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 8. Scope
|
||||||
|
|
||||||
|
We expect all community participants (contributors, paid or otherwise; sponsors; and other guests) to abide by this Code of Conduct in all community venues–online and in-person–as well as in all one-on-one communications pertaining to community business.
|
||||||
|
|
||||||
|
This code of conduct and its related procedures also applies to unacceptable behavior occurring outside the scope of community activities when such behavior has the potential to adversely affect the safety and well-being of community members.
|
||||||
|
|
||||||
|
## 9. Contact info
|
||||||
|
|
||||||
|
contact@dolibarr.org
|
||||||
|
|
||||||
|
## 10. License and attribution
|
||||||
|
|
||||||
|
This Code of Conduct is distributed under a [Creative Commons Attribution-ShareAlike license](http://creativecommons.org/licenses/by-sa/3.0/).
|
||||||
|
|
||||||
|
Portions of text derived from the [Django Code of Conduct](https://www.djangoproject.com/conduct/) and the [Geek Feminism Anti-Harassment Policy](http://geekfeminism.wikia.com/wiki/Conference_anti-harassment/Policy).
|
||||||
|
|
||||||
|
Retrieved on November 22, 2016 from [http://citizencodeofconduct.org/](http://citizencodeofconduct.org/)
|
||||||
11
COPYRIGHT
11
COPYRIGHT
@ -34,12 +34,11 @@ Swift Mailer 5.4.2-DEV MIT license Yes
|
|||||||
Stripe 4.7.0 MIT licence Yes Library for Stripe module
|
Stripe 4.7.0 MIT licence Yes Library for Stripe module
|
||||||
|
|
||||||
JS libraries:
|
JS libraries:
|
||||||
jQuery 1.11.3 MIT License Yes JS library
|
jQuery 3.1.1 MIT License Yes JS library
|
||||||
jQuery UI 1.11.4 GPL and MIT License Yes JS library plugin UI
|
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
|
||||||
jQuery select2 3.5.2 GPL and Apache License Yes JS library plugin for sexier multiselect
|
jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect
|
||||||
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
||||||
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
|
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
|
||||||
jQuery FileUpload 5.0.3 GPL and MIT License Yes JS library to upload files
|
|
||||||
jQuery Flot 0.8.3 MIT License Yes JS library to build graph
|
jQuery Flot 0.8.3 MIT License Yes JS library to build graph
|
||||||
jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images)
|
jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images)
|
||||||
jQuery Jeditable 1.7.1 GPL and MIT License Yes JS library plugin jeditable (to edit in place)
|
jQuery Jeditable 1.7.1 GPL and MIT License Yes JS library plugin jeditable (to edit in place)
|
||||||
@ -49,10 +48,10 @@ jQuery jqueryFileTree 1.0.1 GPL and MIT License Yes
|
|||||||
jQuery jquerytreeview 1.4.1 MIT License Yes JS library for filetree
|
jQuery jquerytreeview 1.4.1 MIT License Yes JS library for filetree
|
||||||
jQuery TableDnD 0.6 GPL and MIT License Yes JS library plugin TableDnD (to reorder table rows)
|
jQuery TableDnD 0.6 GPL and MIT License Yes JS library plugin TableDnD (to reorder table rows)
|
||||||
jQuery Timepicker 1.1.0 GPL and MIT License Yes JS library Timepicker addon for Datepicker
|
jQuery Timepicker 1.1.0 GPL and MIT License Yes JS library Timepicker addon for Datepicker
|
||||||
jQuery Tiptip 1.3 GPL and MIT License Yes JS library for tooltips
|
jsGanttImproved 1.7.5.4 BSD License Yes JS library (to build Gantt reports)
|
||||||
jsGanttImproved 1.7.5.2 BSD License Yes JS library (to build Gantt reports)
|
|
||||||
JsTimezoneDetect 1.0.6 MIT License Yes JS library to detect user timezone
|
JsTimezoneDetect 1.0.6 MIT License Yes JS library to detect user timezone
|
||||||
SwaggerUI 2.0.24 GPL-2+ Yes JS library to offer the REST API explorer
|
SwaggerUI 2.0.24 GPL-2+ Yes JS library to offer the REST API explorer
|
||||||
|
Ace 1.2.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||||
|
|
||||||
For licenses compatibility informations:
|
For licenses compatibility informations:
|
||||||
http://www.gnu.org/licenses/licenses.en.html
|
http://www.gnu.org/licenses/licenses.en.html
|
||||||
|
|||||||
376
ChangeLog
376
ChangeLog
@ -3,6 +3,381 @@ English Dolibarr ChangeLog
|
|||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
***** ChangeLog for 8.0.0 compared to 7.0.0 *****
|
||||||
|
|
||||||
|
WARNING:
|
||||||
|
|
||||||
|
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||||
|
* Remove old deprecated hook 'insertExtraFields'. Triggers must be used for action on CRUD events.
|
||||||
|
* Hook 'maildao' was renamed into 'mail' into the method sendfile that send emails, and method was renamed from
|
||||||
|
'doaction' into 'sendMail'.
|
||||||
|
* Rename trigger CONTRACT_SERVICE_ACTIVATE into LINECONTRACT_ACTIVATE and
|
||||||
|
CONTRACT_SERVICE_CLOSE into LINECONTRACT_CLOSE
|
||||||
|
* Remove triggers *_CLONE. The trigger CREATE with context 'createfromclone' is already called so this is
|
||||||
|
a duplicated feature. Cloning is not a business event, the business event is CREATE, so no trigger required.
|
||||||
|
* PHP 5.3 is no more supported. Minimum PHP is now 5.4+
|
||||||
|
* Remove the old deprecated code of doActions and getInstanceDao in canvas. The doActions of standard hooks are
|
||||||
|
already available and are better.
|
||||||
|
* Removed method fetch_prods() and get_each_prod() not used, keep only get_arbo_each_prod() that is better.
|
||||||
|
* The hook contaxt commcard has been renamed thirdpartycomm
|
||||||
|
* The hook contaxt thirdpartycard has been renamed thirdpartycontact
|
||||||
|
|
||||||
|
|
||||||
|
***** ChangeLog for 7.0.1 compared to 7.0.0 *****
|
||||||
|
FIX: #8139 User search does not work if MAIN_USE_OLD_SEARCH_FORM, missing list.php
|
||||||
|
FIX: #8200
|
||||||
|
FIX: #8219
|
||||||
|
FIX: #8232
|
||||||
|
FIX: #8269
|
||||||
|
FIX: #8277
|
||||||
|
FIX: #8285 Extrafields now reported by /api/index.php/agendaevents/{id}
|
||||||
|
FIX: #8289 add a configuration for stock calculation
|
||||||
|
FIX: Activate all also if there are inactive services
|
||||||
|
FIX: add planned delivery to order exports
|
||||||
|
FIX: approval date was not visible if leave was canceled after
|
||||||
|
FIX: avoid "Array" on screen
|
||||||
|
FIX: Avoid empty value to fk_multicurrency attribute
|
||||||
|
FIX: Bad var for substitution of free text
|
||||||
|
FIX: Can't activate tasks on projects configuration
|
||||||
|
FIX: Can use odx templates that does not include lines tags
|
||||||
|
FIX: check shipping on delete order
|
||||||
|
FIX: check verif exped on delete order
|
||||||
|
FIX: comment on tasks
|
||||||
|
FIX: country must not be mandatory for accounting report groups
|
||||||
|
FIX: css
|
||||||
|
FIX: Delete tasks on project delete will now trigger TASK_DELETE
|
||||||
|
FIX: Do not lose filter when editing comment of a time spent in task view
|
||||||
|
FIX: duplicate confirm message. Missing reposition class
|
||||||
|
FIX: Duplicate product_type asignement on order addline
|
||||||
|
FIX: email use the validate user instead of approver in holiday approval
|
||||||
|
FIX: Error management in leave request
|
||||||
|
FIX: for nondisplay of fk_element 's id in REST API response
|
||||||
|
FIX: Generic substitution of constant disabled for sensitive constant
|
||||||
|
FIX: if we make a mistake with situation_percent, now we can correct it. before situation_final was always set to 1 and no way to go back
|
||||||
|
FIX: Import process must stop after ending line nb to import
|
||||||
|
FIX: Infinite loop on deletion of temp file when there is symbolic links
|
||||||
|
FIX: Input of holiday for subordinates was ko
|
||||||
|
FIX: invoice creation fails when next date not defined
|
||||||
|
FIX: Label of event show twice
|
||||||
|
FIX: letter for month March
|
||||||
|
FIX: Look and feel v7
|
||||||
|
FIX: Make a redirect after the remove_file action to avoid deletion done
|
||||||
|
FIX: migration script for product photo
|
||||||
|
FIX: missing email of customer in stripe info payments
|
||||||
|
FIX: missing object entity in fetch
|
||||||
|
FIX: Missing restore_lastsearch_values
|
||||||
|
FIX: multicompany compatibility and fix reports
|
||||||
|
FIX: natural search double quote
|
||||||
|
FIX: navigation and filters on holiday list
|
||||||
|
FIX: Parameter must be an array or an object that implements Countable
|
||||||
|
FIX: Payment mode not correctly set in donation and document
|
||||||
|
FIX: Permission in list of holiday
|
||||||
|
FIX: Properties updated if update successfull.
|
||||||
|
FIX: reverse field to have object loaded in doaction
|
||||||
|
FIX: Saving wrong localtax on order addline
|
||||||
|
FIX: Search criteria on vat
|
||||||
|
FIX: security report by DIGITEMIS CYBERSECURITY & PRIVACY
|
||||||
|
FIX: show status on societe banner
|
||||||
|
FIX: solve column mismatch in user card with multicompany transverse mode + code cleanup
|
||||||
|
FIX: Subscription events not recorded into agenda
|
||||||
|
FIX: Subscription not correctly log in blockedlog
|
||||||
|
FIX: Temporary dir for mail files must be cleaned at beginning of form
|
||||||
|
FIX: Trad and creation date in subscription create
|
||||||
|
FIX: translation of holiday types
|
||||||
|
FIX: Unknown column 'pl.amount_requested' in compta/prelevement/factures.php
|
||||||
|
FIX: Useless clean of tree
|
||||||
|
FIX: Use of undefined constant _ROWS_2
|
||||||
|
FIX: warning when adding ECM files using old photo path
|
||||||
|
|
||||||
|
|
||||||
|
***** ChangeLog for 7.0.0 compared to 6.0.5 *****
|
||||||
|
For users:
|
||||||
|
NEW: Add a preview icon after files that can be previewed (pdf + images)
|
||||||
|
NEW: When payment is registered, PDF of invoices are also regenerated so payments
|
||||||
|
appears with no need to click on regenerate.
|
||||||
|
NEW: #5711 Add shipment line deleting and editing for draft shipments.
|
||||||
|
NEW: Accept substitution key __(ABC)__ replaced with value of translation of key ABC
|
||||||
|
NEW: Accept substitution key __[ABC]__ replaced with value of const ABC
|
||||||
|
NEW: Accountancy Add fields for sale accounting account for intracommunity sales & export sales
|
||||||
|
NEW: Add a button "Activate all services" on contracts
|
||||||
|
NEW: Add a confirmation for all mass action 'delete'
|
||||||
|
NEW: Add a group task line for tasks on same level on gantt diagram
|
||||||
|
NEW: Add and edit country for chart of accounts systems
|
||||||
|
NEW: add a new notification for the signed closed event of a proposal.
|
||||||
|
NEW: Add a parameter to specify char used as separator for variant product label
|
||||||
|
NEW: Add a profile to import product translations
|
||||||
|
NEW: Add a protection so we can't journalize non balanced transactions
|
||||||
|
NEW: Add a status enabled/disabled on recurring invoices
|
||||||
|
NEW: add burger menu to list action comm
|
||||||
|
NEW: Add button cancel on shipment creation
|
||||||
|
NEW: Add chart of account for england
|
||||||
|
NEW: Add Chile accounting plan
|
||||||
|
NEW: Add class in societe/card.php
|
||||||
|
NEW: add company alias name when create company from member
|
||||||
|
NEW: Add date of birth on user card.
|
||||||
|
NEW: Add date_valid and date_pointoftax on supplier invoices.
|
||||||
|
NEW: Added Region name to state/province form field
|
||||||
|
NEW: Added regions to third party/societe lists, can be filtered
|
||||||
|
NEW: Add error message
|
||||||
|
NEW: Add expense report rules and ik
|
||||||
|
NEW: Add filter on event code on automatic filling setup page
|
||||||
|
NEW: Add filters on month/year on the accountancy binding tools
|
||||||
|
NEW: add fk_unit field into product/service import/export
|
||||||
|
NEW: add 'formObjectOptions' hook to the form setting the product selling price
|
||||||
|
NEW: Add hidden option PROJECT_DISABLE_UNLINK_FROM_OVERVIEW
|
||||||
|
NEW: add image object_phoning_mobile.png
|
||||||
|
NEW: Adding Field "First date of expire" + filter on contract list
|
||||||
|
NEW: add ldap_rename for avoid password if ldap key changed
|
||||||
|
NEW: Add mass action "validate" on supplier invoices.
|
||||||
|
NEW: add members types ldap group management
|
||||||
|
NEW: Add new property visible dy default on lists on extrafields
|
||||||
|
NEW: Add Next/Previous button on operation date of bank line
|
||||||
|
NEW: Add option EXPENSEREPORT_ALLOW_OVERLAPPING_PERIODS
|
||||||
|
NEW: Add option PROPOSAL/ORDER/INVOICE_ALLOW_EXTERNAL_DOWNLOAD
|
||||||
|
NEW: Add product unit fields for ODT substitution
|
||||||
|
NEW: Add project on a various payment
|
||||||
|
NEW: Add project related fields to ODT
|
||||||
|
NEW: Add protection to avoid to send to much emails using builk actions
|
||||||
|
NEW: Add search field for date on supplier payment page
|
||||||
|
NEW: Add search on date and accounting account in various payment list
|
||||||
|
NEW: add specific translation for title of documents (Invoice, Order, Proposal)
|
||||||
|
NEW: Adds the payment reference to the return of the function getListOfPayements
|
||||||
|
NEW: Add supplier proposals into stats of product page.
|
||||||
|
NEW: Add tab "Expense report" on user card
|
||||||
|
NEW: add the ability to regenerate a pdf for the order module
|
||||||
|
NEW: Add The accountancy Switzerland chart of accounts
|
||||||
|
NEW: Add The developed French chart of accounts 2014
|
||||||
|
NEW: Add The Luxembourg chart of accounts
|
||||||
|
NEW: Add The Moroccan chart of accounts
|
||||||
|
NEW: Add The Switzerland chart of accounts
|
||||||
|
NEW: Add The SYSCOHADA chart of accounts
|
||||||
|
NEW: Add the total in the perday view of the time spent form.
|
||||||
|
NEW: Add The Tunisia chart of accounts
|
||||||
|
NEW: Add toolkit for StockLimit and DesiredStock
|
||||||
|
NEW: add translation and possibility to change month and year
|
||||||
|
NEW: Add view of status of template invoice
|
||||||
|
NEW: All search boxes are available on smartphone
|
||||||
|
NEW: All setup of accountancy can be done from menu "Accountancy-Setup"
|
||||||
|
NEW: Attaching doc automatically in email is now a parameter of template.
|
||||||
|
NEW: automatic activation of external module on country set
|
||||||
|
NEW: Better autoselect customer or supplier fields to save clicks
|
||||||
|
NEW: Better behaviour when using a text browser
|
||||||
|
NEW: Break lines per project on the new timesheet page
|
||||||
|
NEW: Bulk action validate on customer invoices
|
||||||
|
NEW: Bulk delete actions available on leave requests
|
||||||
|
NEW: burger menu and hooks on list action
|
||||||
|
NEW: Can add html content on right of tabs
|
||||||
|
NEW: Can add link to other element on a donation
|
||||||
|
NEW: Can create intervention from a proposal
|
||||||
|
NEW: Can create thirdparty from card proposal, order or invoice
|
||||||
|
NEW: Can download PDF document from the payment page
|
||||||
|
NEW: Can edit the language into the email templates editor.
|
||||||
|
NEW: Can edit with delete/insert a forced translation
|
||||||
|
NEW: Can export list of stock movements
|
||||||
|
NEW: Can filter on date on the page showing existing bindings
|
||||||
|
NEW: Can filter on document name in ECM module for automatic tree
|
||||||
|
NEW: can filter on status of template invoices
|
||||||
|
NEW: Can filter on the "other" column on emailing target list
|
||||||
|
NEW: Can filter on type of email template
|
||||||
|
NEW: Can filter on user on unalterable log
|
||||||
|
NEW: Can import local tax rates in prices
|
||||||
|
NEW: Can include extrafields into member card templates
|
||||||
|
NEW: Can include tag {uuu} into some numbering masks to replace with user
|
||||||
|
NEW: Can make a specific setup for SMTP sending for emailing module
|
||||||
|
NEW: Can rename (so reorder) bank receipts
|
||||||
|
NEW: Can send email from contract card
|
||||||
|
NEW: Can send email from the member card using email templates.
|
||||||
|
NEW: Can set a dedicated message on payment forms
|
||||||
|
NEW: Can set email of thirdparty as unique and/or mandatory
|
||||||
|
NEW: Can setup csv accounting export from admin config
|
||||||
|
NEW: Can show currency in list of bank accounts
|
||||||
|
NEW: Can show stock in alert even if alter is set to 0
|
||||||
|
NEW: Can sort joined files on thirdparty and user card.
|
||||||
|
NEW: Can transfer from bank account to bank account with different currencies
|
||||||
|
NEW: Can use an url like $conf->global>-MYPARAM for menu urls
|
||||||
|
NEW: change description on click
|
||||||
|
NEW: Chart of account is loaded when selected into accounting setup
|
||||||
|
NEW: Classify the order as invoiced in the REST API
|
||||||
|
NEW: comments system on task
|
||||||
|
NEW: comment system working with all objects
|
||||||
|
NEW: Compatibility with PHP 7.2
|
||||||
|
NEW: confirm form style to accept or reject proposal
|
||||||
|
NEW: Create an invoice using an existing order
|
||||||
|
NEW: Create an order using an existing proposal
|
||||||
|
NEW: customizable meteo in value or percentage
|
||||||
|
NEW: Days where user is on vacation use different colors in timesheet.
|
||||||
|
NEW: Deduct an available credit to an existing invoice
|
||||||
|
NEW: Default filter and sort order can use partial list of query
|
||||||
|
NEW: Deposit invoice more explicit in invoice line description
|
||||||
|
NEW: deposits can be converted even if unpaid
|
||||||
|
NEW: detection of edge browser
|
||||||
|
NEW: Each user can edit its own email template (menu tools)
|
||||||
|
NEW: Enabled sending email in bulk actions for supplier orders
|
||||||
|
NEW: Enhance the anti XSS filter
|
||||||
|
NEW: extrafield on facture_rec
|
||||||
|
NEW: Extrafields "link to object" now use a combo selection and getNomUrl
|
||||||
|
NEW: filter date for blockedlog
|
||||||
|
NEW: filter on extrafield on product list (as in company list)
|
||||||
|
NEW: General ledger : Add field date_creation and selected field
|
||||||
|
NEW: generate also document when invoice is build from recurring template
|
||||||
|
NEW: Generated files are now indexed in database
|
||||||
|
NEW: generate invoice PDF on disount application or payment
|
||||||
|
NEW: Get a list of payments terms
|
||||||
|
NEW: hrm details output on user
|
||||||
|
NEW: If max nb of generation is reached, date for next gen is striked
|
||||||
|
NEW: improvements of invoices, orders and proposals in the REST API
|
||||||
|
NEW: Include a color syntaxed HTML editor for emailing edition.
|
||||||
|
NEW: Introduce code syntax coloration with mode 'ace' for DolEditor.
|
||||||
|
NEW: Introduce experimental feature to search dolistore from application
|
||||||
|
NEW: jquery date selector become default date selector
|
||||||
|
NEW: langs
|
||||||
|
NEW: link project from other company conf
|
||||||
|
NEW: manageme extrafields with multientity
|
||||||
|
NEW: Mass PDF Merging is available on contracts
|
||||||
|
NEW: merge categories while merging thirdparties
|
||||||
|
NEW: Merge resource/add.php to resource/card.php
|
||||||
|
NEW: Module "Product variants" is moved as stable.
|
||||||
|
NEW: More picto for phone
|
||||||
|
NEW: Move accountancy features into a dedicated menu
|
||||||
|
NEW: Move contacts of a thirdparty on tab Contacts/Addresses
|
||||||
|
NEW: Move the upload input on top right in ECM module
|
||||||
|
NEW: new columns into extrafields table to get update create information
|
||||||
|
NEW: new param on load_board() function in ActionComm class to avoid duplicate code
|
||||||
|
NEW: On bulk email from a list, can uncheck "Join main document".
|
||||||
|
NEW: On reconciliation, show balance including all reconciliated fields
|
||||||
|
NEW: Option "one email per recipient" when using bulk actions emails.
|
||||||
|
NEW: Option STOCK_SUPPORTS_SERVICES become visible.
|
||||||
|
NEW: option to avoid countries to disable there blockedlog
|
||||||
|
NEW: option to fix top menu with eldy theme (hidden conf)
|
||||||
|
NEW: Popup for preview of image add a button "Original size"
|
||||||
|
NEW: post lines of an invoice using the REST API
|
||||||
|
NEW: preload comments in task
|
||||||
|
NEW: Provide a way to download a file from a public URL for files in ECM
|
||||||
|
NEW: Reduce size of HTML page by removing duplicate tooltips
|
||||||
|
NEW: Remove background on agenda view when event is a not busy event.
|
||||||
|
NEW: Retrieves available discounts and payments details from a specific invoice
|
||||||
|
NEW: Revenue stamp can be a percent
|
||||||
|
NEW: Search filters in lists are restored when using "back to list"
|
||||||
|
NEW: Send by email available in bulk for expense report
|
||||||
|
NEW: Set a proposal to draft
|
||||||
|
NEW: Show badge with nbr of shipment on shimpen tab of order
|
||||||
|
NEW: Show country and vat number into company tooltip
|
||||||
|
NEW: Show direct preview link on contract
|
||||||
|
NEW: Show expected worked hours on the timesheet form.
|
||||||
|
NEW: Show line "other filtered task" when using filter on timesheet.
|
||||||
|
NEW: Show list of tracked events into the module config page.
|
||||||
|
NEW: Show the supplier ref into supplier cards
|
||||||
|
NEW: Show user id of web process in system info - web server
|
||||||
|
NEW: Summary of last events on a card are sorted on decreasing date.
|
||||||
|
NEW: Support Italian addresses format. Fixes #7785
|
||||||
|
NEW: Support visibility on extrafields
|
||||||
|
NEW: Template invoices are visible on the customer tab
|
||||||
|
NEW: template invoices support substition key
|
||||||
|
NEW: The bank account is visible on payment of taxes
|
||||||
|
NEW: The comment when closing a proposal is added to commercial proposal
|
||||||
|
NEW: The gantt diagram is now sensitive to hours
|
||||||
|
NEW: The lot of a product uses the link and picto when shown into list.
|
||||||
|
NEW: The "Show detail by account" accepts 3 values: yes, no, if non zero
|
||||||
|
NEW: The unalterable log can be browse by any user with he permission
|
||||||
|
NEW: Tooltip for substitutions variables on tooltips on admin pages
|
||||||
|
NEW: unexistant function load_state_board() on several objects
|
||||||
|
NEW: Update availability
|
||||||
|
NEW: Update bank account when updating an invoice
|
||||||
|
NEW: Update bank account when updating an order
|
||||||
|
NEW: Use autocompletion on selection of chart of account
|
||||||
|
NEW: view company name if different of fullname in dol_banner
|
||||||
|
NEW: warning on module blocked log reset if country code is FR
|
||||||
|
|
||||||
|
For developers:
|
||||||
|
NEW: Add 2 new automatic classification in workflow module
|
||||||
|
NEW: Add API for contracts
|
||||||
|
NEW: Add API to activate/unactivate a contract
|
||||||
|
NEW: Add api validate and close on contracts
|
||||||
|
NEW: add doActions hook in admin ihm
|
||||||
|
NEW: add doActions hook in company admin
|
||||||
|
NEW: Added functionality to get order customer contact as contact_xx tags
|
||||||
|
NEW: Add hook addAdminLdapOptions and doAction in ldap admin page
|
||||||
|
NEW: Add method executeCLI and a phpunit
|
||||||
|
NEW: add '$moreatt' parameter in picto_from_langcode function
|
||||||
|
NEW: Add non intrusive js library to make syntaxic coloring of textarea
|
||||||
|
NEW: Add payment line to a specific invoice using the REST API
|
||||||
|
NEW: add possibility to disabled the LDAP trigger
|
||||||
|
NEW: add possibility to hide LDAP tab for non admin
|
||||||
|
NEW: Add possibility to propose last num releve in conciliation
|
||||||
|
NEW: add possibility to remove address field
|
||||||
|
NEW: Add REST API for supplier proposals
|
||||||
|
NEW: Add REST API to add payment line to a specific invoice
|
||||||
|
NEW: Add the attribute accept to the input form for file upload
|
||||||
|
NEW: add translation column for extrafields list
|
||||||
|
NEW: Add performances indexes on calendar events
|
||||||
|
NEW: A module can change order of element in the quick search combo
|
||||||
|
NEW: Can test signature of a version from API
|
||||||
|
NEW: complete_head_from_modules() in ldap_prepare_head()
|
||||||
|
NEW: Consolidates REST dictionary APIs into a single tree and a single file
|
||||||
|
NEW: Delete a line of invoice using the REST API
|
||||||
|
NEW: documents REST API return list of documents by element
|
||||||
|
NEW: Download a document using the REST API
|
||||||
|
NEW: Enhance framework so we can use html/icons into SELECT options.
|
||||||
|
NEW: External module can interact with the customer summary page
|
||||||
|
NEW: Generates the document before downloading using REST API
|
||||||
|
NEW: get and post lines of an invoice using the REST API
|
||||||
|
NEW: Get a payment list of a given invoice using the REST API
|
||||||
|
NEW: Get available assets of an invoice using the REST API
|
||||||
|
NEW: Get credit notes or deposits of a thirdparty
|
||||||
|
NEW: GET lines of an invoice in the REST API
|
||||||
|
NEW: get payment types using the REST API + consolidates REST dictionary APIs
|
||||||
|
NEW: Get the list of payments terms.
|
||||||
|
NEW: hook formObjectOptions in the form setting product selling price
|
||||||
|
NEW: hook to enrich homepage open elements dashboard
|
||||||
|
NEW: Insert a discount in a specific invoice using the REST API
|
||||||
|
NEW: Remove js library fileupload that was not used by core code.
|
||||||
|
NEW: Remove tooltip tipTip library replaced with standatd jquery tooltip
|
||||||
|
NEW: Set invoices as draft using the REST API
|
||||||
|
NEW: Sets an invoice as paid using the REST API
|
||||||
|
NEW: Tag the order as validated (opened) in the REST API
|
||||||
|
NEW: Update end of validity date of proposal using the API
|
||||||
|
NEW: Update in the order REST API
|
||||||
|
NEW: Upgrade jquery select2 to 4.0.4
|
||||||
|
|
||||||
|
|
||||||
|
WARNING:
|
||||||
|
|
||||||
|
If you enabled (for test) the experimental BlockedLog module before 7.0, you must purge the table llx_blockedlog because
|
||||||
|
way to save data for final version has changed.
|
||||||
|
|
||||||
|
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||||
|
* The methode "cloture" on contract were renamed into "closeAll".
|
||||||
|
* The method "is_erasable" of invoice return a value <= 0 if not erasable (value is meaning) instead of always 0.
|
||||||
|
* The substitution key for reference of objects is now __REF__ whatever is the object (it replaces __ORDERREF__,
|
||||||
|
__PROPALREF__, ...)
|
||||||
|
* The substition key __SIGNATURE__ was renamed into __USER_SIGNATURE__ to follow naming conventions.
|
||||||
|
* Substitution keys with syntax %XXX% were renamed into __XXX__ to match others.
|
||||||
|
* Removed old deprecated REST API (APIs found into '/root' section of the REST API explorer in Dolibarr v6).
|
||||||
|
* Some REST API to access setup features, like dictionaries (country, town, extrafields, ...) were moved into a
|
||||||
|
common API "/setup".
|
||||||
|
* The REST API /documents were renamed into /documents/download and /documents/upload.
|
||||||
|
* Page bank/index.php, bank/bankentries.php and comm/actions/listactions.php were renamed into
|
||||||
|
bank/list.php, bank/bankentries_list.php and comm/actions/list.php to follow page naming
|
||||||
|
conventions (so default filter/sort order features can also work for this pages).
|
||||||
|
* The trigger ORDER_SUPPLIER_STATUS_ONPROCESS was renamed into ORDER_SUPPLIER_STATUS_ORDERED.
|
||||||
|
* The trigger ORDER_SUPPLIER_STATUS_RECEIVED_ALL was renamed into ORDER_SUPPLIER_STATUS_RECEIVED_COMPLETELY.
|
||||||
|
* The parameter note into method cloture() is added at end of private note (previously in v6, it replaced).
|
||||||
|
* The parameter $user is now mandatory for method createFromOrder and createFromPropal.
|
||||||
|
* Removed js library 'fileupload' that was not used by core code.
|
||||||
|
* Jquery plugin tableDnd updated. You now need to use decodeURI on the return value of tableDnDSerialize()
|
||||||
|
and add 'td.' to the beginning of the dragHandle match string.
|
||||||
|
* IE8 and earlier and Firefox 12 and earlier (< 2012) are no more supported.
|
||||||
|
* The module ExpenseReport use numbering rules that you can setup (like other modules do). If you need to
|
||||||
|
keep the hard coded numbering rule of expenses report used in 6.0, just add constant
|
||||||
|
EXPENSEREPORT_USE_OLD_NUMBERING_RULE to 1.
|
||||||
|
* If you use the external module "multicompany", you must also upgrade the module. Multicompany module for
|
||||||
|
Dolibarr v7 is required because with Dolibarr v7, payment modes and payment conditions are management as data
|
||||||
|
that are dedicated to each company. If you keep your old version of multicompany module, mode and
|
||||||
|
condition of payments will appears empty in all companies that are not the first one. By upgrading the
|
||||||
|
multicompany module to a version that support Dolibarr v7, everything should work as expected.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 6.0.6 compared to 6.0.6 *****
|
***** ChangeLog for 6.0.6 compared to 6.0.6 *****
|
||||||
FIX: #7974 Contract - Invalid reference on the document
|
FIX: #7974 Contract - Invalid reference on the document
|
||||||
FIX: #8139
|
FIX: #8139
|
||||||
@ -81,6 +456,7 @@ FIX: test for filter fk_status
|
|||||||
FIX: too much users on holiday list
|
FIX: too much users on holiday list
|
||||||
FIX: Wrong alias sql
|
FIX: Wrong alias sql
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 6.0.3 compared to 6.0.2 *****
|
***** ChangeLog for 6.0.3 compared to 6.0.2 *****
|
||||||
FIX: #7211 Update qty dispatched on qty change
|
FIX: #7211 Update qty dispatched on qty change
|
||||||
FIX: #7458
|
FIX: #7458
|
||||||
|
|||||||
19
Dockerfile
19
Dockerfile
@ -1,19 +0,0 @@
|
|||||||
FROM php:5.6-apache
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev libldap2-dev \
|
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
|
||||||
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
|
|
||||||
&& docker-php-ext-install gd \
|
|
||||||
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
|
|
||||||
&& docker-php-ext-install ldap \
|
|
||||||
&& docker-php-ext-install mysqli \
|
|
||||||
&& apt-get purge -y libpng12-dev libjpeg-dev libldap2-dev
|
|
||||||
|
|
||||||
COPY htdocs/ /var/www/html/
|
|
||||||
|
|
||||||
RUN chown -hR www-data:www-data /var/www/html
|
|
||||||
|
|
||||||
VOLUME /var/www/html/conf
|
|
||||||
VOLUME /var/www/html/documents
|
|
||||||
|
|
||||||
EXPOSE 80
|
|
||||||
@ -138,9 +138,10 @@ Voici un liste de fonctionnalites pas encore gérées par Dolibarr:
|
|||||||
Les documentations utilisateur, développeur et traducteur sont disponible sous forme de ressources de la communautés via la site [Wiki](https://wiki.dolibarr.org).
|
Les documentations utilisateur, développeur et traducteur sont disponible sous forme de ressources de la communautés via la site [Wiki](https://wiki.dolibarr.org).
|
||||||
|
|
||||||
|
|
||||||
## CONTRIBUTING
|
## CONTRIBUER
|
||||||
|
|
||||||
Voir le fichier [CONTRIBUTING](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)
|
Ce projet existe grâce à ses nombreux contributeurs [[Contribuer](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)].
|
||||||
|
<a href="https://github.com/Dolibarr/dolibarr/graphs/contributors"><img src="https://opencollective.com/dolibarr/contributors.svg?width=890&button=false" /></a>
|
||||||
|
|
||||||
|
|
||||||
## CREDITS
|
## CREDITS
|
||||||
|
|||||||
39
README.md
39
README.md
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
 
|
 
|
||||||
|
|
||||||
Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda, ...).
|
Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…).
|
||||||
|
|
||||||
It's an Open Source software (wrote in PHP language) designed for small, medium or large companies, foundations and freelances.
|
It's an Open Source Software (written in PHP language) designed for small, medium or large companies, foundations and freelances.
|
||||||
|
|
||||||
You can freely use, study, modify or distribute it according to its Free Software licence.
|
You can freely use, study, modify or distribute it according to its Free Software licence.
|
||||||
|
|
||||||
@ -29,18 +29,25 @@ Other licenses apply for some included dependencies. See [COPYRIGHT](https://git
|
|||||||
Releases can be downloaded from [official website](https://www.dolibarr.org/).
|
Releases can be downloaded from [official website](https://www.dolibarr.org/).
|
||||||
|
|
||||||
### Install from composer
|
### Install from composer
|
||||||
If you do not already have Composer installed, you may do so by following the instructions at getcomposer.org. On Linux and Mac OS X, you'll run the following commands:
|
|
||||||
|
|
||||||
|
If you do not already have Composer installed, you may do so by following the instructions at [getcomposer.org](https://getcomposer.org/). On Linux and macOS, you may run the following commands:
|
||||||
|
|
||||||
|
```bash
|
||||||
curl -sS https://getcomposer.org/installer | php
|
curl -sS https://getcomposer.org/installer | php
|
||||||
mv composer.phar /usr/local/bin/composer
|
mv composer.phar /usr/local/bin/composer
|
||||||
|
```
|
||||||
|
|
||||||
On Windows, you'll download and run https://getcomposer.org/Composer-Setup.exe
|
On Windows, you can download and run https://getcomposer.org/Composer-Setup.exe
|
||||||
|
|
||||||
|
You can then create a new project
|
||||||
|
|
||||||
|
```bash
|
||||||
composer create-project dolibarr/dolibarr erp
|
composer create-project dolibarr/dolibarr erp
|
||||||
|
```
|
||||||
|
|
||||||
### Simple setup
|
### Simple setup
|
||||||
|
|
||||||
If you have low technical skills and you're looking to install Dolibarr ERP/CRM in few clicks, you can use one of the packaged versions:
|
If you have low technical skills and you're looking to install Dolibarr ERP/CRM in just a few clicks, you can use one of the packaged versions:
|
||||||
|
|
||||||
- DoliWamp for Windows
|
- DoliWamp for Windows
|
||||||
- DoliDeb for Debian or Ubuntu
|
- DoliDeb for Debian or Ubuntu
|
||||||
@ -48,11 +55,11 @@ If you have low technical skills and you're looking to install Dolibarr ERP/CRM
|
|||||||
|
|
||||||
### Advanced setup
|
### Advanced setup
|
||||||
|
|
||||||
You can use a Web server and a supported database (MariaDb, MySql or Postgresql) to install the standard version.
|
You can use a Web server and a supported database (MariaDB, MySQL or PostgreSQL) to install the standard version.
|
||||||
|
|
||||||
- Uncompress the downloaded archive
|
- Uncompress the downloaded archive
|
||||||
- Copy directory "dolibarr" and all its files inside your web server root, or copy directory anywhere and set up your web server to use "dolibarr/htdocs" as root for a new web server virtual host (second choice need to be server administrator)
|
- Copy the "dolibarr" directory and all its files inside your web server root or anywhere you'd like and set up your web server to use "*dolibarr/htdocs*" as root for a new web server virtual host (second choice need to be server administrator)
|
||||||
- Create an empty file "htdocs/conf/conf.php" and set permissions for your web server user (write permissions will be removed once install is finished)
|
- Create an empty `htdocs/conf/conf.php` file and set permissions for your web server user (*write* permissions will be removed once install is finished)
|
||||||
- From your browser, go to the dolibarr "install/" page
|
- From your browser, go to the dolibarr "install/" page
|
||||||
|
|
||||||
The URL will depends on choices made in the first step:
|
The URL will depends on choices made in the first step:
|
||||||
@ -73,10 +80,10 @@ You can use a Web server and a supported database (MariaDb, MySql or Postgresql)
|
|||||||
## UPGRADING
|
## UPGRADING
|
||||||
|
|
||||||
- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
|
- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
|
||||||
- At first next access, Dolibarr will redirect your to the "install/" page to make the upgrade process.
|
- At first next access, Dolibarr will redirect your to the "install/" page to follow the upgrade process.
|
||||||
If a file install.lock exists to lock any run of upgrade process, the application will ask you to remove the file manually (you should find the install.lock file into the directory used to store generated and uploaded documents, in most cases, it is the directory called "documents").
|
If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file into the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*").
|
||||||
|
|
||||||
*Note: migration process can safely be done multiple times by calling the page /install/index.php*
|
*Note: migration process can be safely done multiple times by calling the `/install/index.php` page*
|
||||||
|
|
||||||
|
|
||||||
## WHAT'S NEW
|
## WHAT'S NEW
|
||||||
@ -155,7 +162,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
|||||||
Dolibarr can be extended with a lot of other external application or modules from third party developers available at the [DoliStore](https://www.dolistore.com).
|
Dolibarr can be extended with a lot of other external application or modules from third party developers available at the [DoliStore](https://www.dolistore.com).
|
||||||
|
|
||||||
|
|
||||||
## FUTURE
|
## WHAT DOLIBARR CAN'T DO YET
|
||||||
|
|
||||||
These are features that Dolibarr does **not** yet fully support:
|
These are features that Dolibarr does **not** yet fully support:
|
||||||
|
|
||||||
@ -172,7 +179,8 @@ Administrator, user, developer and translator's documentations are available alo
|
|||||||
|
|
||||||
## CONTRIBUTING
|
## CONTRIBUTING
|
||||||
|
|
||||||
See file [CONTRIBUTING](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)
|
This project exists thanks to all the people who contribute. [[Contribute](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)].
|
||||||
|
<a href="https://github.com/Dolibarr/dolibarr/graphs/contributors"><img src="https://opencollective.com/dolibarr/contributors.svg?width=890&button=false" /></a>
|
||||||
|
|
||||||
|
|
||||||
## CREDITS
|
## CREDITS
|
||||||
@ -192,3 +200,8 @@ Follow Dolibarr project on:
|
|||||||
- [LinkedIn](https://www.linkedin.com/company/association-dolibarr)
|
- [LinkedIn](https://www.linkedin.com/company/association-dolibarr)
|
||||||
- [YouTube](https://www.youtube.com/user/DolibarrERPCRM)
|
- [YouTube](https://www.youtube.com/user/DolibarrERPCRM)
|
||||||
- [GitHub](https://github.com/Dolibarr/dolibarr)
|
- [GitHub](https://github.com/Dolibarr/dolibarr)
|
||||||
|
|
||||||
|
|
||||||
|
### Sponsors
|
||||||
|
|
||||||
|
Support this project by becoming a sponsor. Your logo will show up here. 🙏 [[Become a sponsor/backer](https://opencollective.com/dolibarr#backer)]
|
||||||
|
|||||||
@ -34,17 +34,4 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
|
|||||||
+$conffiletoshow = "/etc/dolibarr/conf.php";
|
+$conffiletoshow = "/etc/dolibarr/conf.php";
|
||||||
|
|
||||||
|
|
||||||
// Load conf file if it is already defined
|
|
||||||
--- a/htdocs/support/inc.php
|
|
||||||
+++ b/htdocs/support/inc.php
|
|
||||||
@@ -69,8 +69,8 @@ $conffiletoshowshort = "conf.php";
|
|
||||||
$conffile = "../conf/conf.php";
|
|
||||||
$conffiletoshow = "htdocs/conf/conf.php";
|
|
||||||
// For debian/redhat like systems
|
|
||||||
-//$conffile = "/etc/dolibarr/conf.php";
|
|
||||||
-//$conffiletoshow = "/etc/dolibarr/conf.php";
|
|
||||||
+$conffile = "/etc/dolibarr/conf.php";
|
|
||||||
+$conffiletoshow = "/etc/dolibarr/conf.php";
|
|
||||||
|
|
||||||
|
|
||||||
// Load conf file if it is already defined
|
// Load conf file if it is already defined
|
||||||
|
|||||||
@ -10,12 +10,23 @@ export DH_OPTIONS=-v
|
|||||||
%:
|
%:
|
||||||
dh $@
|
dh $@
|
||||||
|
|
||||||
|
# Replace standard debian package actions with a new one
|
||||||
|
########################################################
|
||||||
|
|
||||||
override_dh_auto_clean:
|
override_dh_auto_clean:
|
||||||
# Do nothing. Added to disable launchpad to use bugged dh_auto_clean search for ant
|
# Do nothing. Added to disable launchpad to use bugged dh_auto_clean search for ant
|
||||||
|
|
||||||
override_dh_auto_build:
|
override_dh_auto_build:
|
||||||
# Do nothing. Added to disable launchpad to use bugged dh_auto_build search for ant
|
# Do nothing. Added to disable launchpad to use bugged dh_auto_build search for ant
|
||||||
|
|
||||||
|
#override_dh_compress:
|
||||||
|
# dh_compress --no-act -X.png
|
||||||
|
|
||||||
|
# We disable this for png file because it modify content of original file so make
|
||||||
|
# the dolibarr signature not valid.
|
||||||
|
override_dh_strip_nondeterminism:
|
||||||
|
dh_strip_nondeterminism -X.png
|
||||||
|
|
||||||
override_dh_install:
|
override_dh_install:
|
||||||
dh_install
|
dh_install
|
||||||
# Delete files
|
# Delete files
|
||||||
|
|||||||
3
build/docker/.dockerignore
Normal file
3
build/docker/.dockerignore
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Dockerfile
|
||||||
|
README.md
|
||||||
|
docker-compose.yml
|
||||||
20
build/docker/Dockerfile
Normal file
20
build/docker/Dockerfile
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
FROM php:7.0-apache
|
||||||
|
|
||||||
|
ENV HOST_USER_ID 33
|
||||||
|
ENV PHP_INI_DATE_TIMEZONE 'UTC'
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev libldap2-dev \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
|
||||||
|
&& docker-php-ext-install gd \
|
||||||
|
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
|
||||||
|
&& docker-php-ext-install ldap \
|
||||||
|
&& docker-php-ext-install mysqli \
|
||||||
|
&& apt-get purge -y libpng12-dev libjpeg-dev libldap2-dev
|
||||||
|
|
||||||
|
COPY docker-run.sh /usr/local/bin/
|
||||||
|
RUN chmod +x /usr/local/bin/docker-run.sh
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
ENTRYPOINT ["docker-run.sh"]
|
||||||
25
build/docker/README.md
Normal file
25
build/docker/README.md
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# How to use it ?
|
||||||
|
|
||||||
|
The docker-compose.yml file is used to build and run Dolibarr in the current workspace.
|
||||||
|
|
||||||
|
Before build/run, define the variable HOST_USER_ID as following:
|
||||||
|
|
||||||
|
export HOST_USER_ID=$(id -u)
|
||||||
|
|
||||||
|
Go in repository build/docker :
|
||||||
|
|
||||||
|
cd build/docker
|
||||||
|
|
||||||
|
And then, you can run :
|
||||||
|
|
||||||
|
docker-compose up
|
||||||
|
|
||||||
|
This will run 3 container Docker : Dolibarr, MariaDB and PhpMyAdmin.
|
||||||
|
|
||||||
|
The URL to go to the Dolibarr is :
|
||||||
|
|
||||||
|
http://0.0.0.0
|
||||||
|
|
||||||
|
The URL to go to PhpMyAdmin is (login/password is root/root) :
|
||||||
|
|
||||||
|
http://0.0.0.0:8080
|
||||||
25
build/docker/docker-compose.yml
Normal file
25
build/docker/docker-compose.yml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
mariadb:
|
||||||
|
image: mariadb:latest
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: root
|
||||||
|
MYSQL_DATABASE: dolibarr
|
||||||
|
|
||||||
|
phpmyadmin:
|
||||||
|
image: phpmyadmin/phpmyadmin
|
||||||
|
environment:
|
||||||
|
PMA_HOST: mariadb
|
||||||
|
links:
|
||||||
|
- mariadb
|
||||||
|
ports:
|
||||||
|
- "8080:80"
|
||||||
|
|
||||||
|
web:
|
||||||
|
build: .
|
||||||
|
environment:
|
||||||
|
HOST_USER_ID: $HOST_USER_ID
|
||||||
|
volumes:
|
||||||
|
- ../../htdocs:/var/www/html
|
||||||
|
links:
|
||||||
|
- mariadb
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
15
build/docker/docker-run.sh
Normal file
15
build/docker/docker-run.sh
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
usermod -u $HOST_USER_ID www-data
|
||||||
|
groupmod -g $HOST_USER_ID www-data
|
||||||
|
|
||||||
|
chown -hR www-data:www-data /var/www
|
||||||
|
|
||||||
|
if [ ! -f /usr/local/etc/php/php.ini ]; then
|
||||||
|
cat <<EOF > /usr/local/etc/php/php.ini
|
||||||
|
date.timezone = $PHP_INI_DATE_TIMEZONE
|
||||||
|
display_errors = On
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec apache2-foreground
|
||||||
@ -442,7 +442,7 @@ SORT_BY_SCOPE_NAME = NO
|
|||||||
# disable (NO) the todo list. This list is created by putting \todo
|
# disable (NO) the todo list. This list is created by putting \todo
|
||||||
# commands in the documentation.
|
# commands in the documentation.
|
||||||
|
|
||||||
GENERATE_TODOLIST = YES
|
GENERATE_TODOLIST = NO
|
||||||
|
|
||||||
# The GENERATE_TESTLIST tag can be used to enable (YES) or
|
# The GENERATE_TESTLIST tag can be used to enable (YES) or
|
||||||
# disable (NO) the test list. This list is created by putting \test
|
# disable (NO) the test list. This list is created by putting \test
|
||||||
@ -639,7 +639,7 @@ EXCLUDE_SYMBOLS =
|
|||||||
# directories that contain example code fragments that are included (see
|
# directories that contain example code fragments that are included (see
|
||||||
# the \include command).
|
# the \include command).
|
||||||
|
|
||||||
EXAMPLE_PATH = ../../dev/skeletons
|
EXAMPLE_PATH = ../../htdocs/modulebuilder/template
|
||||||
|
|
||||||
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
|
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
|
||||||
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
||||||
|
|||||||
@ -43,3 +43,5 @@ DoliWampWillStartApacheMysql=DoliWamp installer will now start or restart Apache
|
|||||||
OldVersionFoundAndMoveInNew=An old database version has been found and moved to be used by new Dolibarr version
|
OldVersionFoundAndMoveInNew=An old database version has been found and moved to be used by new Dolibarr version
|
||||||
OldVersionFoundButFailedToMoveInNew=An old database version has been found but could not be moved to be used with new Dolibarr version
|
OldVersionFoundButFailedToMoveInNew=An old database version has been found but could not be moved to be used with new Dolibarr version
|
||||||
|
|
||||||
|
DLLMissing=The "Visual C++ Redistributable for Visual Studio 2012" component is missing. Please install the 32-bit version (vcredit_x86.exe) first from https://www.microsoft.com/en-us/download/details.aspx?id=30679 and restart DoliWamp installation/upgrade.
|
||||||
|
ContinueAnyway=Continue anyway (install process may fails without this prerequisite)
|
||||||
|
|||||||
@ -28,11 +28,11 @@ OutputBaseFilename=__FILENAMEEXEDOLIWAMP__
|
|||||||
SourceDir=..\..\..
|
SourceDir=..\..\..
|
||||||
AppId=doliwamp
|
AppId=doliwamp
|
||||||
AppPublisher=NLTechno
|
AppPublisher=NLTechno
|
||||||
AppPublisherURL=http://www.nltechno.com
|
AppPublisherURL=https://www.nltechno.com
|
||||||
AppSupportURL=http://www.dolibarr.org
|
AppSupportURL=https://www.dolibarr.org
|
||||||
AppUpdatesURL=http://www.dolibarr.org
|
AppUpdatesURL=https://www.dolibarr.org
|
||||||
AppComments=DoliWamp includes Dolibarr, Apache, PHP and Mysql softwares.
|
AppComments=DoliWamp includes Dolibarr, Apache, PHP and Mysql softwares.
|
||||||
AppCopyright=Copyright (C) 2008-2016 Laurent Destailleur, NLTechno
|
AppCopyright=Copyright (C) 2008-2017 Laurent Destailleur (NLTechno), Fabian Rodriguez (Le Goût du Libre)
|
||||||
DefaultDirName=c:\dolibarr
|
DefaultDirName=c:\dolibarr
|
||||||
DefaultGroupName=Dolibarr
|
DefaultGroupName=Dolibarr
|
||||||
;LicenseFile=COPYING
|
;LicenseFile=COPYING
|
||||||
@ -100,9 +100,9 @@ Source: "build\exe\doliwamp\builddemosslfiles.bat.install"; DestDir: "{app}\"; F
|
|||||||
Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversion;
|
Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversion;
|
||||||
; PhpMyAdmin, Apache, Php, Mysql
|
; PhpMyAdmin, Apache, Php, Mysql
|
||||||
; Put here path of Wampserver applications
|
; Put here path of Wampserver applications
|
||||||
; Value OK: apache 2.2.6, php 5.2.5 (5.2.11, 5.3.0 and 5.3.1 fails if php_exif, php_pgsql, php_zip is on), mysql 5.0.45
|
; Value OK: apache 2.2.6, php 5.2.5 (5.2.11, 5.3.0 and 5.3.1 fails if php_exif, php_pgsql, php_zip is on), mysql 5.0.45
|
||||||
; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45
|
; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45
|
||||||
; Value ???: apache 2.4.19, php 5.5.12, mysql 5.0.45 instead of 5.6.17 (wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe)
|
; Value OK: apache 2.4.19, php 5.5.12, mysql 5.0.45 instead of 5.6.17 (wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe)
|
||||||
Source: "C:\Program Files\Wamp\apps\phpmyadmin4.1.14\*.*"; DestDir: "{app}\apps\phpmyadmin4.1.14"; Flags: ignoreversion recursesubdirs; Excludes: "config.inc.php,wampserver.conf,*.log,*_log,darkblue_orange"
|
Source: "C:\Program Files\Wamp\apps\phpmyadmin4.1.14\*.*"; DestDir: "{app}\apps\phpmyadmin4.1.14"; Flags: ignoreversion recursesubdirs; Excludes: "config.inc.php,wampserver.conf,*.log,*_log,darkblue_orange"
|
||||||
Source: "C:\Program Files\Wamp\bin\apache\apache2.4.9\*.*"; DestDir: "{app}\bin\apache\apache2.4.9"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
|
Source: "C:\Program Files\Wamp\bin\apache\apache2.4.9\*.*"; DestDir: "{app}\bin\apache\apache2.4.9"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
|
||||||
Source: "C:\Program Files\Wamp\bin\php\php5.5.12\*.*"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log"
|
Source: "C:\Program Files\Wamp\bin\php\php5.5.12\*.*"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log"
|
||||||
@ -202,10 +202,30 @@ var value: String;
|
|||||||
function InitializeSetup(): Boolean;
|
function InitializeSetup(): Boolean;
|
||||||
begin
|
begin
|
||||||
Result := MsgBox(CustomMessage('YouWillInstallDoliWamp')+#13#13+CustomMessage('ThisAssistantInstallOrUpgrade')+#13#13+CustomMessage('IfYouHaveTechnicalKnowledge')+#13#13+CustomMessage('ButIfYouLook')+#13#13+CustomMessage('DoYouWantToStart'), mbConfirmation, MB_YESNO) = IDYES;
|
Result := MsgBox(CustomMessage('YouWillInstallDoliWamp')+#13#13+CustomMessage('ThisAssistantInstallOrUpgrade')+#13#13+CustomMessage('IfYouHaveTechnicalKnowledge')+#13#13+CustomMessage('ButIfYouLook')+#13#13+CustomMessage('DoYouWantToStart'), mbConfirmation, MB_YESNO) = IDYES;
|
||||||
|
|
||||||
|
if Result then
|
||||||
|
begin
|
||||||
|
|
||||||
|
//----------------------------------------------
|
||||||
|
// Test if msvcr110 DLL has been installed
|
||||||
|
//----------------------------------------------
|
||||||
|
|
||||||
|
if not FileExists ('c:/windows/system32/msvcr110.dll') and not FileExists ('c:/windows/sysWOW64/msvcr110.dll') and not FileExists ('c:/winnt/system32/msvcr110.dll') and not FileExists ('c:/winnt/sysWOW64/msvcr110.dll') then
|
||||||
|
begin
|
||||||
|
// TODO - offer to install the component by opening the URL in the default browser, abort installation if user doesn't accept
|
||||||
|
Result := MsgBox(CustomMessage('DLLMissing')+#13#13+CustomMessage('ContinueAnyway'), mbConfirmation, MB_YESNO) = IDYES;
|
||||||
|
|
||||||
|
end;
|
||||||
|
// Pb seems similar with msvcp110.dll
|
||||||
|
//vcredist_x64.exe
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure InitializeWizard();
|
procedure InitializeWizard();
|
||||||
begin
|
begin
|
||||||
|
|
||||||
//version des applis, a modifier pour chaque version de WampServer 2
|
//version des applis, a modifier pour chaque version de WampServer 2
|
||||||
apacheVersion := '2.4.9';
|
apacheVersion := '2.4.9';
|
||||||
phpVersion := '5.5.12' ;
|
phpVersion := '5.5.12' ;
|
||||||
@ -217,6 +237,7 @@ begin
|
|||||||
mysqlPort := '3306';
|
mysqlPort := '3306';
|
||||||
newPassword := 'changeme';
|
newPassword := 'changeme';
|
||||||
|
|
||||||
|
|
||||||
firstinstall := true;
|
firstinstall := true;
|
||||||
|
|
||||||
|
|
||||||
@ -345,19 +366,6 @@ begin
|
|||||||
exedirnew := pathWithSlashes+'/bin/mysql/mysql5.0.45';
|
exedirnew := pathWithSlashes+'/bin/mysql/mysql5.0.45';
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------
|
|
||||||
// Test if msvcr110 DLL has been installed
|
|
||||||
//----------------------------------------------
|
|
||||||
|
|
||||||
if not FileExists ('c:/windows/system32/msvcr110.dll') and not FileExists ('c:/windows/sysWOW64/msvcr110.dll') and not FileExists ('c:/winnt/system32/msvcr110.dll') and not FileExists ('c:/winnt/sysWOW64/msvcr110.dll') then
|
|
||||||
begin
|
|
||||||
// TODO Copy file or ask to install package ?
|
|
||||||
//CustomMessage('YouWillInstallDoliWamp')+#13#13
|
|
||||||
MsgBox('The Visual C++ Redistributable package should be installed, it seems it is not. Please install the 32-bit version from http://www.microsoft.com/en-us/download/details.aspx?id=30679, then restart the DoliWAMP installation/upgrade.',mbInformation,MB_OK);
|
|
||||||
end;
|
|
||||||
// Pb seems similar with msvcp110.dll
|
|
||||||
//vcredist_x64.exe
|
|
||||||
|
|
||||||
|
|
||||||
// If we have a new database version, we should only copy old my.ini file into new directory
|
// If we have a new database version, we should only copy old my.ini file into new directory
|
||||||
// and change only all basedir= strings to use new version. Like this, data dir is still correct.
|
// and change only all basedir= strings to use new version. Like this, data dir is still correct.
|
||||||
|
|||||||
@ -535,7 +535,7 @@ a:hover {
|
|||||||
<li><a href="?lang={$langues[$langue]['autreLangueLien1']}">{$langues[$langue]['autreLangue1']}</a>
|
<li><a href="?lang={$langues[$langue]['autreLangueLien1']}">{$langues[$langue]['autreLangue1']}</a>
|
||||||
- <a href="?lang={$langues[$langue]['autreLangueLien2']}">{$langues[$langue]['autreLangue2']}</a></li>
|
- <a href="?lang={$langues[$langue]['autreLangueLien2']}">{$langues[$langue]['autreLangue2']}</a></li>
|
||||||
<br><br>
|
<br><br>
|
||||||
<li>Provided by <a href="http://www.nltechno.com" targer="_blank">NLTechno</a></li>
|
<li>Provided by <a href="https://www.nltechno.com" targer="_blank">NLTechno</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</td></tr></table>
|
</td></tr></table>
|
||||||
<hr>
|
<hr>
|
||||||
@ -580,7 +580,7 @@ a:hover {
|
|||||||
|
|
||||||
|
|
||||||
<ul id="foot">
|
<ul id="foot">
|
||||||
<li><a href="http://www.nltechno.com/pages/dolibarrwinbin.php">DoliWamp project</a> was built from modified sources of <a href="http://www.wampserver.com">WampServer project</a> from Anaska</li>
|
<li><a href="https://www.nltechno.com/pages/dolibarrwinbin.php">DoliWamp project</a> was built from modified sources of <a href="http://www.wampserver.com">WampServer project</a> from Anaska</li>
|
||||||
</ul>
|
</ul>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file build/generate_filecheck_xml.php
|
* \file build/generate_filelist_xml.php
|
||||||
* \ingroup dev
|
* \ingroup dev
|
||||||
* \brief This script create a xml checksum file
|
* \brief This script create a xml checksum file
|
||||||
*/
|
*/
|
||||||
@ -45,7 +45,7 @@ $includeconstants=array();
|
|||||||
|
|
||||||
if (empty($argv[1]))
|
if (empty($argv[1]))
|
||||||
{
|
{
|
||||||
print "Usage: ".$script_file." release=x.y.z[-...] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
|
print "Usage: ".$script_file." release=auto|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
|
||||||
print "Example: ".$script_file." release=6.0.0 includecustom=1 includeconstant=FR:INVOICE_CAN_ALWAYS_BE_REMOVED:0 includeconstant=all:MAILING_NO_USING_PHPMAIL:1\n";
|
print "Example: ".$script_file." release=6.0.0 includecustom=1 includeconstant=FR:INVOICE_CAN_ALWAYS_BE_REMOVED:0 includeconstant=all:MAILING_NO_USING_PHPMAIL:1\n";
|
||||||
exit -1;
|
exit -1;
|
||||||
}
|
}
|
||||||
@ -68,11 +68,20 @@ while ($i < $argc)
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If release is auto, we take current version
|
||||||
|
$tmpver=explode('-', $release, 2);
|
||||||
|
if ($tmpver[0] == 'auto')
|
||||||
|
{
|
||||||
|
$release=DOL_VERSION;
|
||||||
|
if ($tmpver[1]) $release.='-'.$tmpver[1];
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($includecustom))
|
if (empty($includecustom))
|
||||||
{
|
{
|
||||||
if (DOL_VERSION != $release)
|
$tmpver=explode('-', $release, 2);
|
||||||
|
if (DOL_VERSION != $tmpver[0])
|
||||||
{
|
{
|
||||||
print 'Error: When parameter "includecustom" is not set, version declared into filefunc.in.php ('.DOL_VERSION.') must be exact same value than "release" parameter ('.$release.')'."\n";
|
print 'Error: When parameter "includecustom" is not set and there is no suffix in release parameter, version declared into filefunc.in.php ('.DOL_VERSION.') must be exact same value than "release" parameter ('.$tmpver[0].')'."\n";
|
||||||
print "Usage: ".$script_file." release=x.y.z[-...] [includecustom=1]\n";
|
print "Usage: ".$script_file." release=x.y.z[-...] [includecustom=1]\n";
|
||||||
exit -1;
|
exit -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -388,7 +388,7 @@ if ($nboftargetok) {
|
|||||||
#-----------------------
|
#-----------------------
|
||||||
if ($CHOOSEDTARGET{'-CHKSUM'})
|
if ($CHOOSEDTARGET{'-CHKSUM'})
|
||||||
{
|
{
|
||||||
print 'Create xml check file with md5 checksum with command php '.$SOURCE.'/build/generate_filecheck_xml.php release='.$MAJOR.'.'.$MINOR.'.'.$BUILD."\n";
|
print 'Create xml check file with md5 checksum with command php '.$SOURCE.'/build/generate_filelist_xml.php release='.$MAJOR.'.'.$MINOR.'.'.$BUILD."\n";
|
||||||
$ret=`php $SOURCE/build/generate_filelist_xml.php release=$MAJOR.$MINOR.$BUILD`;
|
$ret=`php $SOURCE/build/generate_filelist_xml.php release=$MAJOR.$MINOR.$BUILD`;
|
||||||
print $ret."\n";
|
print $ret."\n";
|
||||||
# Copy to final dir
|
# Copy to final dir
|
||||||
@ -558,7 +558,7 @@ if ($nboftargetok) {
|
|||||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/geoip/sample*.*`;
|
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/geoip/sample*.*`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/adapters`; # Keep this removal in case we embed libraries
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/adapters`; # Keep this removal in case we embed libraries
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/samples`; # Keep this removal in case we embed libraries
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/samples`; # Keep this removal in case we embed libraries
|
||||||
#$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/_source`; # _source must be kept into tarball
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/_source`; # _source must be kept into tarball for official debian, not for the rest
|
||||||
|
|
||||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`;
|
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`;
|
||||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/select2/release.sh`;
|
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/select2/release.sh`;
|
||||||
@ -767,8 +767,8 @@ if ($nboftargetok) {
|
|||||||
$cmd="cp -pr '$BUILDROOT/$PROJECT' '$BUILDROOT/$FILENAMETGZ2'";
|
$cmd="cp -pr '$BUILDROOT/$PROJECT' '$BUILDROOT/$FILENAMETGZ2'";
|
||||||
$ret=`$cmd`;
|
$ret=`$cmd`;
|
||||||
|
|
||||||
# Removed files we don't need
|
# Removed files we don't need (already removed before)
|
||||||
$ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/htdocs/includes/ckeditor/_source`;
|
#$ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/htdocs/includes/ckeditor/_source`;
|
||||||
|
|
||||||
print "Set permissions on files/dir\n";
|
print "Set permissions on files/dir\n";
|
||||||
$ret=`chmod -R 755 $BUILDROOT/$FILENAMETGZ2`;
|
$ret=`chmod -R 755 $BUILDROOT/$FILENAMETGZ2`;
|
||||||
@ -915,8 +915,8 @@ if ($nboftargetok) {
|
|||||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/mike42/escpos-php/LICENSE.md`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/mike42/escpos-php/LICENSE.md`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/mobiledetect/mobiledetectlib/LICENSE.txt`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/mobiledetect/mobiledetectlib/LICENSE.txt`;
|
||||||
|
|
||||||
# Removed files we don't need
|
# Removed files we don't need (already removed)
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/ckeditor/_source`;
|
#$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/ckeditor/_source`;
|
||||||
|
|
||||||
# Rename upstream changelog to match debian rules
|
# Rename upstream changelog to match debian rules
|
||||||
$ret=`mv $BUILDROOT/$PROJECT.tmp/ChangeLog $BUILDROOT/$PROJECT.tmp/changelog`;
|
$ret=`mv $BUILDROOT/$PROJECT.tmp/ChangeLog $BUILDROOT/$PROJECT.tmp/changelog`;
|
||||||
@ -978,7 +978,7 @@ if ($nboftargetok) {
|
|||||||
$ret=`chmod 755 $BUILDROOT/$PROJECT.tmp/debian/rules`;
|
$ret=`chmod 755 $BUILDROOT/$PROJECT.tmp/debian/rules`;
|
||||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/translation/autotranslator.class.php`;
|
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/translation/autotranslator.class.php`;
|
||||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/actions_mymodule.class.php`;
|
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/actions_mymodule.class.php`;
|
||||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/api_myobject.class.php`;
|
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/api_mymodule.class.php`;
|
||||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/myobject.class.php`;
|
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/myobject.class.php`;
|
||||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/core/modules/modMyModule.class.php`;
|
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/core/modules/modMyModule.class.php`;
|
||||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/mymoduleindex.php`;
|
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/mymoduleindex.php`;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# \file dolibarr.pl
|
# \file dolibarr.pl
|
||||||
# \brief Dolibarr script install for Virtualmin Pro
|
# \brief Dolibarr script install for Virtualmin Pro
|
||||||
# \author (c)2009-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
# \author (c)2009-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ return "Regis Houssin";
|
|||||||
# script_dolibarr_versions()
|
# script_dolibarr_versions()
|
||||||
sub script_dolibarr_versions
|
sub script_dolibarr_versions
|
||||||
{
|
{
|
||||||
return ( "5.0.4", "4.0.6", "3.9.4" );
|
return ( "7.0.0", "6.0.5", "5.0.7" );
|
||||||
}
|
}
|
||||||
|
|
||||||
sub script_dolibarr_release
|
sub script_dolibarr_release
|
||||||
@ -386,14 +386,16 @@ sub script_dolibarr_check_latest
|
|||||||
{
|
{
|
||||||
local ($ver) = @_;
|
local ($ver) = @_;
|
||||||
local @vers = &osdn_package_versions("dolibarr",
|
local @vers = &osdn_package_versions("dolibarr",
|
||||||
$ver >= 5.0 ? "dolibarr\\-(5\\.0\\.[0-9\\.]+)\\.tgz" :
|
$ver >= 7.0 ? "dolibarr\\-(7\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||||
$ver >= 4.0 ? "dolibarr\\-(4\\.0\\.[0-9\\.]+)\\.tgz" :
|
$ver >= 6.0 ? "dolibarr\\-(6\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||||
$ver >= 3.9 ? "dolibarr\\-(3\\.9\\.[0-9\\.]+)\\.tgz" :
|
$ver >= 5.0 ? "dolibarr\\-(5\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||||
$ver >= 3.8 ? "dolibarr\\-(3\\.8\\.[0-9\\.]+)\\.tgz" :
|
$ver >= 4.0 ? "dolibarr\\-(4\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||||
$ver >= 3.7 ? "dolibarr\\-(3\\.7\\.[0-9\\.]+)\\.tgz" :
|
$ver >= 3.9 ? "dolibarr\\-(3\\.9\\.[0-9\\.]+)\\.tgz" :
|
||||||
$ver >= 3.6 ? "dolibarr\\-(3\\.6\\.[0-9\\.]+)\\.tgz" :
|
$ver >= 3.8 ? "dolibarr\\-(3\\.8\\.[0-9\\.]+)\\.tgz" :
|
||||||
$ver >= 3.5 ? "dolibarr\\-(3\\.5\\.[0-9\\.]+)\\.tgz" :
|
$ver >= 3.7 ? "dolibarr\\-(3\\.7\\.[0-9\\.]+)\\.tgz" :
|
||||||
$ver >= 2.9 ? "dolibarr\\-(2\\.9\\.[0-9\\.]+)\\.tgz" :
|
$ver >= 3.6 ? "dolibarr\\-(3\\.6\\.[0-9\\.]+)\\.tgz" :
|
||||||
|
$ver >= 3.5 ? "dolibarr\\-(3\\.5\\.[0-9\\.]+)\\.tgz" :
|
||||||
|
$ver >= 2.9 ? "dolibarr\\-(2\\.9\\.[0-9\\.]+)\\.tgz" :
|
||||||
"dolibarr\\-(2\\.8\\.[0-9\\.]+)\\.tgz");
|
"dolibarr\\-(2\\.8\\.[0-9\\.]+)\\.tgz");
|
||||||
return "Failed to find versions" if (!@vers);
|
return "Failed to find versions" if (!@vers);
|
||||||
return $ver eq $vers[0] ? undef : $vers[0];
|
return $ver eq $vers[0] ? undef : $vers[0];
|
||||||
|
|||||||
@ -15,21 +15,7 @@ diff -up htdocs/filefunc.inc.php.patch htdocs/filefunc.inc.php
|
|||||||
diff -up htdocs/install/inc.php.patch htdocs/install/inc.php
|
diff -up htdocs/install/inc.php.patch htdocs/install/inc.php
|
||||||
--- htdocs/install/inc.php.patch 2011-09-03 02:33:26.450952000 +0200
|
--- htdocs/install/inc.php.patch 2011-09-03 02:33:26.450952000 +0200
|
||||||
+++ htdocs/install/inc.php 2011-09-03 02:33:36.286952001 +0200
|
+++ htdocs/install/inc.php 2011-09-03 02:33:36.286952001 +0200
|
||||||
@@ -71,8 +71,8 @@
|
@@ -74,8 +74,8 @@
|
||||||
$conffile = "../conf/conf.php";
|
|
||||||
$conffiletoshow = "htdocs/conf/conf.php";
|
|
||||||
// For debian/redhat like systems
|
|
||||||
-//$conffile = "/etc/dolibarr/conf.php";
|
|
||||||
-//$conffiletoshow = "/etc/dolibarr/conf.php";
|
|
||||||
+$conffile = "/etc/dolibarr/conf.php";
|
|
||||||
+$conffiletoshow = "/etc/dolibarr/conf.php";
|
|
||||||
|
|
||||||
|
|
||||||
// Load conf file if it is already defined
|
|
||||||
diff -up htdocs/support/inc.php.patch htdocs/support/inc.php
|
|
||||||
--- htdocs/support/inc.php.patch 2011-09-03 02:34:39.606952000 +0200
|
|
||||||
+++ htdocs/support/inc.php 2011-09-03 02:33:59.814952000 +0200
|
|
||||||
@@ -69,8 +69,8 @@
|
|
||||||
$conffile = "../conf/conf.php";
|
$conffile = "../conf/conf.php";
|
||||||
$conffiletoshow = "htdocs/conf/conf.php";
|
$conffiletoshow = "htdocs/conf/conf.php";
|
||||||
// For debian/redhat like systems
|
// For debian/redhat like systems
|
||||||
|
|||||||
@ -25,7 +25,7 @@ BuildArch: noarch
|
|||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
|
||||||
Group: Applications/Productivity
|
Group: Applications/Productivity
|
||||||
Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mysql, php-adodb, php-nusoap, dejavu-sans-fonts
|
Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mysqli, php-adodb, php-nusoap, dejavu-sans-fonts
|
||||||
Requires: mysql-server, mysql
|
Requires: mysql-server, mysql
|
||||||
#BuildRequires: desktop-file-utils
|
#BuildRequires: desktop-file-utils
|
||||||
|
|
||||||
@ -176,6 +176,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/core
|
%_datadir/dolibarr/htdocs/core
|
||||||
%_datadir/dolibarr/htdocs/cron
|
%_datadir/dolibarr/htdocs/cron
|
||||||
%_datadir/dolibarr/htdocs/custom
|
%_datadir/dolibarr/htdocs/custom
|
||||||
|
%_datadir/dolibarr/htdocs/dav
|
||||||
%_datadir/dolibarr/htdocs/don
|
%_datadir/dolibarr/htdocs/don
|
||||||
%_datadir/dolibarr/htdocs/ecm
|
%_datadir/dolibarr/htdocs/ecm
|
||||||
%_datadir/dolibarr/htdocs/expedition
|
%_datadir/dolibarr/htdocs/expedition
|
||||||
@ -213,7 +214,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/user
|
%_datadir/dolibarr/htdocs/user
|
||||||
%_datadir/dolibarr/htdocs/variants
|
%_datadir/dolibarr/htdocs/variants
|
||||||
%_datadir/dolibarr/htdocs/webservices
|
%_datadir/dolibarr/htdocs/webservices
|
||||||
%_datadir/dolibarr/htdocs/websites
|
%_datadir/dolibarr/htdocs/website
|
||||||
%_datadir/dolibarr/htdocs/*.ico
|
%_datadir/dolibarr/htdocs/*.ico
|
||||||
%_datadir/dolibarr/htdocs/*.patch
|
%_datadir/dolibarr/htdocs/*.patch
|
||||||
%_datadir/dolibarr/htdocs/*.php
|
%_datadir/dolibarr/htdocs/*.php
|
||||||
|
|||||||
@ -46,7 +46,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|||||||
|
|
||||||
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version}
|
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version}
|
||||||
Group: Applications/Productivity
|
Group: Applications/Productivity
|
||||||
Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mysql, php-adodb, php-nusoap, dejavu-sans-fonts
|
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: mysql-server, mysql
|
Requires: mysql-server, mysql
|
||||||
BuildRequires: desktop-file-utils
|
BuildRequires: desktop-file-utils
|
||||||
%else
|
%else
|
||||||
@ -63,9 +63,9 @@ Requires: mysql-community-server, mysql-community-server-client
|
|||||||
BuildRequires: update-desktop-files fdupes
|
BuildRequires: update-desktop-files fdupes
|
||||||
%else
|
%else
|
||||||
Group: Applications/Productivity
|
Group: Applications/Productivity
|
||||||
Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap
|
Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mbstring, php-xml
|
||||||
Requires: mysql-server, mysql
|
Requires: mysql-server, mysql
|
||||||
Requires: php-mysql >= 4.1.0
|
Requires: php-mysqli >= 4.1.0
|
||||||
%endif
|
%endif
|
||||||
%endif
|
%endif
|
||||||
%endif
|
%endif
|
||||||
@ -256,6 +256,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/core
|
%_datadir/dolibarr/htdocs/core
|
||||||
%_datadir/dolibarr/htdocs/cron
|
%_datadir/dolibarr/htdocs/cron
|
||||||
%_datadir/dolibarr/htdocs/custom
|
%_datadir/dolibarr/htdocs/custom
|
||||||
|
%_datadir/dolibarr/htdocs/dav
|
||||||
%_datadir/dolibarr/htdocs/don
|
%_datadir/dolibarr/htdocs/don
|
||||||
%_datadir/dolibarr/htdocs/ecm
|
%_datadir/dolibarr/htdocs/ecm
|
||||||
%_datadir/dolibarr/htdocs/expedition
|
%_datadir/dolibarr/htdocs/expedition
|
||||||
@ -293,7 +294,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/user
|
%_datadir/dolibarr/htdocs/user
|
||||||
%_datadir/dolibarr/htdocs/variants
|
%_datadir/dolibarr/htdocs/variants
|
||||||
%_datadir/dolibarr/htdocs/webservices
|
%_datadir/dolibarr/htdocs/webservices
|
||||||
%_datadir/dolibarr/htdocs/websites
|
%_datadir/dolibarr/htdocs/website
|
||||||
%_datadir/dolibarr/htdocs/*.ico
|
%_datadir/dolibarr/htdocs/*.ico
|
||||||
%_datadir/dolibarr/htdocs/*.patch
|
%_datadir/dolibarr/htdocs/*.patch
|
||||||
%_datadir/dolibarr/htdocs/*.php
|
%_datadir/dolibarr/htdocs/*.php
|
||||||
@ -441,8 +442,8 @@ if [ "x$os" = "xfedora-redhat" -a -s /sbin/restorecon ]; then
|
|||||||
%else
|
%else
|
||||||
echo Add SE Linux permissions for dolibarr
|
echo Add SE Linux permissions for dolibarr
|
||||||
# semanage add records into /etc/selinux/targeted/contexts/files/file_contexts.local
|
# semanage add records into /etc/selinux/targeted/contexts/files/file_contexts.local
|
||||||
semanage fcontext -a -t httpd_sys_script_rw_t "/etc/dolibarr(/.*?)"
|
semanage fcontext -a -t httpd_sys_rw_content_t "/etc/dolibarr(/.*)?"
|
||||||
semanage fcontext -a -t httpd_sys_script_rw_t "/var/lib/dolibarr(/.*?)"
|
semanage fcontext -a -t httpd_sys_rw_content_t "/var/lib/dolibarr(/.*)?"
|
||||||
restorecon -R -v /etc/dolibarr
|
restorecon -R -v /etc/dolibarr
|
||||||
restorecon -R -v /var/lib/dolibarr
|
restorecon -R -v /var/lib/dolibarr
|
||||||
%endif
|
%endif
|
||||||
|
|||||||
@ -173,6 +173,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/core
|
%_datadir/dolibarr/htdocs/core
|
||||||
%_datadir/dolibarr/htdocs/cron
|
%_datadir/dolibarr/htdocs/cron
|
||||||
%_datadir/dolibarr/htdocs/custom
|
%_datadir/dolibarr/htdocs/custom
|
||||||
|
%_datadir/dolibarr/htdocs/dav
|
||||||
%_datadir/dolibarr/htdocs/don
|
%_datadir/dolibarr/htdocs/don
|
||||||
%_datadir/dolibarr/htdocs/ecm
|
%_datadir/dolibarr/htdocs/ecm
|
||||||
%_datadir/dolibarr/htdocs/expedition
|
%_datadir/dolibarr/htdocs/expedition
|
||||||
@ -210,7 +211,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/user
|
%_datadir/dolibarr/htdocs/user
|
||||||
%_datadir/dolibarr/htdocs/variants
|
%_datadir/dolibarr/htdocs/variants
|
||||||
%_datadir/dolibarr/htdocs/webservices
|
%_datadir/dolibarr/htdocs/webservices
|
||||||
%_datadir/dolibarr/htdocs/websites
|
%_datadir/dolibarr/htdocs/website
|
||||||
%_datadir/dolibarr/htdocs/*.ico
|
%_datadir/dolibarr/htdocs/*.ico
|
||||||
%_datadir/dolibarr/htdocs/*.patch
|
%_datadir/dolibarr/htdocs/*.patch
|
||||||
%_datadir/dolibarr/htdocs/*.php
|
%_datadir/dolibarr/htdocs/*.php
|
||||||
|
|||||||
@ -184,6 +184,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/core
|
%_datadir/dolibarr/htdocs/core
|
||||||
%_datadir/dolibarr/htdocs/cron
|
%_datadir/dolibarr/htdocs/cron
|
||||||
%_datadir/dolibarr/htdocs/custom
|
%_datadir/dolibarr/htdocs/custom
|
||||||
|
%_datadir/dolibarr/htdocs/dav
|
||||||
%_datadir/dolibarr/htdocs/don
|
%_datadir/dolibarr/htdocs/don
|
||||||
%_datadir/dolibarr/htdocs/ecm
|
%_datadir/dolibarr/htdocs/ecm
|
||||||
%_datadir/dolibarr/htdocs/expedition
|
%_datadir/dolibarr/htdocs/expedition
|
||||||
@ -221,7 +222,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/user
|
%_datadir/dolibarr/htdocs/user
|
||||||
%_datadir/dolibarr/htdocs/variants
|
%_datadir/dolibarr/htdocs/variants
|
||||||
%_datadir/dolibarr/htdocs/webservices
|
%_datadir/dolibarr/htdocs/webservices
|
||||||
%_datadir/dolibarr/htdocs/websites
|
%_datadir/dolibarr/htdocs/website
|
||||||
%_datadir/dolibarr/htdocs/*.ico
|
%_datadir/dolibarr/htdocs/*.ico
|
||||||
%_datadir/dolibarr/htdocs/*.patch
|
%_datadir/dolibarr/htdocs/*.patch
|
||||||
%_datadir/dolibarr/htdocs/*.php
|
%_datadir/dolibarr/htdocs/*.php
|
||||||
|
|||||||
@ -15,8 +15,14 @@ Alias /dolibarr /usr/share/dolibarr/htdocs
|
|||||||
|
|
||||||
# Directory for web pages
|
# Directory for web pages
|
||||||
<DirectoryMatch /usr/share/dolibarr>
|
<DirectoryMatch /usr/share/dolibarr>
|
||||||
Order deny,allow
|
<IfVersion >= 2.3>
|
||||||
Allow from all
|
Require all granted
|
||||||
|
</IfVersion>
|
||||||
|
<IfVersion < 2.3>
|
||||||
|
Order deny,allow
|
||||||
|
Allow from all
|
||||||
|
</IfVersion>
|
||||||
|
|
||||||
DirectoryIndex index.php
|
DirectoryIndex index.php
|
||||||
Options +FollowSymLinks +Indexes
|
Options +FollowSymLinks +Indexes
|
||||||
|
|
||||||
@ -60,27 +66,51 @@ Alias /dolibarr /usr/share/dolibarr/htdocs
|
|||||||
|
|
||||||
# Directory for public pages
|
# Directory for public pages
|
||||||
<DirectoryMatch /usr/share/dolibarr/public>
|
<DirectoryMatch /usr/share/dolibarr/public>
|
||||||
AllowOverride All
|
<IfVersion >= 2.3>
|
||||||
|
Require all granted
|
||||||
|
</IfVersion>
|
||||||
|
<IfVersion < 2.3>
|
||||||
Order deny,allow
|
Order deny,allow
|
||||||
Allow from all
|
Allow from all
|
||||||
|
</IfVersion>
|
||||||
|
|
||||||
|
AllowOverride All
|
||||||
</DirectoryMatch>
|
</DirectoryMatch>
|
||||||
|
|
||||||
# Config files
|
# Config files
|
||||||
<DirectoryMatch /etc/dolibarr>
|
<DirectoryMatch /etc/dolibarr>
|
||||||
AllowOverride All
|
<IfVersion >= 2.3>
|
||||||
|
Require all granted
|
||||||
|
</IfVersion>
|
||||||
|
<IfVersion < 2.3>
|
||||||
Order deny,allow
|
Order deny,allow
|
||||||
Allow from all
|
Allow from all
|
||||||
|
</IfVersion>
|
||||||
|
|
||||||
|
AllowOverride All
|
||||||
</DirectoryMatch>
|
</DirectoryMatch>
|
||||||
|
|
||||||
# Directory for data files
|
# Directory for data files
|
||||||
<DirectoryMatch /usr/share/dolibarr/documents>
|
<DirectoryMatch /usr/share/dolibarr/documents>
|
||||||
AllowOverride All
|
<IfVersion >= 2.3>
|
||||||
|
Require all granted
|
||||||
|
</IfVersion>
|
||||||
|
<IfVersion < 2.3>
|
||||||
Order deny,allow
|
Order deny,allow
|
||||||
Allow from all
|
Allow from all
|
||||||
|
</IfVersion>
|
||||||
|
|
||||||
|
AllowOverride All
|
||||||
</DirectoryMatch>
|
</DirectoryMatch>
|
||||||
<DirectoryMatch /var/lib/dolibarr/documents>
|
<DirectoryMatch /var/lib/dolibarr/documents>
|
||||||
AllowOverride All
|
<IfVersion >= 2.3>
|
||||||
Order deny,allow
|
Require all granted
|
||||||
|
</IfVersion>
|
||||||
|
<IfVersion < 2.3>
|
||||||
|
Order allow,deny
|
||||||
Allow from all
|
Allow from all
|
||||||
|
</IfVersion>
|
||||||
|
|
||||||
|
AllowOverride All
|
||||||
</DirectoryMatch>
|
</DirectoryMatch>
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
DocumentRoot %TRAVIS_BUILD_DIR%/htdocs
|
DocumentRoot %TRAVIS_BUILD_DIR%/htdocs
|
||||||
|
|
||||||
<Directory "%TRAVIS_BUILD_DIR%/htdocs">
|
<Directory "%TRAVIS_BUILD_DIR%/htdocs/">
|
||||||
Options FollowSymLinks MultiViews ExecCGI
|
Options FollowSymLinks MultiViews ExecCGI
|
||||||
AllowOverride All
|
AllowOverride All
|
||||||
Order deny,allow
|
Require all granted
|
||||||
Allow from all
|
|
||||||
</Directory>
|
</Directory>
|
||||||
|
|
||||||
# Wire up Apache to use Travis CI's php-fpm.
|
# Wire up Apache to use Travis CI's php-fpm.
|
||||||
@ -14,5 +13,9 @@
|
|||||||
Action php5-fcgi /php5-fcgi
|
Action php5-fcgi /php5-fcgi
|
||||||
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
|
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
|
||||||
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization
|
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization
|
||||||
|
|
||||||
|
<Directory /usr/lib/cgi-bin>
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
</IfModule>
|
</IfModule>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
"agenda"
|
"agenda"
|
||||||
],
|
],
|
||||||
"homepage": "https://www.dolibarr.org",
|
"homepage": "https://www.dolibarr.org",
|
||||||
"license": "GPL-3.0+",
|
"license": "GPL-3.0-or-later",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/Dolibarr/dolibarr/issues",
|
"issues": "https://github.com/Dolibarr/dolibarr/issues",
|
||||||
"forum": "https://www.dolibarr.org/forum",
|
"forum": "https://www.dolibarr.org/forum",
|
||||||
|
|||||||
@ -82,7 +82,13 @@ with
|
|||||||
// LDR To open in same window
|
// LDR To open in same window
|
||||||
//var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth);
|
//var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth);
|
||||||
window.location.href=pRef
|
window.location.href=pRef
|
||||||
* Replace hard coded string with i18n["String"];
|
|
||||||
|
* Replace
|
||||||
|
vTmpDiv=this.newNode(vTmpCell, 'div', null, null, vTaskList[i].getResource());
|
||||||
|
with
|
||||||
|
var vTmpNode=this.newNode(vTmpCell, 'div', null, '');
|
||||||
|
vTmpNode=this.newNode(vTmpNode, 'a', null, '', vLangs[vLang]['moreinfo']);
|
||||||
|
vTmpNode.setAttribute('href',vTaskList[i].getLink());
|
||||||
|
|
||||||
|
|
||||||
JCROP:
|
JCROP:
|
||||||
@ -111,10 +117,44 @@ to get
|
|||||||
if ($className == 'Luracast\Restler\mixed') return;
|
if ($className == 'Luracast\Restler\mixed') return;
|
||||||
...
|
...
|
||||||
|
|
||||||
|
Change also file Luracast/Restler/explorer/index.html
|
||||||
|
|
||||||
|
+With swagger 2:
|
||||||
|
|
||||||
|
* Add line into Util.php to complete function
|
||||||
|
|
||||||
|
public static function getShortName($className)
|
||||||
|
{
|
||||||
|
// @CHANGE LDR
|
||||||
|
if (! is_string($className)) return;
|
||||||
|
//var_dump($className);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PARSEDOWN
|
PARSEDOWN
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
* Add support of css by adding in Parsedown.php:
|
||||||
|
|
||||||
|
// @CHANGE LDR
|
||||||
|
'class' => $Link['element']['attributes']['class']
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
// @CHANGE LDR
|
||||||
|
if (preg_match('/{([^}]+)}/', $remainder, $matches2))
|
||||||
|
{
|
||||||
|
$Element['attributes']['class'] = $matches2[1];
|
||||||
|
$remainder = preg_replace('/{'.preg_quote($matches2[1],'/').'}/', '', $remainder);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// @CHANGE LDR
|
||||||
|
//$markup .= $this->{$Element['handler']}($Element['text']);
|
||||||
|
$markup .= preg_replace('/>{[^}]+}/', '>', $this->{$Element['handler']}($Element['text']));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
* Fix to avoid fatal error when mb_strlen not available:
|
* Fix to avoid fatal error when mb_strlen not available:
|
||||||
|
|
||||||
// @CHANGE LDR Fix when mb_strlen is not available
|
// @CHANGE LDR Fix when mb_strlen is not available
|
||||||
@ -124,11 +164,9 @@ PARSEDOWN
|
|||||||
$shortage = 4 - $len % 4;
|
$shortage = 4 - $len % 4;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
JEDITABLE.JS
|
JEDITABLE.JS
|
||||||
------------
|
------------
|
||||||
|
|
||||||
* <button type="submit" /> => <button class="button" type="submit" />
|
* <button type="submit" /> => <button class="button" type="submit" />
|
||||||
* <button type="cancel" /> => <button class="button" type="cancel" />
|
* <button type="cancel" /> => <button class="button" type="cancel" />
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -60,14 +60,14 @@ $db->begin();
|
|||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/user/class/user.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/user/class/user.class.php");
|
||||||
|
|
||||||
// Create invoice object
|
// Create user object
|
||||||
$obj = new User($db);
|
$obj = new User($db);
|
||||||
//$obj->initAsSpecimen();
|
//$obj->initAsSpecimen();
|
||||||
|
|
||||||
$obj->login = 'ABCDEF';
|
$obj->login = 'ABCDEF';
|
||||||
$obj->nom = 'ABCDEF';
|
$obj->nom = 'ABCDEF';
|
||||||
|
|
||||||
// Create invoice
|
// Create user
|
||||||
$idobject=$obj->create($user);
|
$idobject=$obj->create($user);
|
||||||
if ($idobject > 0)
|
if ($idobject > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -67,7 +67,7 @@ $db->begin();
|
|||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
|
||||||
|
|
||||||
// Create invoice object
|
// Create contract object
|
||||||
$obj = new Contrat($db);
|
$obj = new Contrat($db);
|
||||||
$obj->socid=$argv[1];
|
$obj->socid=$argv[1];
|
||||||
|
|
||||||
|
|||||||
@ -7,3 +7,7 @@
|
|||||||
# ldapsearch -h hostname -x -b "ou=people,dc=teclib,dc=infra"
|
# ldapsearch -h hostname -x -b "ou=people,dc=teclib,dc=infra"
|
||||||
# ldapsearch -h hostname -x -z 0 -b "o=somecompany.com" -D "cn=manager,o=somecompany.com" -w password "(objectclass=*)"
|
# ldapsearch -h hostname -x -z 0 -b "o=somecompany.com" -D "cn=manager,o=somecompany.com" -w password "(objectclass=*)"
|
||||||
# ldapsearch -h hostname -x -b "o=somecompany.com" -D "cn=manager,o=somecompany.com" -w password "(objectclass=*)"
|
# ldapsearch -h hostname -x -b "o=somecompany.com" -D "cn=manager,o=somecompany.com" -w password "(objectclass=*)"
|
||||||
|
#
|
||||||
|
# Example to test a ldap search:
|
||||||
|
# ldapsearch -h hostname -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
|
||||||
|
|
||||||
|
|||||||
@ -149,7 +149,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
|||||||
$condpayment = trim($fields[36]);
|
$condpayment = trim($fields[36]);
|
||||||
if ($condpayment == 'A la commande') $condpayment = 'A réception de commande';
|
if ($condpayment == 'A la commande') $condpayment = 'A réception de commande';
|
||||||
if ($condpayment == 'A reception facture') $condpayment = 'Réception de facture';
|
if ($condpayment == 'A reception facture') $condpayment = 'Réception de facture';
|
||||||
$object->cond_reglement_id = dol_getIdFromCode($db, $condpayment, 'c_payment_term', 'libelle_facture', 'rowid');
|
$object->cond_reglement_id = dol_getIdFromCode($db, $condpayment, 'c_payment_term', 'libelle_facture', 'rowid', 1);
|
||||||
if (empty($object->cond_reglement_id))
|
if (empty($object->cond_reglement_id))
|
||||||
{
|
{
|
||||||
print " - Error cant find payment mode for ".$condpayment."\n";
|
print " - Error cant find payment mode for ".$condpayment."\n";
|
||||||
|
|||||||
@ -78,15 +78,17 @@ $sqls=array(
|
|||||||
'DELETE FROM '.MAIN_DB_PREFIX.'propaldet',
|
'DELETE FROM '.MAIN_DB_PREFIX.'propaldet',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'propal',
|
'DELETE FROM '.MAIN_DB_PREFIX.'propal',
|
||||||
),
|
),
|
||||||
'supplier_order'=>array(
|
'supplier_proposal'=>array(
|
||||||
|
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposaldet',
|
||||||
|
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposal',
|
||||||
|
),
|
||||||
|
'supplier_order'=>array(
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet',
|
'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseur',
|
'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseur',
|
||||||
),
|
),
|
||||||
'supplier_invoice'=>array(
|
'supplier_invoice'=>array(
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det',
|
'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn',
|
'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposaldet',
|
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposal',
|
|
||||||
),
|
),
|
||||||
'delivery'=>array(
|
'delivery'=>array(
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'livraisondet',
|
'DELETE FROM '.MAIN_DB_PREFIX.'livraisondet',
|
||||||
@ -114,8 +116,10 @@ $sqls=array(
|
|||||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_lang',
|
'DELETE FROM '.MAIN_DB_PREFIX.'product_lang',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_price',
|
'DELETE FROM '.MAIN_DB_PREFIX.'product_price',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_fournisseur_price',
|
'DELETE FROM '.MAIN_DB_PREFIX.'product_fournisseur_price',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_stock',
|
'DELETE FROM '.MAIN_DB_PREFIX.'product_batch',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'product',
|
'DELETE FROM '.MAIN_DB_PREFIX.'product_stock',
|
||||||
|
'DELETE FROM '.MAIN_DB_PREFIX.'product_lot',
|
||||||
|
'DELETE FROM '.MAIN_DB_PREFIX.'product',
|
||||||
),
|
),
|
||||||
'project'=>array(
|
'project'=>array(
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'projet_task_time',
|
'DELETE FROM '.MAIN_DB_PREFIX.'projet_task_time',
|
||||||
@ -133,7 +137,8 @@ $sqls=array(
|
|||||||
'DELETE FROM '.MAIN_DB_PREFIX.'categorie_fournisseur',
|
'DELETE FROM '.MAIN_DB_PREFIX.'categorie_fournisseur',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'categorie_societe',
|
'DELETE FROM '.MAIN_DB_PREFIX.'categorie_societe',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'societe_remise_except',
|
'DELETE FROM '.MAIN_DB_PREFIX.'societe_remise_except',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'societe',
|
'DELETE FROM '.MAIN_DB_PREFIX.'societe_rib',
|
||||||
|
'DELETE FROM '.MAIN_DB_PREFIX.'societe',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -152,27 +157,37 @@ $mode = $argv[1];
|
|||||||
$option = $argv[2];
|
$option = $argv[2];
|
||||||
|
|
||||||
if (empty($mode) || ! in_array($mode,array('test','confirm'))) {
|
if (empty($mode) || ! in_array($mode,array('test','confirm'))) {
|
||||||
print "Usage: $script_file (test|confirm) (all|option)\n";
|
print "Usage: $script_file (test|confirm) (all|option) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
|
||||||
print "\n";
|
print "\n";
|
||||||
print "option can be ".implode(',',array_keys($sqls))."\n";
|
print "option can be ".implode(',',array_keys($sqls))."\n";
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($option) || ! in_array($option, array_merge(array('all'),array_keys($sqls))) ) {
|
if (empty($option) || ! in_array($option, array_merge(array('all'),array_keys($sqls))) ) {
|
||||||
print "Usage: $script_file (test|confirm) (all|option)\n";
|
print "Usage: $script_file (test|confirm) (all|option) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
|
||||||
print "\n";
|
print "\n";
|
||||||
print "option can be ".implode(',',array_keys($sqls))."\n";
|
print "option can be ".implode(',',array_keys($sqls))."\n";
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Replace database handler
|
||||||
|
if (! empty($argv[3]))
|
||||||
|
{
|
||||||
|
$db->close();
|
||||||
|
unset($db);
|
||||||
|
$db=getDoliDBInstance($argv[3], $argv[4], $argv[5], $argv[6], $argv[7], $argv[8]);
|
||||||
|
$user=new User($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
//var_dump($user->db->database_name);
|
||||||
$ret=$user->fetch('','admin');
|
$ret=$user->fetch('','admin');
|
||||||
if (! $ret > 0)
|
if (! $ret > 0)
|
||||||
{
|
{
|
||||||
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
|
print 'An admin user with login "admin" must exists to use this script.'."\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$user->getrights();
|
//$user->getrights();
|
||||||
|
|
||||||
|
|
||||||
print "Purge all data for this database:\n";
|
print "Purge all data for this database:\n";
|
||||||
print "Server = ".$db->database_host."\n";
|
print "Server = ".$db->database_host."\n";
|
||||||
|
|||||||
2
dev/initdemo/documents_demo/medias/README.txt
Normal file
2
dev/initdemo/documents_demo/medias/README.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# File(s) into root medias directory are provide by Pixabay with Licence "CC0 Creative Commons"
|
||||||
|
# https://creativecommons.org/publicdomain/zero/1.0/
|
||||||
BIN
dev/initdemo/documents_demo/medias/background_sunset.jpg
Normal file
BIN
dev/initdemo/documents_demo/medias/background_sunset.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 360 KiB |
@ -171,6 +171,7 @@ then
|
|||||||
cp -pr $mydir/../../htdocs/install/doctemplates/* "$documentdir/doctemplates/"
|
cp -pr $mydir/../../htdocs/install/doctemplates/* "$documentdir/doctemplates/"
|
||||||
mkdir -p "$documentdir/ecm/Administrative documents"
|
mkdir -p "$documentdir/ecm/Administrative documents"
|
||||||
mkdir -p "$documentdir/ecm/Images"
|
mkdir -p "$documentdir/ecm/Images"
|
||||||
|
rm -f "$documentdir/doctemplates/"*/index.html
|
||||||
echo cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images"
|
echo cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images"
|
||||||
cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images"
|
cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images"
|
||||||
else
|
else
|
||||||
|
|||||||
10135
dev/initdemo/mysqldump_dolibarr_7.0.0.sql
Normal file
10135
dev/initdemo/mysqldump_dolibarr_7.0.0.sql
Normal file
File diff suppressed because one or more lines are too long
@ -92,7 +92,7 @@ if ($connection)
|
|||||||
{
|
{
|
||||||
if (! @ssh2_auth_password($connection, $login, $password))
|
if (! @ssh2_auth_password($connection, $login, $password))
|
||||||
{
|
{
|
||||||
dol_syslog("Could not authenticate with username ".$login." . and password ".$password,LOG_ERR);
|
dol_syslog("Could not authenticate with username ".$login." . and password ".preg_replace('/./', '*', $password),LOG_ERR);
|
||||||
exit(-5);
|
exit(-5);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
14
dev/resources/iso-normes/accountancy_rules.txt
Normal file
14
dev/resources/iso-normes/accountancy_rules.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
Gestion escompte:
|
||||||
|
|
||||||
|
Sur une facture de 120 € TTC :
|
||||||
|
707xxx 100 € HT
|
||||||
|
44571x 20 € TVA
|
||||||
|
411xxx 120 € TTC
|
||||||
|
|
||||||
|
Le client règle rapidement et on lui accorde un escompte de 3% (120 € * 3% = 3.6 € TTC), on aura donc :
|
||||||
|
665000 3,00 € HT
|
||||||
|
44571x 0,60 € TVA
|
||||||
|
411xxx 3.60 € TVA
|
||||||
|
|
||||||
|
Et ça marche à l’inverse avec un fournisseur sauf que l’on est en 775000 au lieu de 665000 pour escompte obtenus.
|
||||||
1
dev/resources/iso-normes/code_nace.txt
Normal file
1
dev/resources/iso-normes/code_nace.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
http://ec.europa.eu/eurostat/ramon/nomenclatures/index.cfm?TargetUrl=LST_CLS_DLD&StrNom=NACE_REV2&StrLanguageCode=FR&StrLayoutCode=#
|
||||||
@ -11,3 +11,25 @@ Banque Banque 17306 20170119 5121CRA CR AGRICOLE A01 20170119 ZDAV courtage s/
|
|||||||
Banque Banque 17306 20170119 401ZDAV SANDRA DAVILA A01 20170119 ZDAV courtage s/ ventes 508,00 0,00 20170119
|
Banque Banque 17306 20170119 401ZDAV SANDRA DAVILA A01 20170119 ZDAV courtage s/ ventes 508,00 0,00 20170119
|
||||||
Banque Banque 17307 20170119 401ZDAV SANDRA DAVILA A01 20170119 ZDAV courtage s/ ventes 508,00 0,00 20170131
|
Banque Banque 17307 20170119 401ZDAV SANDRA DAVILA A01 20170119 ZDAV courtage s/ ventes 508,00 0,00 20170131
|
||||||
Banque Banque 17307 20170119 5121CRA CR AGRICOLE A01 20170119 ZDAV courtage s/ ventes 0,00 508,00 20170131
|
Banque Banque 17307 20170119 5121CRA CR AGRICOLE A01 20170119 ZDAV courtage s/ ventes 0,00 508,00 20170131
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Other example
|
||||||
|
JournalCode JournalLib EcritureNum EcritureDate CompteNum CompteLib CompAuxNum CompAuxLib PieceRef PieceDate EcritureLib Debit Credit EcritureLet DateLet ValidDate Montantdevise Idevise
|
||||||
|
FAC Factures clients AB6/FAC/2017/0045 20171120 41110000 Clients - Ventes de biens ou de prestations de services ID 2892 2 Et 3 Dimensions - 20171120 / 1 0 0 0 20171120
|
||||||
|
FAC Factures clients AB6/FAC/2017/0052 20171120 70710000 Marchandises (ou groupe) A ID 2892 2 Et 3 Dimensions - 20171120 [AX] Activités Annexes 0 0 1 0 20171120
|
||||||
|
FAC Factures clients AB6/FAC/2017/0052 20171120 70710000 Marchandises (ou groupe) A ID 2892 2 Et 3 Dimensions - 20171120 [AX] Activités Annexes 0 0 1 0 20171120
|
||||||
|
FAC Factures clients AB6/FAC/2017/0052 20171120 41110000 Clients - Ventes de biens ou de prestations de services ID 2892 2 Et 3 Dimensions - 20171120 / 2 0 0 0 20171120
|
||||||
|
OUV Balance initiale Balance initiale BRED 20171101 51215000 BRED - 20171101 / 6201 0 0 0 20171101
|
||||||
|
OUV Balance initiale Balance initiale Crédit Coopératif Nation 20171101 51211000 Crédit Coopératif Nation - 20171101 / 1364 20 0 0 20171101
|
||||||
|
OUV Balance initiale Balance initiale TVA collectée (Taux Intermédiaire) 20171101 44571200 TVA collectée (Taux Intermédiaire) - 20171101 / 0 0 147 4 20171101
|
||||||
|
OUV Balance initiale Balance initiale TVA déductible intracommunautaire 20171101 44566200 TVA déductible intracommunautaire - 20171101 / 18 0 0 0 20171101
|
||||||
|
OUV Balance initiale Balance initiale Capital souscrit - non appelé 20171101 10110000 Capital souscrit - non appelé - 20171101 / 10 0 0 0 20171101
|
||||||
|
OUV Balance initiale Balance initiale Réserves statutaires ou contractuelles 20171101 10630000 Réserves statutaires ou contractuelles - 20171101 / 0 0 10 0 20171101
|
||||||
|
OUV Balance initiale Balance initiale Frais entrepreneurs 20171101 46750000 Frais entrepreneurs - 20171101 / 0 0 100 0 20171101
|
||||||
|
OUV Balance initiale Balance initiale Fournissseurs réglés par Coopaname 20171101 40100000 Fournissseurs réglés par Coopaname - 20171101 / 0 0 4123 20 20171101
|
||||||
|
OUV Balance initiale Balance initiale TVA sur autres biens et services 20171101 44566000 TVA sur autres biens et services - 20171101 / 507 70 0 0 20171101
|
||||||
|
OUV Balance initiale Balance initiale TVA en attente à 20% 20171101 44572200 TVA en attente à 20% - 20171101 / 200 0 0 0 20171101
|
||||||
|
|||||||
921
dev/resources/sepa/pain.001.001.03.xsd
Normal file
921
dev/resources/sepa/pain.001.001.03.xsd
Normal file
@ -0,0 +1,921 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!--Generated by SWIFTStandards Workstation (build:R6.1.0.2) on 2009 Jan 08 17:30:53-->
|
||||||
|
<xs:schema xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03">
|
||||||
|
<xs:element name="Document" type="Document"/>
|
||||||
|
<xs:complexType name="AccountIdentification4Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="IBAN" type="IBAN2007Identifier"/>
|
||||||
|
<xs:element name="Othr" type="GenericAccountIdentification1"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="AccountSchemeName1Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="ExternalAccountIdentification1Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="ActiveOrHistoricCurrencyAndAmount_SimpleType">
|
||||||
|
<xs:restriction base="xs:decimal">
|
||||||
|
<xs:minInclusive value="0"/>
|
||||||
|
<xs:fractionDigits value="5"/>
|
||||||
|
<xs:totalDigits value="18"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="ActiveOrHistoricCurrencyAndAmount">
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="ActiveOrHistoricCurrencyAndAmount_SimpleType">
|
||||||
|
<xs:attribute name="Ccy" type="ActiveOrHistoricCurrencyCode" use="required"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="ActiveOrHistoricCurrencyCode">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:pattern value="[A-Z]{3,3}"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="AddressType2Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="ADDR"/>
|
||||||
|
<xs:enumeration value="PBOX"/>
|
||||||
|
<xs:enumeration value="HOME"/>
|
||||||
|
<xs:enumeration value="BIZZ"/>
|
||||||
|
<xs:enumeration value="MLTO"/>
|
||||||
|
<xs:enumeration value="DLVY"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="AmountType3Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="InstdAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element name="EqvtAmt" type="EquivalentAmount2"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="AnyBICIdentifier">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:pattern value="[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="Authorisation1Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="Authorisation1Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max128Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="Authorisation1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="AUTH"/>
|
||||||
|
<xs:enumeration value="FDET"/>
|
||||||
|
<xs:enumeration value="FSUM"/>
|
||||||
|
<xs:enumeration value="ILEV"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="BICIdentifier">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:pattern value="[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="BaseOneRate">
|
||||||
|
<xs:restriction base="xs:decimal">
|
||||||
|
<xs:fractionDigits value="10"/>
|
||||||
|
<xs:totalDigits value="11"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="BatchBookingIndicator">
|
||||||
|
<xs:restriction base="xs:boolean"/>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="BranchAndFinancialInstitutionIdentification4">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="FinInstnId" type="FinancialInstitutionIdentification7"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="BrnchId" type="BranchData2"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="BranchData2">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Id" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max140Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="PstlAdr" type="PostalAddress6"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="CashAccount16">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="Id" type="AccountIdentification4Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Tp" type="CashAccountType2"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Ccy" type="ActiveOrHistoricCurrencyCode"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max70Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="CashAccountType2">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="CashAccountType4Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="CashAccountType4Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="CASH"/>
|
||||||
|
<xs:enumeration value="CHAR"/>
|
||||||
|
<xs:enumeration value="COMM"/>
|
||||||
|
<xs:enumeration value="TAXE"/>
|
||||||
|
<xs:enumeration value="CISH"/>
|
||||||
|
<xs:enumeration value="TRAS"/>
|
||||||
|
<xs:enumeration value="SACC"/>
|
||||||
|
<xs:enumeration value="CACC"/>
|
||||||
|
<xs:enumeration value="SVGS"/>
|
||||||
|
<xs:enumeration value="ONDP"/>
|
||||||
|
<xs:enumeration value="MGLD"/>
|
||||||
|
<xs:enumeration value="NREX"/>
|
||||||
|
<xs:enumeration value="MOMA"/>
|
||||||
|
<xs:enumeration value="LOAN"/>
|
||||||
|
<xs:enumeration value="SLRY"/>
|
||||||
|
<xs:enumeration value="ODFT"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="CategoryPurpose1Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="ExternalCategoryPurpose1Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="ChargeBearerType1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="DEBT"/>
|
||||||
|
<xs:enumeration value="CRED"/>
|
||||||
|
<xs:enumeration value="SHAR"/>
|
||||||
|
<xs:enumeration value="SLEV"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="Cheque6">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="ChqTp" type="ChequeType2Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="ChqNb" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="ChqFr" type="NameAndAddress10"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="DlvryMtd" type="ChequeDeliveryMethod1Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="DlvrTo" type="NameAndAddress10"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="InstrPrty" type="Priority2Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="ChqMtrtyDt" type="ISODate"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="FrmsCd" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="2" minOccurs="0" name="MemoFld" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RgnlClrZone" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="PrtLctn" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="ChequeDelivery1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="MLDB"/>
|
||||||
|
<xs:enumeration value="MLCD"/>
|
||||||
|
<xs:enumeration value="MLFA"/>
|
||||||
|
<xs:enumeration value="CRDB"/>
|
||||||
|
<xs:enumeration value="CRCD"/>
|
||||||
|
<xs:enumeration value="CRFA"/>
|
||||||
|
<xs:enumeration value="PUDB"/>
|
||||||
|
<xs:enumeration value="PUCD"/>
|
||||||
|
<xs:enumeration value="PUFA"/>
|
||||||
|
<xs:enumeration value="RGDB"/>
|
||||||
|
<xs:enumeration value="RGCD"/>
|
||||||
|
<xs:enumeration value="RGFA"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="ChequeDeliveryMethod1Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="ChequeDelivery1Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="ChequeType2Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="CCHQ"/>
|
||||||
|
<xs:enumeration value="CCCH"/>
|
||||||
|
<xs:enumeration value="BCHQ"/>
|
||||||
|
<xs:enumeration value="DRFT"/>
|
||||||
|
<xs:enumeration value="ELDR"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="ClearingSystemIdentification2Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="ExternalClearingSystemIdentification1Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="ClearingSystemMemberIdentification2">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="ClrSysId" type="ClearingSystemIdentification2Choice"/>
|
||||||
|
<xs:element name="MmbId" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="ContactDetails2">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="NmPrfx" type="NamePrefix1Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max140Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="PhneNb" type="PhoneNumber"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="MobNb" type="PhoneNumber"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="FaxNb" type="PhoneNumber"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="EmailAdr" type="Max2048Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Othr" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="CountryCode">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:pattern value="[A-Z]{2,2}"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="CreditDebitCode">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="CRDT"/>
|
||||||
|
<xs:enumeration value="DBIT"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="CreditTransferTransactionInformation10">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="PmtId" type="PaymentIdentification1"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="PmtTpInf" type="PaymentTypeInformation19"/>
|
||||||
|
<xs:element name="Amt" type="AmountType3Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="XchgRateInf" type="ExchangeRateInformation1"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="ChrgBr" type="ChargeBearerType1Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="ChqInstr" type="Cheque6"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="UltmtDbtr" type="PartyIdentification32"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="IntrmyAgt1" type="BranchAndFinancialInstitutionIdentification4"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="IntrmyAgt1Acct" type="CashAccount16"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="IntrmyAgt2" type="BranchAndFinancialInstitutionIdentification4"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="IntrmyAgt2Acct" type="CashAccount16"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="IntrmyAgt3" type="BranchAndFinancialInstitutionIdentification4"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="IntrmyAgt3Acct" type="CashAccount16"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CdtrAgt" type="BranchAndFinancialInstitutionIdentification4"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CdtrAgtAcct" type="CashAccount16"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Cdtr" type="PartyIdentification32"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CdtrAcct" type="CashAccount16"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="UltmtCdtr" type="PartyIdentification32"/>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="0" name="InstrForCdtrAgt" type="InstructionForCreditorAgent1"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="InstrForDbtrAgt" type="Max140Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Purp" type="Purpose2Choice"/>
|
||||||
|
<xs:element maxOccurs="10" minOccurs="0" name="RgltryRptg" type="RegulatoryReporting3"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Tax" type="TaxInformation3"/>
|
||||||
|
<xs:element maxOccurs="10" minOccurs="0" name="RltdRmtInf" type="RemittanceLocation2"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RmtInf" type="RemittanceInformation5"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="CreditorReferenceInformation2">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Tp" type="CreditorReferenceType2"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Ref" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="CreditorReferenceType1Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="DocumentType3Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="CreditorReferenceType2">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="CdOrPrtry" type="CreditorReferenceType1Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Issr" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="CustomerCreditTransferInitiationV03">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="GrpHdr" type="GroupHeader32"/>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="1" name="PmtInf" type="PaymentInstructionInformation3"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="DateAndPlaceOfBirth">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="BirthDt" type="ISODate"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="PrvcOfBirth" type="Max35Text"/>
|
||||||
|
<xs:element name="CityOfBirth" type="Max35Text"/>
|
||||||
|
<xs:element name="CtryOfBirth" type="CountryCode"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="DatePeriodDetails">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="FrDt" type="ISODate"/>
|
||||||
|
<xs:element name="ToDt" type="ISODate"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="DecimalNumber">
|
||||||
|
<xs:restriction base="xs:decimal">
|
||||||
|
<xs:fractionDigits value="17"/>
|
||||||
|
<xs:totalDigits value="18"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="Document">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="CstmrCdtTrfInitn" type="CustomerCreditTransferInitiationV03"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="DocumentAdjustment1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="Amt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CdtDbtInd" type="CreditDebitCode"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Rsn" type="Max4Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="AddtlInf" type="Max140Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="DocumentType3Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="RADM"/>
|
||||||
|
<xs:enumeration value="RPIN"/>
|
||||||
|
<xs:enumeration value="FXDR"/>
|
||||||
|
<xs:enumeration value="DISP"/>
|
||||||
|
<xs:enumeration value="PUOR"/>
|
||||||
|
<xs:enumeration value="SCOR"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="DocumentType5Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="MSIN"/>
|
||||||
|
<xs:enumeration value="CNFA"/>
|
||||||
|
<xs:enumeration value="DNFA"/>
|
||||||
|
<xs:enumeration value="CINV"/>
|
||||||
|
<xs:enumeration value="CREN"/>
|
||||||
|
<xs:enumeration value="DEBN"/>
|
||||||
|
<xs:enumeration value="HIRI"/>
|
||||||
|
<xs:enumeration value="SBIN"/>
|
||||||
|
<xs:enumeration value="CMCN"/>
|
||||||
|
<xs:enumeration value="SOAC"/>
|
||||||
|
<xs:enumeration value="DISP"/>
|
||||||
|
<xs:enumeration value="BOLD"/>
|
||||||
|
<xs:enumeration value="VCHR"/>
|
||||||
|
<xs:enumeration value="AROI"/>
|
||||||
|
<xs:enumeration value="TSUT"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="EquivalentAmount2">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="Amt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element name="CcyOfTrf" type="ActiveOrHistoricCurrencyCode"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="ExchangeRateInformation1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="XchgRate" type="BaseOneRate"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RateTp" type="ExchangeRateType1Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CtrctId" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="ExchangeRateType1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="SPOT"/>
|
||||||
|
<xs:enumeration value="SALE"/>
|
||||||
|
<xs:enumeration value="AGRD"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ExternalAccountIdentification1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="4"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ExternalCategoryPurpose1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="4"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ExternalClearingSystemIdentification1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="5"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ExternalFinancialInstitutionIdentification1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="4"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ExternalLocalInstrument1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="35"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ExternalOrganisationIdentification1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="4"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ExternalPersonIdentification1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="4"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ExternalPurpose1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="4"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ExternalServiceLevel1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="4"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="FinancialIdentificationSchemeName1Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="ExternalFinancialInstitutionIdentification1Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="FinancialInstitutionIdentification7">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="BIC" type="BICIdentifier"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="ClrSysMmbId" type="ClearingSystemMemberIdentification2"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max140Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="PstlAdr" type="PostalAddress6"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Othr" type="GenericFinancialIdentification1"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="GenericAccountIdentification1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="Id" type="Max34Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="SchmeNm" type="AccountSchemeName1Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Issr" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="GenericFinancialIdentification1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="Id" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="SchmeNm" type="FinancialIdentificationSchemeName1Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Issr" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="GenericOrganisationIdentification1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="Id" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="SchmeNm" type="OrganisationIdentificationSchemeName1Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Issr" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="GenericPersonIdentification1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="Id" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="SchmeNm" type="PersonIdentificationSchemeName1Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Issr" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="GroupHeader32">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="MsgId" type="Max35Text"/>
|
||||||
|
<xs:element name="CreDtTm" type="ISODateTime"/>
|
||||||
|
<xs:element maxOccurs="2" minOccurs="0" name="Authstn" type="Authorisation1Choice"/>
|
||||||
|
<xs:element name="NbOfTxs" type="Max15NumericText"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CtrlSum" type="DecimalNumber"/>
|
||||||
|
<xs:element name="InitgPty" type="PartyIdentification32"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="FwdgAgt" type="BranchAndFinancialInstitutionIdentification4"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="IBAN2007Identifier">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:pattern value="[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ISODate">
|
||||||
|
<xs:restriction base="xs:date"/>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ISODateTime">
|
||||||
|
<xs:restriction base="xs:dateTime"/>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Instruction3Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="CHQB"/>
|
||||||
|
<xs:enumeration value="HOLD"/>
|
||||||
|
<xs:enumeration value="PHOB"/>
|
||||||
|
<xs:enumeration value="TELB"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="InstructionForCreditorAgent1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Cd" type="Instruction3Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="InstrInf" type="Max140Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="LocalInstrument2Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="ExternalLocalInstrument1Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="Max10Text">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="10"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Max128Text">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="128"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Max140Text">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="140"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Max15NumericText">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:pattern value="[0-9]{1,15}"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Max16Text">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="16"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Max2048Text">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="2048"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Max34Text">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="34"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Max35Text">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="35"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Max4Text">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="4"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Max70Text">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="70"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="NameAndAddress10">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="Nm" type="Max140Text"/>
|
||||||
|
<xs:element name="Adr" type="PostalAddress6"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="NamePrefix1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="DOCT"/>
|
||||||
|
<xs:enumeration value="MIST"/>
|
||||||
|
<xs:enumeration value="MISS"/>
|
||||||
|
<xs:enumeration value="MADM"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Number">
|
||||||
|
<xs:restriction base="xs:decimal">
|
||||||
|
<xs:fractionDigits value="0"/>
|
||||||
|
<xs:totalDigits value="18"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="OrganisationIdentification4">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="BICOrBEI" type="AnyBICIdentifier"/>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="0" name="Othr" type="GenericOrganisationIdentification1"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="OrganisationIdentificationSchemeName1Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="ExternalOrganisationIdentification1Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="Party6Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="OrgId" type="OrganisationIdentification4"/>
|
||||||
|
<xs:element name="PrvtId" type="PersonIdentification5"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="PartyIdentification32">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max140Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="PstlAdr" type="PostalAddress6"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Id" type="Party6Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CtryOfRes" type="CountryCode"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CtctDtls" type="ContactDetails2"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="PaymentIdentification1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="InstrId" type="Max35Text"/>
|
||||||
|
<xs:element name="EndToEndId" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="PaymentInstructionInformation3">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="PmtInfId" type="Max35Text"/>
|
||||||
|
<xs:element name="PmtMtd" type="PaymentMethod3Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="BtchBookg" type="BatchBookingIndicator"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="NbOfTxs" type="Max15NumericText"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CtrlSum" type="DecimalNumber"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="PmtTpInf" type="PaymentTypeInformation19"/>
|
||||||
|
<xs:element name="ReqdExctnDt" type="ISODate"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="PoolgAdjstmntDt" type="ISODate"/>
|
||||||
|
<xs:element name="Dbtr" type="PartyIdentification32"/>
|
||||||
|
<xs:element name="DbtrAcct" type="CashAccount16"/>
|
||||||
|
<xs:element name="DbtrAgt" type="BranchAndFinancialInstitutionIdentification4"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="DbtrAgtAcct" type="CashAccount16"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="UltmtDbtr" type="PartyIdentification32"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="ChrgBr" type="ChargeBearerType1Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="ChrgsAcct" type="CashAccount16"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="ChrgsAcctAgt" type="BranchAndFinancialInstitutionIdentification4"/>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="1" name="CdtTrfTxInf" type="CreditTransferTransactionInformation10"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="PaymentMethod3Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="CHK"/>
|
||||||
|
<xs:enumeration value="TRF"/>
|
||||||
|
<xs:enumeration value="TRA"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="PaymentTypeInformation19">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="InstrPrty" type="Priority2Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="SvcLvl" type="ServiceLevel8Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="LclInstrm" type="LocalInstrument2Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CtgyPurp" type="CategoryPurpose1Choice"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="PercentageRate">
|
||||||
|
<xs:restriction base="xs:decimal">
|
||||||
|
<xs:fractionDigits value="10"/>
|
||||||
|
<xs:totalDigits value="11"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="PersonIdentification5">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="DtAndPlcOfBirth" type="DateAndPlaceOfBirth"/>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="0" name="Othr" type="GenericPersonIdentification1"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="PersonIdentificationSchemeName1Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="ExternalPersonIdentification1Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="PhoneNumber">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:pattern value="\+[0-9]{1,3}-[0-9()+\-]{1,30}"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="PostalAddress6">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="AdrTp" type="AddressType2Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Dept" type="Max70Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="SubDept" type="Max70Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="StrtNm" type="Max70Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="BldgNb" type="Max16Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="PstCd" type="Max16Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TwnNm" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CtrySubDvsn" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Ctry" type="CountryCode"/>
|
||||||
|
<xs:element maxOccurs="7" minOccurs="0" name="AdrLine" type="Max70Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="Priority2Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="HIGH"/>
|
||||||
|
<xs:enumeration value="NORM"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="Purpose2Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="ExternalPurpose1Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="ReferredDocumentInformation3">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Tp" type="ReferredDocumentType2"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Nb" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RltdDt" type="ISODate"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="ReferredDocumentType1Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="DocumentType5Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="ReferredDocumentType2">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="CdOrPrtry" type="ReferredDocumentType1Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Issr" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="RegulatoryAuthority2">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max140Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Ctry" type="CountryCode"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="RegulatoryReporting3">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="DbtCdtRptgInd" type="RegulatoryReportingType1Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Authrty" type="RegulatoryAuthority2"/>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="0" name="Dtls" type="StructuredRegulatoryReporting3"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="RegulatoryReportingType1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="CRED"/>
|
||||||
|
<xs:enumeration value="DEBT"/>
|
||||||
|
<xs:enumeration value="BOTH"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="RemittanceAmount1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="DuePyblAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="DscntApldAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CdtNoteAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TaxAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="0" name="AdjstmntAmtAndRsn" type="DocumentAdjustment1"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RmtdAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="RemittanceInformation5">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="0" name="Ustrd" type="Max140Text"/>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="0" name="Strd" type="StructuredRemittanceInformation7"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="RemittanceLocation2">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RmtId" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RmtLctnMtd" type="RemittanceLocationMethod2Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RmtLctnElctrncAdr" type="Max2048Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RmtLctnPstlAdr" type="NameAndAddress10"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="RemittanceLocationMethod2Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="FAXI"/>
|
||||||
|
<xs:enumeration value="EDIC"/>
|
||||||
|
<xs:enumeration value="URID"/>
|
||||||
|
<xs:enumeration value="EMAL"/>
|
||||||
|
<xs:enumeration value="POST"/>
|
||||||
|
<xs:enumeration value="SMSM"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="ServiceLevel8Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="ExternalServiceLevel1Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="StructuredRegulatoryReporting3">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Tp" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Dt" type="ISODate"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Ctry" type="CountryCode"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Cd" type="Max10Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Amt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="0" name="Inf" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="StructuredRemittanceInformation7">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="0" name="RfrdDocInf" type="ReferredDocumentInformation3"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RfrdDocAmt" type="RemittanceAmount1"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CdtrRefInf" type="CreditorReferenceInformation2"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Invcr" type="PartyIdentification32"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Invcee" type="PartyIdentification32"/>
|
||||||
|
<xs:element maxOccurs="3" minOccurs="0" name="AddtlRmtInf" type="Max140Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="TaxAmount1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Rate" type="PercentageRate"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TaxblBaseAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TtlAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="0" name="Dtls" type="TaxRecordDetails1"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="TaxAuthorisation1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Titl" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max140Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="TaxInformation3">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Cdtr" type="TaxParty1"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Dbtr" type="TaxParty2"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="AdmstnZn" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RefNb" type="Max140Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Mtd" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TtlTaxblBaseAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TtlTaxAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Dt" type="ISODate"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="SeqNb" type="Number"/>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="0" name="Rcrd" type="TaxRecord1"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="TaxParty1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TaxId" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RegnId" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TaxTp" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="TaxParty2">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TaxId" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RegnId" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TaxTp" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Authstn" type="TaxAuthorisation1"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="TaxPeriod1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Yr" type="ISODate"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Tp" type="TaxRecordPeriod1Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="FrToDt" type="DatePeriodDetails"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="TaxRecord1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Tp" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Ctgy" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CtgyDtls" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="DbtrSts" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CertId" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="FrmsCd" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Prd" type="TaxPeriod1"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TaxAmt" type="TaxAmount1"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="AddtlInf" type="Max140Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="TaxRecordDetails1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Prd" type="TaxPeriod1"/>
|
||||||
|
<xs:element name="Amt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="TaxRecordPeriod1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="MM01"/>
|
||||||
|
<xs:enumeration value="MM02"/>
|
||||||
|
<xs:enumeration value="MM03"/>
|
||||||
|
<xs:enumeration value="MM04"/>
|
||||||
|
<xs:enumeration value="MM05"/>
|
||||||
|
<xs:enumeration value="MM06"/>
|
||||||
|
<xs:enumeration value="MM07"/>
|
||||||
|
<xs:enumeration value="MM08"/>
|
||||||
|
<xs:enumeration value="MM09"/>
|
||||||
|
<xs:enumeration value="MM10"/>
|
||||||
|
<xs:enumeration value="MM11"/>
|
||||||
|
<xs:enumeration value="MM12"/>
|
||||||
|
<xs:enumeration value="QTR1"/>
|
||||||
|
<xs:enumeration value="QTR2"/>
|
||||||
|
<xs:enumeration value="QTR3"/>
|
||||||
|
<xs:enumeration value="QTR4"/>
|
||||||
|
<xs:enumeration value="HLF1"/>
|
||||||
|
<xs:enumeration value="HLF2"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
</xs:schema>
|
||||||
879
dev/resources/sepa/pain.008.001.02.xsd
Normal file
879
dev/resources/sepa/pain.008.001.02.xsd
Normal file
@ -0,0 +1,879 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!--Generated by SWIFTStandards Workstation (build:R6.1.0.2) on 2009 Jan 08 17:30:53-->
|
||||||
|
<xs:schema xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02">
|
||||||
|
<xs:element name="Document" type="Document"/>
|
||||||
|
<xs:complexType name="AccountIdentification4Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="IBAN" type="IBAN2007Identifier"/>
|
||||||
|
<xs:element name="Othr" type="GenericAccountIdentification1"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="AccountSchemeName1Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="ExternalAccountIdentification1Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="ActiveOrHistoricCurrencyAndAmount_SimpleType">
|
||||||
|
<xs:restriction base="xs:decimal">
|
||||||
|
<xs:minInclusive value="0"/>
|
||||||
|
<xs:fractionDigits value="5"/>
|
||||||
|
<xs:totalDigits value="18"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="ActiveOrHistoricCurrencyAndAmount">
|
||||||
|
<xs:simpleContent>
|
||||||
|
<xs:extension base="ActiveOrHistoricCurrencyAndAmount_SimpleType">
|
||||||
|
<xs:attribute name="Ccy" type="ActiveOrHistoricCurrencyCode" use="required"/>
|
||||||
|
</xs:extension>
|
||||||
|
</xs:simpleContent>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="ActiveOrHistoricCurrencyCode">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:pattern value="[A-Z]{3,3}"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="AddressType2Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="ADDR"/>
|
||||||
|
<xs:enumeration value="PBOX"/>
|
||||||
|
<xs:enumeration value="HOME"/>
|
||||||
|
<xs:enumeration value="BIZZ"/>
|
||||||
|
<xs:enumeration value="MLTO"/>
|
||||||
|
<xs:enumeration value="DLVY"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="AmendmentInformationDetails6">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="OrgnlMndtId" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="OrgnlCdtrSchmeId" type="PartyIdentification32"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="OrgnlCdtrAgt" type="BranchAndFinancialInstitutionIdentification4"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="OrgnlCdtrAgtAcct" type="CashAccount16"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="OrgnlDbtr" type="PartyIdentification32"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="OrgnlDbtrAcct" type="CashAccount16"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="OrgnlDbtrAgt" type="BranchAndFinancialInstitutionIdentification4"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="OrgnlDbtrAgtAcct" type="CashAccount16"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="OrgnlFnlColltnDt" type="ISODate"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="OrgnlFrqcy" type="Frequency1Code"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="AnyBICIdentifier">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:pattern value="[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="Authorisation1Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="Authorisation1Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max128Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="Authorisation1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="AUTH"/>
|
||||||
|
<xs:enumeration value="FDET"/>
|
||||||
|
<xs:enumeration value="FSUM"/>
|
||||||
|
<xs:enumeration value="ILEV"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="BICIdentifier">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:pattern value="[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="BatchBookingIndicator">
|
||||||
|
<xs:restriction base="xs:boolean"/>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="BranchAndFinancialInstitutionIdentification4">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="FinInstnId" type="FinancialInstitutionIdentification7"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="BrnchId" type="BranchData2"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="BranchData2">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Id" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max140Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="PstlAdr" type="PostalAddress6"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="CashAccount16">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="Id" type="AccountIdentification4Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Tp" type="CashAccountType2"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Ccy" type="ActiveOrHistoricCurrencyCode"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max70Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="CashAccountType2">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="CashAccountType4Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="CashAccountType4Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="CASH"/>
|
||||||
|
<xs:enumeration value="CHAR"/>
|
||||||
|
<xs:enumeration value="COMM"/>
|
||||||
|
<xs:enumeration value="TAXE"/>
|
||||||
|
<xs:enumeration value="CISH"/>
|
||||||
|
<xs:enumeration value="TRAS"/>
|
||||||
|
<xs:enumeration value="SACC"/>
|
||||||
|
<xs:enumeration value="CACC"/>
|
||||||
|
<xs:enumeration value="SVGS"/>
|
||||||
|
<xs:enumeration value="ONDP"/>
|
||||||
|
<xs:enumeration value="MGLD"/>
|
||||||
|
<xs:enumeration value="NREX"/>
|
||||||
|
<xs:enumeration value="MOMA"/>
|
||||||
|
<xs:enumeration value="LOAN"/>
|
||||||
|
<xs:enumeration value="SLRY"/>
|
||||||
|
<xs:enumeration value="ODFT"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="CategoryPurpose1Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="ExternalCategoryPurpose1Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="ChargeBearerType1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="DEBT"/>
|
||||||
|
<xs:enumeration value="CRED"/>
|
||||||
|
<xs:enumeration value="SHAR"/>
|
||||||
|
<xs:enumeration value="SLEV"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="ClearingSystemIdentification2Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="ExternalClearingSystemIdentification1Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="ClearingSystemMemberIdentification2">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="ClrSysId" type="ClearingSystemIdentification2Choice"/>
|
||||||
|
<xs:element name="MmbId" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="ContactDetails2">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="NmPrfx" type="NamePrefix1Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max140Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="PhneNb" type="PhoneNumber"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="MobNb" type="PhoneNumber"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="FaxNb" type="PhoneNumber"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="EmailAdr" type="Max2048Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Othr" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="CountryCode">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:pattern value="[A-Z]{2,2}"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="CreditDebitCode">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="CRDT"/>
|
||||||
|
<xs:enumeration value="DBIT"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="CreditorReferenceInformation2">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Tp" type="CreditorReferenceType2"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Ref" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="CreditorReferenceType1Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="DocumentType3Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="CreditorReferenceType2">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="CdOrPrtry" type="CreditorReferenceType1Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Issr" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="CustomerDirectDebitInitiationV02">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="GrpHdr" type="GroupHeader39"/>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="1" name="PmtInf" type="PaymentInstructionInformation4"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="DateAndPlaceOfBirth">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="BirthDt" type="ISODate"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="PrvcOfBirth" type="Max35Text"/>
|
||||||
|
<xs:element name="CityOfBirth" type="Max35Text"/>
|
||||||
|
<xs:element name="CtryOfBirth" type="CountryCode"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="DatePeriodDetails">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="FrDt" type="ISODate"/>
|
||||||
|
<xs:element name="ToDt" type="ISODate"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="DecimalNumber">
|
||||||
|
<xs:restriction base="xs:decimal">
|
||||||
|
<xs:fractionDigits value="17"/>
|
||||||
|
<xs:totalDigits value="18"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="DirectDebitTransaction6">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="MndtRltdInf" type="MandateRelatedInformation6"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CdtrSchmeId" type="PartyIdentification32"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="PreNtfctnId" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="PreNtfctnDt" type="ISODate"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="DirectDebitTransactionInformation9">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="PmtId" type="PaymentIdentification1"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="PmtTpInf" type="PaymentTypeInformation20"/>
|
||||||
|
<xs:element name="InstdAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="ChrgBr" type="ChargeBearerType1Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="DrctDbtTx" type="DirectDebitTransaction6"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="UltmtCdtr" type="PartyIdentification32"/>
|
||||||
|
<xs:element name="DbtrAgt" type="BranchAndFinancialInstitutionIdentification4"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="DbtrAgtAcct" type="CashAccount16"/>
|
||||||
|
<xs:element name="Dbtr" type="PartyIdentification32"/>
|
||||||
|
<xs:element name="DbtrAcct" type="CashAccount16"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="UltmtDbtr" type="PartyIdentification32"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="InstrForCdtrAgt" type="Max140Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Purp" type="Purpose2Choice"/>
|
||||||
|
<xs:element maxOccurs="10" minOccurs="0" name="RgltryRptg" type="RegulatoryReporting3"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Tax" type="TaxInformation3"/>
|
||||||
|
<xs:element maxOccurs="10" minOccurs="0" name="RltdRmtInf" type="RemittanceLocation2"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RmtInf" type="RemittanceInformation5"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="Document">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="CstmrDrctDbtInitn" type="CustomerDirectDebitInitiationV02"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="DocumentAdjustment1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="Amt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CdtDbtInd" type="CreditDebitCode"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Rsn" type="Max4Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="AddtlInf" type="Max140Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="DocumentType3Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="RADM"/>
|
||||||
|
<xs:enumeration value="RPIN"/>
|
||||||
|
<xs:enumeration value="FXDR"/>
|
||||||
|
<xs:enumeration value="DISP"/>
|
||||||
|
<xs:enumeration value="PUOR"/>
|
||||||
|
<xs:enumeration value="SCOR"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="DocumentType5Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="MSIN"/>
|
||||||
|
<xs:enumeration value="CNFA"/>
|
||||||
|
<xs:enumeration value="DNFA"/>
|
||||||
|
<xs:enumeration value="CINV"/>
|
||||||
|
<xs:enumeration value="CREN"/>
|
||||||
|
<xs:enumeration value="DEBN"/>
|
||||||
|
<xs:enumeration value="HIRI"/>
|
||||||
|
<xs:enumeration value="SBIN"/>
|
||||||
|
<xs:enumeration value="CMCN"/>
|
||||||
|
<xs:enumeration value="SOAC"/>
|
||||||
|
<xs:enumeration value="DISP"/>
|
||||||
|
<xs:enumeration value="BOLD"/>
|
||||||
|
<xs:enumeration value="VCHR"/>
|
||||||
|
<xs:enumeration value="AROI"/>
|
||||||
|
<xs:enumeration value="TSUT"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ExternalAccountIdentification1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="4"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ExternalCategoryPurpose1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="4"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ExternalClearingSystemIdentification1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="5"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ExternalFinancialInstitutionIdentification1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="4"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ExternalLocalInstrument1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="35"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ExternalOrganisationIdentification1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="4"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ExternalPersonIdentification1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="4"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ExternalPurpose1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="4"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ExternalServiceLevel1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="4"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="FinancialIdentificationSchemeName1Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="ExternalFinancialInstitutionIdentification1Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="FinancialInstitutionIdentification7">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="BIC" type="BICIdentifier"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="ClrSysMmbId" type="ClearingSystemMemberIdentification2"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max140Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="PstlAdr" type="PostalAddress6"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Othr" type="GenericFinancialIdentification1"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="Frequency1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="YEAR"/>
|
||||||
|
<xs:enumeration value="MNTH"/>
|
||||||
|
<xs:enumeration value="QURT"/>
|
||||||
|
<xs:enumeration value="MIAN"/>
|
||||||
|
<xs:enumeration value="WEEK"/>
|
||||||
|
<xs:enumeration value="DAIL"/>
|
||||||
|
<xs:enumeration value="ADHO"/>
|
||||||
|
<xs:enumeration value="INDA"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="GenericAccountIdentification1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="Id" type="Max34Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="SchmeNm" type="AccountSchemeName1Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Issr" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="GenericFinancialIdentification1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="Id" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="SchmeNm" type="FinancialIdentificationSchemeName1Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Issr" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="GenericOrganisationIdentification1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="Id" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="SchmeNm" type="OrganisationIdentificationSchemeName1Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Issr" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="GenericPersonIdentification1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="Id" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="SchmeNm" type="PersonIdentificationSchemeName1Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Issr" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="GroupHeader39">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="MsgId" type="Max35Text"/>
|
||||||
|
<xs:element name="CreDtTm" type="ISODateTime"/>
|
||||||
|
<xs:element maxOccurs="2" minOccurs="0" name="Authstn" type="Authorisation1Choice"/>
|
||||||
|
<xs:element name="NbOfTxs" type="Max15NumericText"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CtrlSum" type="DecimalNumber"/>
|
||||||
|
<xs:element name="InitgPty" type="PartyIdentification32"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="FwdgAgt" type="BranchAndFinancialInstitutionIdentification4"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="IBAN2007Identifier">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:pattern value="[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ISODate">
|
||||||
|
<xs:restriction base="xs:date"/>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="ISODateTime">
|
||||||
|
<xs:restriction base="xs:dateTime"/>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="LocalInstrument2Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="ExternalLocalInstrument1Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="MandateRelatedInformation6">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="MndtId" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="DtOfSgntr" type="ISODate"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="AmdmntInd" type="TrueFalseIndicator"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="AmdmntInfDtls" type="AmendmentInformationDetails6"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="ElctrncSgntr" type="Max1025Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="FrstColltnDt" type="ISODate"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="FnlColltnDt" type="ISODate"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Frqcy" type="Frequency1Code"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="Max1025Text">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="1025"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Max10Text">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="10"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Max128Text">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="128"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Max140Text">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="140"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Max15NumericText">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:pattern value="[0-9]{1,15}"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Max16Text">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="16"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Max2048Text">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="2048"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Max34Text">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="34"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Max35Text">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="35"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Max4Text">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="4"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Max70Text">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:minLength value="1"/>
|
||||||
|
<xs:maxLength value="70"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="NameAndAddress10">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="Nm" type="Max140Text"/>
|
||||||
|
<xs:element name="Adr" type="PostalAddress6"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="NamePrefix1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="DOCT"/>
|
||||||
|
<xs:enumeration value="MIST"/>
|
||||||
|
<xs:enumeration value="MISS"/>
|
||||||
|
<xs:enumeration value="MADM"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="Number">
|
||||||
|
<xs:restriction base="xs:decimal">
|
||||||
|
<xs:fractionDigits value="0"/>
|
||||||
|
<xs:totalDigits value="18"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="OrganisationIdentification4">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="BICOrBEI" type="AnyBICIdentifier"/>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="0" name="Othr" type="GenericOrganisationIdentification1"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="OrganisationIdentificationSchemeName1Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="ExternalOrganisationIdentification1Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="Party6Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="OrgId" type="OrganisationIdentification4"/>
|
||||||
|
<xs:element name="PrvtId" type="PersonIdentification5"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="PartyIdentification32">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max140Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="PstlAdr" type="PostalAddress6"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Id" type="Party6Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CtryOfRes" type="CountryCode"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CtctDtls" type="ContactDetails2"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="PaymentIdentification1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="InstrId" type="Max35Text"/>
|
||||||
|
<xs:element name="EndToEndId" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="PaymentInstructionInformation4">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="PmtInfId" type="Max35Text"/>
|
||||||
|
<xs:element name="PmtMtd" type="PaymentMethod2Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="BtchBookg" type="BatchBookingIndicator"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="NbOfTxs" type="Max15NumericText"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CtrlSum" type="DecimalNumber"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="PmtTpInf" type="PaymentTypeInformation20"/>
|
||||||
|
<xs:element name="ReqdColltnDt" type="ISODate"/>
|
||||||
|
<xs:element name="Cdtr" type="PartyIdentification32"/>
|
||||||
|
<xs:element name="CdtrAcct" type="CashAccount16"/>
|
||||||
|
<xs:element name="CdtrAgt" type="BranchAndFinancialInstitutionIdentification4"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CdtrAgtAcct" type="CashAccount16"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="UltmtCdtr" type="PartyIdentification32"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="ChrgBr" type="ChargeBearerType1Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="ChrgsAcct" type="CashAccount16"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="ChrgsAcctAgt" type="BranchAndFinancialInstitutionIdentification4"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CdtrSchmeId" type="PartyIdentification32"/>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="1" name="DrctDbtTxInf" type="DirectDebitTransactionInformation9"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="PaymentMethod2Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="DD"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="PaymentTypeInformation20">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="InstrPrty" type="Priority2Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="SvcLvl" type="ServiceLevel8Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="LclInstrm" type="LocalInstrument2Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="SeqTp" type="SequenceType1Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CtgyPurp" type="CategoryPurpose1Choice"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="PercentageRate">
|
||||||
|
<xs:restriction base="xs:decimal">
|
||||||
|
<xs:fractionDigits value="10"/>
|
||||||
|
<xs:totalDigits value="11"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="PersonIdentification5">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="DtAndPlcOfBirth" type="DateAndPlaceOfBirth"/>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="0" name="Othr" type="GenericPersonIdentification1"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="PersonIdentificationSchemeName1Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="ExternalPersonIdentification1Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="PhoneNumber">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:pattern value="\+[0-9]{1,3}-[0-9()+\-]{1,30}"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="PostalAddress6">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="AdrTp" type="AddressType2Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Dept" type="Max70Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="SubDept" type="Max70Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="StrtNm" type="Max70Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="BldgNb" type="Max16Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="PstCd" type="Max16Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TwnNm" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CtrySubDvsn" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Ctry" type="CountryCode"/>
|
||||||
|
<xs:element maxOccurs="7" minOccurs="0" name="AdrLine" type="Max70Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="Priority2Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="HIGH"/>
|
||||||
|
<xs:enumeration value="NORM"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="Purpose2Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="ExternalPurpose1Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="ReferredDocumentInformation3">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Tp" type="ReferredDocumentType2"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Nb" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RltdDt" type="ISODate"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="ReferredDocumentType1Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="DocumentType5Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="ReferredDocumentType2">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="CdOrPrtry" type="ReferredDocumentType1Choice"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Issr" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="RegulatoryAuthority2">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max140Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Ctry" type="CountryCode"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="RegulatoryReporting3">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="DbtCdtRptgInd" type="RegulatoryReportingType1Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Authrty" type="RegulatoryAuthority2"/>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="0" name="Dtls" type="StructuredRegulatoryReporting3"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="RegulatoryReportingType1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="CRED"/>
|
||||||
|
<xs:enumeration value="DEBT"/>
|
||||||
|
<xs:enumeration value="BOTH"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="RemittanceAmount1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="DuePyblAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="DscntApldAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CdtNoteAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TaxAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="0" name="AdjstmntAmtAndRsn" type="DocumentAdjustment1"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RmtdAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="RemittanceInformation5">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="0" name="Ustrd" type="Max140Text"/>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="0" name="Strd" type="StructuredRemittanceInformation7"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="RemittanceLocation2">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RmtId" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RmtLctnMtd" type="RemittanceLocationMethod2Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RmtLctnElctrncAdr" type="Max2048Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RmtLctnPstlAdr" type="NameAndAddress10"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="RemittanceLocationMethod2Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="FAXI"/>
|
||||||
|
<xs:enumeration value="EDIC"/>
|
||||||
|
<xs:enumeration value="URID"/>
|
||||||
|
<xs:enumeration value="EMAL"/>
|
||||||
|
<xs:enumeration value="POST"/>
|
||||||
|
<xs:enumeration value="SMSM"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="SequenceType1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="FRST"/>
|
||||||
|
<xs:enumeration value="RCUR"/>
|
||||||
|
<xs:enumeration value="FNAL"/>
|
||||||
|
<xs:enumeration value="OOFF"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:complexType name="ServiceLevel8Choice">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:choice>
|
||||||
|
<xs:element name="Cd" type="ExternalServiceLevel1Code"/>
|
||||||
|
<xs:element name="Prtry" type="Max35Text"/>
|
||||||
|
</xs:choice>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="StructuredRegulatoryReporting3">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Tp" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Dt" type="ISODate"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Ctry" type="CountryCode"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Cd" type="Max10Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Amt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="0" name="Inf" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="StructuredRemittanceInformation7">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="0" name="RfrdDocInf" type="ReferredDocumentInformation3"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RfrdDocAmt" type="RemittanceAmount1"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CdtrRefInf" type="CreditorReferenceInformation2"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Invcr" type="PartyIdentification32"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Invcee" type="PartyIdentification32"/>
|
||||||
|
<xs:element maxOccurs="3" minOccurs="0" name="AddtlRmtInf" type="Max140Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="TaxAmount1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Rate" type="PercentageRate"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TaxblBaseAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TtlAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="0" name="Dtls" type="TaxRecordDetails1"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="TaxAuthorisation1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Titl" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Nm" type="Max140Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="TaxInformation3">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Cdtr" type="TaxParty1"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Dbtr" type="TaxParty2"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="AdmstnZn" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RefNb" type="Max140Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Mtd" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TtlTaxblBaseAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TtlTaxAmt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Dt" type="ISODate"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="SeqNb" type="Number"/>
|
||||||
|
<xs:element maxOccurs="unbounded" minOccurs="0" name="Rcrd" type="TaxRecord1"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="TaxParty1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TaxId" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RegnId" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TaxTp" type="Max35Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="TaxParty2">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TaxId" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="RegnId" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TaxTp" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Authstn" type="TaxAuthorisation1"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="TaxPeriod1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Yr" type="ISODate"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Tp" type="TaxRecordPeriod1Code"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="FrToDt" type="DatePeriodDetails"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="TaxRecord1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Tp" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Ctgy" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CtgyDtls" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="DbtrSts" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="CertId" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="FrmsCd" type="Max35Text"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Prd" type="TaxPeriod1"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="TaxAmt" type="TaxAmount1"/>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="AddtlInf" type="Max140Text"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:complexType name="TaxRecordDetails1">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element maxOccurs="1" minOccurs="0" name="Prd" type="TaxPeriod1"/>
|
||||||
|
<xs:element name="Amt" type="ActiveOrHistoricCurrencyAndAmount"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
<xs:simpleType name="TaxRecordPeriod1Code">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="MM01"/>
|
||||||
|
<xs:enumeration value="MM02"/>
|
||||||
|
<xs:enumeration value="MM03"/>
|
||||||
|
<xs:enumeration value="MM04"/>
|
||||||
|
<xs:enumeration value="MM05"/>
|
||||||
|
<xs:enumeration value="MM06"/>
|
||||||
|
<xs:enumeration value="MM07"/>
|
||||||
|
<xs:enumeration value="MM08"/>
|
||||||
|
<xs:enumeration value="MM09"/>
|
||||||
|
<xs:enumeration value="MM10"/>
|
||||||
|
<xs:enumeration value="MM11"/>
|
||||||
|
<xs:enumeration value="MM12"/>
|
||||||
|
<xs:enumeration value="QTR1"/>
|
||||||
|
<xs:enumeration value="QTR2"/>
|
||||||
|
<xs:enumeration value="QTR3"/>
|
||||||
|
<xs:enumeration value="QTR4"/>
|
||||||
|
<xs:enumeration value="HLF1"/>
|
||||||
|
<xs:enumeration value="HLF2"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
<xs:simpleType name="TrueFalseIndicator">
|
||||||
|
<xs:restriction base="xs:boolean"/>
|
||||||
|
</xs:simpleType>
|
||||||
|
</xs:schema>
|
||||||
133
dev/resources/sepa/test.xml
Normal file
133
dev/resources/sepa/test.xml
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<CstmrDrctDbtInitn>
|
||||||
|
<GrpHdr>
|
||||||
|
<MsgId>PREL20171012/REF10</MsgId>
|
||||||
|
<CreDtTm>2017-10-12T00:08:30</CreDtTm>
|
||||||
|
<NbOfTxs>2</NbOfTxs>
|
||||||
|
<CtrlSum>734.4</CtrlSum>
|
||||||
|
<InitgPty>
|
||||||
|
<Nm>MyBigCompany</Nm>
|
||||||
|
<Id>
|
||||||
|
<PrvtId>
|
||||||
|
<Othr>
|
||||||
|
<Id>FR76AAAAA</Id>
|
||||||
|
</Othr>
|
||||||
|
</PrvtId>
|
||||||
|
</Id>
|
||||||
|
</InitgPty>
|
||||||
|
</GrpHdr>
|
||||||
|
<PmtInf>
|
||||||
|
<PmtInfId>PREL20171012/ID00010-T171001</PmtInfId>
|
||||||
|
<PmtMtd>DD</PmtMtd>
|
||||||
|
<NbOfTxs>2</NbOfTxs>
|
||||||
|
<CtrlSum>734.4</CtrlSum>
|
||||||
|
<PmtTpInf>
|
||||||
|
<SvcLvl>
|
||||||
|
<Cd>SEPA</Cd>
|
||||||
|
</SvcLvl>
|
||||||
|
<LclInstrm>
|
||||||
|
<Cd>CORE</Cd>
|
||||||
|
</LclInstrm>
|
||||||
|
<SeqTp>RCUR</SeqTp>
|
||||||
|
</PmtTpInf>
|
||||||
|
<ReqdColltnDt>2017-10-12</ReqdColltnDt>
|
||||||
|
<Cdtr>
|
||||||
|
<Nm>MyBigCompany</Nm>
|
||||||
|
<PstlAdr>
|
||||||
|
<Ctry>FR</Ctry>
|
||||||
|
<AdrLine>Address1</AdrLine>
|
||||||
|
<AdrLine>Address2</AdrLine>
|
||||||
|
</PstlAdr>
|
||||||
|
</Cdtr>
|
||||||
|
<CdtrAcct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>FR76123456</IBAN>
|
||||||
|
</Id>
|
||||||
|
</CdtrAcct>
|
||||||
|
<CdtrAgt>
|
||||||
|
<FinInstnId>
|
||||||
|
<BIC>BICABCDEF</BIC>
|
||||||
|
</FinInstnId>
|
||||||
|
</CdtrAgt>
|
||||||
|
<ChrgBr>SLEV</ChrgBr>
|
||||||
|
<CdtrSchmeId>
|
||||||
|
<Id>
|
||||||
|
<PrvtId>
|
||||||
|
<Othr>
|
||||||
|
<Id>FR76AAAAA</Id>
|
||||||
|
<SchmeNm>
|
||||||
|
<Prtry>SEPA</Prtry>
|
||||||
|
</SchmeNm>
|
||||||
|
</Othr>
|
||||||
|
</PrvtId>
|
||||||
|
</Id>
|
||||||
|
</CdtrSchmeId>
|
||||||
|
<DrctDbtTxInf>
|
||||||
|
<PmtId>
|
||||||
|
<EndToEndId>AS-FA1710-0416-000679</EndToEndId>
|
||||||
|
</PmtId>
|
||||||
|
<InstdAmt Ccy="EUR">540</InstdAmt>
|
||||||
|
<DrctDbtTx>
|
||||||
|
<MndtRltdInf>
|
||||||
|
<MndtId>RUM-CU1610-0001-3-1476058417</MndtId>
|
||||||
|
<DtOfSgntr>2016-10-10</DtOfSgntr>
|
||||||
|
<AmdmntInd>false</AmdmntInd>
|
||||||
|
</MndtRltdInf>
|
||||||
|
</DrctDbtTx>
|
||||||
|
<DbtrAgt>
|
||||||
|
<FinInstnId>
|
||||||
|
<BIC>BICXYZ</BIC>
|
||||||
|
</FinInstnId>
|
||||||
|
</DbtrAgt>
|
||||||
|
<Dbtr>
|
||||||
|
<Nm>CUSTOMER A</Nm>
|
||||||
|
<PstlAdr>
|
||||||
|
<Ctry>FR</Ctry>
|
||||||
|
<AdrLine>Mr abc</AdrLine>
|
||||||
|
</PstlAdr>
|
||||||
|
</Dbtr>
|
||||||
|
<DbtrAcct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>FR123456</IBAN>
|
||||||
|
</Id>
|
||||||
|
</DbtrAcct>
|
||||||
|
<RmtInf>
|
||||||
|
<Ustrd>FA1710-0416</Ustrd>
|
||||||
|
</RmtInf>
|
||||||
|
</DrctDbtTxInf>
|
||||||
|
<DrctDbtTxInf>
|
||||||
|
<PmtId>
|
||||||
|
<EndToEndId>AS-FA1710-0415-000683</EndToEndId>
|
||||||
|
</PmtId>
|
||||||
|
<InstdAmt Ccy="EUR">194.4</InstdAmt>
|
||||||
|
<DrctDbtTx>
|
||||||
|
<MndtRltdInf>
|
||||||
|
<MndtId>RUM-CU1709-0011-4-1506525346</MndtId>
|
||||||
|
<DtOfSgntr>2017-09-27</DtOfSgntr>
|
||||||
|
<AmdmntInd>false</AmdmntInd>
|
||||||
|
</MndtRltdInf>
|
||||||
|
</DrctDbtTx>
|
||||||
|
<DbtrAgt>
|
||||||
|
<FinInstnId>
|
||||||
|
<BIC>BICJKL</BIC>
|
||||||
|
</FinInstnId>
|
||||||
|
</DbtrAgt>
|
||||||
|
<Dbtr>
|
||||||
|
<Nm>CUSTOMER2</Nm>
|
||||||
|
<PstlAdr>
|
||||||
|
<Ctry>FR</Ctry>
|
||||||
|
</PstlAdr>
|
||||||
|
</Dbtr>
|
||||||
|
<DbtrAcct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>FR76123456</IBAN>
|
||||||
|
</Id>
|
||||||
|
</DbtrAcct>
|
||||||
|
<RmtInf>
|
||||||
|
<Ustrd>FA1710-0415</Ustrd>
|
||||||
|
</RmtInf>
|
||||||
|
</DrctDbtTxInf>
|
||||||
|
</PmtInf>
|
||||||
|
</CstmrDrctDbtInitn>
|
||||||
|
</Document>
|
||||||
2
dev/resources/sepa/text.txt
Normal file
2
dev/resources/sepa/text.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
To test a SEPA file:
|
||||||
|
http://www.mesfluxdepaiement.fr/testez-vos-fichiers-sepa
|
||||||
62
dev/setup/apache/virtualhost
Normal file
62
dev/setup/apache/virtualhost
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<VirtualHost *:80>
|
||||||
|
#php_admin_value sendmail_path "/usr/sbin/sendmail -t -i"
|
||||||
|
#php_admin_value mail.force_extra_parameters "-f postmaster@mydomain.com"
|
||||||
|
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com"
|
||||||
|
php_admin_value open_basedir /tmp/:/home/../htdocs
|
||||||
|
|
||||||
|
ServerName myvirtualalias
|
||||||
|
ServerAlias myvirtualalias
|
||||||
|
|
||||||
|
UseCanonicalName On
|
||||||
|
|
||||||
|
AddDefaultCharset UTF-8
|
||||||
|
|
||||||
|
DocumentRoot "/home/.../htdocs"
|
||||||
|
|
||||||
|
<Directory /home/.../htdocs/>
|
||||||
|
AllowOverride None
|
||||||
|
Options -Indexes -MultiViews +FollowSymLinks -ExecCGI
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Directory "/home/../htdocs/cache">
|
||||||
|
Deny from all
|
||||||
|
RemoveHandler .phtml .php .php3 .php4 .php5 .php6 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml
|
||||||
|
AddType application/x-httpd-php-source .phtml .php .php3 .php4 .php5 .php6 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
|
||||||
|
ErrorLog /var/log/apache2/myvirtualalias_error_log
|
||||||
|
TransferLog /var/log/apache2/myvirtualalias_access_log
|
||||||
|
|
||||||
|
# Compress returned resources of type php pages, text file export, css and javascript
|
||||||
|
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
|
||||||
|
|
||||||
|
AddType text/javascript .jgz
|
||||||
|
AddEncoding gzip .jgz
|
||||||
|
ExpiresActive On
|
||||||
|
ExpiresByType image/x-icon A2592000
|
||||||
|
ExpiresByType image/gif A2592000
|
||||||
|
ExpiresByType image/png A2592000
|
||||||
|
ExpiresByType image/jpeg A2592000
|
||||||
|
ExpiresByType text/css A2592000
|
||||||
|
ExpiresByType text/javascript A2592000
|
||||||
|
ExpiresByType application/x-javascript A2592000
|
||||||
|
ExpiresByType application/javascript A2592000
|
||||||
|
|
||||||
|
SSLEngine On
|
||||||
|
|
||||||
|
# A self-signed (snakeoil) certificate can be created by installing
|
||||||
|
# the ssl-cert package. See
|
||||||
|
# /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
|
||||||
|
|
||||||
|
#RewriteEngine on
|
||||||
|
#RewriteCond %{SERVER_PORT} ^80$
|
||||||
|
#RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]
|
||||||
|
|
||||||
|
</VirtualHost>
|
||||||
@ -126,21 +126,19 @@
|
|||||||
<rule ref="Generic.Metrics.CyclomaticComplexity">
|
<rule ref="Generic.Metrics.CyclomaticComplexity">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="complexity" value="120" />
|
<property name="complexity" value="120" />
|
||||||
<property name="absoluteComplexity" value="250" />
|
<property name="absoluteComplexity" value="300" />
|
||||||
</properties>
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
<rule ref="Generic.Metrics.NestingLevel">
|
<rule ref="Generic.Metrics.NestingLevel">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="nestingLevel" value="10" />
|
<property name="nestingLevel" value="12" />
|
||||||
<property name="absoluteNestingLevel" value="50" />
|
<property name="absoluteNestingLevel" value="50" />
|
||||||
</properties>
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
<rule ref="Generic.NamingConventions.ConstructorName" />
|
<rule ref="Generic.NamingConventions.ConstructorName" />
|
||||||
<!-- Check if we use PHP4 constructor instead of __construct() -->
|
<!-- Check if we use PHP4 constructor instead of __construct() -->
|
||||||
<rule ref="Generic.NamingConventions.ConstructorName.OldStyle">
|
<rule ref="Generic.NamingConventions.ConstructorName.OldStyle" />
|
||||||
<severity>0</severity>
|
|
||||||
</rule>
|
|
||||||
|
|
||||||
<rule ref="Generic.NamingConventions.UpperCaseConstantName" />
|
<rule ref="Generic.NamingConventions.UpperCaseConstantName" />
|
||||||
|
|
||||||
@ -156,8 +154,8 @@
|
|||||||
<!-- Warning when using @ before functions -->
|
<!-- Warning when using @ before functions -->
|
||||||
<!-- <rule ref="Generic.PHP.NoSilencedErrors" /> -->
|
<!-- <rule ref="Generic.PHP.NoSilencedErrors" /> -->
|
||||||
|
|
||||||
<!-- Say if null, true, false must be uppercase -->
|
<!-- Say if null, true, false must be uppercase (Rule 2.5 of PSR2 https://www.php-fig.org/psr/psr-2/) -->
|
||||||
<!-- <rule ref="Generic.PHP.UpperCaseConstant" /> -->
|
<rule ref="Generic.PHP.LowerCaseConstant" />
|
||||||
|
|
||||||
<rule ref="Generic.Strings.UnnecessaryStringConcat" />
|
<rule ref="Generic.Strings.UnnecessaryStringConcat" />
|
||||||
|
|
||||||
|
|||||||
@ -46,13 +46,20 @@ then
|
|||||||
then
|
then
|
||||||
aaupper="GR"
|
aaupper="GR"
|
||||||
fi
|
fi
|
||||||
|
if [ $bb = "EG" ]
|
||||||
|
then
|
||||||
|
aaupper="SA"
|
||||||
|
fi
|
||||||
|
|
||||||
bblower=`echo $dirshort | nawk -F"_" '{ print tolower($2) }'`
|
bblower=`echo $dirshort | nawk -F"_" '{ print tolower($2) }'`
|
||||||
|
|
||||||
|
echo "***** Process language "$aa"_"$bb
|
||||||
if [ "$aa" != "$bblower" -a "$dirshort" != "en_US" ]
|
if [ "$aa" != "$bblower" -a "$dirshort" != "en_US" ]
|
||||||
then
|
then
|
||||||
reflang="htdocs/langs/"$aa"_"$aaupper
|
reflang="htdocs/langs/"$aa"_"$aaupper
|
||||||
if [ -d $reflang -a $aa"_"$bb != $aa"_"$aaupper ]
|
if [ -d $reflang -a $aa"_"$bb != $aa"_"$aaupper ]
|
||||||
then
|
then
|
||||||
echo "***** Process language "$aa"_"$bb" - Search original into "$reflang
|
echo "***** Search original into "$reflang
|
||||||
echo $dirshort is an alternative language of $reflang
|
echo $dirshort is an alternative language of $reflang
|
||||||
echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
|
echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
|
||||||
./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
|
./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
|
||||||
|
|||||||
@ -1,7 +1,13 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
FROM=2016-01-01
|
if [ "x$1" = "x" ]; then
|
||||||
TO=2016-12-31
|
echo "Usage: $0 YEAR"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
FROM=$1-01-01
|
||||||
|
TO=$1-12-31
|
||||||
|
|
||||||
echo "git log --since $FROM --before $TO | grep ^Author | sort -u -f -i -b | wc -l"
|
echo "git log --since $FROM --before $TO | grep ^Author | sort -u -f -i -b | wc -l"
|
||||||
git log --since $FROM --before $TO | grep ^Author | sort -u -f -i -b | wc -l
|
git log --since $FROM --before $TO | grep ^Author | sort -u -f -i -b | wc -l
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
#/bin/bash
|
#/bin/bash
|
||||||
Releases=("3.8" "3.9" "4.0" "5.0", "develop")
|
Releases=("3.8" "3.9" "4.0" "5.0" "6.0" " 7.0" "develop")
|
||||||
Dates=("2010-01-01", "2011-01-01", "2012-01-01", "2013-01-01", "2014-01-01", "2015-01-01", "2016-07-01")
|
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")
|
||||||
let "counter = 1"
|
let "counter = 1"
|
||||||
|
|
||||||
for i in "${Releases[@]}"
|
for i in "${Releases[@]}"
|
||||||
do
|
do
|
||||||
|
echo "=== $counter git shortlog -s -n --after=${Dates[counter-1]} --before=${Dates[counter]}"
|
||||||
git shortlog -s -n --after=${Dates[counter-1]} --before=${Dates[counter]}
|
git shortlog -s -n --after=${Dates[counter-1]} --before=${Dates[counter]}
|
||||||
echo -n "Total $i: "
|
echo -n "Total $i: "
|
||||||
git log --pretty=oneline --after=${Dates[counter-1]} --before=${Dates[counter]} | wc -l
|
git log --pretty=oneline --after=${Dates[counter-1]} --before=${Dates[counter]} | wc -l
|
||||||
|
|||||||
@ -101,7 +101,7 @@ $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
|
|||||||
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
|
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
|
||||||
|
|
||||||
//set auto page breaks
|
//set auto page breaks
|
||||||
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
|
$pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM);
|
||||||
|
|
||||||
//set image scale factor
|
//set image scale factor
|
||||||
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
|
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
|
||||||
|
|||||||
@ -76,7 +76,7 @@ $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
|
|||||||
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
|
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
|
||||||
|
|
||||||
//set auto page breaks
|
//set auto page breaks
|
||||||
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
|
$pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM);
|
||||||
|
|
||||||
//set image scale factor
|
//set image scale factor
|
||||||
//$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
|
//$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
|
||||||
|
|||||||
@ -15,7 +15,7 @@ then
|
|||||||
echo "This push local files to transifex for project $project."
|
echo "This push local files to transifex for project $project."
|
||||||
echo "Note: If you push a language file (not source), file will be skipped if transifex file is newer."
|
echo "Note: If you push a language file (not source), file will be skipped if transifex file is newer."
|
||||||
echo " Using -f will overwrite translation but not memory."
|
echo " Using -f will overwrite translation but not memory."
|
||||||
echo "Usage: ./dev/translation/txpush.sh (source|xx_XX|all) [-r dolibarr.file] [-f] [--no-interactive]"
|
echo "Usage: ./dev/translation/txpush.sh (source|xx_XX|all) [-r ".$project.".file] [-f] [--no-interactive]"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
BIN
doc/images/dolibarr_screenshot1_1680x1050.png
Normal file
BIN
doc/images/dolibarr_screenshot1_1680x1050.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 255 KiB |
BIN
doc/images/dolibarr_screenshot4_1680x1050.png
Normal file
BIN
doc/images/dolibarr_screenshot4_1680x1050.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 171 KiB |
BIN
doc/images/dolibarr_screenshot5_1920x1080_a.jpg
Normal file
BIN
doc/images/dolibarr_screenshot5_1920x1080_a.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 223 KiB |
BIN
doc/images/dolibarr_screenshot5_1920x1080_b.jpg
Normal file
BIN
doc/images/dolibarr_screenshot5_1920x1080_b.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 124 KiB |
BIN
doc/images/dolibarr_screenshot9_1680x1050.png
Normal file
BIN
doc/images/dolibarr_screenshot9_1680x1050.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 200 KiB |
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2016-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -28,18 +28,14 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||||
|
|
||||||
// Langs
|
$langs->loadLangs(array("compta","bills","admin","accountancy","salaries"));
|
||||||
$langs->load("compta");
|
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("admin");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
$langs->load("salaries");
|
|
||||||
|
|
||||||
$mesg = '';
|
$mesg = '';
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
$cancel = GETPOST('cancel');
|
$cancel = GETPOST('cancel','alpha');
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$rowid = GETPOST('rowid', 'int');
|
$rowid = GETPOST('rowid', 'int');
|
||||||
|
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'accountingaccountlist'; // To manage different context of search
|
||||||
|
|
||||||
$search_account = GETPOST("search_account");
|
$search_account = GETPOST("search_account");
|
||||||
$search_label = GETPOST("search_label");
|
$search_label = GETPOST("search_label");
|
||||||
@ -53,12 +49,10 @@ if (! $user->rights->accounting->chartofaccount) accessforbidden();
|
|||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST('sortfield','alpha');
|
||||||
$sortorder = GETPOST("sortorder", 'sortorder');
|
$sortorder = GETPOST('sortorder','alpha');
|
||||||
$page = GETPOST("page", 'int');
|
$page = GETPOST('page','int');
|
||||||
if ($page == - 1) {
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
$page = 0;
|
|
||||||
}
|
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
@ -69,23 +63,21 @@ $arrayfields=array(
|
|||||||
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
|
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
|
||||||
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||||
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0),
|
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0),
|
||||||
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>0),
|
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
|
||||||
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0),
|
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
|
||||||
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
|
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
|
||||||
);
|
);
|
||||||
|
|
||||||
$accounting = new AccountingAccount($db);
|
$accounting = new AccountingAccount($db);
|
||||||
|
|
||||||
// Initialize technical object to manage context to save list fields
|
|
||||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'accountingaccountlist';
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction')) { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha')) { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
@ -107,14 +99,32 @@ if (empty($reshook))
|
|||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST('change_chart'))
|
if (GETPOST('change_chart','alpha'))
|
||||||
{
|
{
|
||||||
$chartofaccounts = GETPOST('chartofaccounts', 'int');
|
$chartofaccounts = GETPOST('chartofaccounts', 'int');
|
||||||
|
|
||||||
if (! empty($chartofaccounts)) {
|
if ($chartofaccounts > 0)
|
||||||
|
{
|
||||||
|
// Get language code for this $chartofaccounts
|
||||||
|
$sql ='SELECT code FROM '.MAIN_DB_PREFIX.'c_country as c, '.MAIN_DB_PREFIX.'accounting_system as a';
|
||||||
|
$sql.=' WHERE c.rowid = a.fk_country AND a.rowid = '.(int) $chartofaccounts;
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$country_code = $obj->code;
|
||||||
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
|
|
||||||
|
// Try to load sql file
|
||||||
|
if ($country_code)
|
||||||
|
{
|
||||||
|
$sqlfile = DOL_DOCUMENT_ROOT.'/install/mysql/data/llx_accounting_account_'.strtolower($country_code).'.sql';
|
||||||
|
$result = run_sql($sqlfile, 1, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
|
if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
|
||||||
$error ++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$error ++;
|
$error ++;
|
||||||
@ -161,11 +171,10 @@ $sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.acco
|
|||||||
$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
|
$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||||
// Dirty hack wainting that foreign key account_parent is an integer to be compared correctly with rowid
|
if ($db->type == 'pgsql') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent";
|
||||||
if ($db->type == 'pgsql') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = CAST(aa.account_parent AS INTEGER)";
|
else $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent";
|
||||||
else $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = CAST(aa.account_parent AS UNSIGNED)";
|
|
||||||
$sql .= " WHERE asy.rowid = " . $pcgver;
|
$sql .= " WHERE asy.rowid = " . $pcgver;
|
||||||
|
//print $sql;
|
||||||
if (strlen(trim($search_account))) $sql .= natural_search("aa.account_number", $search_account);
|
if (strlen(trim($search_account))) $sql .= natural_search("aa.account_number", $search_account);
|
||||||
if (strlen(trim($search_label))) $sql .= natural_search("aa.label", $search_label);
|
if (strlen(trim($search_label))) $sql .= natural_search("aa.label", $search_label);
|
||||||
if (strlen(trim($search_accountparent))) $sql .= natural_search("aa.account_parent", $search_accountparent);
|
if (strlen(trim($search_accountparent))) $sql .= natural_search("aa.account_parent", $search_accountparent);
|
||||||
@ -179,6 +188,11 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
{
|
{
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
$nbtotalofrecords = $db->num_rows($resql);
|
$nbtotalofrecords = $db->num_rows($resql);
|
||||||
|
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||||
|
{
|
||||||
|
$page = 0;
|
||||||
|
$offset = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
@ -190,13 +204,14 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
$params='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($search_account) $params.= '&search_account='.urlencode($search_account);
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
if ($search_label) $params.= '&search_label='.urlencode($search_label);
|
if ($search_account) $param.= '&search_account='.urlencode($search_account);
|
||||||
if ($search_accountparent) $params.= '&search_accountparent='.urlencode($search_accountparent);
|
if ($search_label) $param.= '&search_label='.urlencode($search_label);
|
||||||
if ($search_pcgtype) $params.= '&search_pcgtype='.urlencode($search_pcgtype);
|
if ($search_accountparent) $param.= '&search_accountparent='.urlencode($search_accountparent);
|
||||||
if ($search_pcgsubtype) $params.= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
|
if ($search_pcgtype) $param.= '&search_pcgtype='.urlencode($search_pcgtype);
|
||||||
|
if ($search_pcgsubtype) $param.= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
|
||||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||||
|
|
||||||
|
|
||||||
@ -210,33 +225,40 @@ if ($resql)
|
|||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||||
|
|
||||||
$htmlbuttonadd = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
|
$newcardbutton = '<a class="butActionNew" href="./card.php?action=create">' . $langs->trans("Addanaccount");
|
||||||
|
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
|
||||||
|
$newcardbutton.= '</a>';
|
||||||
|
|
||||||
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $htmlbuttonadd);
|
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit);
|
||||||
|
|
||||||
// Box to select active chart of account
|
// Box to select active chart of account
|
||||||
print $langs->trans("Selectchartofaccounts") . " : ";
|
print $langs->trans("Selectchartofaccounts") . " : ";
|
||||||
print '<select class="flat" name="chartofaccounts" id="chartofaccounts">';
|
print '<select class="flat" name="chartofaccounts" id="chartofaccounts">';
|
||||||
$sql = "SELECT rowid, pcg_version, label, active";
|
$sql = "SELECT a.rowid, a.pcg_version, a.label, a.active, c.code as country_code";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a";
|
||||||
$sql .= " WHERE active = 1";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON a.fk_country = c.rowid";
|
||||||
dol_syslog('accountancy/admin/account.php:: $sql=' . $sql);
|
$sql .= " WHERE a.active = 1";
|
||||||
|
dol_syslog('accountancy/admin/account.php $sql='.$sql);
|
||||||
|
print $sql;
|
||||||
$resqlchart = $db->query($sql);
|
$resqlchart = $db->query($sql);
|
||||||
if ($resqlchart) {
|
if ($resqlchart) {
|
||||||
$numbis = $db->num_rows($resqlchart);
|
$numbis = $db->num_rows($resqlchart);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ( $i < $numbis ) {
|
while ($i < $numbis) {
|
||||||
$row = $db->fetch_row($resqlchart);
|
$obj = $db->fetch_object($resqlchart);
|
||||||
|
|
||||||
print '<option value="' . $row[0] . '"';
|
print '<option value="' . $obj->rowid . '"';
|
||||||
print $pcgver == $row[0] ? ' selected' : '';
|
print ($pcgver == $obj->rowid) ? ' selected' : '';
|
||||||
print '>' . $row[1] . ' - ' . $row[2] . '</option>';
|
print '>' . $obj->pcg_version . ' - ' . $obj->label . ' - (' . $obj->country_code . ')</option>';
|
||||||
|
|
||||||
$i ++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
print "</select>";
|
print "</select>";
|
||||||
print '<input type="submit" class="button" name="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
print ajax_combobox("chartofaccounts");
|
||||||
|
print '<input type="submit" class="button" name="change_chart" tabindex="-1" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
@ -254,7 +276,7 @@ if ($resql)
|
|||||||
if (! empty($arrayfields['aa.pcg_type']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="' . $search_pcgtype . '"></td>';
|
if (! empty($arrayfields['aa.pcg_type']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="' . $search_pcgtype . '"></td>';
|
||||||
if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgsubtype" value="' . $search_pcgsubtype . '"></td>';
|
if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgsubtype" value="' . $search_pcgsubtype . '"></td>';
|
||||||
if (! empty($arrayfields['aa.active']['checked'])) print '<td class="liste_titre"> </td>';
|
if (! empty($arrayfields['aa.active']['checked'])) print '<td class="liste_titre"> </td>';
|
||||||
print '<td align="right" colspan="2" class="liste_titre">';
|
print '<td align="right" class="liste_titre">';
|
||||||
$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
||||||
print $searchpicto;
|
print $searchpicto;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -264,8 +286,8 @@ if ($resql)
|
|||||||
if (! empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"],"aa.account_number","",$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"],"aa.account_number","",$param,'',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"],"aa.label","",$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"],"aa.label","",$param,'',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"],"aa.account_parent", "", $param,'align="left"',$sortfield,$sortorder);
|
if (! empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"],"aa.account_parent", "", $param,'align="left"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'],$_SERVER["PHP_SELF"],'aa.pcg_type','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'],$_SERVER["PHP_SELF"],'aa.pcg_type','',$param,'',$sortfield,$sortorder,'',$arrayfields['aa.pcg_type']['help']);
|
||||||
if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'],$_SERVER["PHP_SELF"],'aa.pcg_subtype','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'],$_SERVER["PHP_SELF"],'aa.pcg_subtype','',$param,'',$sortfield,$sortorder,'',$arrayfields['aa.pcg_subtype']['help']);
|
||||||
if (! empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'],$_SERVER["PHP_SELF"],'aa.active','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'],$_SERVER["PHP_SELF"],'aa.active','',$param,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -288,7 +310,7 @@ if ($resql)
|
|||||||
if (! empty($arrayfields['aa.account_number']['checked']))
|
if (! empty($arrayfields['aa.account_number']['checked']))
|
||||||
{
|
{
|
||||||
print "<td>";
|
print "<td>";
|
||||||
print $accountstatic->getNomUrl(1);
|
print $accountstatic->getNomUrl(1, 0, 0, '', 0, 1);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -31,16 +31,15 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
|||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// Langs
|
$langs->loadLangs(array("bills","accountancy"));
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
|
|
||||||
$mesg = '';
|
$mesg = '';
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
$backtopage = GETPOST('backtopage');
|
$backtopage = GETPOST('backtopage','alpha');
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
|
$ref = GETPOST('ref', 'alpha');
|
||||||
$rowid = GETPOST('rowid', 'int');
|
$rowid = GETPOST('rowid', 'int');
|
||||||
$cancel = GETPOST('cancel');
|
$cancel = GETPOST('cancel','alpha');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
|
|
||||||
@ -52,7 +51,7 @@ $object = new AccountingAccount($db);
|
|||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel'))
|
if (GETPOST('cancel','alpha'))
|
||||||
{
|
{
|
||||||
$urltogo=$backtopage?$backtopage:dol_buildpath('/accountancy/admin/account.php',1);
|
$urltogo=$backtopage?$backtopage:dol_buildpath('/accountancy/admin/account.php',1);
|
||||||
header("Location: ".$urltogo);
|
header("Location: ".$urltogo);
|
||||||
@ -187,12 +186,10 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
$title = $langs->trans('AccountAccounting') ." - ". $langs->trans('Card');
|
|
||||||
$helpurl = '';
|
|
||||||
llxheader('', $title, $helpurl);
|
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
@ -200,6 +197,11 @@ $formaccounting = new FormAccounting($db);
|
|||||||
$accountsystem = new AccountancySystem($db);
|
$accountsystem = new AccountancySystem($db);
|
||||||
$accountsystem->fetch($conf->global->CHARTOFACCOUNTS);
|
$accountsystem->fetch($conf->global->CHARTOFACCOUNTS);
|
||||||
|
|
||||||
|
$title = $langs->trans('AccountAccounting') ." - ". $langs->trans('Card');
|
||||||
|
$helpurl = '';
|
||||||
|
llxheader('', $title, $helpurl);
|
||||||
|
|
||||||
|
|
||||||
// Create mode
|
// Create mode
|
||||||
if ($action == 'create') {
|
if ($action == 'create') {
|
||||||
print load_fiche_titre($langs->trans('NewAccountingAccount'));
|
print load_fiche_titre($langs->trans('NewAccountingAccount'));
|
||||||
@ -261,8 +263,10 @@ if ($action == 'create') {
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
} else if ($id) {
|
}
|
||||||
$result = $object->fetch($id);
|
else if ($id > 0 || $ref) {
|
||||||
|
|
||||||
|
$result = $object->fetch($id, $ref, 1);
|
||||||
|
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
dol_htmloutput_mesg($mesg);
|
dol_htmloutput_mesg($mesg);
|
||||||
@ -327,19 +331,20 @@ if ($action == 'create') {
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
} else {
|
} else {
|
||||||
// View mode
|
// View mode
|
||||||
$linkback = '<a href="../admin/account.php">' . $langs->trans("BackToChartofaccounts") . '</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php?restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>';
|
||||||
|
|
||||||
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
|
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), -1, 'billr');
|
||||||
|
|
||||||
|
dol_banner_tab($object, 'ref', $linkback, 1, 'account_number', 'ref');
|
||||||
|
|
||||||
|
|
||||||
|
print '<div class="fichecenter">';
|
||||||
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Account number
|
|
||||||
print '<tr><td class="titlefield">' . $langs->trans("AccountNumber") . '</td>';
|
|
||||||
print '<td>' . $object->account_number . '</td>';
|
|
||||||
print '<td align="right" width="25%">' . $linkback . '</td></tr>';
|
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<tr><td>' . $langs->trans("Label") . '</td>';
|
print '<tr><td class="titlefield">' . $langs->trans("Label") . '</td>';
|
||||||
print '<td colspan="2">' . $object->label . '</td></tr>';
|
print '<td colspan="2">' . $object->label . '</td></tr>';
|
||||||
|
|
||||||
// Account parent
|
// Account parent
|
||||||
@ -361,20 +366,10 @@ if ($action == 'create') {
|
|||||||
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
|
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
|
||||||
print '<td colspan="2">' . $object->pcg_subtype . '</td></tr>';
|
print '<td colspan="2">' . $object->pcg_subtype . '</td></tr>';
|
||||||
|
|
||||||
// Active
|
|
||||||
print '<tr><td>' . $langs->trans("Status") . '</td>';
|
|
||||||
print '<td colspan="2">';
|
|
||||||
print $object->getLibStatut(4);
|
|
||||||
/*if (empty($object->active)) {
|
|
||||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
|
||||||
} else {
|
|
||||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
|
||||||
}*/
|
|
||||||
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -397,7 +392,7 @@ if ($action == 'create') {
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db, $object->error, $object->errors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,13 +29,12 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
|||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$langs->load("bills");
|
$langs->loadLangs(array("bills","accountancy"));
|
||||||
$langs->load("accountancy");
|
|
||||||
|
|
||||||
$mesg = '';
|
$mesg = '';
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$rowid = GETPOST('rowid', 'int');
|
$rowid = GETPOST('rowid', 'int');
|
||||||
$cancel = GETPOST('cancel');
|
$cancel = GETPOST('cancel','alpha');
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
$cat_id = GETPOST('account_category');
|
$cat_id = GETPOST('account_category');
|
||||||
$selectcpt = GETPOST('cpt_bk', 'array');
|
$selectcpt = GETPOST('cpt_bk', 'array');
|
||||||
@ -53,6 +52,11 @@ if (empty($user->rights->accounting->chartofaccount))
|
|||||||
|
|
||||||
$accountingcategory = new AccountancyCategory($db);
|
$accountingcategory = new AccountancyCategory($db);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
// si ajout de comptes
|
// si ajout de comptes
|
||||||
if (! empty($selectcpt)) {
|
if (! empty($selectcpt)) {
|
||||||
$cpts = array ();
|
$cpts = array ();
|
||||||
@ -66,7 +70,7 @@ if (! empty($selectcpt)) {
|
|||||||
if ($return<0) {
|
if ($return<0) {
|
||||||
setEventMessages($langs->trans('errors'), $accountingcategory->errors, 'errors');
|
setEventMessages($langs->trans('errors'), $accountingcategory->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($action == 'delete') {
|
if ($action == 'delete') {
|
||||||
@ -83,12 +87,15 @@ if ($action == 'delete') {
|
|||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
|
|
||||||
llxheader('', $langs->trans('AccountAccounting'));
|
llxheader('', $langs->trans('AccountingCategory'));
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans('AccountingCategory'));
|
$linkback = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories_list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
|
print load_fiche_titre($langs->trans('AccountingCategory'), $linkback);
|
||||||
|
|
||||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
@ -97,13 +104,15 @@ print '<input type="hidden" name="action" value="display">';
|
|||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
// Category
|
|
||||||
print '<tr><td>' . $langs->trans("AccountingCategory") . '</td>';
|
// Select the category
|
||||||
|
print '<tr><td class="titlefield">' . $langs->trans("AccountingCategory") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 1);
|
$formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 1);
|
||||||
print '<input class="button" type="submit" value="' . $langs->trans("Select") . '">';
|
print '<input class="button" type="submit" value="' . $langs->trans("Select") . '">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Select the accounts
|
||||||
if (! empty($cat_id))
|
if (! empty($cat_id))
|
||||||
{
|
{
|
||||||
$return = $accountingcategory->getAccountsWithNoCategory($cat_id);
|
$return = $accountingcategory->getAccountsWithNoCategory($cat_id);
|
||||||
@ -112,12 +121,24 @@ if (! empty($cat_id))
|
|||||||
}
|
}
|
||||||
print '<tr><td>' . $langs->trans("AddAccountFromBookKeepingWithNoCategories") . '</td>';
|
print '<tr><td>' . $langs->trans("AddAccountFromBookKeepingWithNoCategories") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
|
|
||||||
|
$arraykeyvalue=array();
|
||||||
|
foreach($accountingcategory->lines_cptbk as $key => $val)
|
||||||
|
{
|
||||||
|
$arraykeyvalue[length_accountg($val->numero_compte)] = length_accountg($val->numero_compte) . ' (' . $val->label_compte . ($val->doc_ref?' '.$val->doc_ref:'').')';
|
||||||
|
}
|
||||||
|
|
||||||
if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) {
|
if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) {
|
||||||
print '<select class="flat minwidth200" size="' . count($obj) . '" name="cpt_bk[]" multiple>';
|
|
||||||
|
print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, null, null, "90%");
|
||||||
|
print '<br>';
|
||||||
|
/*print '<select class="flat minwidth200" size="8" name="cpt_bk[]" multiple>';
|
||||||
foreach ( $accountingcategory->lines_cptbk as $cpt ) {
|
foreach ( $accountingcategory->lines_cptbk as $cpt ) {
|
||||||
print '<option value="' . length_accountg($cpt->numero_compte) . '">' . length_accountg($cpt->numero_compte) . ' (' . $cpt->label_compte . ' ' . $cpt->doc_ref . ')</option>';
|
print '<option value="' . length_accountg($cpt->numero_compte) . '">' . length_accountg($cpt->numero_compte) . ' (' . $cpt->label_compte . ' ' . $cpt->doc_ref . ')</option>';
|
||||||
}
|
}
|
||||||
print '</select><br>';
|
print '</select><br>';
|
||||||
|
print ajax_combobox('cpt_bk');
|
||||||
|
*/
|
||||||
print '<input class="button" type="submit" id="" class="action-delete" value="' . $langs->trans("Add") . '"> ';
|
print '<input class="button" type="submit" id="" class="action-delete" value="' . $langs->trans("Add") . '"> ';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -139,7 +160,7 @@ if ($action == 'display' || $action == 'delete') {
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
if (! empty($cat_id)) {
|
if (! empty($cat_id)) {
|
||||||
$return = $accountingcategory->display($cat_id);
|
$return = $accountingcategory->display($cat_id); // This load ->lines_display
|
||||||
if ($return < 0) {
|
if ($return < 0) {
|
||||||
setEventMessages(null, $accountingcategory->errors, 'errors');
|
setEventMessages(null, $accountingcategory->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
|
||||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
|
||||||
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
|
||||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
|
||||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
|
||||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
|
|
||||||
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
|
||||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
|
||||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -41,18 +31,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||||
|
|
||||||
$langs->load("errors");
|
$langs->loadLangs(array("errors","admin","companies","resource","holiday","accountancy","hrm"));
|
||||||
$langs->load("admin");
|
|
||||||
$langs->load("main");
|
|
||||||
$langs->load("companies");
|
|
||||||
$langs->load("resource");
|
|
||||||
$langs->load("holiday");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
$langs->load("hrm");
|
|
||||||
|
|
||||||
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
$id=GETPOST('id','int');
|
$id=32;
|
||||||
$rowid=GETPOST('rowid','alpha');
|
$rowid=GETPOST('rowid','alpha');
|
||||||
$code=GETPOST('code','alpha');
|
$code=GETPOST('code','alpha');
|
||||||
|
|
||||||
@ -71,10 +54,10 @@ $listoffset=GETPOST('listoffset');
|
|||||||
$listlimit=GETPOST('listlimit')>0?GETPOST('listlimit'):1000;
|
$listlimit=GETPOST('listlimit')>0?GETPOST('listlimit'):1000;
|
||||||
$active = 1;
|
$active = 1;
|
||||||
|
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'aZ09comma');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'aZ09comma');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
$offset = $listlimit * $page ;
|
$offset = $listlimit * $page ;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
@ -100,7 +83,7 @@ $tablib[32]= "DictionaryAccountancyCategory";
|
|||||||
|
|
||||||
// Requests to extract data
|
// Requests to extract data
|
||||||
$tabsql=array();
|
$tabsql=array();
|
||||||
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
||||||
|
|
||||||
// Criteria to sort dictionaries
|
// Criteria to sort dictionaries
|
||||||
$tabsqlsort=array();
|
$tabsqlsort=array();
|
||||||
@ -108,15 +91,15 @@ $tabsqlsort[32]="position ASC";
|
|||||||
|
|
||||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||||
$tabfield=array();
|
$tabfield=array();
|
||||||
$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
|
$tabfield[32]= "code,label,range_account,category_type,formula,position,country";
|
||||||
|
|
||||||
// Nom des champs d'edition pour modification d'un enregistrement
|
// Nom des champs d'edition pour modification d'un enregistrement
|
||||||
$tabfieldvalue=array();
|
$tabfieldvalue=array();
|
||||||
$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country";
|
$tabfieldvalue[32]= "code,label,range_account,category_type,formula,position,country_id";
|
||||||
|
|
||||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||||
$tabfieldinsert=array();
|
$tabfieldinsert=array();
|
||||||
$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
|
$tabfieldinsert[32]= "code,label,range_account,category_type,formula,position,fk_country";
|
||||||
|
|
||||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||||
// Example: "" if id field is "rowid" and has autoincrement on
|
// Example: "" if id field is "rowid" and has autoincrement on
|
||||||
@ -130,7 +113,7 @@ $tabcond[32]= ! empty($conf->accounting->enabled);
|
|||||||
|
|
||||||
// List of help for fields
|
// List of help for fields
|
||||||
$tabhelp=array();
|
$tabhelp=array();
|
||||||
$tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode"));
|
$tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode"), 'category_type'=>$langs->trans("SetToYesIfGroupIsComputationOfOtherGroups"), 'formula'=>$langs->trans("EnterCalculationRuleIfPreviousFieldIsYes"));
|
||||||
|
|
||||||
// List of check for fields (NOT USED YET)
|
// List of check for fields (NOT USED YET)
|
||||||
$tabfieldcheck=array();
|
$tabfieldcheck=array();
|
||||||
@ -167,24 +150,17 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
$ok=1;
|
$ok=1;
|
||||||
foreach ($listfield as $f => $value)
|
foreach ($listfield as $f => $value)
|
||||||
{
|
{
|
||||||
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp','DictionaryAccountancysystem','DictionaryAccountancyCategory'))) continue; // For some pages, country is not mandatory
|
|
||||||
if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
|
|
||||||
if ($value == 'formula' && empty($_POST['formula'])) continue;
|
if ($value == 'formula' && empty($_POST['formula'])) continue;
|
||||||
if ((! isset($_POST[$value]) || $_POST[$value]=='')
|
if ($value == 'range_account' && empty($_POST['range_account'])) continue;
|
||||||
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy')) // Fields that are not mandatory
|
if ($value == 'country' || $value == 'country_id') continue;
|
||||||
&& (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10
|
if (! isset($_POST[$value]) || $_POST[$value]=='')
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
$ok=0;
|
$ok=0;
|
||||||
$fieldnamekey=$listfield[$f];
|
$fieldnamekey=$listfield[$f];
|
||||||
// We take translate key of field
|
// We take translate key of field
|
||||||
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
|
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
|
||||||
if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
|
|
||||||
if ($fieldnamekey == 'module') $fieldnamekey='Module';
|
|
||||||
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
|
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
|
||||||
if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
|
if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
|
||||||
if ($fieldnamekey == 'taux') $fieldnamekey = 'Rate';
|
|
||||||
if ($fieldnamekey == 'type') $fieldnamekey = 'Type';
|
if ($fieldnamekey == 'type') $fieldnamekey = 'Type';
|
||||||
if ($fieldnamekey == 'position') $fieldnamekey = 'Position';
|
if ($fieldnamekey == 'position') $fieldnamekey = 'Position';
|
||||||
if ($fieldnamekey == 'category_type') $fieldnamekey = 'Calculated';
|
if ($fieldnamekey == 'category_type') $fieldnamekey = 'Calculated';
|
||||||
@ -192,11 +168,6 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Other checks
|
|
||||||
if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"],array('system','systemauto'))) {
|
|
||||||
$ok=0;
|
|
||||||
setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors');
|
|
||||||
}
|
|
||||||
if (isset($_POST["code"]))
|
if (isset($_POST["code"]))
|
||||||
{
|
{
|
||||||
if ($_POST["code"]=='0')
|
if ($_POST["code"]=='0')
|
||||||
@ -204,23 +175,12 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
$ok=0;
|
$ok=0;
|
||||||
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
||||||
}
|
}
|
||||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
|
||||||
{
|
|
||||||
$ok = 0;
|
|
||||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
if (isset($_POST["country"]) && ($_POST["country"]=='0'))
|
if (! is_numeric(GETPOST('position','alpha')))
|
||||||
{
|
{
|
||||||
if (in_array($tablib[$id],array('DictionaryCompanyType','DictionaryHolidayTypes'))) // Field country is no mandatory for such dictionaries
|
$langs->loadLangs(array("errors"));
|
||||||
{
|
$ok=0;
|
||||||
$_POST["country"]='';
|
setEventMessages($langs->transnoentities('ErrorFieldMustBeANumeric', $langs->transnoentities("Position")), null, 'errors');
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$ok=0;
|
|
||||||
setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean some parameters
|
// Clean some parameters
|
||||||
@ -229,7 +189,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
|
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
|
||||||
|
|
||||||
// Si verif ok et action add, on ajoute la ligne
|
// Si verif ok et action add, on ajoute la ligne
|
||||||
if ($ok && GETPOST('actionadd'))
|
if ($ok && GETPOST('actionadd','alpha'))
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id])
|
if ($tabrowid[$id])
|
||||||
{
|
{
|
||||||
@ -250,26 +210,21 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
// Add new entry
|
// Add new entry
|
||||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||||
// List of fields
|
// List of fields
|
||||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert)) $sql.= $tabrowid[$id].",";
|
||||||
$sql.= $tabrowid[$id].",";
|
|
||||||
$sql.= $tabfieldinsert[$id];
|
$sql.= $tabfieldinsert[$id];
|
||||||
$sql.=",active)";
|
$sql.=",active)";
|
||||||
$sql.= " VALUES(";
|
$sql.= " VALUES(";
|
||||||
|
|
||||||
// List of values
|
// List of values
|
||||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert)) $sql.= $newid.",";
|
||||||
$sql.= $newid.",";
|
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach ($listfieldinsert as $f => $value)
|
foreach ($listfieldinsert as $f => $value)
|
||||||
{
|
{
|
||||||
if ($value == 'price' || preg_match('/^amount/i',$value) || $value == 'taux') {
|
if ($value == 'entity') {
|
||||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
|
||||||
}
|
|
||||||
else if ($value == 'entity') {
|
|
||||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||||
}
|
}
|
||||||
if ($i) $sql.=",";
|
if ($i) $sql.=",";
|
||||||
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
if ($_POST[$listfieldvalue[$i]] == '' && ! $listfieldvalue[$i] == 'formula') $sql.="null"; // For vat, we want/accept code = ''
|
||||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -310,15 +265,15 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($listfieldmodify as $field)
|
foreach ($listfieldmodify as $field)
|
||||||
{
|
{
|
||||||
if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') {
|
if ($field == 'fk_country' && $_POST['country'] > 0) {
|
||||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
$_POST[$listfieldvalue[$i]] = $_POST['country'];
|
||||||
}
|
}
|
||||||
else if ($field == 'entity') {
|
else if ($field == 'entity') {
|
||||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||||
}
|
}
|
||||||
if ($i) $sql.=",";
|
if ($i) $sql.=",";
|
||||||
$sql.= $field."=";
|
$sql.= $field."=";
|
||||||
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
if ($_POST[$listfieldvalue[$i]] == '' && ! $listfieldvalue[$i] == 'range_account') $sql.="null"; // For range_account, we want/accept code = ''
|
||||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -345,7 +300,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
|||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
|
||||||
|
|
||||||
dol_syslog("delete", LOG_DEBUG);
|
dol_syslog("delete", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -369,10 +324,10 @@ if ($action == $acts[0])
|
|||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
|
||||||
}
|
}
|
||||||
elseif ($code) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code = '".$db->escape($code)."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -389,10 +344,10 @@ if ($action == $acts[1])
|
|||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
|
||||||
}
|
}
|
||||||
elseif ($code) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code = '".$db->escape($code)."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -409,10 +364,10 @@ if ($action == 'activate_favorite')
|
|||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
|
||||||
}
|
}
|
||||||
elseif ($code) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".$code."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code = '".$db->escape($code)."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -429,10 +384,10 @@ if ($action == 'disable_favorite')
|
|||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
|
||||||
}
|
}
|
||||||
elseif ($code) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".$code."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code = '".$db->escape($code)."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -450,19 +405,20 @@ if ($action == 'disable_favorite')
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formadmin=new FormAdmin($db);
|
$formadmin=new FormAdmin($db);
|
||||||
|
|
||||||
llxHeader();
|
llxHeader('', $langs->trans('DictionaryAccountancyCategory'));
|
||||||
|
|
||||||
$titre=$langs->trans($tablib[$id]);
|
$titre=$langs->trans($tablib[$id]);
|
||||||
$linkback='';
|
$linkback='';
|
||||||
$titlepicto='title_setup';
|
$titlepicto='title_setup';
|
||||||
|
|
||||||
print load_fiche_titre($titre,$linkback,$titlepicto);
|
print load_fiche_titre($titre, $linkback, $titlepicto);
|
||||||
|
|
||||||
|
print $langs->trans("AccountingAccountGroupsDesc", $langs->transnoentitiesnoconv("ByPersonalizedAccountGroups")).'<br><br>';
|
||||||
|
|
||||||
// Confirmation de la suppression de la ligne
|
// Confirmation de la suppression de la ligne
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id.($search_country_id>0?'&search_country_id='.$search_country_id:''), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
||||||
}
|
}
|
||||||
//var_dump($elementList);
|
//var_dump($elementList);
|
||||||
|
|
||||||
@ -478,27 +434,12 @@ if ($id)
|
|||||||
{
|
{
|
||||||
if (preg_match('/ WHERE /',$sql)) $sql.= " AND ";
|
if (preg_match('/ WHERE /',$sql)) $sql.= " AND ";
|
||||||
else $sql.=" WHERE ";
|
else $sql.=" WHERE ";
|
||||||
$sql.= " c.rowid = ".$search_country_id;
|
$sql.= " (a.fk_country = ".$search_country_id." OR a.fk_country = 0)";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sortfield)
|
// If sort order is "country", we use country_code instead
|
||||||
{
|
if ($sortfield == 'country') $sortfield='country_code';
|
||||||
// If sort order is "country", we use country_code instead
|
$sql.=$db->order($sortfield,$sortorder);
|
||||||
if ($sortfield == 'country') $sortfield='country_code';
|
|
||||||
$sql.= " ORDER BY ".$sortfield;
|
|
||||||
if ($sortorder)
|
|
||||||
{
|
|
||||||
$sql.=" ".strtoupper($sortorder);
|
|
||||||
}
|
|
||||||
$sql.=", ";
|
|
||||||
// Clear the required sort criteria for the tabsqlsort to be able to force it with selected value
|
|
||||||
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i','',$tabsqlsort[$id]);
|
|
||||||
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.',/i','',$tabsqlsort[$id]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$sql.=" ORDER BY ";
|
|
||||||
}
|
|
||||||
$sql.=$tabsqlsort[$id];
|
|
||||||
$sql.=$db->plimit($listlimit+1,$offset);
|
$sql.=$db->plimit($listlimit+1,$offset);
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
@ -508,13 +449,13 @@ if ($id)
|
|||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
// Form to add a new line
|
// Form to add a new line
|
||||||
if ($tabname[$id])
|
if ($tabname[$id])
|
||||||
{
|
{
|
||||||
$alabelisused=0;
|
$alabelisused=0;
|
||||||
$var=false;
|
|
||||||
|
|
||||||
$fieldlist=explode(',',$tabfield[$id]);
|
$fieldlist=explode(',',$tabfield[$id]);
|
||||||
|
|
||||||
@ -536,18 +477,15 @@ if ($id)
|
|||||||
{
|
{
|
||||||
$valuetoshow=$langs->trans("Label");
|
$valuetoshow=$langs->trans("Label");
|
||||||
}
|
}
|
||||||
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; }
|
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments"); }
|
||||||
if ($fieldlist[$field]=='country') {
|
if ($fieldlist[$field]=='country') {
|
||||||
if (in_array('region_id',$fieldlist)) { print '<td> </td>'; continue; } // For region page, we do not show the country input
|
|
||||||
$valuetoshow=$langs->trans("Country");
|
$valuetoshow=$langs->trans("Country");
|
||||||
}
|
}
|
||||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $valuetoshow=''; }
|
|
||||||
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
|
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
|
||||||
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); }
|
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); }
|
||||||
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); }
|
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); }
|
||||||
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
|
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
|
||||||
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
|
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Comment"); }
|
||||||
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Direction"); }
|
|
||||||
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
||||||
|
|
||||||
if ($valuetoshow != '')
|
if ($valuetoshow != '')
|
||||||
@ -599,6 +537,7 @@ if ($id)
|
|||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
$colspan=count($fieldlist)+3;
|
$colspan=count($fieldlist)+3;
|
||||||
|
if ($id == 32) $colspan++;
|
||||||
|
|
||||||
print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
||||||
}
|
}
|
||||||
@ -610,15 +549,13 @@ if ($id)
|
|||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$var=true;
|
|
||||||
|
|
||||||
$param = '&id='.$id;
|
$param = '&id='.$id;
|
||||||
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
|
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
|
||||||
$paramwithsearch = $param;
|
$paramwithsearch = $param;
|
||||||
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
||||||
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
||||||
if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
|
if (GETPOST('from','alpha')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
|
||||||
|
|
||||||
// There is several pages
|
// There is several pages
|
||||||
if ($num > $listlimit)
|
if ($num > $listlimit)
|
||||||
{
|
{
|
||||||
@ -688,7 +625,6 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
|
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
|
||||||
{
|
{
|
||||||
$valuetoshow=$langs->trans("Label");
|
$valuetoshow=$langs->trans("Label");
|
||||||
if ($id != 25) $valuetoshow.="*";
|
|
||||||
}
|
}
|
||||||
if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); }
|
if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); }
|
||||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
||||||
@ -700,8 +636,7 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); }
|
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); }
|
||||||
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
|
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
|
||||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||||
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
|
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Comment"); }
|
||||||
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Direction"); }
|
|
||||||
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
||||||
// Affiche nom du champ
|
// Affiche nom du champ
|
||||||
if ($showfield)
|
if ($showfield)
|
||||||
@ -742,6 +677,7 @@ if ($id)
|
|||||||
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
|
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
|
||||||
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
print '<td></td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -759,17 +695,9 @@ if ($id)
|
|||||||
$showfield=1;
|
$showfield=1;
|
||||||
$align="left";
|
$align="left";
|
||||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||||
if ($value == 'type_template')
|
if ($value == 'category_type')
|
||||||
{
|
{
|
||||||
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
$valuetoshow = yn($valuetoshow);
|
||||||
}
|
|
||||||
if ($value == 'element')
|
|
||||||
{
|
|
||||||
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
|
||||||
}
|
|
||||||
else if ($value == 'source')
|
|
||||||
{
|
|
||||||
$valuetoshow = isset($sourceList[$valuetoshow])?$sourceList[$valuetoshow]:$valuetoshow;
|
|
||||||
}
|
}
|
||||||
else if ($valuetoshow=='all') {
|
else if ($valuetoshow=='all') {
|
||||||
$valuetoshow=$langs->trans('All');
|
$valuetoshow=$langs->trans('All');
|
||||||
@ -785,18 +713,12 @@ if ($id)
|
|||||||
$valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country);
|
$valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($fieldlist[$field]=='libelle_facture') {
|
|
||||||
$langs->load("bills");
|
|
||||||
$key=$langs->trans("PaymentCondition".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "PaymentCondition".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
|
||||||
$valuetoshow=nl2br($valuetoshow);
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') {
|
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') {
|
||||||
$key=$langs->trans("Country".strtoupper($obj->code));
|
$key=$langs->trans("Country".strtoupper($obj->code));
|
||||||
$valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
$valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||||
}
|
}
|
||||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_availability') {
|
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_availability') {
|
||||||
$langs->load("propal");
|
$langs->loadLangs(array("propal"));
|
||||||
$key=$langs->trans("AvailabilityType".strtoupper($obj->code));
|
$key=$langs->trans("AvailabilityType".strtoupper($obj->code));
|
||||||
$valuetoshow=($obj->code && $key != "AvailabilityType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
$valuetoshow=($obj->code && $key != "AvailabilityType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||||
}
|
}
|
||||||
@ -804,83 +726,11 @@ if ($id)
|
|||||||
$key=$langs->trans("Action".strtoupper($obj->code));
|
$key=$langs->trans("Action".strtoupper($obj->code));
|
||||||
$valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
$valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
||||||
}
|
}
|
||||||
else if (! empty($obj->code_iso) && $fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_currencies') {
|
|
||||||
$key=$langs->trans("Currency".strtoupper($obj->code_iso));
|
|
||||||
$valuetoshow=($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso)?$key:$obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_typent') {
|
|
||||||
$key=$langs->trans(strtoupper($obj->code));
|
|
||||||
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_prospectlevel') {
|
|
||||||
$key=$langs->trans(strtoupper($obj->code));
|
|
||||||
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_civility') {
|
|
||||||
$key=$langs->trans("Civility".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_type_contact') {
|
|
||||||
$langs->load('agenda');
|
|
||||||
$key=$langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_payment_term') {
|
|
||||||
$langs->load("bills");
|
|
||||||
$key=$langs->trans("PaymentConditionShort".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paiement') {
|
|
||||||
$langs->load("bills");
|
|
||||||
$key=$langs->trans("PaymentType".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_reason') {
|
|
||||||
$key=$langs->trans("DemandReasonType".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_method') {
|
|
||||||
$langs->load("orders");
|
|
||||||
$key=$langs->trans($obj->code);
|
|
||||||
$valuetoshow=($obj->code && $key != $obj->code)?$key:$obj->{$fieldlist[$field]};
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_shipment_mode') {
|
|
||||||
$langs->load("sendings");
|
|
||||||
$key=$langs->trans("SendingMethod".strtoupper($obj->code));
|
|
||||||
$valuetoshow=($obj->code && $key != "SendingMethod".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field] == 'libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paper_format')
|
|
||||||
{
|
|
||||||
$key = $langs->trans('PaperFormat'.strtoupper($obj->code));
|
|
||||||
$valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees')
|
|
||||||
{
|
|
||||||
$langs->load('trips');
|
|
||||||
$key = $langs->trans(strtoupper($obj->code));
|
|
||||||
$valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') {
|
else if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') {
|
||||||
$showfield=0;
|
$showfield=0;
|
||||||
}
|
}
|
||||||
else if ($fieldlist[$field]=='label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') {
|
|
||||||
$langs->load("products");
|
|
||||||
$valuetoshow=$langs->trans($obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='short_label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') {
|
|
||||||
$langs->load("products");
|
|
||||||
$valuetoshow = $langs->trans($obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
else if (in_array($fieldlist[$field],array('recuperableonly')))
|
|
||||||
{
|
|
||||||
$align="center";
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') {
|
|
||||||
$valuetoshow = length_accountg($valuetoshow);
|
|
||||||
}
|
|
||||||
|
|
||||||
$class='tddict';
|
$class='tddict';
|
||||||
if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto';
|
|
||||||
// Show value for field
|
// Show value for field
|
||||||
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
||||||
}
|
}
|
||||||
@ -891,14 +741,9 @@ if ($id)
|
|||||||
if (isset($obj->code))
|
if (isset($obj->code))
|
||||||
{
|
{
|
||||||
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $canbedisabled = 0; }
|
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $canbedisabled = 0; }
|
||||||
else if ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; }
|
|
||||||
else if ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) { $iserasable=0; }
|
|
||||||
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $canbedisabled=0; $canbedisabled = 0; }
|
|
||||||
$canbemodified=$iserasable;
|
$canbemodified=$iserasable;
|
||||||
if ($obj->code == 'RECEP') $canbemodified=1;
|
|
||||||
|
|
||||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
|
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
|
||||||
if ($param) $url .= '&'.$param;
|
if ($param) $url .= '&'.$param;
|
||||||
@ -909,10 +754,7 @@ if ($id)
|
|||||||
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO'))) print $langs->trans("AlwaysActive");
|
print $langs->trans("AlwaysActive");
|
||||||
else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) print $langs->trans("Deprecated");
|
|
||||||
else if (isset($obj->type) && in_array($obj->type, array('system')) && ! empty($obj->active) && $obj->code != 'AC_OTH') print $langs->trans("UsedOnlyWithTypeOption");
|
|
||||||
else print $langs->trans("AlwaysActive");
|
|
||||||
}
|
}
|
||||||
print "</td>";
|
print "</td>";
|
||||||
|
|
||||||
@ -931,14 +773,16 @@ if ($id)
|
|||||||
else print '<td> </td>';
|
else print '<td> </td>';
|
||||||
|
|
||||||
// Link to setup the group
|
// Link to setup the group
|
||||||
print '<td>';
|
print '<td class="center">';
|
||||||
if (empty($obj->formula))
|
if (empty($obj->formula))
|
||||||
{
|
{
|
||||||
print '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories.php?action=display&account_category='.$obj->rowid.'">'.$langs->trans("Setup").'</a>';
|
print '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories.php?action=display&save_lastsearch_values=1&account_category='.$obj->rowid.'">';
|
||||||
|
print $langs->trans("ListOfAccounts");
|
||||||
|
print '</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
|
||||||
}
|
}
|
||||||
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -948,6 +792,7 @@ if ($id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
@ -984,16 +829,17 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex
|
|||||||
{
|
{
|
||||||
if ($fieldlist[$field] == 'country')
|
if ($fieldlist[$field] == 'country')
|
||||||
{
|
{
|
||||||
if (in_array('region_id',$fieldlist))
|
|
||||||
{
|
|
||||||
print '<td>';
|
|
||||||
//print join(',',$fieldlist);
|
|
||||||
print '</td>';
|
|
||||||
continue;
|
|
||||||
} // For state page, we do not show the country input (we link to region, not country)
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$fieldname='country';
|
$fieldname='country';
|
||||||
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:$mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
if ($context == 'add')
|
||||||
|
{
|
||||||
|
$fieldname='country_id';
|
||||||
|
print $form->select_country(GETPOST('country_id','int'), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:$mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
elseif ($fieldlist[$field] == 'country_id')
|
elseif ($fieldlist[$field] == 'country_id')
|
||||||
@ -1006,130 +852,14 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($fieldlist[$field] == 'region')
|
elseif ($fieldlist[$field] == 'category_type') {
|
||||||
{
|
print '<td>';
|
||||||
print '<td>';
|
print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1);
|
||||||
$formcompany->select_region($region_id,'region');
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
elseif ($fieldlist[$field] == 'region_id')
|
|
||||||
{
|
|
||||||
$region_id = (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:0);
|
|
||||||
print '<td>';
|
|
||||||
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$region_id.'">';
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
elseif ($fieldlist[$field] == 'lang')
|
|
||||||
{
|
|
||||||
print '<td>';
|
|
||||||
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'lang');
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
// Le type de template
|
|
||||||
elseif ($fieldlist[$field] == 'type_template')
|
|
||||||
{
|
|
||||||
print '<td>';
|
|
||||||
print $form->selectarray('type_template', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
// Le type de l'element (pour les type de contact)
|
|
||||||
elseif ($fieldlist[$field] == 'element')
|
|
||||||
{
|
|
||||||
print '<td>';
|
|
||||||
print $form->selectarray('element', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
// La source de l'element (pour les type de contact)
|
|
||||||
elseif ($fieldlist[$field] == 'source')
|
|
||||||
{
|
|
||||||
print '<td>';
|
|
||||||
print $form->selectarray('source', $sourceList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm")
|
|
||||||
{
|
|
||||||
print '<td>';
|
|
||||||
print 'user<input type="hidden" name="type" value="user">';
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
|
|
||||||
if ($fieldlist[$field] == 'type_cdr') print '<td align="center">';
|
|
||||||
else print '<td>';
|
|
||||||
if ($fieldlist[$field] == 'type_cdr') {
|
|
||||||
print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
|
||||||
} else {
|
|
||||||
print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1);
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
elseif (in_array($fieldlist[$field],array('nbjour','decalage','taux','localtax1','localtax2'))) {
|
|
||||||
$align="left";
|
|
||||||
if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) $align="center"; // Fields aligned on right
|
|
||||||
print '<td align="'.$align.'">';
|
|
||||||
print '<input type="text" class="flat" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" size="3" name="'.$fieldlist[$field].'">';
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
|
|
||||||
print '<td><textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea></td>';
|
|
||||||
}
|
|
||||||
elseif (in_array($fieldlist[$field], array('content')))
|
|
||||||
{
|
|
||||||
if ($tabname == MAIN_DB_PREFIX.'c_email_templates')
|
|
||||||
{
|
|
||||||
print '<td colspan="4"></td></tr><tr class="pair nohover"><td colspan="5">'; // To create an artificial CR for the current tr we are on
|
|
||||||
}
|
|
||||||
else print '<td>';
|
|
||||||
if ($context != 'hide')
|
|
||||||
{
|
|
||||||
//print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
|
|
||||||
$okforextended=true;
|
|
||||||
if ($tabname == MAIN_DB_PREFIX.'c_email_templates' && empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended=false;
|
|
||||||
$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_5, '90%');
|
|
||||||
print $doleditor->Create(1);
|
|
||||||
}
|
|
||||||
else print ' ';
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) {
|
|
||||||
print '<td><input type="text" class="flat minwidth75" value="'.price((! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')).'" name="'.$fieldlist[$field].'"></td>';
|
|
||||||
}
|
|
||||||
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||||
print '<td><input type="text" class="flat minwidth100" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
|
print '<td><input type="text" class="flat minwidth100" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
|
||||||
}
|
}
|
||||||
elseif ($fieldlist[$field]=='unit') {
|
|
||||||
print '<td>';
|
|
||||||
$units = array(
|
|
||||||
'mm' => $langs->trans('SizeUnitmm'),
|
|
||||||
'cm' => $langs->trans('SizeUnitcm'),
|
|
||||||
'point' => $langs->trans('SizeUnitpoint'),
|
|
||||||
'inch' => $langs->trans('SizeUnitinch')
|
|
||||||
);
|
|
||||||
print $form->selectarray('unit', $units, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 0, 0, 0);
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
// Le type de taxe locale
|
|
||||||
elseif ($fieldlist[$field] == 'localtax1_type' || $fieldlist[$field] == 'localtax2_type')
|
|
||||||
{
|
|
||||||
print '<td align="center">';
|
|
||||||
print $form->selectarray($fieldlist[$field], $localtax_typeList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
elseif ($fieldlist[$field] == 'accountancy_code' || $fieldlist[$field] == 'accountancy_code_sell' || $fieldlist[$field] == 'accountancy_code_buy')
|
|
||||||
{
|
|
||||||
print '<td>';
|
|
||||||
if (! empty($conf->accounting->enabled))
|
|
||||||
{
|
|
||||||
$fieldname = $fieldlist[$field];
|
|
||||||
$accountancy_account = (! empty($obj->$fieldname) ? $obj->$fieldname : 0);
|
|
||||||
print $formaccounting->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$fieldname = $fieldlist[$field];
|
|
||||||
print '<input type="text" size="10" class="flat" value="'.(isset($obj->$fieldname)?$obj->$fieldname:'').'" name="'.$fieldlist[$field].'">';
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -1137,8 +867,7 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex
|
|||||||
if ($fieldlist[$field]=='code') $class='maxwidth100';
|
if ($fieldlist[$field]=='code') $class='maxwidth100';
|
||||||
if ($fieldlist[$field]=='position') $class='maxwidth50';
|
if ($fieldlist[$field]=='position') $class='maxwidth50';
|
||||||
if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent';
|
if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent';
|
||||||
if ($fieldlist[$field]=='tracking') $class='quatrevingtpercent';
|
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='category_type') $size='size="2" ';
|
||||||
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
|
|
||||||
print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,12 +34,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
|
|
||||||
$langs->load("compta");
|
$langs->loadLangs(array("compta","bills","admin","accountancy","salaries","loan"));
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("admin");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
$langs->load("salaries");
|
|
||||||
$langs->load("loan");
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (empty($user->rights->accounting->chartofaccount))
|
if (empty($user->rights->accounting->chartofaccount))
|
||||||
@ -77,7 +72,7 @@ $list_account = array (
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$accounting_mode = defined('ACCOUNTING_MODE') ? ACCOUNTING_MODE : 'RECETTES-DEPENSES';
|
$accounting_mode = empty($conf->global->ACCOUNTING_MODE) ? 'RECETTES-DEPENSES' : $conf->global->ACCOUNTING_MODE;
|
||||||
|
|
||||||
|
|
||||||
if (GETPOST('change_chart'))
|
if (GETPOST('change_chart'))
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
|
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -27,39 +28,51 @@
|
|||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
// Class
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php';
|
||||||
|
|
||||||
$langs->load("compta");
|
$langs->loadLangs(array("compta","bills","admin","accountancy"));
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("admin");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
|
|
||||||
// Security check
|
// Security access
|
||||||
if (empty($user->admin) && empty($user->rights->accounting->chartofaccount))
|
if (empty($user->rights->accounting->chartofaccount))
|
||||||
{
|
{
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
|
||||||
// Parameters ACCOUNTING_EXPORT_*
|
// Parameters ACCOUNTING_EXPORT_*
|
||||||
$main_option = array (
|
$main_option = array (
|
||||||
'ACCOUNTING_EXPORT_PREFIX_SPEC'
|
'ACCOUNTING_EXPORT_PREFIX_SPEC',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$configuration = AccountancyExport::getTypeConfig();
|
||||||
|
|
||||||
|
$listparam = $configuration[param];
|
||||||
|
|
||||||
|
$listformat = $configuration[format];
|
||||||
|
|
||||||
|
$listcr = $configuration[cr];
|
||||||
|
|
||||||
|
|
||||||
$model_option = array (
|
$model_option = array (
|
||||||
'ACCOUNTING_EXPORT_SEPARATORCSV',
|
'1' => array(
|
||||||
'ACCOUNTING_EXPORT_DATE'
|
'label' => 'ACCOUNTING_EXPORT_FORMAT',
|
||||||
/*
|
'param' => $listformat,
|
||||||
'ACCOUNTING_EXPORT_PIECE',
|
),
|
||||||
'ACCOUNTING_EXPORT_GLOBAL_ACCOUNT',
|
'2' => array(
|
||||||
'ACCOUNTING_EXPORT_LABEL',
|
'label' => 'ACCOUNTING_EXPORT_SEPARATORCSV',
|
||||||
'ACCOUNTING_EXPORT_AMOUNT',
|
'param' => '',
|
||||||
'ACCOUNTING_EXPORT_DEVISE'
|
),
|
||||||
*/
|
'3' => array(
|
||||||
|
'label' => 'ACCOUNTING_EXPORT_ENDLINE',
|
||||||
|
'param' => $listcr,
|
||||||
|
),
|
||||||
|
'4' => array(
|
||||||
|
'label' => 'ACCOUNTING_EXPORT_DATE',
|
||||||
|
'param' => '',
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -68,24 +81,15 @@ $model_option = array (
|
|||||||
if ($action == 'update') {
|
if ($action == 'update') {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$format = GETPOST('format', 'alpha');
|
$modelcsv = GETPOST('ACCOUNTING_EXPORT_MODELCSV', 'int');
|
||||||
$modelcsv = GETPOST('modelcsv', 'int');
|
|
||||||
|
|
||||||
if (! empty($format)) {
|
|
||||||
if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', $format, 'chaine', 0, '', $conf->entity)) {
|
|
||||||
$error ++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$error ++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($modelcsv)) {
|
if (! empty($modelcsv)) {
|
||||||
if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) {
|
if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) {
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
if ($modelcsv==AccountancyExport::$EXPORT_TYPE_QUADRATUS || $modelcsv==AccountancyExport::$EXPORT_TYPE_CIEL) {
|
//if ($modelcsv==AccountancyExport::$EXPORT_TYPE_QUADRATUS || $modelcsv==AccountancyExport::$EXPORT_TYPE_CIEL) {
|
||||||
dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', 'txt', 'chaine', 0, '', $conf->entity);
|
// dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', 'txt', 'chaine', 0, '', $conf->entity);
|
||||||
}
|
//}
|
||||||
} else {
|
} else {
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
@ -98,16 +102,22 @@ if ($action == 'update') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ( $model_option as $constname ) {
|
foreach ($listparam[$modelcsv] as $key => $value ) {
|
||||||
$constvalue = GETPOST($constname, 'alpha');
|
$constante = $key;
|
||||||
|
|
||||||
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
if (strpos($constante, 'ACCOUNTING')!==false) {
|
||||||
$error ++;
|
$constvalue = GETPOST($key, 'alpha');
|
||||||
}
|
if (! dolibarr_set_const($db, $constante, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||||
|
$error ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
// reload
|
||||||
|
$configuration = AccountancyExport::getTypeConfig();
|
||||||
|
$listparam = $configuration[param];
|
||||||
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
}
|
}
|
||||||
@ -121,19 +131,57 @@ llxHeader();
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
// $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
|
||||||
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
|
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
|
||||||
|
|
||||||
$head = admin_accounting_prepare_head();
|
print "\n".'<script type="text/javascript" language="javascript">'."\n";
|
||||||
|
print 'jQuery(document).ready(function () {'."\n";
|
||||||
|
print ' function initfields()'."\n";
|
||||||
|
print ' {'."\n";
|
||||||
|
foreach ($listparam as $key => $param) {
|
||||||
|
print ' if (jQuery("#ACCOUNTING_EXPORT_MODELCSV").val()=="'.$key.'")'."\n";
|
||||||
|
print ' {'."\n";
|
||||||
|
print ' //console.log("'.$param[label].'");'."\n";
|
||||||
|
if (empty($param[ACCOUNTING_EXPORT_FORMAT])) {
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$conf->global->ACCOUNTING_EXPORT_FORMAT.'");'."\n";
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").prop("disabled", true);'."\n";
|
||||||
|
} else {
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$param[ACCOUNTING_EXPORT_FORMAT].'");'."\n";
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").removeAttr("disabled");'."\n";
|
||||||
|
}
|
||||||
|
if (empty($param[ACCOUNTING_EXPORT_SEPARATORCSV])) {
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("");'."\n";
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").prop("disabled", true);'."\n";
|
||||||
|
} else {
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("'.$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV.'");'."\n";
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").removeAttr("disabled");'."\n";
|
||||||
|
}
|
||||||
|
if (empty($param[ACCOUNTING_EXPORT_ENDLINE])) {
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").prop("disabled", true);'."\n";
|
||||||
|
} else {
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").removeAttr("disabled");'."\n";
|
||||||
|
}
|
||||||
|
if (empty($param[ACCOUNTING_EXPORT_DATE])) {
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("");'."\n";
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_DATE").prop("disabled", true);'."\n";
|
||||||
|
} else {
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("'.$conf->global->ACCOUNTING_EXPORT_DATE.'");'."\n";
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_DATE").removeAttr("disabled");'."\n";
|
||||||
|
}
|
||||||
|
print ' }'."\n";
|
||||||
|
}
|
||||||
|
print ' }'."\n";
|
||||||
|
print ' initfields();'."\n";
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_MODELCSV").change(function() {'."\n";
|
||||||
|
print ' initfields();'."\n";
|
||||||
|
print ' });'."\n";
|
||||||
|
print '})'."\n";
|
||||||
|
print '</script>'."\n";
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
|
|
||||||
dol_fiche_head($head, 'export', $langs->trans("Configuration"), -1, 'cron');
|
|
||||||
|
|
||||||
$var = true;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Main Options
|
* Main Options
|
||||||
*/
|
*/
|
||||||
@ -143,7 +191,6 @@ print '<tr class="liste_titre">';
|
|||||||
print '<td colspan="3">' . $langs->trans('Options') . '</td>';
|
print '<td colspan="3">' . $langs->trans('Options') . '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$var = ! $var;
|
|
||||||
|
|
||||||
$num = count($main_option);
|
$num = count($main_option);
|
||||||
if ($num) {
|
if ($num) {
|
||||||
@ -157,7 +204,7 @@ if ($num) {
|
|||||||
|
|
||||||
// Value
|
// Value
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" size="20" name="' . $key . '" value="' . $conf->global->$key . '">';
|
print '<input type="text" size="20" id="'.$key.'" name="' . $key . '" value="' . $conf->global->$key . '">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -175,7 +222,6 @@ print '<tr class="liste_titre">';
|
|||||||
print '<td colspan="2">' . $langs->trans("Modelcsv") . '</td>';
|
print '<td colspan="2">' . $langs->trans("Modelcsv") . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$var = ! $var;
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td width="50%">' . $langs->trans("Selectmodelcsv") . '</td>';
|
print '<td width="50%">' . $langs->trans("Selectmodelcsv") . '</td>';
|
||||||
@ -186,7 +232,7 @@ if (! $conf->use_javascript_ajax) {
|
|||||||
} else {
|
} else {
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$listmodelcsv = AccountancyExport::getType();
|
$listmodelcsv = AccountancyExport::getType();
|
||||||
print $form->selectarray("modelcsv", $listmodelcsv, $conf->global->ACCOUNTING_EXPORT_MODELCSV, 0);
|
print $form->selectarray("ACCOUNTING_EXPORT_MODELCSV", $listmodelcsv, $conf->global->ACCOUNTING_EXPORT_MODELCSV, 0);
|
||||||
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
@ -206,47 +252,27 @@ if ($num2) {
|
|||||||
print '<td colspan="3">' . $langs->trans('OtherOptions') . '</td>';
|
print '<td colspan="3">' . $langs->trans('OtherOptions') . '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > AccountancyExport::$EXPORT_TYPE_NORMAL)
|
foreach ( $model_option as $key) {
|
||||||
{
|
|
||||||
print '<tr><td colspan="2" bgcolor="red"><b>' . $langs->trans('OptionsDeactivatedForThisExportModel') . '</b></td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print '<td width="50%">' . $langs->trans("Selectformat") . '</td>';
|
|
||||||
if (! $conf->use_javascript_ajax) {
|
|
||||||
print '<td class="nowrap">';
|
|
||||||
print $langs->trans("NotAvailableWhenAjaxDisabled");
|
|
||||||
print "</td>";
|
|
||||||
} else {
|
|
||||||
print '<td>';
|
|
||||||
$listformat = array (
|
|
||||||
'csv' => $langs->trans("csv"),
|
|
||||||
'txt' => $langs->trans("txt")
|
|
||||||
);
|
|
||||||
print $form->selectarray("format", $listformat, $conf->global->ACCOUNTING_EXPORT_FORMAT, 0);
|
|
||||||
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
print "</td></tr>";
|
|
||||||
|
|
||||||
foreach ( $model_option as $key ) {
|
|
||||||
print '<tr class="oddeven value">';
|
print '<tr class="oddeven value">';
|
||||||
|
|
||||||
// Param
|
// Param
|
||||||
$label = $langs->trans($key);
|
$label = $key[label];
|
||||||
print '<td width="50%">' . $label . '</td>';
|
print '<td width="50%">' . $langs->trans($label) . '</td>';
|
||||||
|
|
||||||
// Value
|
// Value
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" size="20" name="' . $key . '" value="' . $conf->global->$key . '">';
|
if (is_array($key[param])) {
|
||||||
|
print $form->selectarray($label, $key[param], $conf->global->$label, 0);
|
||||||
|
} else {
|
||||||
|
print '<input type="text" size="20" id="'. $label .'" name="' . $key[label] . '" value="' . $conf->global->$label . '">';
|
||||||
|
}
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
|
|
||||||
print '<div class="center"><input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '" name="button"></div>';
|
print '<div class="center"><input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '" name="button"></div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|||||||
@ -39,8 +39,7 @@ $pagenext = $page + 1;
|
|||||||
if (! $sortfield) $sortfield="f.rowid"; // Set here default search field
|
if (! $sortfield) $sortfield="f.rowid"; // Set here default search field
|
||||||
if (! $sortorder) $sortorder="ASC";
|
if (! $sortorder) $sortorder="ASC";
|
||||||
|
|
||||||
$langs->load("admin");
|
$langs->loadLangs(array("admin","compta"));
|
||||||
$langs->load("compta");
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
@ -95,19 +94,33 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
{
|
{
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
$nbtotalofrecords = $db->num_rows($result);
|
$nbtotalofrecords = $db->num_rows($result);
|
||||||
|
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||||
|
{
|
||||||
|
$page = 0;
|
||||||
|
$offset = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql.= $db->plimit($limit+1, $offset);
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result)
|
||||||
$var = false;
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
|
if (! empty($user->rights->accounting->fiscalyear))
|
||||||
|
{
|
||||||
|
$addbutton = '<a class="butAction" href="fiscalyear_card.php?action=create">' . $langs->trans("NewFiscalYear") . '</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$addbutton = '<a class="butActionRefused" href="#">' . $langs->trans("NewFiscalYear") . '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
$title = $langs->trans('AccountingPeriods');
|
$title = $langs->trans('AccountingPeriods');
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 1);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $addbutton, '', $limit, 1);
|
||||||
|
|
||||||
// Load attribute_label
|
// Load attribute_label
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
@ -132,8 +145,7 @@ if ($result) {
|
|||||||
print '<td align="left">' . dol_print_date($db->jdate($obj->date_end), 'day') . '</td>';
|
print '<td align="left">' . dol_print_date($db->jdate($obj->date_end), 'day') . '</td>';
|
||||||
print '<td align="right">' . $fiscalyearstatic->LibStatut($obj->statut, 5) . '</td>';
|
print '<td align="right">' . $fiscalyearstatic->LibStatut($obj->statut, 5) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$var = ! $var;
|
$i++;
|
||||||
$i ++;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<tr class="oddeven"><td colspan="5" class="opacitymedium">' . $langs->trans("None") . '</td></tr>';
|
print '<tr class="oddeven"><td colspan="5" class="opacitymedium">' . $langs->trans("None") . '</td></tr>';
|
||||||
@ -143,19 +155,6 @@ if ($result) {
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
|
|
||||||
// Buttons
|
|
||||||
print '<div class="tabsAction">';
|
|
||||||
if (! empty($user->rights->accounting->fiscalyear))
|
|
||||||
{
|
|
||||||
print '<a class="butAction" href="fiscalyear_card.php?action=create">' . $langs->trans("NewFiscalYear") . '</a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<a class="butActionRefused" href="#">' . $langs->trans("NewFiscalYear") . '</a>';
|
|
||||||
}
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
@ -20,13 +20,13 @@
|
|||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Page to show a fiscal year
|
* \brief Page to show a fiscal year
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/fiscalyear.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/fiscalyear.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php';
|
||||||
|
|
||||||
$langs->load("admin");
|
$langs->loadLangs(array("admin","compta"));
|
||||||
$langs->load("compta");
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
|
|||||||
@ -26,8 +26,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/fiscalyear.lib.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php';
|
||||||
|
|
||||||
$langs->load("admin");
|
$langs->loadLangs(array("admin","compta"));
|
||||||
$langs->load("compta");
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
|
|||||||
@ -24,16 +24,12 @@
|
|||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
// Class
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
|
|
||||||
// langs
|
// Load traductions files requiredby by page
|
||||||
$langs->load("compta");
|
$langs->loadLangs(array("compta","bills","accountancy"));
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("main");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (! $user->admin)
|
if (! $user->admin)
|
||||||
@ -141,7 +137,6 @@ if ($result) {
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
|
|
||||||
$var = true;
|
|
||||||
while ( $i < min($num_lines, $limit) ) {
|
while ( $i < min($num_lines, $limit) ) {
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
|
* Copyright (C) 2017 Laurent Destailleur <eldy@destailleur.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -19,7 +20,6 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,20 +27,15 @@
|
|||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Setup page to configure accounting expert module
|
* \brief Setup page to configure accounting expert module
|
||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
|
||||||
|
|
||||||
// Class
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
|
||||||
$langs->load("compta");
|
$langs->loadLangs(array("compta","bills","admin","accountancy"));
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("admin");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
$langs->load("salaries");
|
|
||||||
|
|
||||||
// Security check
|
// Security access
|
||||||
if (empty($user->admin))
|
if (empty($user->rights->accounting->chartofaccount))
|
||||||
{
|
{
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
@ -61,44 +56,28 @@ $list = array (
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$accounting_mode = defined('ACCOUNTING_MODE') ? ACCOUNTING_MODE : 'RECETTES-DEPENSES';
|
$accounting_mode = empty($conf->global->ACCOUNTING_MODE) ? 'RECETTES-DEPENSES' : $conf->global->ACCOUNTING_MODE;
|
||||||
|
|
||||||
if ($action == 'update') {
|
if ($action == 'update') {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$accounting_modes = array (
|
if (! $error)
|
||||||
'RECETTES-DEPENSES',
|
{
|
||||||
'CREANCES-DETTES'
|
foreach ($list as $constname)
|
||||||
);
|
{
|
||||||
|
$constvalue = GETPOST($constname, 'alpha');
|
||||||
|
|
||||||
$accounting_mode = GETPOST('accounting_mode', 'alpha');
|
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||||
|
$error++;
|
||||||
if (in_array($accounting_mode, $accounting_modes)) {
|
}
|
||||||
|
}
|
||||||
if (! dolibarr_set_const($db, 'ACCOUNTING_MODE', $accounting_mode, 'chaine', 0, '', $conf->entity)) {
|
if ($error) {
|
||||||
$error ++;
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$error ++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error) {
|
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($list as $constname)
|
|
||||||
{
|
|
||||||
$constvalue = GETPOST($constname, 'alpha');
|
|
||||||
|
|
||||||
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
|
||||||
$error ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
} else {
|
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,20 +139,15 @@ llxHeader();
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
//$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
|
||||||
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
|
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
|
||||||
|
|
||||||
$head = admin_accounting_prepare_head($accounting);
|
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
|
|
||||||
dol_fiche_head($head, 'general', $langs->trans("Configuration"), -1, 'cron');
|
|
||||||
|
|
||||||
|
|
||||||
// Default mode for calculating turnover (parameter ACCOUNTING_MODE)
|
// Default mode for calculating turnover (parameter ACCOUNTING_MODE)
|
||||||
|
/*
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -200,7 +174,7 @@ print "</table>\n";
|
|||||||
|
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
*/
|
||||||
|
|
||||||
// Others params
|
// Others params
|
||||||
|
|
||||||
@ -287,18 +261,11 @@ foreach ($list as $key)
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
|
|
||||||
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="button"></div>';
|
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="button"></div>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print '<div class="opacitymedium">'.$langs->trans("AccountancySetupDoneFromAccountancyMenu", $langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")).'</div>';
|
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
|||||||
@ -30,13 +30,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||||
|
|
||||||
$langs->load("admin");
|
$langs->loadLangs(array("admin","compta","accountancy"));
|
||||||
$langs->load("compta");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
|
|
||||||
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
$id=GETPOST('id','int');
|
$id=35;
|
||||||
$rowid=GETPOST('rowid','alpha');
|
$rowid=GETPOST('rowid','alpha');
|
||||||
$code=GETPOST('code','alpha');
|
$code=GETPOST('code','alpha');
|
||||||
|
|
||||||
@ -58,7 +56,7 @@ $active = 1;
|
|||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
$offset = $listlimit * $page ;
|
$offset = $listlimit * $page ;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
@ -128,13 +126,14 @@ complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,
|
|||||||
|
|
||||||
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
|
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
|
||||||
$elementList = array();
|
$elementList = array();
|
||||||
// Must match ids defined into eldy.lib.php
|
// Must match ids defined into eldy.lib.php
|
||||||
$sourceList = array(
|
$sourceList = array(
|
||||||
'1' => $langs->trans('AccountingJournalType1'),
|
'1' => $langs->trans('AccountingJournalType1'),
|
||||||
'2' => $langs->trans('AccountingJournalType2'),
|
'2' => $langs->trans('AccountingJournalType2'),
|
||||||
'3' => $langs->trans('AccountingJournalType3'),
|
'3' => $langs->trans('AccountingJournalType3'),
|
||||||
'4' => $langs->trans('AccountingJournalType4'),
|
'4' => $langs->trans('AccountingJournalType4'),
|
||||||
'5' => $langs->trans('AccountingJournalType5'),
|
'5' => $langs->trans('AccountingJournalType5'),
|
||||||
|
'8' => $langs->trans('AccountingJournalType8'),
|
||||||
'9' => $langs->trans('AccountingJournalType9')
|
'9' => $langs->trans('AccountingJournalType9')
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -144,216 +143,226 @@ $elementList = array();
|
|||||||
|
|
||||||
if (GETPOST('button_removefilter') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter_x'))
|
if (GETPOST('button_removefilter') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter_x'))
|
||||||
{
|
{
|
||||||
$search_country_id = '';
|
$search_country_id = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions add or modify an entry into a dictionary
|
// Actions add or modify an entry into a dictionary
|
||||||
if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||||
{
|
{
|
||||||
$listfield=explode(',', str_replace(' ', '',$tabfield[$id]));
|
$listfield=explode(',', str_replace(' ', '',$tabfield[$id]));
|
||||||
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
|
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
|
||||||
$listfieldmodify=explode(',',$tabfieldinsert[$id]);
|
$listfieldmodify=explode(',',$tabfieldinsert[$id]);
|
||||||
$listfieldvalue=explode(',',$tabfieldvalue[$id]);
|
$listfieldvalue=explode(',',$tabfieldvalue[$id]);
|
||||||
|
|
||||||
// Check that all fields are filled
|
// Check that all fields are filled
|
||||||
$ok=1;
|
$ok=1;
|
||||||
foreach ($listfield as $f => $value)
|
foreach ($listfield as $f => $value)
|
||||||
{
|
{
|
||||||
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
|
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
|
||||||
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
|
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
|
||||||
if ($fieldnamekey == 'nature') $fieldnamekey = 'Nature';
|
if ($fieldnamekey == 'nature') $fieldnamekey = 'Nature';
|
||||||
}
|
}
|
||||||
// Other checks
|
// Other checks
|
||||||
if (isset($_POST["code"]))
|
if (isset($_POST["code"]))
|
||||||
{
|
{
|
||||||
if ($_POST["code"]=='0')
|
if ($_POST["code"]=='0')
|
||||||
{
|
{
|
||||||
$ok=0;
|
$ok=0;
|
||||||
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
||||||
}
|
}
|
||||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||||
{
|
{
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
|
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
if (! GETPOST('label','alpha'))
|
||||||
|
{
|
||||||
|
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
|
||||||
|
$ok=0;
|
||||||
|
}
|
||||||
|
|
||||||
// Clean some parameters
|
// Clean some parameters
|
||||||
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null
|
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null
|
||||||
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null
|
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null
|
||||||
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
|
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
|
||||||
|
|
||||||
// Si verif ok et action add, on ajoute la ligne
|
// Si verif ok et action add, on ajoute la ligne
|
||||||
if ($ok && GETPOST('actionadd'))
|
if ($ok && GETPOST('actionadd'))
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id])
|
if ($tabrowid[$id])
|
||||||
{
|
{
|
||||||
// Recupere id libre pour insertion
|
// Recupere id libre pour insertion
|
||||||
$newid=0;
|
$newid=0;
|
||||||
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
|
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
$newid=($obj->newid + 1);
|
$newid=($obj->newid + 1);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add new entry
|
// Add new entry
|
||||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||||
// List of fields
|
// List of fields
|
||||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
||||||
$sql.= $tabrowid[$id].",";
|
$sql.= $tabrowid[$id].",";
|
||||||
$sql.= $tabfieldinsert[$id];
|
$sql.= $tabfieldinsert[$id];
|
||||||
$sql.=",active)";
|
$sql.=",active,entity)";
|
||||||
$sql.= " VALUES(";
|
$sql.= " VALUES(";
|
||||||
|
|
||||||
// List of values
|
// List of values
|
||||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
||||||
$sql.= $newid.",";
|
$sql.= $newid.",";
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach ($listfieldinsert as $f => $value)
|
foreach ($listfieldinsert as $f => $value)
|
||||||
{
|
{
|
||||||
if ($value == 'entity') {
|
if ($value == 'entity') {
|
||||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||||
}
|
}
|
||||||
if ($i) $sql.=",";
|
if ($i) $sql.=",";
|
||||||
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = ''
|
||||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$sql.=",1)";
|
$sql.=",1,".$conf->entity.")";
|
||||||
|
|
||||||
dol_syslog("actionadd", LOG_DEBUG);
|
dol_syslog("actionadd", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) // Add is ok
|
if ($result) // Add is ok
|
||||||
{
|
{
|
||||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||||
$_POST=array('id'=>$id); // Clean $_POST array, we keep only
|
$_POST=array('id'=>$id); // Clean $_POST array, we keep only
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||||
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
|
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si verif ok et action modify, on modifie la ligne
|
// Si verif ok et action modify, on modifie la ligne
|
||||||
if ($ok && GETPOST('actionmodify'))
|
if ($ok && GETPOST('actionmodify'))
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
// Modify entry
|
// Modify entry
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||||
// Modifie valeur des champs
|
// Modifie valeur des champs
|
||||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldmodify))
|
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldmodify))
|
||||||
{
|
{
|
||||||
$sql.= $tabrowid[$id]."=";
|
$sql.= $tabrowid[$id]."=";
|
||||||
$sql.= "'".$db->escape($rowid)."', ";
|
$sql.= "'".$db->escape($rowid)."', ";
|
||||||
}
|
}
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($listfieldmodify as $field)
|
foreach ($listfieldmodify as $field)
|
||||||
{
|
{
|
||||||
if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') {
|
if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') {
|
||||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
||||||
}
|
}
|
||||||
else if ($field == 'entity') {
|
else if ($field == 'entity') {
|
||||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||||
}
|
}
|
||||||
if ($i) $sql.=",";
|
if ($i) $sql.=",";
|
||||||
$sql.= $field."=";
|
$sql.= $field."=";
|
||||||
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
||||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
||||||
|
$sql.=" AND entity = ".$conf->entity;
|
||||||
|
|
||||||
dol_syslog("actionmodify", LOG_DEBUG);
|
dol_syslog("actionmodify", LOG_DEBUG);
|
||||||
//print $sql;
|
//print $sql;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
setEventMessages($db->error(), null, 'errors');
|
setEventMessages($db->error(), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST('actioncancel'))
|
if (GETPOST('actioncancel'))
|
||||||
{
|
{
|
||||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
|
||||||
|
$sql.=" AND entity = ".$conf->entity;
|
||||||
|
|
||||||
dol_syslog("delete", LOG_DEBUG);
|
dol_syslog("delete", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if (! $result)
|
if (! $result)
|
||||||
{
|
{
|
||||||
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
||||||
{
|
{
|
||||||
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
|
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// activate
|
// activate
|
||||||
if ($action == $acts[0])
|
if ($action == $acts[0])
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
}
|
||||||
elseif ($code) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'";
|
||||||
}
|
}
|
||||||
|
$sql.=" AND entity = ".$conf->entity;
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable
|
// disable
|
||||||
if ($action == $acts[1])
|
if ($action == $acts[1])
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
}
|
||||||
elseif ($code) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'";
|
||||||
}
|
}
|
||||||
|
$sql.=" AND entity = ".$conf->entity;
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if (!$result)
|
if (!$result)
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -367,8 +376,8 @@ $titre=$langs->trans("DictionarySetup");
|
|||||||
$linkback='';
|
$linkback='';
|
||||||
if ($id)
|
if ($id)
|
||||||
{
|
{
|
||||||
$titre.=' - '.$langs->trans($tablib[$id]);
|
$titre.=' - '.$langs->trans($tablib[$id]);
|
||||||
$titlepicto='title_accountancy';
|
$titlepicto='title_accountancy';
|
||||||
}
|
}
|
||||||
|
|
||||||
print load_fiche_titre($titre,$linkback,$titlepicto);
|
print load_fiche_titre($titre,$linkback,$titlepicto);
|
||||||
@ -377,7 +386,7 @@ print load_fiche_titre($titre,$linkback,$titlepicto);
|
|||||||
// Confirmation de la suppression de la ligne
|
// Confirmation de la suppression de la ligne
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
||||||
}
|
}
|
||||||
//var_dump($elementList);
|
//var_dump($elementList);
|
||||||
|
|
||||||
@ -386,313 +395,285 @@ if ($action == 'delete')
|
|||||||
*/
|
*/
|
||||||
if ($id)
|
if ($id)
|
||||||
{
|
{
|
||||||
// Complete requete recherche valeurs avec critere de tri
|
// Complete requete recherche valeurs avec critere de tri
|
||||||
$sql=$tabsql[$id];
|
$sql=$tabsql[$id];
|
||||||
|
$sql.= " WHERE a.entity = ".$conf->entity;
|
||||||
|
|
||||||
if ($search_country_id > 0)
|
// If sort order is "country", we use country_code instead
|
||||||
{
|
if ($sortfield == 'country') $sortfield='country_code';
|
||||||
if (preg_match('/ WHERE /',$sql)) $sql.= " AND ";
|
$sql.=$db->order($sortfield,$sortorder);
|
||||||
else $sql.=" WHERE ";
|
$sql.=$db->plimit($listlimit+1,$offset);
|
||||||
$sql.= " c.rowid = ".$search_country_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($sortfield)
|
$fieldlist=explode(',',$tabfield[$id]);
|
||||||
{
|
|
||||||
// If sort order is "country", we use country_code instead
|
|
||||||
if ($sortfield == 'country') $sortfield='country_code';
|
|
||||||
$sql.= " ORDER BY ".$sortfield;
|
|
||||||
if ($sortorder)
|
|
||||||
{
|
|
||||||
$sql.=" ".strtoupper($sortorder);
|
|
||||||
}
|
|
||||||
$sql.=", ";
|
|
||||||
// Clear the required sort criteria for the tabsqlsort to be able to force it with selected value
|
|
||||||
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i','',$tabsqlsort[$id]);
|
|
||||||
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.',/i','',$tabsqlsort[$id]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$sql.=" ORDER BY ";
|
|
||||||
}
|
|
||||||
$sql.=$tabsqlsort[$id];
|
|
||||||
$sql.=$db->plimit($listlimit+1,$offset);
|
|
||||||
//print $sql;
|
|
||||||
|
|
||||||
$fieldlist=explode(',',$tabfield[$id]);
|
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
||||||
|
|
||||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
// Form to add a new line
|
||||||
|
if ($tabname[$id])
|
||||||
|
{
|
||||||
|
$alabelisused=0;
|
||||||
|
|
||||||
// Form to add a new line
|
$fieldlist=explode(',',$tabfield[$id]);
|
||||||
if ($tabname[$id])
|
|
||||||
{
|
|
||||||
$alabelisused=0;
|
|
||||||
$var=false;
|
|
||||||
|
|
||||||
$fieldlist=explode(',',$tabfield[$id]);
|
// Line for title
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
foreach ($fieldlist as $field => $value)
|
||||||
|
{
|
||||||
|
// Determine le nom du champ par rapport aux noms possibles
|
||||||
|
// dans les dictionnaires de donnees
|
||||||
|
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
||||||
|
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||||
|
$align="left";
|
||||||
|
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
||||||
|
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
|
||||||
|
{
|
||||||
|
$valuetoshow=$langs->trans("Label");
|
||||||
|
}
|
||||||
|
if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); }
|
||||||
|
|
||||||
// Line for title
|
if ($valuetoshow != '')
|
||||||
print '<tr class="liste_titre">';
|
{
|
||||||
foreach ($fieldlist as $field => $value)
|
print '<td align="'.$align.'">';
|
||||||
{
|
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>';
|
||||||
// Determine le nom du champ par rapport aux noms possibles
|
else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
|
||||||
// dans les dictionnaires de donnees
|
else print $valuetoshow;
|
||||||
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
print '</td>';
|
||||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
}
|
||||||
$align="left";
|
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
||||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
}
|
||||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
|
|
||||||
{
|
|
||||||
$valuetoshow=$langs->trans("Label");
|
|
||||||
}
|
|
||||||
if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); }
|
|
||||||
|
|
||||||
if ($valuetoshow != '')
|
print '<td>';
|
||||||
{
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
print '<td align="'.$align.'">';
|
print '</td>';
|
||||||
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>';
|
print '<td style="min-width: 26px;"></td>';
|
||||||
else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
|
print '<td style="min-width: 26px;"></td>';
|
||||||
else print $valuetoshow;
|
print '<td style="min-width: 26px;"></td>';
|
||||||
print '</td>';
|
print '</tr>';
|
||||||
}
|
|
||||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<td>';
|
// Line to enter new values
|
||||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
print '<tr class="oddeven nodrag nodrap nohover">';
|
||||||
print '</td>';
|
|
||||||
print '<td style="min-width: 26px;"></td>';
|
|
||||||
print '<td style="min-width: 26px;"></td>';
|
|
||||||
print '<td style="min-width: 26px;"></td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
// Line to enter new values
|
$obj = new stdClass();
|
||||||
print '<tr class="oddeven nodrag nodrap nohover">';
|
// If data was already input, we define them in obj to populate input fields.
|
||||||
|
if (GETPOST('actionadd'))
|
||||||
|
{
|
||||||
|
foreach ($fieldlist as $key=>$val)
|
||||||
|
{
|
||||||
|
if (GETPOST($val) != '')
|
||||||
|
$obj->$val=GETPOST($val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$obj = new stdClass();
|
$tmpaction = 'create';
|
||||||
// If data was already input, we define them in obj to populate input fields.
|
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||||
if (GETPOST('actionadd'))
|
$reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||||
{
|
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||||
foreach ($fieldlist as $key=>$val)
|
|
||||||
{
|
|
||||||
if (GETPOST($val) != '')
|
|
||||||
$obj->$val=GETPOST($val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$tmpaction = 'create';
|
if (empty($reshook))
|
||||||
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
{
|
||||||
$reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
fieldListJournal($fieldlist,$obj,$tabname[$id],'add');
|
||||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
}
|
||||||
|
|
||||||
if (empty($reshook))
|
print '<td colspan="4" align="right">';
|
||||||
{
|
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
|
||||||
fieldList($fieldlist,$obj,$tabname[$id],'add');
|
print '</td>';
|
||||||
}
|
print "</tr>";
|
||||||
|
|
||||||
print '<td colspan="4" align="right">';
|
print '<tr><td colspan="7"> </td></tr>'; // Keep to have a line with enough height
|
||||||
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
|
}
|
||||||
print '</td>';
|
|
||||||
print "</tr>";
|
|
||||||
|
|
||||||
print '<tr><td colspan="7"> </td></tr>'; // Keep to have a line with enough height
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// List of available record in database
|
// List of available record in database
|
||||||
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
|
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$var=true;
|
|
||||||
|
|
||||||
$param = '&id='.$id;
|
$param = '&id='.$id;
|
||||||
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
|
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
|
||||||
$paramwithsearch = $param;
|
$paramwithsearch = $param;
|
||||||
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
||||||
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
||||||
if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
|
if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
|
||||||
|
|
||||||
// There is several pages
|
// There is several pages
|
||||||
if ($num > $listlimit)
|
if ($num > $listlimit)
|
||||||
{
|
{
|
||||||
print '<tr class="none"><td align="right" colspan="'.(3+count($fieldlist)).'">';
|
print '<tr class="none"><td align="right" colspan="'.(3+count($fieldlist)).'">';
|
||||||
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
|
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Title of lines
|
// Title line with search boxes
|
||||||
print '<tr class="liste_titre liste_titre_add">';
|
print '<tr class="liste_titre_filter liste_titre_add">';
|
||||||
foreach ($fieldlist as $field => $value)
|
print '<td class="liste_titre"></td>';
|
||||||
{
|
print '<td class="liste_titre"></td>';
|
||||||
// Determine le nom du champ par rapport aux noms possibles
|
print '<td class="liste_titre"></td>';
|
||||||
// dans les dictionnaires de donnees
|
print '<td class="liste_titre"></td>';
|
||||||
$showfield=1; // By defaut
|
print '<td class="liste_titre"></td>';
|
||||||
$align="left";
|
print '<td class="liste_titre"></td>';
|
||||||
$sortable=1;
|
print '<td class="liste_titre" align="center">';
|
||||||
$valuetoshow='';
|
if ($filterfound)
|
||||||
/*
|
{
|
||||||
|
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||||
|
print $searchpicto;
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Title of lines
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
foreach ($fieldlist as $field => $value)
|
||||||
|
{
|
||||||
|
// Determine le nom du champ par rapport aux noms possibles
|
||||||
|
// dans les dictionnaires de donnees
|
||||||
|
$showfield=1; // By defaut
|
||||||
|
$align="left";
|
||||||
|
$sortable=1;
|
||||||
|
$valuetoshow='';
|
||||||
|
/*
|
||||||
$tmparray=getLabelOfField($fieldlist[$field]);
|
$tmparray=getLabelOfField($fieldlist[$field]);
|
||||||
$showfield=$tmp['showfield'];
|
$showfield=$tmp['showfield'];
|
||||||
$valuetoshow=$tmp['valuetoshow'];
|
$valuetoshow=$tmp['valuetoshow'];
|
||||||
$align=$tmp['align'];
|
$align=$tmp['align'];
|
||||||
$sortable=$tmp['sortable'];
|
$sortable=$tmp['sortable'];
|
||||||
*/
|
*/
|
||||||
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut
|
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut
|
||||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
||||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
|
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
|
||||||
if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); }
|
if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); }
|
||||||
|
|
||||||
// Affiche nom du champ
|
// Affiche nom du champ
|
||||||
if ($showfield)
|
if ($showfield)
|
||||||
{
|
{
|
||||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
|
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder);
|
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print getTitleFieldOfList('');
|
print getTitleFieldOfList('');
|
||||||
print getTitleFieldOfList('');
|
print getTitleFieldOfList('');
|
||||||
print getTitleFieldOfList('');
|
print getTitleFieldOfList('');
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Title line with search boxes
|
if ($num)
|
||||||
print '<tr class="liste_titre_filter">';
|
{
|
||||||
print '<td class="liste_titre"></td>';
|
// Lines with values
|
||||||
print '<td class="liste_titre"></td>';
|
while ($i < $num)
|
||||||
print '<td class="liste_titre"></td>';
|
{
|
||||||
print '<td class="liste_titre"></td>';
|
$obj = $db->fetch_object($resql);
|
||||||
print '<td class="liste_titre"></td>';
|
//print_r($obj);
|
||||||
print '<td class="liste_titre"></td>';
|
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
||||||
print '<td class="liste_titre" align="center">';
|
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
|
||||||
if ($filterfound)
|
{
|
||||||
{
|
$tmpaction='edit';
|
||||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||||
print $searchpicto;
|
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||||
}
|
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
if ($num)
|
// Show fields
|
||||||
{
|
if (empty($reshook)) fieldListJournal($fieldlist,$obj,$tabname[$id],'edit');
|
||||||
// Lines with values
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($resql);
|
|
||||||
//print_r($obj);
|
|
||||||
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
|
||||||
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
|
|
||||||
{
|
|
||||||
$tmpaction='edit';
|
|
||||||
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
|
||||||
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
|
||||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
|
||||||
|
|
||||||
// Show fields
|
print '<td align="center" colspan="4">';
|
||||||
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit');
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
|
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||||
|
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||||
|
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||||
|
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$tmpaction = 'view';
|
||||||
|
$parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||||
|
$reshook=$hookmanager->executeHooks('viewDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
print '<td align="center" colspan="4">';
|
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
|
||||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
|
||||||
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
|
||||||
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
|
||||||
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$tmpaction = 'view';
|
|
||||||
$parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
|
||||||
$reshook=$hookmanager->executeHooks('viewDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
|
||||||
|
|
||||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
foreach ($fieldlist as $field => $value)
|
||||||
|
{
|
||||||
|
|
||||||
if (empty($reshook))
|
$showfield=1;
|
||||||
{
|
$align="left";
|
||||||
foreach ($fieldlist as $field => $value)
|
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||||
{
|
if ($valuetoshow=='all') {
|
||||||
|
$valuetoshow=$langs->trans('All');
|
||||||
|
}
|
||||||
|
else if ($fieldlist[$field]=='nature' && $tabname[$id]==MAIN_DB_PREFIX.'accounting_journal') {
|
||||||
|
$langs->loadLangs(array("accountancy"));
|
||||||
|
$key=$langs->trans("AccountingJournalType".strtoupper($obj->nature));
|
||||||
|
$valuetoshow=($obj->nature && $key != "AccountingJournalType".strtoupper($obj->nature)?$key:$obj->{$fieldlist[$field]});
|
||||||
|
}
|
||||||
|
|
||||||
$showfield=1;
|
$class='tddict';
|
||||||
$align="left";
|
|
||||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
|
||||||
if ($valuetoshow=='all') {
|
|
||||||
$valuetoshow=$langs->trans('All');
|
|
||||||
}
|
|
||||||
else if ($fieldlist[$field]=='nature' && $tabname[$id]==MAIN_DB_PREFIX.'accounting_journal') {
|
|
||||||
$langs->load("accountancy");
|
|
||||||
$key=$langs->trans("AccountingJournalType".strtoupper($obj->nature));
|
|
||||||
$valuetoshow=($obj->nature && $key != "AccountingJournalType".strtoupper($obj->nature)?$key:$obj->{$fieldlist[$field]});
|
|
||||||
}
|
|
||||||
|
|
||||||
$class='tddict';
|
|
||||||
// Show value for field
|
// Show value for field
|
||||||
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can an entry be erased or disabled ?
|
// Can an entry be erased or disabled ?
|
||||||
$iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default
|
$iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default
|
||||||
if (isset($obj->code) && $id != 10)
|
if (isset($obj->code) && $id != 10)
|
||||||
{
|
{
|
||||||
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $canbedisabled = 0; }
|
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $canbedisabled = 0; }
|
||||||
else if ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; }
|
else if ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; }
|
||||||
else if ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; }
|
else if ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
$canbemodified=$iserasable;
|
$canbemodified=$iserasable;
|
||||||
|
|
||||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
|
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
|
||||||
if ($param) $url .= '&'.$param;
|
if ($param) $url .= '&'.$param;
|
||||||
$url.='&';
|
$url.='&';
|
||||||
|
|
||||||
// Active
|
// Active
|
||||||
print '<td align="center" class="nowrap">';
|
print '<td align="center" class="nowrap">';
|
||||||
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
||||||
else
|
else print $langs->trans("AlwaysActive");
|
||||||
{
|
print "</td>";
|
||||||
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO'))) print $langs->trans("AlwaysActive");
|
|
||||||
else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) print $langs->trans("Deprecated");
|
|
||||||
else if (isset($obj->type) && in_array($obj->type, array('system')) && ! empty($obj->active) && $obj->code != 'AC_OTH') print $langs->trans("UsedOnlyWithTypeOption");
|
|
||||||
else print $langs->trans("AlwaysActive");
|
|
||||||
}
|
|
||||||
print "</td>";
|
|
||||||
|
|
||||||
// Modify link
|
// Modify link
|
||||||
if ($canbemodified) print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
|
if ($canbemodified) print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
|
||||||
else print '<td> </td>';
|
else print '<td> </td>';
|
||||||
|
|
||||||
// Delete link
|
// Delete link
|
||||||
if ($iserasable)
|
if ($iserasable)
|
||||||
{
|
{
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if ($user->admin) print '<a href="'.$url.'action=delete">'.img_delete().'</a>';
|
if ($user->admin) print '<a href="'.$url.'action=delete">'.img_delete().'</a>';
|
||||||
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
|
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
else print '<td> </td>';
|
else print '<td> </td>';
|
||||||
|
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -711,7 +692,7 @@ $db->close();
|
|||||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
function fieldListJournal($fieldlist, $obj='', $tabname='', $context='')
|
||||||
{
|
{
|
||||||
global $conf,$langs,$db;
|
global $conf,$langs,$db;
|
||||||
global $form, $mysoc;
|
global $form, $mysoc;
|
||||||
|
|||||||
@ -26,7 +26,6 @@
|
|||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
// Class
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
||||||
@ -35,12 +34,8 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||||
|
|
||||||
// Langs
|
// Load traductions files requiredby by page
|
||||||
$langs->load("companies");
|
$langs->loadLangs(array("companies","compta","accountancy","products"));
|
||||||
$langs->load("compta");
|
|
||||||
$langs->load("main");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
$langs->load("products");
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (empty($conf->accounting->enabled)) {
|
if (empty($conf->accounting->enabled)) {
|
||||||
@ -90,8 +85,8 @@ $arrayfields=array();
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
@ -136,17 +131,25 @@ if ($action == 'update') {
|
|||||||
$accounting = new AccountingAccount($db);
|
$accounting = new AccountingAccount($db);
|
||||||
|
|
||||||
//$msg .= '<div><span class="accountingprocessing">' . count($chk_prod) . ' ' . $langs->trans("SelectedLines") . '</span></div>';
|
//$msg .= '<div><span class="accountingprocessing">' . count($chk_prod) . ' ' . $langs->trans("SelectedLines") . '</span></div>';
|
||||||
|
$arrayofdifferentselectedvalues = array();
|
||||||
|
|
||||||
$cpt = 0; $ok = 0; $ko = 0;
|
$cpt = 0; $ok = 0; $ko = 0;
|
||||||
foreach ( $chk_prod as $productid ) {
|
foreach ( $chk_prod as $productid )
|
||||||
|
{
|
||||||
$accounting_account_id = GETPOST('codeventil_' . $productid);
|
$accounting_account_id = GETPOST('codeventil_' . $productid);
|
||||||
|
|
||||||
$result = $accounting->fetch($accounting_account_id, null, 1);
|
$result = 0;
|
||||||
if ($result < 0) {
|
if ($accounting_account_id > 0)
|
||||||
|
{
|
||||||
|
$arrayofdifferentselectedvalues[$accounting_account_id]=$accounting_account_id;
|
||||||
|
$result = $accounting->fetch($accounting_account_id, null, 1);
|
||||||
|
}
|
||||||
|
if ($result <= 0) {
|
||||||
// setEventMessages(null, $accounting->errors, 'errors');
|
// setEventMessages(null, $accounting->errors, 'errors');
|
||||||
$msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : id=' . $accounting_account_id . '<br/> <pre>' . $sql . '</pre></font></div>';
|
$msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : id=' . $accounting_account_id . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||||
|
$ko++;
|
||||||
} else {
|
} else {
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "product";
|
$sql = " UPDATE " . MAIN_DB_PREFIX . "product";
|
||||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||||
@ -158,23 +161,23 @@ if ($action == 'update') {
|
|||||||
$sql .= " WHERE rowid = " . $productid;
|
$sql .= " WHERE rowid = " . $productid;
|
||||||
|
|
||||||
dol_syslog("/accountancy/admin/productaccount.php sql=" . $sql, LOG_DEBUG);
|
dol_syslog("/accountancy/admin/productaccount.php sql=" . $sql, LOG_DEBUG);
|
||||||
if ($db->query($sql)) {
|
if ($db->query($sql))
|
||||||
|
{
|
||||||
$ok++;
|
$ok++;
|
||||||
//$msg .= '<div><font color="green">' . $langs->trans("Product") . ' ' . $productid . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accounting->account_number) . '</font></div>';
|
$db->commit();
|
||||||
} else {
|
} else {
|
||||||
$ko++;
|
$ko++;
|
||||||
//$msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accounting->account_number) . '<br/> <pre>' . $sql . '</pre></font></div>';
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$cpt ++;
|
$cpt++;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
//$msg .= '<div><span class="accountingprocessing">' . $langs->trans("AnyLineVentilate") . '</span></div>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ko) setEventMessages($langs->trans("XLineFailedToBeBinded", $ko), null, 'errors');
|
if ($ko) setEventMessages($langs->trans("XLineFailedToBeBinded", $ko), null, 'errors');
|
||||||
if ($ok) setEventMessages($langs->trans("XLineSuccessfullyBinded", $ok), null, 'mesgs');
|
if ($ok) setEventMessages($langs->trans("XLineSuccessfullyBinded", $ok), null, 'mesgs');
|
||||||
//$msg .= '<div><span class="accountingprocessing">' . $langs->trans("EndProcessing") . '</span></div>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,7 +256,13 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
{
|
{
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
$nbtotalofrecords = $db->num_rows($result);
|
$nbtotalofrecords = $db->num_rows($result);
|
||||||
|
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||||
|
{
|
||||||
|
$page = 0;
|
||||||
|
$offset = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
dol_syslog("/accountancy/admin/productaccount.php:: sql=" . $sql, LOG_DEBUG);
|
dol_syslog("/accountancy/admin/productaccount.php:: sql=" . $sql, LOG_DEBUG);
|
||||||
@ -264,8 +273,8 @@ if ($result)
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||||
if ($search_ref > 0) $param.="&search_desc=".urlencode($search_ref);
|
if ($search_ref > 0) $param.="&search_desc=".urlencode($search_ref);
|
||||||
if ($search_label > 0) $param.="&search_desc=".urlencode($search_label);
|
if ($search_label > 0) $param.="&search_desc=".urlencode($search_label);
|
||||||
if ($search_desc > 0) $param.="&search_desc=".urlencode($search_desc);
|
if ($search_desc > 0) $param.="&search_desc=".urlencode($search_desc);
|
||||||
@ -292,10 +301,10 @@ if ($result)
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>' . $langs->trans('Options') . '</td><td>' . $langs->trans('Description') . '</td>';
|
print '<td>' . $langs->trans('Options') . '</td><td>' . $langs->trans('Description') . '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
print '<tr ' . $bc[false] . '><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL"' . ($accounting_product_mode != 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductSell') . '</td>';
|
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL"' . ($accounting_product_mode != 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductSell') . '</td>';
|
||||||
print '<td>'.$langs->trans('OptionModeProductSellDesc');
|
print '<td>'.$langs->trans('OptionModeProductSellDesc');
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
print '<tr ' . $bc[true] . '><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"' . ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductBuy') . '</td>';
|
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"' . ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductBuy') . '</td>';
|
||||||
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
|
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
@ -312,6 +321,7 @@ if ($result)
|
|||||||
$texte=$langs->trans("ListOfProductsServices");
|
$texte=$langs->trans("ListOfProductsServices");
|
||||||
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
|
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
|
||||||
|
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
@ -319,9 +329,9 @@ if ($result)
|
|||||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
// On sell
|
// On sell
|
||||||
print '<td class="liste_titre"></td>';
|
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') print '<td class="liste_titre"></td>';
|
||||||
// On buy
|
// On buy
|
||||||
print '<td class="liste_titre"></td>';
|
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') print '<td class="liste_titre"></td>';
|
||||||
// Current account
|
// Current account
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input type="text" class="flat" size="6" name="search_current_account" value="' . dol_escape_htmltag($search_current_account) . '">';
|
print '<input type="text" class="flat" size="6" name="search_current_account" value="' . dol_escape_htmltag($search_current_account) . '">';
|
||||||
@ -339,11 +349,9 @@ if ($result)
|
|||||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||||
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
|
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, 'align="center"', $sortfield, $sortorder);
|
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, 'align="center"', $sortfield, $sortorder);
|
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') $fieldtosortaccount="p.accountancy_code_buy";
|
||||||
$fieldtosortaccount="p.accountancy_code_buy";
|
|
||||||
}
|
|
||||||
else $fieldtosortaccount="p.accountancy_code_sell";
|
else $fieldtosortaccount="p.accountancy_code_sell";
|
||||||
print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("AssignDedicatedAccountingAccount");
|
print_liste_field_titre("AssignDedicatedAccountingAccount");
|
||||||
@ -353,7 +361,6 @@ if ($result)
|
|||||||
|
|
||||||
$product_static = new Product($db);
|
$product_static = new Product($db);
|
||||||
|
|
||||||
$var = true;
|
|
||||||
$i=0;
|
$i=0;
|
||||||
while ($i < min($num,$limit))
|
while ($i < min($num,$limit))
|
||||||
{
|
{
|
||||||
@ -401,9 +408,11 @@ if ($result)
|
|||||||
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>';
|
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td align="center">'.$product_static->getLibStatut(3, 0).'</td>';
|
if ($accounting_product_mode == 'ACCOUNTANCY_SELL')
|
||||||
|
print '<td align="center">'.$product_static->getLibStatut(3, 0).'</td>';
|
||||||
|
|
||||||
print '<td align="center">'.$product_static->getLibStatut(3, 1).'</td>';
|
if ($accounting_product_mode == 'ACCOUNTANCY_BUY')
|
||||||
|
print '<td align="center">'.$product_static->getLibStatut(3, 1).'</td>';
|
||||||
|
|
||||||
// Current accounting account
|
// Current accounting account
|
||||||
print '<td align="left">';
|
print '<td align="left">';
|
||||||
@ -448,6 +457,7 @@ if ($result)
|
|||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
// Example : Adding jquery code
|
// Example : Adding jquery code
|
||||||
print '<script type="text/javascript" language="javascript">
|
print '<script type="text/javascript" language="javascript">
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2016-2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
$langs->load("accountancy");
|
$langs->loadLangs(array("accountancy"));
|
||||||
|
|
||||||
$page = GETPOST("page");
|
$page = GETPOST("page");
|
||||||
$sortorder = GETPOST("sortorder");
|
$sortorder = GETPOST("sortorder");
|
||||||
@ -53,11 +53,11 @@ if ($search_accountancy_code_end == - 1) {
|
|||||||
$search_accountancy_code_end = '';
|
$search_accountancy_code_end = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST("button_export_csv_x") || GETPOST("button_export_csv.x") || GETPOST("button_export_csv")) {
|
if (GETPOST("exportcsv")) $action = 'export_csv';
|
||||||
$action = 'export_csv';
|
|
||||||
}
|
|
||||||
|
|
||||||
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||||
|
if (empty($page) || $page < 0) { $page = 0; }
|
||||||
|
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
|
|
||||||
@ -67,9 +67,29 @@ $formaccounting = new FormAccounting($db);
|
|||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
if (empty($search_date_start)) {
|
if (empty($search_date_start) && ! GETPOSTISSET('formfilteraction'))
|
||||||
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
{
|
||||||
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
||||||
|
$sql.= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
|
||||||
|
$sql.= $db->plimit(1);
|
||||||
|
$res = $db->query($sql);
|
||||||
|
if ($res->num_rows > 0) {
|
||||||
|
$fiscalYear = $db->fetch_object($res);
|
||||||
|
$search_date_start = strtotime($fiscalYear->date_start);
|
||||||
|
$search_date_end = strtotime($fiscalYear->date_end);
|
||||||
|
} else {
|
||||||
|
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||||
|
$year_start = dol_print_date(dol_now(), '%Y');
|
||||||
|
$year_end = $year_start + 1;
|
||||||
|
$month_end = $month_start - 1;
|
||||||
|
if ($month_end < 1)
|
||||||
|
{
|
||||||
|
$month_end = 12;
|
||||||
|
$year_end--;
|
||||||
|
}
|
||||||
|
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||||
|
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($sortorder == "")
|
if ($sortorder == "")
|
||||||
$sortorder = "ASC";
|
$sortorder = "ASC";
|
||||||
@ -106,6 +126,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
$search_accountancy_code_end = '';
|
$search_accountancy_code_end = '';
|
||||||
$search_date_start = '';
|
$search_date_start = '';
|
||||||
$search_date_end = '';
|
$search_date_end = '';
|
||||||
|
$filter = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -116,10 +137,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
if ($action == 'export_csv') {
|
if ($action == 'export_csv') {
|
||||||
|
|
||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == AccountancyExport::$EXPORT_TYPE_CEGID) $sep = ";"; // For CEGID, we force separator.
|
|
||||||
|
|
||||||
$journal = 'bookkepping';
|
|
||||||
|
|
||||||
|
$filename = 'balance';
|
||||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||||
|
|
||||||
$result = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
|
$result = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
|
||||||
@ -127,24 +146,26 @@ if ($action == 'export_csv') {
|
|||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($object->lines as $line) {
|
foreach ($object->lines as $line)
|
||||||
|
{
|
||||||
print length_accountg($line->numero_compte) . $sep;
|
print length_accountg($line->numero_compte) . $sep;
|
||||||
print $line->debit . $sep;
|
print $object->get_compte_desc($line->numero_compte) . $sep;
|
||||||
print $line->credit . $sep;
|
print price($line->debit) . $sep;
|
||||||
print $line->debit . $sep;
|
print price($line->credit) . $sep;
|
||||||
print $line->credit - $line->debit . $sep;
|
print price($line->credit - $line->debit) . $sep;
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
$title_page = $langs->trans("AccountBalance") . (($search_date_start || $search_date_end) ? ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end) : '');
|
$title_page = $langs->trans("AccountBalance");
|
||||||
|
|
||||||
llxHeader('', $title_page);
|
llxHeader('', $title_page);
|
||||||
|
|
||||||
// List
|
// List
|
||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
|
{
|
||||||
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
|
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
|
||||||
if ($nbtotalofrecords < 0) {
|
if ($nbtotalofrecords < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
@ -157,17 +178,24 @@ else {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||||
|
print '<input type="hidden" name="action" value="list">';
|
||||||
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
|
|
||||||
$button = '<input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . ' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
$button = '<input type="submit" name="exportcsv" class="butActionNew" value="' . $langs->trans("Export") . ' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
||||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $result, 'title_accountancy', 0, $button);
|
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $result, 'title_accountancy', 0, $button);
|
||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
|
|
||||||
$moreforfilter .= '<div class="divsearchfield">';
|
$moreforfilter .= '<div class="divsearchfield">';
|
||||||
$moreforfilter .= $langs->trans('DateStart') . ': ';
|
$moreforfilter .= $langs->trans('DateStart') . ': ';
|
||||||
$moreforfilter .= $form->select_date($search_date_start, 'date_start', 0, 0, 1, '', 1, 0, 1);
|
$moreforfilter .= $form->select_date($search_date_start?$search_date_start:-1, 'date_start', 0, 0, 1, '', 1, 0, 1);
|
||||||
$moreforfilter .= $langs->trans('DateEnd') . ': ';
|
$moreforfilter .= $langs->trans('DateEnd') . ': ';
|
||||||
$moreforfilter .= $form->select_date($search_date_end, 'date_end', 0, 0, 1, '', 1, 0, 1);
|
$moreforfilter .= $form->select_date($search_date_end?$search_date_end:-1, 'date_end', 0, 0, 1, '', 1, 0, 1);
|
||||||
$moreforfilter .= '</div>';
|
$moreforfilter .= '</div>';
|
||||||
|
|
||||||
if (! empty($moreforfilter)) {
|
if (! empty($moreforfilter)) {
|
||||||
@ -201,7 +229,7 @@ else {
|
|||||||
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
|
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Solde", $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
@ -211,7 +239,8 @@ else {
|
|||||||
$sous_total_credit = 0;
|
$sous_total_credit = 0;
|
||||||
$displayed_account = "";
|
$displayed_account = "";
|
||||||
|
|
||||||
foreach ($object->lines as $line) {
|
foreach ($object->lines as $line)
|
||||||
|
{
|
||||||
$link = '';
|
$link = '';
|
||||||
$total_debit += $line->debit;
|
$total_debit += $line->debit;
|
||||||
$total_credit += $line->credit;
|
$total_credit += $line->credit;
|
||||||
@ -223,8 +252,8 @@ else {
|
|||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
// Permet d'afficher le compte comptable
|
// Permet d'afficher le compte comptable
|
||||||
if ($root_account_description != $displayed_account) {
|
if (empty($displayed_account) || $root_account_description != $displayed_account)
|
||||||
|
{
|
||||||
// Affiche un Sous-Total par compte comptable
|
// Affiche un Sous-Total par compte comptable
|
||||||
if ($displayed_account != "") {
|
if ($displayed_account != "") {
|
||||||
print '<tr class="liste_total"><td align="right" colspan="2">' . $langs->trans("SubTotal") . ':</td><td class="nowrap" align="right">' . price($sous_total_debit) . '</td><td class="nowrap" align="right">' . price($sous_total_credit) . '</td><td class="nowrap" align="right">' . price($sous_total_credit - $sous_total_debit) . '</td>';
|
print '<tr class="liste_total"><td align="right" colspan="2">' . $langs->trans("SubTotal") . ':</td><td class="nowrap" align="right">' . price($sous_total_debit) . '</td><td class="nowrap" align="right">' . price($sous_total_credit) . '</td><td class="nowrap" align="right">' . price($sous_total_credit - $sous_total_debit) . '</td>';
|
||||||
@ -232,9 +261,9 @@ else {
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affiche le compte comptable en d<EFBFBD>but de ligne
|
// Affiche le compte comptable en debut de ligne
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td colspan="6" style="font-weight:bold; border-bottom: 1pt solid black;">' . $root_account_description . '</td>';
|
print '<td colspan="6" style="font-weight:bold; border-bottom: 1pt solid black;">' . $line->numero_compte . ($root_account_description ? ' - ' . $root_account_description : '') . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$displayed_account = $root_account_description;
|
$displayed_account = $root_account_description;
|
||||||
@ -271,4 +300,5 @@ else {
|
|||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
@ -26,16 +26,11 @@
|
|||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
// Class
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
|
||||||
// Langs
|
// Load traductions files requiredby by page
|
||||||
$langs->load("main");
|
$langs->loadLangs(array("bills","compta","accountancy","other"));
|
||||||
$langs->load("compta");
|
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("other");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
|
|
||||||
// Filter
|
// Filter
|
||||||
$year = GETPOST("year",'int');
|
$year = GETPOST("year",'int');
|
||||||
@ -75,8 +70,6 @@ if ($result) {
|
|||||||
|
|
||||||
$y = $year_current;
|
$y = $year_current;
|
||||||
|
|
||||||
$var = true;
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width=150>' . $langs->trans("Label") . '</td><td align="center">' . $langs->trans("JanuaryMin") . '</td><td align="center">' . $langs->trans("FebruaryMin") . '</td><td align="center">' . $langs->trans("MarchMin") . '</td><td align="center">' . $langs->trans("AprilMin") . '</td><td align="center">' . $langs->trans("MayMin") . '</td><td align="center">' . $langs->trans("JuneMin") . '</td><td align="center">' . $langs->trans("JulyMin") . '</td><td align="center">' . $langs->trans("AugustMin") . '</td><td align="center">' . $langs->trans("SeptemberMin") . '</td><td align="center">' . $langs->trans("OctoberMin") . '</td><td align="center">' . $langs->trans("NovemberMin") . '</td><td align="center">' . $langs->trans("DecemberMin") . '</td><td align="center"><b>Total</b></td></tr>';
|
print '<tr class="liste_titre"><td width=150>' . $langs->trans("Label") . '</td><td align="center">' . $langs->trans("JanuaryMin") . '</td><td align="center">' . $langs->trans("FebruaryMin") . '</td><td align="center">' . $langs->trans("MarchMin") . '</td><td align="center">' . $langs->trans("AprilMin") . '</td><td align="center">' . $langs->trans("MayMin") . '</td><td align="center">' . $langs->trans("JuneMin") . '</td><td align="center">' . $langs->trans("JulyMin") . '</td><td align="center">' . $langs->trans("AugustMin") . '</td><td align="center">' . $langs->trans("SeptemberMin") . '</td><td align="center">' . $langs->trans("OctoberMin") . '</td><td align="center">' . $langs->trans("NovemberMin") . '</td><td align="center">' . $langs->trans("DecemberMin") . '</td><td align="center"><b>Total</b></td></tr>';
|
||||||
|
|
||||||
@ -108,7 +101,7 @@ if ($resql) {
|
|||||||
|
|
||||||
$row = $db->fetch_row($resql);
|
$row = $db->fetch_row($resql);
|
||||||
|
|
||||||
print '<tr><td width="14%">' . length_accountg($row[0]) . '</td>';
|
print '<tr class="oddeven"><td width="14%">' . length_accountg($row[0]) . '</td>';
|
||||||
print '<td align="right" width="6.5%">' . price($row[1]) . '</td>';
|
print '<td align="right" width="6.5%">' . price($row[1]) . '</td>';
|
||||||
print '<td align="right" width="6.5%">' . price($row[2]) . '</td>';
|
print '<td align="right" width="6.5%">' . price($row[2]) . '</td>';
|
||||||
print '<td align="right" width="6.5%">' . price($row[3]) . '</td>';
|
print '<td align="right" width="6.5%">' . price($row[3]) . '</td>';
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -32,28 +32,30 @@ require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||||
|
|
||||||
$langs->load("accountancy");
|
$langs->loadLangs(array("accountancy", "bills", "compta"));
|
||||||
|
|
||||||
|
$action = GETPOST('action','aZ09');
|
||||||
|
|
||||||
|
$id = GETPOST('id', 'int'); // id of record
|
||||||
|
$mode = GETPOST('mode','aZ09'); // '' or 'tmp'
|
||||||
|
$piece_num = GETPOST("piece_num",'int'); // id of transaction (several lines share the same transaction id)
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$id = GETPOST('id', 'int');
|
|
||||||
if ($user->societe_id > 0) {
|
if ($user->societe_id > 0) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
$action = GETPOST('action','aZ09');
|
|
||||||
$mode = GETPOST('mode','aZ09'); // '' or 'tmp'
|
|
||||||
$piece_num = GETPOST("piece_num");
|
|
||||||
|
|
||||||
$mesg = '';
|
$mesg = '';
|
||||||
|
|
||||||
$account_number = GETPOST('account_number');
|
$account_number = GETPOST('account_number','alphanohtml');
|
||||||
$subledger_account = GETPOST('subledger_account');
|
$subledger_account = GETPOST('subledger_account','alphanohtml');
|
||||||
if ($subledger_account == - 1) {
|
if ($subledger_account == - 1) {
|
||||||
$subledger_account = null;
|
$subledger_account = null;
|
||||||
}
|
}
|
||||||
$label_compte = GETPOST('label_compte');
|
$label_compte = GETPOST('label_compte','alphanohtml');
|
||||||
$label_operation= GETPOST('label_operation');
|
$label_operation= GETPOST('label_operation','alphanohtml');
|
||||||
$debit = price2num(GETPOST('debit'));
|
$debit = price2num(GETPOST('debit','alpha'));
|
||||||
$credit = price2num(GETPOST('credit'));
|
$credit = price2num(GETPOST('credit','alpha'));
|
||||||
|
|
||||||
$save = GETPOST('save','alpha');
|
$save = GETPOST('save','alpha');
|
||||||
if (! empty($save)) $action = 'add';
|
if (! empty($save)) $action = 'add';
|
||||||
@ -72,53 +74,53 @@ if ($action == "confirm_update") {
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
|
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
||||||
$action='update';
|
$action='update';
|
||||||
|
}
|
||||||
|
if (empty($account_number) || $account_number == '-1')
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
|
||||||
|
$action='update';
|
||||||
}
|
}
|
||||||
if (empty($account_number) || $account_number == '-1')
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
|
|
||||||
$action='update';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$book = new BookKeeping($db);
|
$object = new BookKeeping($db);
|
||||||
|
|
||||||
$result = $book->fetch($id, null, $mode);
|
$result = $object->fetch($id, null, $mode);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
$book->numero_compte = $account_number;
|
$object->numero_compte = $account_number;
|
||||||
$book->subledger_account = $subledger_account;
|
$object->subledger_account = $subledger_account;
|
||||||
$book->label_compte = $label_compte;
|
$object->label_compte = $label_compte;
|
||||||
$book->label_operation= $label_operation;
|
$object->label_operation= $label_operation;
|
||||||
$book->debit = $debit;
|
$object->debit = $debit;
|
||||||
$book->credit = $credit;
|
$object->credit = $credit;
|
||||||
|
|
||||||
if (floatval($debit) != 0.0) {
|
if (floatval($debit) != 0.0) {
|
||||||
$book->montant = $debit;
|
$object->montant = $debit;
|
||||||
$book->sens = 'D';
|
$object->sens = 'D';
|
||||||
}
|
}
|
||||||
if (floatval($credit) != 0.0) {
|
if (floatval($credit) != 0.0) {
|
||||||
$book->montant = $credit;
|
$object->montant = $credit;
|
||||||
$book->sens = 'C';
|
$object->sens = 'C';
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $book->update($user, false, $mode);
|
$result = $object->update($user, false, $mode);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
if ($mode != '_tmp')
|
if ($mode != '_tmp')
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
|
|
||||||
$debit = 0;
|
$debit = 0;
|
||||||
$credit = 0;
|
$credit = 0;
|
||||||
|
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
@ -132,50 +134,50 @@ else if ($action == "add") {
|
|||||||
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0))
|
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
if (empty($account_number) || $account_number == '-1')
|
if (empty($account_number) || $account_number == '-1')
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
$book = new BookKeeping($db);
|
$object = new BookKeeping($db);
|
||||||
|
|
||||||
$book->numero_compte = $account_number;
|
$object->numero_compte = $account_number;
|
||||||
$book->subledger_account = $subledger_account;
|
$object->subledger_account = $subledger_account;
|
||||||
$book->label_compte = $label_compte;
|
$object->label_compte = $label_compte;
|
||||||
$book->label_operation= $label_operation;
|
$object->label_operation= $label_operation;
|
||||||
$book->debit = $debit;
|
$object->debit = $debit;
|
||||||
$book->credit = $credit;
|
$object->credit = $credit;
|
||||||
$book->doc_date = GETPOST('doc_date');
|
$object->doc_date = GETPOST('doc_date','alpha');
|
||||||
$book->doc_type = GETPOST('doc_type');
|
$object->doc_type = GETPOST('doc_type','alpha');
|
||||||
$book->piece_num = $piece_num;
|
$object->piece_num = $piece_num;
|
||||||
$book->doc_ref = GETPOST('doc_ref');
|
$object->doc_ref = GETPOST('doc_ref','alpha');
|
||||||
$book->code_journal = GETPOST('code_journal');
|
$object->code_journal = GETPOST('code_journal','alpha');
|
||||||
$book->fk_doc = GETPOST('fk_doc');
|
$object->fk_doc = GETPOST('fk_doc','alpha');
|
||||||
$book->fk_docdet = GETPOST('fk_docdet');
|
$object->fk_docdet = GETPOST('fk_docdet','alpha');
|
||||||
|
|
||||||
if (floatval($debit) != 0.0) {
|
if (floatval($debit) != 0.0) {
|
||||||
$book->montant = $debit;
|
$object->montant = $debit;
|
||||||
$book->sens = 'D';
|
$object->sens = 'D';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (floatval($credit) != 0.0) {
|
if (floatval($credit) != 0.0) {
|
||||||
$book->montant = $credit;
|
$object->montant = $credit;
|
||||||
$book->sens = 'C';
|
$object->sens = 'C';
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $book->createStd($user, false, $mode);
|
$result = $object->createStd($user, false, $mode);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
if ($mode != '_tmp')
|
if ($mode != '_tmp')
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
|
|
||||||
$debit = 0;
|
$debit = 0;
|
||||||
@ -187,17 +189,17 @@ else if ($action == "add") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == "confirm_delete") {
|
else if ($action == "confirm_delete") {
|
||||||
$book = new BookKeeping($db);
|
$object = new BookKeeping($db);
|
||||||
|
|
||||||
$result = $book->fetch($id, null, $mode);
|
$result = $object->fetch($id, null, $mode);
|
||||||
$piece_num = $book->piece_num;
|
$piece_num = $object->piece_num;
|
||||||
|
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
$result = $book->delete($user, false, $mode);
|
$result = $object->delete($user, false, $mode);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$action = '';
|
$action = '';
|
||||||
@ -206,12 +208,12 @@ else if ($action == "confirm_delete") {
|
|||||||
else if ($action == "confirm_create") {
|
else if ($action == "confirm_create") {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$book = new BookKeeping($db);
|
$object = new BookKeeping($db);
|
||||||
|
|
||||||
if (! GETPOST('code_journal') || GETPOST('code_journal') == '-1') {
|
if (! GETPOST('code_journal','alpha') || GETPOST('code_journal','alpha') == '-1') {
|
||||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors');
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors');
|
||||||
$action='create';
|
$action='create';
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (! GETPOST('next_num_mvt'))
|
if (! GETPOST('next_num_mvt'))
|
||||||
{
|
{
|
||||||
@ -221,29 +223,29 @@ else if ($action == "confirm_create") {
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$book->label_compte = '';
|
$object->label_compte = '';
|
||||||
$book->debit = 0;
|
$object->debit = 0;
|
||||||
$book->credit = 0;
|
$object->credit = 0;
|
||||||
$book->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth'), GETPOST('doc_dateday'), GETPOST('doc_dateyear'));
|
$object->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth','int'), GETPOST('doc_dateday','int'), GETPOST('doc_dateyear','int'));
|
||||||
$book->doc_type = GETPOST('doc_type');
|
$object->doc_type = GETPOST('doc_type','alpha');
|
||||||
$book->piece_num = GETPOST('next_num_mvt');
|
$object->piece_num = GETPOST('next_num_mvt','alpha');
|
||||||
$book->doc_ref = GETPOST('doc_ref');
|
$object->doc_ref = GETPOST('doc_ref','alpha');
|
||||||
$book->code_journal = GETPOST('code_journal');
|
$object->code_journal = GETPOST('code_journal','alpha');
|
||||||
$book->fk_doc = 0;
|
$object->fk_doc = 0;
|
||||||
$book->fk_docdet = 0;
|
$object->fk_docdet = 0;
|
||||||
$book->montant = 0;
|
$object->montant = 0;
|
||||||
|
|
||||||
$result = $book->createStd($user,0, $mode);
|
$result = $object->createStd($user,0, $mode);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
if ($mode != '_tmp')
|
if ($mode != '_tmp')
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
$action = 'update';
|
$action = 'update';
|
||||||
$id=$book->id;
|
$id=$object->id;
|
||||||
$piece_num = $book->piece_num;
|
$piece_num = $object->piece_num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -254,37 +256,37 @@ if ($action == 'setdate') {
|
|||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
if ($mode != '_tmp')
|
if ($mode != '_tmp')
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setjournal') {
|
if ($action == 'setjournal') {
|
||||||
$journaldoc = trim(GETPOST('code_journal'));
|
$journaldoc = trim(GETPOST('code_journal','alpha'));
|
||||||
$result = $object->updateByMvt($piece_num,'code_journal',$journaldoc,$mode);
|
$result = $object->updateByMvt($piece_num, 'code_journal', $journaldoc, $mode);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
if ($mode != '_tmp')
|
if ($mode != '_tmp')
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setdocref') {
|
if ($action == 'setdocref') {
|
||||||
$refdoc = trim(GETPOST('doc_ref'));
|
$refdoc = trim(GETPOST('doc_ref','alpha'));
|
||||||
$result = $object->updateByMvt($piece_num,'doc_ref',$refdoc,$mode);
|
$result = $object->updateByMvt($piece_num,'doc_ref',$refdoc,$mode);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
if ($mode != '_tmp')
|
if ($mode != '_tmp')
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
@ -318,11 +320,12 @@ if ($action == 'delete') {
|
|||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'create') {
|
if ($action == 'create')
|
||||||
|
{
|
||||||
print load_fiche_titre($langs->trans("CreateMvts"));
|
print load_fiche_titre($langs->trans("CreateMvts"));
|
||||||
|
|
||||||
$book = new BookKeeping($db);
|
$object = new BookKeeping($db);
|
||||||
$next_num_mvt = $book->getNextNumMvt('_tmp');
|
$next_num_mvt = $object->getNextNumMvt('_tmp');
|
||||||
|
|
||||||
if (empty($next_num_mvt))
|
if (empty($next_num_mvt))
|
||||||
{
|
{
|
||||||
@ -337,13 +340,14 @@ if ($action == 'create') {
|
|||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print '<tr>';
|
|
||||||
|
/*print '<tr>';
|
||||||
print '<td class="titlefieldcreate fieldrequired">' . $langs->trans("NumPiece") . '</td>';
|
print '<td class="titlefieldcreate fieldrequired">' . $langs->trans("NumPiece") . '</td>';
|
||||||
print '<td>' . $next_num_mvt . '</td>';
|
print '<td>' . $next_num_mvt . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';*/
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="fieldrequired">' . $langs->trans("Docdate") . '</td>';
|
print '<td class="titlefieldcreate fieldrequired">' . $langs->trans("Docdate") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1);
|
print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -355,49 +359,51 @@ if ($action == 'create') {
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>' . $langs->trans("Docref") . '</td>';
|
print '<td>' . $langs->trans("Piece") . '</td>';
|
||||||
print '<td><input type="text" class="minwidth200" name="doc_ref" value=""/></td>';
|
print '<td><input type="text" class="minwidth200" name="doc_ref" value=""/></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
/*
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>' . $langs->trans("Doctype") . '</td>';
|
print '<td>' . $langs->trans("Doctype") . '</td>';
|
||||||
print '<td><input type="text" class="minwidth200 name="doc_type" value=""/></td>';
|
print '<td><input type="text" class="minwidth200 name="doc_type" value=""/></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
*/
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
print '<div align="center"><input type="submit" class="button" value="' . $langs->trans("Create") . '">';
|
print '<div class="center">';
|
||||||
print ' <input type="button" value="' . $langs->trans("Cancel") . '" class="button" onclick="history.go(-1)" />';
|
print '<input type="submit" class="button" value="' . $langs->trans("Create") . '">';
|
||||||
|
print ' ';
|
||||||
|
print '<input type="button" value="' . $langs->trans("Cancel") . '" class="button" onclick="history.go(-1)" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
} else {
|
} else {
|
||||||
$book = new BookKeeping($db);
|
$object = new BookKeeping($db);
|
||||||
$result = $book->fetchPerMvt($piece_num, $mode);
|
$result = $object->fetchPerMvt($piece_num, $mode);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($book->piece_num)) {
|
if (! empty($object->piece_num))
|
||||||
|
{
|
||||||
$backlink = '<a href="list.php">' . $langs->trans('BackToList') . '</a>';
|
$backlink = '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?restore_lastsearch_values=1">' . $langs->trans('BackToList') . '</a>';
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("UpdateMvts"), $backlink);
|
print load_fiche_titre($langs->trans("UpdateMvts"), $backlink);
|
||||||
|
|
||||||
$head=array();
|
$head=array();
|
||||||
$h=0;
|
$h=0;
|
||||||
$head[$h][0] = $_SERVER['PHP_SELF'].'?piece_num='.$book->piece_num.($mode?'&mode='.$mode:'');
|
$head[$h][0] = $_SERVER['PHP_SELF'].'?piece_num='.$object->piece_num.($mode?'&mode='.$mode:'');
|
||||||
$head[$h][1] = $langs->trans("Transaction");
|
$head[$h][1] = $langs->trans("Transaction");
|
||||||
$head[$h][2] = 'transaction';
|
$head[$h][2] = 'transaction';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
dol_fiche_head($head, 'transaction', '', -1);
|
dol_fiche_head($head, 'transaction', '', -1);
|
||||||
|
|
||||||
|
//dol_banner_tab($object, '', $backlink);
|
||||||
//dol_banner_tab($book, '', $backlink);
|
|
||||||
|
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
print '<div class="fichehalfleft">';
|
print '<div class="fichehalfleft">';
|
||||||
@ -405,75 +411,77 @@ if ($action == 'create') {
|
|||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border tableforfield" width="100%">';
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
// account movement
|
// Account movement
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="titlefield">' . $langs->trans("NumMvts") . '</td>';
|
print '<td class="titlefield">' . $langs->trans("NumMvts") . '</td>';
|
||||||
print '<td>' . $book->piece_num . '</td>';
|
print '<td>' . $object->piece_num . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// date
|
// Date
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('Docdate');
|
print $langs->trans('Docdate');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editdate')
|
if ($action != 'editdate')
|
||||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=editdate&piece_num='. $book->piece_num .'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('SetDate'),1).'</a></td>';
|
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate&piece_num='. $object->piece_num .'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('SetDate'),1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="3">';
|
print '</td><td colspan="3">';
|
||||||
if ($action == 'editdate') {
|
if ($action == 'editdate') {
|
||||||
print '<form name="setdate" action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
|
print '<form name="setdate" action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">';
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="setdate">';
|
print '<input type="hidden" name="action" value="setdate">';
|
||||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||||
$form->select_date($book->doc_date ? $book->doc_date : - 1, 'doc_date', '', '', '', "setdate");
|
$form->select_date($object->doc_date ? $object->doc_date : - 1, 'doc_date', '', '', '', "setdate");
|
||||||
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
} else {
|
} else {
|
||||||
print $book->doc_date ? dol_print_date($book->doc_date, 'daytext') : ' ';
|
print $object->doc_date ? dol_print_date($object->doc_date, 'day') : ' ';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
//journal
|
|
||||||
|
// Journal
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('Codejournal');
|
print $langs->trans('Codejournal');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editjournal')
|
if ($action != 'editjournal')
|
||||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=editjournal&piece_num='.$book->piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</a></td>';
|
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editjournal&piece_num='.$object->piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
if ($action == 'editjournal') {
|
if ($action == 'editjournal') {
|
||||||
print '<form name="setjournal" action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
|
print '<form name="setjournal" action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">';
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="setjournal">';
|
print '<input type="hidden" name="action" value="setjournal">';
|
||||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||||
print $formaccounting->select_journal($book->code_journal,'code_journal',0,0,array(),1,1);
|
print $formaccounting->select_journal($object->code_journal,'code_journal',0,0,array(),1,1);
|
||||||
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
} else {
|
} else {
|
||||||
print $book->code_journal ;
|
print $object->code_journal ;
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
//docref
|
|
||||||
|
// Ref document
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('Docref');
|
print $langs->trans('Piece');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editdocref')
|
if ($action != 'editdocref')
|
||||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=editdocref&piece_num='.$book->piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</a></td>';
|
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdocref&piece_num='.$object->piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
if ($action == 'editdocref') {
|
if ($action == 'editdocref') {
|
||||||
print '<form name="setdocref" action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
|
print '<form name="setdocref" action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">';
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="setdocref">';
|
print '<input type="hidden" name="action" value="setdocref">';
|
||||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||||
print '<input type="text" size="20" name="doc_ref" value="'.$book->doc_ref.'">';
|
print '<input type="text" size="20" name="doc_ref" value="'.dol_escape_htmltag($object->doc_ref).'">';
|
||||||
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
} else {
|
} else {
|
||||||
print $book->doc_ref ;
|
print $object->doc_ref ;
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -488,9 +496,20 @@ if ($action == 'create') {
|
|||||||
print '<table class="border tableforfield" width="100%">';
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
// Doc type
|
// Doc type
|
||||||
|
if(! empty($object->doc_type))
|
||||||
|
{
|
||||||
|
print '<tr>';
|
||||||
|
print '<td class="titlefield">' . $langs->trans("Doctype") . '</td>';
|
||||||
|
print '<td>' . $object->doc_type . '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Date document creation
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>' . $langs->trans("Doctype") . '</td>';
|
print '<td class="titlefield">' . $langs->trans("DateCreation") . '</td>';
|
||||||
print '<td>' . $book->doc_type . '</td>';
|
print '<td>';
|
||||||
|
print $object->date_creation ? dol_print_date($object->date_creation, 'day') : ' ';
|
||||||
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
@ -498,7 +517,7 @@ if ($action == 'create') {
|
|||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="titlefield">' . $langs->trans("Status") . '</td>';
|
print '<td class="titlefield">' . $langs->trans("Status") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if (empty($book->validated)) {
|
if (empty($object->validated)) {
|
||||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $line->rowid . '&action=enable">';
|
print '<a href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $line->rowid . '&action=enable">';
|
||||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
@ -515,11 +534,11 @@ if ($action == 'create') {
|
|||||||
/*
|
/*
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="titlefield">' . $langs->trans("Control") . '</td>';
|
print '<td class="titlefield">' . $langs->trans("Control") . '</td>';
|
||||||
if ($book->doc_type == 'customer_invoice')
|
if ($object->doc_type == 'customer_invoice')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT rowid as ref';
|
$sqlmid = 'SELECT rowid as ref';
|
||||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."facture as fac";
|
$sqlmid .= " FROM ".MAIN_DB_PREFIX."facture as fac";
|
||||||
$sqlmid .= " WHERE fac.rowid=" . $book->fk_doc;
|
$sqlmid .= " WHERE fac.rowid=" . $object->fk_doc;
|
||||||
dol_syslog("accountancy/bookkeeping/card.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
dol_syslog("accountancy/bookkeeping/card.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||||
$resultmid = $db->query($sqlmid);
|
$resultmid = $db->query($sqlmid);
|
||||||
if ($resultmid) {
|
if ($resultmid) {
|
||||||
@ -542,25 +561,24 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
$result = $object->fetchAllPerMvt($piece_num, $mode);
|
||||||
$result = $book->fetchAllPerMvt($piece_num, $mode);
|
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("ListeMvts"), '', '');
|
print load_fiche_titre($langs->trans("ListeMvts"), '', '');
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">';
|
||||||
print '<input type="hidden" name="doc_date" value="' . $book->doc_date . '">' . "\n";
|
print '<input type="hidden" name="doc_date" value="' . $object->doc_date . '">' . "\n";
|
||||||
print '<input type="hidden" name="doc_type" value="' . $book->doc_type . '">' . "\n";
|
print '<input type="hidden" name="doc_type" value="' . $object->doc_type . '">' . "\n";
|
||||||
print '<input type="hidden" name="doc_ref" value="' . $book->doc_ref . '">' . "\n";
|
print '<input type="hidden" name="doc_ref" value="' . $object->doc_ref . '">' . "\n";
|
||||||
print '<input type="hidden" name="code_journal" value="' . $book->code_journal . '">' . "\n";
|
print '<input type="hidden" name="code_journal" value="' . $object->code_journal . '">' . "\n";
|
||||||
print '<input type="hidden" name="fk_doc" value="' . $book->fk_doc . '">' . "\n";
|
print '<input type="hidden" name="fk_doc" value="' . $object->fk_doc . '">' . "\n";
|
||||||
print '<input type="hidden" name="fk_docdet" value="' . $book->fk_docdet . '">' . "\n";
|
print '<input type="hidden" name="fk_docdet" value="' . $object->fk_docdet . '">' . "\n";
|
||||||
print '<input type="hidden" name="mode" value="' . $mode . '">' . "\n";
|
print '<input type="hidden" name="mode" value="' . $mode . '">' . "\n";
|
||||||
|
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
if (count($book->linesmvt) > 0) {
|
if (count($object->linesmvt) > 0) {
|
||||||
|
|
||||||
$total_debit = 0;
|
$total_debit = 0;
|
||||||
$total_credit = 0;
|
$total_credit = 0;
|
||||||
@ -569,15 +587,15 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
print_liste_field_titre("AccountAccountingShort");
|
print_liste_field_titre("AccountAccountingShort");
|
||||||
print_liste_field_titre("SubledgerAccount");
|
print_liste_field_titre("SubledgerAccount");
|
||||||
print_liste_field_titre("Labelcompte");
|
print_liste_field_titre("LabelAccount");
|
||||||
print_liste_field_titre("Label");
|
print_liste_field_titre("LabelOperation");
|
||||||
print_liste_field_titre("Debit", "", "", "", "", 'align="right"');
|
print_liste_field_titre("Debit", "", "", "", "", 'align="right"');
|
||||||
print_liste_field_titre("Credit", "", "", "", "", 'align="right"');
|
print_liste_field_titre("Credit", "", "", "", "", 'align="right"');
|
||||||
print_liste_field_titre("Action", "", "", "", "", 'width="60" align="center"');
|
print_liste_field_titre("Action", "", "", "", "", 'width="60" align="center"');
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
foreach ( $book->linesmvt as $line ) {
|
foreach ($object->linesmvt as $line) {
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
$total_debit += $line->debit;
|
$total_debit += $line->debit;
|
||||||
$total_credit += $line->credit;
|
$total_credit += $line->credit;
|
||||||
@ -587,19 +605,19 @@ if ($action == 'create') {
|
|||||||
print $formaccounting->select_account($line->numero_compte, 'account_number', 1, array (), 1, 1, '');
|
print $formaccounting->select_account($line->numero_compte, 'account_number', 1, array (), 1, 1, '');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||||
{
|
{
|
||||||
print $formaccounting->select_auxaccount($line->subledger_account, 'subledger_account', 1);
|
print $formaccounting->select_auxaccount($line->subledger_account, 'subledger_account', 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<input type="text" name="subledger_account" value="'.$line->subledger_account.'">';
|
print '<input type="text" name="subledger_account" value="'.$line->subledger_account.'">';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
|
print '<td><input type="text" class="minwidth100" name="label_compte" value="' . $line->label_compte . '"/></td>';
|
||||||
print '<td><input type="text" size="15" name="label_operation" value="' . $line->label_operation. '"/></td>';
|
print '<td><input type="text" class="minwidth200" name="label_operation" value="' . $line->label_operation. '"/></td>';
|
||||||
print '<td align="right"><input type="text" size="6" class="right" name="debit" value="' . price($line->debit) . '"/></td>';
|
print '<td align="right"><input type="text" size="6" class="right" name="debit" value="' . price($line->debit) . '"/></td>';
|
||||||
print '<td align="right"><input type="text" size="6" class="right" name="credit" value="' . price($line->credit) . '"/></td>';
|
print '<td align="right"><input type="text" size="6" class="right" name="credit" value="' . price($line->credit) . '"/></td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -619,8 +637,8 @@ if ($action == 'create') {
|
|||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a> ';
|
print '</a> ';
|
||||||
|
|
||||||
$actiontodelete='detele';
|
$actiontodelete='delete';
|
||||||
if ($mode == '_tmp') $actiontodelete='confirm_delete';
|
if ($mode == '_tmp' || $action != 'delmouv') $actiontodelete='confirm_delete';
|
||||||
|
|
||||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action='.$actiontodelete.'&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
|
print '<a href="' . $_SERVER["PHP_SELF"] . '?action='.$actiontodelete.'&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
|
||||||
print img_delete();
|
print img_delete();
|
||||||
@ -631,9 +649,12 @@ if ($action == 'create') {
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (price2num($total_debit) != price2num($total_credit))
|
$total_debit = price2num($total_debit);
|
||||||
|
$total_credit = price2num($total_credit);
|
||||||
|
|
||||||
|
if ($total_debit != $total_credit)
|
||||||
{
|
{
|
||||||
setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_credit, $total_debit)), 'warnings');
|
setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_debit, $total_credit)), 'warnings');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == "" || $action == 'add') {
|
if ($action == "" || $action == 'add') {
|
||||||
@ -644,19 +665,19 @@ if ($action == 'create') {
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||||
{
|
{
|
||||||
print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1);
|
print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<input type="text" name="subledger_account" value="">';
|
print '<input type="text" name="subledger_account" value="">';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
|
print '<td><input type="text" class="minwidth100" name="label_compte" value=""/></td>';
|
||||||
print '<td><input type="text" size="15" name="label_operation" value="' . $line->label_operation. '"/></td>';
|
print '<td><input type="text" class="minwidth200" name="label_operation" value=""/></td>';
|
||||||
print '<td align="right"><input type="text" size="6" class="right" name="debit" value="' . ($debit ? price($debit) : '') . '"/></td>';
|
print '<td align="right"><input type="text" size="6" class="right" name="debit" value=""/></td>';
|
||||||
print '<td align="right"><input type="text" size="6" class="right" name="credit" value="' . ($credit ? price($credit) : '') . '"/></td>';
|
print '<td align="right"><input type="text" size="6" class="right" name="credit" value=""/></td>';
|
||||||
print '<td><input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '"></td>';
|
print '<td><input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
@ -665,15 +686,15 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
if ($mode=='_tmp' && $action=='')
|
if ($mode=='_tmp' && $action=='')
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
if ($total_debit == $total_credit)
|
if ($total_debit == $total_credit)
|
||||||
{
|
{
|
||||||
print '<a class="button" href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '&action=valid">'.$langs->trans("ValidTransaction").'</a>';
|
print '<a class="button" href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '&action=valid">'.$langs->trans("ValidTransaction").'</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<input type="submit" class="button" disabled="disabled" href="#" title="'.dol_escape_htmltag($langs->trans("MvtNotCorrectlyBalanced", $credit, $debit)).'" value="'.dol_escape_htmltag($langs->trans("ValidTransaction")).'">';
|
print '<input type="submit" class="button" disabled="disabled" href="#" title="'.dol_escape_htmltag($langs->trans("MvtNotCorrectlyBalanced", $debit, $credit)).'" value="'.dol_escape_htmltag($langs->trans("ValidTransaction")).'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
print ' ';
|
print ' ';
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -30,21 +30,22 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
|
||||||
// Langs
|
$langs->loadLangs(array("accountancy"));
|
||||||
$langs->load("accountancy");
|
|
||||||
|
|
||||||
$page = GETPOST("page");
|
|
||||||
$sortorder = GETPOST("sortorder");
|
|
||||||
$sortfield = GETPOST("sortfield");
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
$search_mvt_num = GETPOST('search_mvt_num', 'int');
|
$search_mvt_num = GETPOST('search_mvt_num', 'int');
|
||||||
$search_doc_type = GETPOST("search_doc_type");
|
$search_doc_type = GETPOST("search_doc_type");
|
||||||
$search_doc_ref = GETPOST("search_doc_ref");
|
$search_doc_ref = GETPOST("search_doc_ref");
|
||||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
|
||||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
$search_date_end = dol_mktime(0, 0, 0, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
|
||||||
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
|
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
|
||||||
|
$search_date_creation_start = dol_mktime(0, 0, 0, GETPOST('date_creation_startmonth', 'int'), GETPOST('date_creation_startday', 'int'), GETPOST('date_creation_startyear', 'int'));
|
||||||
|
$search_date_creation_end = dol_mktime(0, 0, 0, GETPOST('date_creation_endmonth', 'int'), GETPOST('date_creation_endday', 'int'), GETPOST('date_creation_endyear', 'int'));
|
||||||
|
$search_date_modification_start = dol_mktime(0, 0, 0, GETPOST('date_modification_startmonth', 'int'), GETPOST('date_modification_startday', 'int'), GETPOST('date_modification_startyear', 'int'));
|
||||||
|
$search_date_modification_end = dol_mktime(0, 0, 0, GETPOST('date_modification_endmonth', 'int'), GETPOST('date_modification_endday', 'int'), GETPOST('date_modification_endyear', 'int'));
|
||||||
|
//var_dump($search_date_start);exit;
|
||||||
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
|
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
|
||||||
$action = 'delbookkeepingyear';
|
$action = 'delbookkeepingyear';
|
||||||
}
|
}
|
||||||
@ -53,7 +54,6 @@ if (GETPOST("button_export_file_x") || GETPOST("button_export_file.x") || GETPOS
|
|||||||
}
|
}
|
||||||
|
|
||||||
$search_accountancy_code = GETPOST("search_accountancy_code");
|
$search_accountancy_code = GETPOST("search_accountancy_code");
|
||||||
|
|
||||||
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
|
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
|
||||||
if ($search_accountancy_code_start == - 1) {
|
if ($search_accountancy_code_start == - 1) {
|
||||||
$search_accountancy_code_start = '';
|
$search_accountancy_code_start = '';
|
||||||
@ -64,7 +64,6 @@ if ($search_accountancy_code_end == - 1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$search_accountancy_aux_code = GETPOST("search_accountancy_aux_code");
|
$search_accountancy_aux_code = GETPOST("search_accountancy_aux_code");
|
||||||
|
|
||||||
$search_accountancy_aux_code_start = GETPOST('search_accountancy_aux_code_start', 'alpha');
|
$search_accountancy_aux_code_start = GETPOST('search_accountancy_aux_code_start', 'alpha');
|
||||||
if ($search_accountancy_aux_code_start == - 1) {
|
if ($search_accountancy_aux_code_start == - 1) {
|
||||||
$search_accountancy_aux_code_start = '';
|
$search_accountancy_aux_code_start = '';
|
||||||
@ -75,6 +74,8 @@ if ($search_accountancy_aux_code_end == - 1) {
|
|||||||
}
|
}
|
||||||
$search_mvt_label = GETPOST('search_mvt_label', 'alpha');
|
$search_mvt_label = GETPOST('search_mvt_label', 'alpha');
|
||||||
$search_direction = GETPOST('search_direction', 'alpha');
|
$search_direction = GETPOST('search_direction', 'alpha');
|
||||||
|
$search_debit = GETPOST('search_debit', 'alpha');
|
||||||
|
$search_credit = GETPOST('search_credit', 'alpha');
|
||||||
$search_ledger_code = GETPOST('search_ledger_code', 'alpha');
|
$search_ledger_code = GETPOST('search_ledger_code', 'alpha');
|
||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
@ -82,12 +83,12 @@ $limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->AC
|
|||||||
$sortfield = GETPOST('sortfield', 'alpha');
|
$sortfield = GETPOST('sortfield', 'alpha');
|
||||||
$sortorder = GETPOST('sortorder', 'alpha');
|
$sortorder = GETPOST('sortorder', 'alpha');
|
||||||
$page = GETPOST('page','int');
|
$page = GETPOST('page','int');
|
||||||
if ($page < 0) { $page = 0; }
|
if (empty($page) || $page < 0) { $page = 0; }
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if ($sortorder == "") $sortorder = "ASC";
|
if ($sortorder == "") $sortorder = "ASC";
|
||||||
if ($sortfield == "") $sortfield = "t.rowid";
|
if ($sortfield == "") $sortfield = "t.piece_num,t.rowid";
|
||||||
|
|
||||||
|
|
||||||
$object = new BookKeeping($db);
|
$object = new BookKeeping($db);
|
||||||
@ -96,20 +97,59 @@ $formaccounting = new FormAccounting($db);
|
|||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
|
if (! in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && GETPOST('page','int') == '' && ! GETPOST('noreset','int'))
|
||||||
|
{
|
||||||
|
if (empty($search_date_start) && empty($search_date_end) && ! GETPOSTISSET('restore_lastsearch_values'))
|
||||||
|
{
|
||||||
|
$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";
|
||||||
|
$res = $db->query($query);
|
||||||
|
|
||||||
if ($action != 'export_file' && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && empty($page)) {
|
if ($res->num_rows > 0) {
|
||||||
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
$fiscalYear = $db->fetch_object($res);
|
||||||
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
$search_date_start = strtotime($fiscalYear->date_start);
|
||||||
|
$search_date_end = strtotime($fiscalYear->date_end);
|
||||||
|
} else {
|
||||||
|
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||||
|
$year_start = dol_print_date(dol_now(), '%Y');
|
||||||
|
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||||
|
$year_end = $year_start + 1;
|
||||||
|
$month_end = $month_start - 1;
|
||||||
|
if ($month_end < 1)
|
||||||
|
{
|
||||||
|
$month_end = 12;
|
||||||
|
$year_end--;
|
||||||
|
}
|
||||||
|
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||||
|
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$arrayfields=array(
|
||||||
|
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
|
||||||
|
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
|
||||||
|
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
|
||||||
|
'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.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
|
||||||
|
't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
|
||||||
|
't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
@ -128,74 +168,109 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
$search_ledger_code = '';
|
$search_ledger_code = '';
|
||||||
$search_date_start = '';
|
$search_date_start = '';
|
||||||
$search_date_end = '';
|
$search_date_end = '';
|
||||||
|
$search_date_creation_start = '';
|
||||||
|
$search_date_creation_end = '';
|
||||||
|
$search_date_modification_start = '';
|
||||||
|
$search_date_modification_end = '';
|
||||||
|
$search_debit = '';
|
||||||
|
$search_credit = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Must be after the remove filter action, before the export.
|
// Must be after the remove filter action, before the export.
|
||||||
$param = '';
|
$param = '';
|
||||||
$filter = array ();
|
$filter = array ();
|
||||||
if (! empty($search_date_start)) {
|
if (! empty($search_date_start)) {
|
||||||
$filter['t.doc_date>='] = $search_date_start;
|
$filter['t.doc_date>='] = $search_date_start;
|
||||||
$tmp=dol_getdate($search_date_start);
|
$tmp=dol_getdate($search_date_start);
|
||||||
$param .= '&date_startmonth=' . $tmp['mon'] . '&date_startday=' . $tmp['mday'] . '&date_startyear=' . $tmp['year'];
|
$param .= '&search_date_startmonth=' . $tmp['mon'] . '&search_date_startday=' . $tmp['mday'] . '&search_date_startyear=' . $tmp['year'];
|
||||||
}
|
}
|
||||||
if (! empty($search_date_end)) {
|
if (! empty($search_date_end)) {
|
||||||
$filter['t.doc_date<='] = $search_date_end;
|
$filter['t.doc_date<='] = $search_date_end;
|
||||||
$tmp=dol_getdate($search_date_end);
|
$tmp=dol_getdate($search_date_end);
|
||||||
$param .= '&date_endmonth=' . $tmp['mon'] . '&date_endday=' . $tmp['mday'] . '&date_endyear=' . $tmp['year'];
|
$param .= '&search_date_endmonth=' . $tmp['mon'] . '&search_date_endday=' . $tmp['mday'] . '&search_date_endyear=' . $tmp['year'];
|
||||||
}
|
}
|
||||||
if (! empty($search_doc_date)) {
|
if (! empty($search_doc_date)) {
|
||||||
$filter['t.doc_date'] = $search_doc_date;
|
$filter['t.doc_date'] = $search_doc_date;
|
||||||
$tmp=dol_getdate($search_doc_date);
|
$tmp=dol_getdate($search_doc_date);
|
||||||
$param .= '&doc_datemonth=' . $tmp['mon'] . '&doc_dateday=' . $tmp['mday'] . '&doc_dateyear=' . $tmp['year'];
|
$param .= '&doc_datemonth=' . $tmp['mon'] . '&doc_dateday=' . $tmp['mday'] . '&doc_dateyear=' . $tmp['year'];
|
||||||
}
|
}
|
||||||
if (! empty($search_doc_type)) {
|
if (! empty($search_doc_type)) {
|
||||||
$filter['t.doc_type'] = $search_doc_type;
|
$filter['t.doc_type'] = $search_doc_type;
|
||||||
$param .= '&search_doc_type=' . $search_doc_type;
|
$param .= '&search_doc_type=' . urlencode($search_doc_type);
|
||||||
}
|
}
|
||||||
if (! empty($search_doc_ref)) {
|
if (! empty($search_doc_ref)) {
|
||||||
$filter['t.doc_ref'] = $search_doc_ref;
|
$filter['t.doc_ref'] = $search_doc_ref;
|
||||||
$param .= '&search_doc_ref=' . $search_doc_ref;
|
$param .= '&search_doc_ref=' . urlencode($search_doc_ref);
|
||||||
}
|
}
|
||||||
if (! empty($search_accountancy_code)) {
|
if (! empty($search_accountancy_code)) {
|
||||||
$filter['t.numero_compte'] = $search_accountancy_code;
|
$filter['t.numero_compte'] = $search_accountancy_code;
|
||||||
$param .= '&search_accountancy_code=' . $search_accountancy_code;
|
$param .= '&search_accountancy_code=' . urlencode($search_accountancy_code);
|
||||||
}
|
}
|
||||||
if (! empty($search_accountancy_code_start)) {
|
if (! empty($search_accountancy_code_start)) {
|
||||||
$filter['t.numero_compte>='] = $search_accountancy_code_start;
|
$filter['t.numero_compte>='] = $search_accountancy_code_start;
|
||||||
$param .= '&search_accountancy_code_start=' . $search_accountancy_code_start;
|
$param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start);
|
||||||
}
|
}
|
||||||
if (! empty($search_accountancy_code_end)) {
|
if (! empty($search_accountancy_code_end)) {
|
||||||
$filter['t.numero_compte<='] = $search_accountancy_code_end;
|
$filter['t.numero_compte<='] = $search_accountancy_code_end;
|
||||||
$param .= '&search_accountancy_code_end=' . $search_accountancy_code_end;
|
$param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end);
|
||||||
}
|
}
|
||||||
if (! empty($search_accountancy_aux_code)) {
|
if (! empty($search_accountancy_aux_code)) {
|
||||||
$filter['t.subledger_account'] = $search_accountancy_aux_code;
|
$filter['t.subledger_account'] = $search_accountancy_aux_code;
|
||||||
$param .= '&search_accountancy_aux_code=' . $search_accountancy_aux_code;
|
$param .= '&search_accountancy_aux_code=' . urlencode($search_accountancy_aux_code);
|
||||||
}
|
}
|
||||||
if (! empty($search_accountancy_aux_code_start)) {
|
if (! empty($search_accountancy_aux_code_start)) {
|
||||||
$filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
|
$filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
|
||||||
$param .= '&search_accountancy_aux_code_start=' . $search_accountancy_aux_code_start;
|
$param .= '&search_accountancy_aux_code_start=' . urlencode($search_accountancy_aux_code_start);
|
||||||
}
|
}
|
||||||
if (! empty($search_accountancy_aux_code_end)) {
|
if (! empty($search_accountancy_aux_code_end)) {
|
||||||
$filter['t.subledger_account<='] = $search_accountancy_aux_code_end;
|
$filter['t.subledger_account<='] = $search_accountancy_aux_code_end;
|
||||||
$param .= '&search_accountancy_aux_code_end=' . $search_accountancy_aux_code_end;
|
$param .= '&search_accountancy_aux_code_end=' . urlencode($search_accountancy_aux_code_end);
|
||||||
}
|
}
|
||||||
if (! empty($search_mvt_label)) {
|
if (! empty($search_mvt_label)) {
|
||||||
$filter['t.label_operation'] = $search_mvt_label;
|
$filter['t.label_operation'] = $search_mvt_label;
|
||||||
$param .= '&search_mvt_label=' . $search_mvt_label;
|
$param .= '&search_mvt_label=' . urlencode($search_mvt_label);
|
||||||
}
|
}
|
||||||
if (! empty($search_direction)) {
|
if (! empty($search_direction)) {
|
||||||
$filter['t.sens'] = $search_direction;
|
$filter['t.sens'] = $search_direction;
|
||||||
$param .= '&search_direction=' . $search_direction;
|
$param .= '&search_direction=' . urlencode($search_direction);
|
||||||
}
|
}
|
||||||
if (! empty($search_ledger_code)) {
|
if (! empty($search_ledger_code)) {
|
||||||
$filter['t.code_journal'] = $search_ledger_code;
|
$filter['t.code_journal'] = $search_ledger_code;
|
||||||
$param .= '&search_ledger_code=' . $search_ledger_code;
|
$param .= '&search_ledger_code=' . urlencode($search_ledger_code);
|
||||||
}
|
}
|
||||||
if (! empty($search_mvt_num)) {
|
if (! empty($search_mvt_num)) {
|
||||||
$filter['t.piece_num'] = $search_mvt_num;
|
$filter['t.piece_num'] = $search_mvt_num;
|
||||||
$param .= '&search_mvt_num=' . $search_mvt_num;
|
$param .= '&search_mvt_num=' . urlencode($search_mvt_num);
|
||||||
}
|
}
|
||||||
|
if (! empty($search_date_creation_start)) {
|
||||||
|
$filter['t.date_creation>='] = $search_date_creation_start;
|
||||||
|
$tmp=dol_getdate($search_date_creation_start);
|
||||||
|
$param .= '&date_creation_startmonth=' . $tmp['mon'] . '&date_creation_startday=' . $tmp['mday'] . '&date_creation_startyear=' . $tmp['year'];
|
||||||
|
}
|
||||||
|
if (! empty($search_date_creation_end)) {
|
||||||
|
$filter['t.date_creation<='] = $search_date_creation_end;
|
||||||
|
$tmp=dol_getdate($search_date_creation_end);
|
||||||
|
$param .= '&date_creation_endmonth=' . $tmp['mon'] . '&date_creation_endday=' . $tmp['mday'] . '&date_creation_endyear=' . $tmp['year'];
|
||||||
|
}
|
||||||
|
if (! empty($search_date_modification_start)) {
|
||||||
|
$filter['t.tms>='] = $search_date_modification_start;
|
||||||
|
$tmp=dol_getdate($search_date_modification_start);
|
||||||
|
$param .= '&date_modification_startmonth=' . $tmp['mon'] . '&date_modification_startday=' . $tmp['mday'] . '&date_modification_startyear=' . $tmp['year'];
|
||||||
|
}
|
||||||
|
if (! empty($search_date_modification_end)) {
|
||||||
|
$filter['t.tms<='] = $search_date_modification_end;
|
||||||
|
$tmp=dol_getdate($search_date_modification_end);
|
||||||
|
$param .= '&date_modification_endmonth=' . $tmp['mon'] . '&date_modification_endday=' . $tmp['mday'] . '&date_modification_endyear=' . $tmp['year'];
|
||||||
|
}
|
||||||
|
if (! empty($search_debit)) {
|
||||||
|
$filter['t.debit'] = $search_debit;
|
||||||
|
$param .= '&search_debit=' . urlencode($search_debit);
|
||||||
|
}
|
||||||
|
if (! empty($search_credit)) {
|
||||||
|
$filter['t.credit'] = $search_credit;
|
||||||
|
$param .= '&search_credit=' . urlencode($search_credit);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($action == 'delbookkeeping') {
|
if ($action == 'delbookkeeping') {
|
||||||
|
|
||||||
@ -229,16 +304,16 @@ if ($action == 'delbookkeepingyearconfirm') {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages("RecordDeleted", null, 'mesgs');
|
setEventMessages("RecordDeleted", null, 'mesgs');
|
||||||
}
|
}
|
||||||
Header("Location: list.php");
|
Header("Location: list.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages("NoRecordDeleted", null, 'warnings');
|
setEventMessages("NoRecordDeleted", null, 'warnings');
|
||||||
Header("Location: list.php");
|
Header("Location: list.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($action == 'delmouvconfirm') {
|
if ($action == 'delmouvconfirm') {
|
||||||
@ -248,13 +323,14 @@ if ($action == 'delmouvconfirm') {
|
|||||||
if (! empty($mvt_num)) {
|
if (! empty($mvt_num)) {
|
||||||
$result = $object->deleteMvtNum($mvt_num);
|
$result = $object->deleteMvtNum($mvt_num);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
Header("Location: list.php");
|
|
||||||
|
Header("Location: list.php?noreset=1".($param?'&'.$param:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -262,21 +338,21 @@ if ($action == 'delmouvconfirm') {
|
|||||||
// Export into a file with format defined into setup
|
// Export into a file with format defined into setup
|
||||||
if ($action == 'export_file') {
|
if ($action == 'export_file') {
|
||||||
|
|
||||||
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
|
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
|
||||||
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$accountancyexport = new AccountancyExport($db);
|
$accountancyexport = new AccountancyExport($db);
|
||||||
$accountancyexport->export($object->lines);
|
$accountancyexport->export($object->lines);
|
||||||
if (!empty($accountancyexport->errors)) {
|
if (!empty($accountancyexport->errors)) {
|
||||||
setEventMessages('', $accountancyexport->errors, 'errors');
|
setEventMessages('', $accountancyexport->errors, 'errors');
|
||||||
}
|
}
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -306,7 +382,7 @@ if ($result < 0) {
|
|||||||
$num=count($object->lines);
|
$num=count($object->lines);
|
||||||
|
|
||||||
if ($action == 'delmouv') {
|
if ($action == 'delmouv') {
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?mvt_num='.GETPOST('mvt_num').$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1);
|
||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
}
|
}
|
||||||
if ($action == 'delbookkeepingyear') {
|
if ($action == 'delbookkeepingyear') {
|
||||||
@ -330,7 +406,7 @@ if ($action == 'delbookkeepingyear') {
|
|||||||
);
|
);
|
||||||
$form_question['deljournal'] = array (
|
$form_question['deljournal'] = array (
|
||||||
'name' => 'deljournal',
|
'name' => 'deljournal',
|
||||||
'type' => 'other', // We don't use select here, the journal_array is already a select html component
|
'type' => 'other', // We don't use select here, the journal_array is already a select html component
|
||||||
'label' => $langs->trans('DelJournal'),
|
'label' => $langs->trans('DelJournal'),
|
||||||
'value' => $journal_array,
|
'value' => $journal_array,
|
||||||
'default' => $deljournal
|
'default' => $deljournal
|
||||||
@ -340,7 +416,7 @@ if ($action == 'delbookkeepingyear') {
|
|||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
}
|
}
|
||||||
|
|
||||||
//$param=''; param started before
|
//$param=''; param started before
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
|
|
||||||
@ -357,150 +433,317 @@ $listofformat=AccountancyExport::getType();
|
|||||||
$button = '<a class="butAction" name="button_export_file" href="'.$_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:'').'">';
|
$button = '<a class="butAction" name="button_export_file" href="'.$_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:'').'">';
|
||||||
if (count($filter)) $button.= $langs->trans("ExportFilteredList");
|
if (count($filter)) $button.= $langs->trans("ExportFilteredList");
|
||||||
else $button.= $langs->trans("ExportList");
|
else $button.= $langs->trans("ExportList");
|
||||||
$button.=' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')';
|
//$button.=' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')';
|
||||||
$button.= '</a>';
|
$button.= '</a>';
|
||||||
|
|
||||||
$groupby = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php"">' . $langs->trans("GroupByAccountAccounting") . '</a>';
|
|
||||||
|
|
||||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, $groupby, '', $limit);
|
$groupby = ' <a class="nohover marginrightonly" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param.'">' . $langs->trans("GroupByAccountAccounting") . '</a>';
|
||||||
|
$newcardbutton = '<a class="butActionNew" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt");
|
||||||
|
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
|
||||||
|
$newcardbutton.= '</a>';
|
||||||
|
|
||||||
print '<div class="tabsAction tabsActionNoBottom">' . "\n";
|
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, $groupby.$newcardbutton, '', $limit);
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
|
|
||||||
print '<div class="inline-block divButAction"><a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear'.($param?'&'.$param:'').'">' . $langs->trans("DelBookKeeping") . '</a></div>';
|
|
||||||
|
|
||||||
print '</div>';
|
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||||
|
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||||
|
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<div class="div-table-responsive">';
|
||||||
|
print '<table class="tagtable liste" width="100%">';
|
||||||
|
|
||||||
|
// Filters lines
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="' . dol_escape_htmltag($search_mvt_num) . '"></td>';
|
// Movement number
|
||||||
print '<td class="liste_titre center">';
|
if (! empty($arrayfields['t.piece_num']['checked']))
|
||||||
print '<div class="nowrap">';
|
|
||||||
print $langs->trans('From') . ' ';
|
|
||||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
|
||||||
print '</div>';
|
|
||||||
print '<div class="nowrap">';
|
|
||||||
print $langs->trans('to') . ' ';
|
|
||||||
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
|
||||||
print '</div>';
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="' . dol_escape_htmltag($search_doc_ref) . '"></td>';
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print '<div class="nowrap">';
|
|
||||||
print $langs->trans('From').' ';
|
|
||||||
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, 'maxwidth200');
|
|
||||||
print '</div>';
|
|
||||||
print '<div class="nowrap">';
|
|
||||||
print $langs->trans('to').' ';
|
|
||||||
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, 'maxwidth200');
|
|
||||||
print '</div>';
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print '<div class="nowrap">';
|
|
||||||
print $langs->trans('From').' ';
|
|
||||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
|
||||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
|
||||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
|
||||||
{
|
{
|
||||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="' . dol_escape_htmltag($search_mvt_num) . '"></td>';
|
||||||
}
|
}
|
||||||
else
|
// Date document
|
||||||
|
if (! empty($arrayfields['t.doc_date']['checked']))
|
||||||
{
|
{
|
||||||
print '<input type="text" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'">';
|
print '<td class="liste_titre center">';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('From') . ' ';
|
||||||
|
print $form->select_date($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to') . ' ';
|
||||||
|
print $form->select_date($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '</div>';
|
// Ref document
|
||||||
print '<div class="nowrap">';
|
if (! empty($arrayfields['t.doc_ref']['checked']))
|
||||||
print $langs->trans('to').' ';
|
|
||||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
|
||||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
|
||||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
|
||||||
{
|
{
|
||||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
print '<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="' . dol_escape_htmltag($search_doc_ref) . '"></td>';
|
||||||
}
|
}
|
||||||
else
|
// Accountancy account
|
||||||
|
if (! empty($arrayfields['t.numero_compte']['checked']))
|
||||||
{
|
{
|
||||||
print '<input type="text" name="search_accountancy_aux_code_end" value="'.$search_accountancy_aux_code_end.'">';
|
print '<td class="liste_titre">';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('From').' ';
|
||||||
|
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, 'maxwidth200');
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to').' ';
|
||||||
|
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, 'maxwidth200');
|
||||||
|
print '</div>';
|
||||||
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '</div>';
|
// Subledger account
|
||||||
print '</td>';
|
if (! empty($arrayfields['t.subledger_account']['checked']))
|
||||||
print '<td class="liste_titre">';
|
{
|
||||||
print '<input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
|
print '<td class="liste_titre">';
|
||||||
print '</td>';
|
print '<div class="nowrap">';
|
||||||
print '<td class="liste_titre center"> </td>';
|
print $langs->trans('From').' ';
|
||||||
print '<td class="liste_titre center"> </td>';
|
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||||
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||||
|
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||||
|
{
|
||||||
|
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<input type="text" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'">';
|
||||||
|
}
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to').' ';
|
||||||
|
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||||
|
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||||
|
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||||
|
{
|
||||||
|
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<input type="text" name="search_accountancy_aux_code_end" value="'.$search_accountancy_aux_code_end.'">';
|
||||||
|
}
|
||||||
|
print '</div>';
|
||||||
|
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 '</td>';
|
||||||
|
}
|
||||||
|
// Debit
|
||||||
|
if (! empty($arrayfields['t.debit']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre" align="right">';
|
||||||
|
print '<input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
// Credit
|
||||||
|
if (! empty($arrayfields['t.credit']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre" align="right">';
|
||||||
|
print '<input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
// Code journal
|
||||||
|
if (! empty($arrayfields['t.code_journal']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
||||||
|
}
|
||||||
|
// Date creation
|
||||||
|
if (! empty($arrayfields['t.date_creation']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre center">';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('From') . ' ';
|
||||||
|
print $form->select_date($search_date_creation_start, 'date_creation_start', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to') . ' ';
|
||||||
|
print $form->select_date($search_date_creation_end, 'date_creation_end', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
// Date modification
|
||||||
|
if (! empty($arrayfields['t.tms']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre center">';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('From') . ' ';
|
||||||
|
print $form->select_date($search_date_modification_start, 'date_modification_start', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to') . ' ';
|
||||||
|
print $form->select_date($search_date_modification_end, 'date_modification_end', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
// Action column
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
$searchpicto=$form->showFilterButtons();
|
$searchpicto=$form->showFilterButtons();
|
||||||
print $searchpicto;
|
print $searchpicto;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
|
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("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
|
if (! empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
|
if (! empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
if (! empty($arrayfields['t.numero_compte']['checked'])) print_liste_field_titre($arrayfields['t.numero_compte']['label'], $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre("SubledgerAccount", $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
|
if (! empty($arrayfields['t.subledger_account']['checked'])) print_liste_field_titre($arrayfields['t.subledger_account']['label'], $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
|
if (! empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
|
if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
|
if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
|
if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
$checkpicto='';
|
if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre($arrayfields['t.date_creation']['label'], $_SERVER['PHP_SELF'], "t.date_creation", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
|
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($checkpicto, $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
$total_debit = 0;
|
if ($num > 0)
|
||||||
$total_credit = 0;
|
|
||||||
|
|
||||||
$i=0;
|
|
||||||
while ($i < min($num, $limit))
|
|
||||||
{
|
{
|
||||||
$line = $object->lines[$i];
|
$i=0;
|
||||||
|
$totalarray=array();
|
||||||
|
while ($i < min($num, $limit))
|
||||||
|
{
|
||||||
|
$line = $object->lines[$i];
|
||||||
|
|
||||||
$total_debit += $line->debit;
|
$total_debit += $line->debit;
|
||||||
$total_credit += $line->credit;
|
$total_credit += $line->credit;
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
print '<td><a href="./card.php?piece_num=' . $line->piece_num . '">' . $line->piece_num . '</a></td>';
|
// Piece number
|
||||||
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
|
if (! empty($arrayfields['t.piece_num']['checked']))
|
||||||
print '<td class="nowrap">' . $line->doc_ref . '</td>';
|
{
|
||||||
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
print '<td>';
|
||||||
print '<td>' . length_accounta($line->subledger_account) . '</td>';
|
$object->id = $line->id;
|
||||||
print '<td>' . $line->label_operation . '</td>';
|
$object->piece_num = $line->piece_num;
|
||||||
print '<td align="right">' . ($line->debit ? price($line->debit) : ''). '</td>';
|
print $object->getNomUrl(1,'',0,'',1);
|
||||||
print '<td align="right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
//print '<a href="./card.php?piece_num=' . $line->piece_num . '&save_lastsearch_values=1">' . $line->piece_num . '</a>';
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
$accountingjournal = new AccountingJournal($db);
|
// Document date
|
||||||
$result = $accountingjournal->fetch('',$line->code_journal);
|
if (! empty($arrayfields['t.doc_date']['checked']))
|
||||||
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0,0,0,'',0) : $line->code_journal);
|
{
|
||||||
print '<td align="center">' . $journaltoshow . '</td>';
|
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
print '<td align="center">';
|
// Document ref
|
||||||
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a> ';
|
if (! empty($arrayfields['t.doc_ref']['checked']))
|
||||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . '">' . img_delete() . '</a>';
|
{
|
||||||
print '</td>';
|
print '<td class="nowrap">' . $line->doc_ref . '</td>';
|
||||||
print "</tr>\n";
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
$i++;
|
// Account number
|
||||||
|
if (! empty($arrayfields['t.numero_compte']['checked']))
|
||||||
|
{
|
||||||
|
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Subledger account
|
||||||
|
if (! empty($arrayfields['t.subledger_account']['checked']))
|
||||||
|
{
|
||||||
|
print '<td>' . length_accounta($line->subledger_account) . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Label operation
|
||||||
|
if (! empty($arrayfields['t.label_operation']['checked']))
|
||||||
|
{
|
||||||
|
print '<td>' . $line->label_operation . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Amount debit
|
||||||
|
if (! empty($arrayfields['t.debit']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="right">' . ($line->debit ? price($line->debit) : ''). '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield'];
|
||||||
|
$totalarray['totaldebit'] += $line->debit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Amount credit
|
||||||
|
if (! empty($arrayfields['t.credit']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
if (! $i) $totalarray['totalcreditfield']=$totalarray['nbfield'];
|
||||||
|
$totalarray['totalcredit'] += $line->credit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Journal code
|
||||||
|
if (! empty($arrayfields['t.code_journal']['checked']))
|
||||||
|
{
|
||||||
|
$accountingjournal = new AccountingJournal($db);
|
||||||
|
$result = $accountingjournal->fetch('',$line->code_journal);
|
||||||
|
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0,0,0,'',0) : $line->code_journal);
|
||||||
|
print '<td align="center">' . $journaltoshow . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creation operation date
|
||||||
|
if (! empty($arrayfields['t.date_creation']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="center">' . dol_print_date($line->date_creation, 'dayhour') . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Modification operation date
|
||||||
|
if (! empty($arrayfields['t.tms']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="center">' . dol_print_date($line->date_modification, 'dayhour') . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action column
|
||||||
|
print '<td align="center" class="nowraponall">';
|
||||||
|
print '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num=' . $line->piece_num . $param . '&page=' . $page . ($sortfield ? '&sortfield='.$sortfield : '') . ($sortorder ? '&sortorder='.$sortorder : '') . '">' . img_edit() . '</a> ';
|
||||||
|
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . ($sortfield ? '&sortfield='.$sortfield : '') . ($sortorder ? '&sortorder='.$sortorder : '') . '">' . img_delete() . '</a>';
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show total line
|
||||||
|
if (isset($totalarray['totaldebitfield']) || isset($totalarray['totalcreditfield']))
|
||||||
|
{
|
||||||
|
$i=0;
|
||||||
|
print '<tr class="liste_total">';
|
||||||
|
while ($i < $totalarray['nbfield'])
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
if ($i == 1)
|
||||||
|
{
|
||||||
|
if ($num < $limit && empty($offset)) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||||
|
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||||
|
}
|
||||||
|
elseif ($totalarray['totaldebitfield'] == $i) print '<td align="right">'.price($totalarray['totaldebit']).'</td>';
|
||||||
|
elseif ($totalarray['totalcreditfield'] == $i) print '<td align="right">'.price($totalarray['totalcredit']).'</td>';
|
||||||
|
else print '<td></td>';
|
||||||
|
}
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="liste_total">';
|
|
||||||
if ($num < $limit) print '<td align="left" colspan="6">'.$langs->trans("Total").'</td>';
|
|
||||||
else print '<td align="left" colspan="6">'.$langs->trans("Totalforthispage").'</td>';
|
|
||||||
print '</td>';
|
|
||||||
print '<td align="right">';
|
|
||||||
print price($total_debit);
|
|
||||||
print '</td>';
|
|
||||||
print '<td align="right">';
|
|
||||||
print price($total_credit);
|
|
||||||
print '</td>';
|
|
||||||
print '<td colspan="2"></td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
// TODO Replace this with mass delete action
|
||||||
|
print '<div class="tabsAction tabsActionNoBottom">' . "\n";
|
||||||
|
print '<a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear'.($param?'&'.$param:'').'">' . $langs->trans("DeleteMvt") . '</a>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2016 Neil Orley <neil.orley@oeris.fr>
|
/* Copyright (C) 2016 Neil Orley <neil.orley@oeris.fr>
|
||||||
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -26,112 +26,159 @@
|
|||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
// Class
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
|
||||||
// Langs
|
$langs->loadLangs(array("accountancy"));
|
||||||
$langs->load("accountancy");
|
|
||||||
|
|
||||||
$page = GETPOST("page");
|
$page = GETPOST("page");
|
||||||
$sortorder = GETPOST("sortorder");
|
$sortorder = GETPOST("sortorder");
|
||||||
$sortfield = GETPOST("sortfield");
|
$sortfield = GETPOST("sortfield");
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
|
||||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
$search_date_end = dol_mktime(0, 0, 0, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
|
||||||
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
|
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$search_accountancy_code = GETPOST("search_accountancy_code");
|
$search_accountancy_code = GETPOST("search_accountancy_code");
|
||||||
|
|
||||||
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
|
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
|
||||||
if ($search_accountancy_code_start == - 1) {
|
if ($search_accountancy_code_start == - 1) {
|
||||||
$search_accountancy_code_start = '';
|
$search_accountancy_code_start = '';
|
||||||
}
|
}
|
||||||
$search_label_account = GETPOST('search_label_account', 'alpha');
|
$search_accountancy_code_end = GETPOST('search_accountancy_code_end', 'alpha');
|
||||||
|
if ($search_accountancy_code_end == - 1) {
|
||||||
$search_mvt_label = GETPOST('search_mvt_label', 'alpha');
|
$search_accountancy_code_end = '';
|
||||||
|
}
|
||||||
|
$search_doc_ref = GETPOST('search_doc_ref', 'alpha');
|
||||||
|
$search_label_operation = GETPOST('search_label_operation', 'alpha');
|
||||||
$search_direction = GETPOST('search_direction', 'alpha');
|
$search_direction = GETPOST('search_direction', 'alpha');
|
||||||
$search_ledger_code = GETPOST('search_ledger_code', 'alpha');
|
$search_ledger_code = GETPOST('search_ledger_code', 'alpha');
|
||||||
|
$search_debit = GETPOST('search_debit', 'alpha');
|
||||||
|
$search_credit = GETPOST('search_credit', 'alpha');
|
||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||||
$sortfield = GETPOST('sortfield', 'alpha');
|
$sortfield = GETPOST('sortfield', 'alpha');
|
||||||
$sortorder = GETPOST('sortorder', 'alpha');
|
$sortorder = GETPOST('sortorder', 'alpha');
|
||||||
$page = GETPOST('page','int');
|
$page = GETPOST('page','int');
|
||||||
if ($page < 0) { $page = 0; }
|
if (empty($page) || $page < 0) { $page = 0; }
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if ($sortorder == "") $sortorder = "ASC";
|
if ($sortorder == "") $sortorder = "ASC";
|
||||||
if ($sortfield == "") $sortfield = "t.rowid";
|
if ($sortfield == "") $sortfield = "t.rowid";
|
||||||
|
|
||||||
if (empty($search_date_start)) $search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
if (empty($search_date_start) && empty($search_date_end)) {
|
||||||
if (empty($search_date_end)) $search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
||||||
|
$sql.= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
|
||||||
|
$sql.= $db->plimit(1);
|
||||||
|
$res = $db->query($sql);
|
||||||
|
|
||||||
|
if ($res->num_rows > 0) {
|
||||||
|
$fiscalYear = $db->fetch_object($res);
|
||||||
|
$search_date_start = strtotime($fiscalYear->date_start);
|
||||||
|
$search_date_end = strtotime($fiscalYear->date_end);
|
||||||
|
} else {
|
||||||
|
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||||
|
$year_start = dol_print_date(dol_now(), '%Y');
|
||||||
|
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||||
|
$year_end = $year_start + 1;
|
||||||
|
$month_end = $month_start - 1;
|
||||||
|
if ($month_end < 1)
|
||||||
|
{
|
||||||
|
$month_end = 12;
|
||||||
|
$year_end--;
|
||||||
|
}
|
||||||
|
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||||
|
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$object = new BookKeeping($db);
|
$object = new BookKeeping($db);
|
||||||
|
|
||||||
|
|
||||||
$options = '';
|
|
||||||
$filter = array ();
|
|
||||||
|
|
||||||
if (! empty($search_date_start)) {
|
|
||||||
$filter['t.doc_date>='] = $search_date_start;
|
|
||||||
$options .= '&date_startmonth=' . GETPOST('date_startmonth', 'int') . '&date_startday=' . GETPOST('date_startday', 'int') . '&date_startyear=' . GETPOST('date_startyear', 'int');
|
|
||||||
}
|
|
||||||
if (! empty($search_date_end)) {
|
|
||||||
$filter['t.doc_date<='] = $search_date_end;
|
|
||||||
$options .= '&date_endmonth=' . GETPOST('date_endmonth', 'int') . '&date_endday=' . GETPOST('date_endday', 'int') . '&date_endyear=' . GETPOST('date_endyear', 'int');
|
|
||||||
}
|
|
||||||
if (! empty($search_doc_date)) {
|
|
||||||
$filter['t.doc_date'] = $search_doc_date;
|
|
||||||
$options .= '&doc_datemonth=' . GETPOST('doc_datemonth', 'int') . '&doc_dateday=' . GETPOST('doc_dateday', 'int') . '&doc_dateyear=' . GETPOST('doc_dateyear', 'int');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (! GETPOST('button_removefilter_x','alpha') && ! GETPOST('button_removefilter.x','alpha') && ! GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
|
||||||
{
|
|
||||||
if (! empty($search_accountancy_code_start)) {
|
|
||||||
$filter['t.numero_compte'] = $search_accountancy_code_start;
|
|
||||||
$options .= '&search_accountancy_code_start=' . $search_accountancy_code_start;
|
|
||||||
}
|
|
||||||
if (! empty($search_label_account)) {
|
|
||||||
$filter['t.label_operation'] = $search_label_account;
|
|
||||||
$options .= '&search_label_account=' . $search_label_account;
|
|
||||||
}
|
|
||||||
if (! empty($search_mvt_label)) {
|
|
||||||
$filter['t.label_operation'] = $search_mvt_label;
|
|
||||||
$options .= '&search_mvt_label=' . $search_mvt_label;
|
|
||||||
}
|
|
||||||
if (! empty($search_direction)) {
|
|
||||||
$filter['t.sens'] = $search_direction;
|
|
||||||
$options .= '&search_direction=' . $search_direction;
|
|
||||||
}
|
|
||||||
if (! empty($search_ledger_code)) {
|
|
||||||
$filter['t.code_journal'] = $search_ledger_code;
|
|
||||||
$options .= '&search_ledger_code=' . $search_ledger_code;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_doc_date = '';
|
$search_doc_date = '';
|
||||||
$search_accountancy_code = '';
|
$search_accountancy_code = '';
|
||||||
$search_accountancy_code_start = '';
|
$search_accountancy_code_start = '';
|
||||||
$search_label_account = '';
|
$search_accountancy_code_end = '';
|
||||||
$search_mvt_label = '';
|
$search_label_account = '';
|
||||||
|
$search_doc_ref = '';
|
||||||
|
$search_label_operation = '';
|
||||||
$search_direction = '';
|
$search_direction = '';
|
||||||
$search_ledger_code = '';
|
$search_ledger_code = '';
|
||||||
|
$search_date_start='';
|
||||||
|
$search_date_end='';
|
||||||
|
$search_date_startyear='';
|
||||||
|
$search_date_startmonth='';
|
||||||
|
$search_date_startday='';
|
||||||
|
$search_date_endyear='';
|
||||||
|
$search_date_endmonth='';
|
||||||
|
$search_date_endday='';
|
||||||
|
$search_debit = '';
|
||||||
|
$search_credit = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Must be after the remove filter action, before the export.
|
||||||
|
$param = '';
|
||||||
|
$filter = array ();
|
||||||
|
|
||||||
|
if (! empty($search_date_start)) {
|
||||||
|
$filter['t.doc_date>='] = $search_date_start;
|
||||||
|
$param .= '&search_date_startmonth=' . GETPOST('search_date_startmonth', 'int') . '&search_date_startday=' . GETPOST('search_date_startday', 'int') . '&search_date_startyear=' . GETPOST('search_date_startyear', 'int');
|
||||||
|
}
|
||||||
|
if (! empty($search_date_end)) {
|
||||||
|
$filter['t.doc_date<='] = $search_date_end;
|
||||||
|
$param .= '&search_date_endmonth=' . GETPOST('search_date_endmonth', 'int') . '&search_date_endday=' . GETPOST('search_date_endday', 'int') . '&search_date_endyear=' . GETPOST('search_date_endyear', 'int');
|
||||||
|
}
|
||||||
|
if (! empty($search_doc_date)) {
|
||||||
|
$filter['t.doc_date'] = $search_doc_date;
|
||||||
|
$param .= '&doc_datemonth=' . GETPOST('doc_datemonth', 'int') . '&doc_dateday=' . GETPOST('doc_dateday', 'int') . '&doc_dateyear=' . GETPOST('doc_dateyear', 'int');
|
||||||
|
}
|
||||||
|
if (! empty($search_accountancy_code_start)) {
|
||||||
|
$filter['t.numero_compte>='] = $search_accountancy_code_start;
|
||||||
|
$param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start);
|
||||||
|
}
|
||||||
|
if (! empty($search_accountancy_code_end)) {
|
||||||
|
$filter['t.numero_compte<='] = $search_accountancy_code_end;
|
||||||
|
$param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end);
|
||||||
|
}
|
||||||
|
if (! empty($search_label_account)) {
|
||||||
|
$filter['t.label_compte'] = $search_label_account;
|
||||||
|
$param .= '&search_label_compte=' . urlencode($search_label_account);
|
||||||
|
}
|
||||||
|
if (! empty($search_doc_ref)) {
|
||||||
|
$filter['t.doc_ref'] = $search_doc_ref;
|
||||||
|
$param .= '&search_doc_ref=' . urlencode($search_doc_ref);
|
||||||
|
}
|
||||||
|
if (! empty($search_label_operation)) {
|
||||||
|
$filter['t.label_operation'] = $search_label_operation;
|
||||||
|
$param .= '&search_label_operation=' . urlencode($search_label_operation);
|
||||||
|
}
|
||||||
|
if (! empty($search_direction)) {
|
||||||
|
$filter['t.sens'] = $search_direction;
|
||||||
|
$param .= '&search_direction=' . urlencode($search_direction);
|
||||||
|
}
|
||||||
|
if (! empty($search_ledger_code)) {
|
||||||
|
$filter['t.code_journal'] = $search_ledger_code;
|
||||||
|
$param .= '&search_ledger_code=' . urlencode($search_ledger_code);
|
||||||
|
}
|
||||||
|
if (! empty($search_debit)) {
|
||||||
|
$filter['t.debit'] = $search_debit;
|
||||||
|
$param .= '&search_debit=' . urlencode($search_debit);
|
||||||
|
}
|
||||||
|
if (! empty($search_credit)) {
|
||||||
|
$filter['t.credit'] = $search_credit;
|
||||||
|
$param .= '&search_credit=' . urlencode($search_credit);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($action == 'delmouvconfirm') {
|
if ($action == 'delmouvconfirm') {
|
||||||
|
|
||||||
$mvt_num = GETPOST('mvt_num', 'int');
|
$mvt_num = GETPOST('mvt_num', 'int');
|
||||||
@ -155,10 +202,11 @@ $formaccounting = new FormAccounting($db);
|
|||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$title_page = $langs->trans("Bookkeeping") . ' ' . strtolower($langs->trans("By")) . ' ' . $langs->trans("AccountAccounting");
|
$title_page = $langs->trans("Bookkeeping") . ' ' . strtolower($langs->trans("By")) . ' ' . strtolower($langs->trans("AccountAccounting"));
|
||||||
|
|
||||||
llxHeader('', $title_page);
|
llxHeader('', $title_page);
|
||||||
|
|
||||||
|
|
||||||
// List
|
// List
|
||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||||
@ -169,6 +217,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter);
|
$result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter);
|
||||||
|
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
@ -177,7 +226,7 @@ $num=count($object->lines);
|
|||||||
|
|
||||||
|
|
||||||
if ($action == 'delmouv') {
|
if ($action == 'delmouv') {
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1);
|
||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
}
|
}
|
||||||
if ($action == 'delbookkeepingyear') {
|
if ($action == 'delbookkeepingyear') {
|
||||||
@ -203,41 +252,50 @@ if ($action == 'delbookkeepingyear') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||||
|
|
||||||
$viewflat = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">' . $langs->trans("ViewFlatList") . '</a>';
|
$viewflat = ' <a class="nohover marginrightonly" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param.'">' . $langs->trans("ViewFlatList") . '</a>';
|
||||||
|
$newcardbutton = '<a class="butActionNew" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt");
|
||||||
|
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
|
||||||
|
$newcardbutton.= '</a>';
|
||||||
|
|
||||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords,'title_accountancy',0,$viewflat,'',$limit);
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||||
|
|
||||||
|
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $viewflat.$newcardbutton, '', $limit);
|
||||||
|
|
||||||
// Reverse sort order
|
// Reverse sort order
|
||||||
if ( preg_match('/^asc/i', $sortorder) )
|
if ( preg_match('/^asc/i', $sortorder) )
|
||||||
$sortorder = "asc";
|
$sortorder = "asc";
|
||||||
else
|
else
|
||||||
$sortorder = "desc";
|
$sortorder = "desc";
|
||||||
|
|
||||||
print '<div class="tabsAction tabsActionNoBottom">' . "\n";
|
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre">' . $object->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '') . '</td>';
|
print '<td class="liste_titre">';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('From').' ';
|
||||||
|
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, 'maxwidth200');
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to').' ';
|
||||||
|
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, 'maxwidth200');
|
||||||
|
print '</div>';
|
||||||
|
print '</td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
print $langs->trans('From') . ': ';
|
print $langs->trans('From') . ': ';
|
||||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
print $form->select_date($search_date_start, 'search_date_start', 0, 0, 1);
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print $langs->trans('to') . ': ';
|
print $langs->trans('to') . ': ';
|
||||||
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
print $form->select_date($search_date_end, 'search_date_end', 0, 0, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/></td>';
|
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_doc_ref" value="' . dol_escape_htmltag($search_doc_ref) . '"/></td>';
|
||||||
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_account" value="' . $search_label_account . '"/></td>';
|
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_operation" value="' . dol_escape_htmltag($search_label_operation) . '"/></td>';
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre" align="right"><input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).'"></td>';
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre" align="right"><input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'"></td>';
|
||||||
print '<td class="liste_titre" align="center"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
print '<td class="liste_titre" align="center"><input type="text" name="search_ledger_code" size="3" value="' . dol_escape_htmltag($search_ledger_code) . '"></td>';
|
||||||
print '<td class="liste_titre" align="right" colspan="2">';
|
print '<td class="liste_titre" align="right" colspan="2">';
|
||||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||||
print $searchpicto;
|
print $searchpicto;
|
||||||
@ -245,14 +303,14 @@ print '</td>';
|
|||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF']);
|
print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF']);
|
||||||
print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $options, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
|
print_liste_field_titre("Piece", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Label");
|
print_liste_field_titre("Label");
|
||||||
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -272,34 +330,34 @@ while ($i < min($num, $limit))
|
|||||||
$total_debit += $line->debit;
|
$total_debit += $line->debit;
|
||||||
$total_credit += $line->credit;
|
$total_credit += $line->credit;
|
||||||
|
|
||||||
$accountg = length_accountg($line->numero_compte);
|
$accountg = length_accountg($line->numero_compte);
|
||||||
//if (empty($accountg)) $accountg = '-';
|
//if (empty($accountg)) $accountg = '-';
|
||||||
|
|
||||||
// Is it a break ?
|
// Is it a break ?
|
||||||
if ($accountg != $displayed_account_number || ! isset($displayed_account_number)) {
|
if ($accountg != $displayed_account_number || ! isset($displayed_account_number)) {
|
||||||
|
|
||||||
// Affiche un Sous-Total par compte comptable
|
// Affiche un Sous-Total par compte comptable
|
||||||
if (isset($displayed_account_number)) {
|
if (isset($displayed_account_number)) {
|
||||||
print '<tr class="liste_total"><td align="right" colspan="5">'.$langs->trans("SubTotal").':</td><td class="nowrap" align="right">'.price($sous_total_debit).'</td><td class="nowrap" align="right">'.price($sous_total_credit).'</td>';
|
print '<tr class="liste_total"><td align="right" colspan="5">'.$langs->trans("SubTotal").':</td><td class="nowrap" align="right">'.price($sous_total_debit).'</td><td class="nowrap" align="right">'.price($sous_total_credit).'</td>';
|
||||||
print "<td> </td>\n";
|
print "<td> </td>\n";
|
||||||
print "<td> </td>\n";
|
print "<td> </td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show the break account
|
// Show the break account
|
||||||
$colspan = 9;
|
$colspan = 9;
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td colspan="'.$colspan.'" style="font-weight:bold; border-bottom: 1pt solid black;">';
|
print '<td colspan="'.$colspan.'" style="font-weight:bold; border-bottom: 1pt solid black;">';
|
||||||
if (! empty($line->numero_compte) && $line->numero_compte != '-1') print length_accountg($line->numero_compte) . ' : ' . $object->get_compte_desc($line->numero_compte);
|
if (! empty($line->numero_compte) && $line->numero_compte != '-1') print length_accountg($line->numero_compte) . ' : ' . $object->get_compte_desc($line->numero_compte);
|
||||||
else print '<span class="error">'.$langs->trans("Unknown").'</span>';
|
else print '<span class="error">'.$langs->trans("Unknown").'</span>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$displayed_account_number = $accountg;
|
$displayed_account_number = $accountg;
|
||||||
//if (empty($displayed_account_number)) $displayed_account_number='-';
|
//if (empty($displayed_account_number)) $displayed_account_number='-';
|
||||||
$sous_total_debit = 0;
|
$sous_total_debit = 0;
|
||||||
$sous_total_credit = 0;
|
$sous_total_credit = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
@ -308,22 +366,27 @@ while ($i < min($num, $limit))
|
|||||||
|
|
||||||
// TODO Add a link according to doc_type and fk_doc
|
// TODO Add a link according to doc_type and fk_doc
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
//if ($line->doc_type == 'supplier_invoice')
|
//if ($line->doc_type == 'supplier_invoice')
|
||||||
//if ($line->doc_type == 'customer_invoice')
|
//if ($line->doc_type == 'customer_invoice')
|
||||||
print $line->doc_ref;
|
print $line->doc_ref;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Affiche un lien vers la facture client/fournisseur
|
// Affiche un lien vers la facture client/fournisseur
|
||||||
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
|
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
|
||||||
print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>' . $line->label_operation . '</td>' : '<td>' . $line->label_operation . '<br /><span style="font-size:0.8em">(' . length_accounta($line->subledger_account) . ')</span></td>';
|
print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>' . $line->label_operation . '</td>' : '<td>' . $line->label_operation . '<br><span style="font-size:0.8em">(' . length_accounta($line->subledger_account) . ')</span></td>';
|
||||||
|
|
||||||
|
|
||||||
print '<td align="right">' . ($line->debit ? price($line->debit) :''). '</td>';
|
print '<td align="right">' . ($line->debit ? price($line->debit) :''). '</td>';
|
||||||
print '<td align="right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
print '<td align="right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
||||||
print '<td align="center">' . $line->code_journal . '</td>';
|
|
||||||
|
$accountingjournal = new AccountingJournal($db);
|
||||||
|
$result = $accountingjournal->fetch('',$line->code_journal);
|
||||||
|
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0,0,0,'',0) : $line->code_journal);
|
||||||
|
print '<td align="center">' . $journaltoshow . '</td>';
|
||||||
|
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a> ';
|
print '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a> ';
|
||||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $options . '&page=' . $page . '">' . img_delete() . '</a>';
|
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . '">' . img_delete() . '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|||||||
@ -1,295 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
|
||||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file htdocs/accountancy/bookkeeping/listbyyear.php
|
|
||||||
* \ingroup Advanced accountancy
|
|
||||||
* \brief Book keeping by year
|
|
||||||
*/
|
|
||||||
require '../../main.inc.php';
|
|
||||||
|
|
||||||
// Class
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
|
||||||
|
|
||||||
// Langs
|
|
||||||
$langs->load("accountancy");
|
|
||||||
|
|
||||||
$page = GETPOST("page");
|
|
||||||
$sortorder = GETPOST("sortorder");
|
|
||||||
$sortfield = GETPOST("sortfield");
|
|
||||||
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
|
||||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
|
||||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
|
||||||
$search_doc_type = GETPOST('search_doc_type', 'alpha');
|
|
||||||
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
|
|
||||||
$search_doc_ref = GETPOST('search_doc_ref', 'alpha');
|
|
||||||
$search_numero_compte = GETPOST('search_numero_compte', 'alpha');
|
|
||||||
$search_numero_compte_start = GETPOST('search_numero_compte_start', 'alpha');
|
|
||||||
if ($search_numero_compte_start == - 1) {
|
|
||||||
$search_numero_compte_start = '';
|
|
||||||
}
|
|
||||||
$search_numero_compte_end = GETPOST('search_numero_compte_end', 'alpha');
|
|
||||||
if ($search_numero_compte_end == - 1) {
|
|
||||||
$search_numero_compte_end = '';
|
|
||||||
}
|
|
||||||
$search_subledger_account = GETPOST('search_subledger_account', 'alpha');
|
|
||||||
$search_subledger_account_start = GETPOST('search_subledger_account_start', 'alpha');
|
|
||||||
if ($search_subledger_account_start == - 1) {
|
|
||||||
$search_subledger_account_start = '';
|
|
||||||
}
|
|
||||||
$search_subledger_account_end = GETPOST('search_subledger_account_end', 'alpha');
|
|
||||||
if ($search_subledger_account_end == - 1) {
|
|
||||||
$search_subledger_account_end = '';
|
|
||||||
}
|
|
||||||
$search_label_operation = GETPOST('search_label_operation', 'alpha');
|
|
||||||
$search_sens = GETPOST('search_sens', 'alpha');
|
|
||||||
$search_code_journal = GETPOST('search_code_journal', 'alpha');
|
|
||||||
|
|
||||||
$object = new BookKeeping($db);
|
|
||||||
$form = new Form($db);
|
|
||||||
$formaccounting = new FormAccounting($db);
|
|
||||||
|
|
||||||
// Filter
|
|
||||||
if (empty($search_date_start)) {
|
|
||||||
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
|
||||||
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
|
||||||
}
|
|
||||||
if ($sortorder == "")
|
|
||||||
$sortorder = "ASC";
|
|
||||||
if ($sortfield == "")
|
|
||||||
$sortfield = "t.rowid";
|
|
||||||
|
|
||||||
$offset = $limit * $page;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Actions
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
|
||||||
{
|
|
||||||
$search_doc_type = "";
|
|
||||||
$search_doc_date = "";
|
|
||||||
$search_doc_ref = "";
|
|
||||||
$search_numero_compte = "";
|
|
||||||
$search_subledger_account = "";
|
|
||||||
$search_label_operation = "";
|
|
||||||
$search_sens = "";
|
|
||||||
$search_code_journal = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
$options = '';
|
|
||||||
$filter = array ();
|
|
||||||
if (! empty($search_date_start)) {
|
|
||||||
$filter['t.doc_date>='] = $search_date_start;
|
|
||||||
$options .= '&date_startmonth=' . GETPOST('date_startmonth', 'int') . '&date_startday=' . GETPOST('date_startday', 'int') . '&date_startyear=' . GETPOST('date_startyear', 'int');
|
|
||||||
}
|
|
||||||
if (! empty($search_date_end)) {
|
|
||||||
$filter['t.doc_date<='] = $search_date_end;
|
|
||||||
$options .= '&date_endmonth=' . GETPOST('date_endmonth', 'int') . '&date_endday=' . GETPOST('date_endday', 'int') . '&date_endyear=' . GETPOST('date_endyear', 'int');
|
|
||||||
}
|
|
||||||
if (! empty($search_doc_type)) {
|
|
||||||
$filter['t.doc_type'] = $search_doc_type;
|
|
||||||
$options .= '&search_doc_type=' . $search_doc_type;
|
|
||||||
}
|
|
||||||
if (! empty($search_doc_date)) {
|
|
||||||
$filter['t.doc_date'] = $search_doc_date;
|
|
||||||
$options .= '&doc_datemonth=' . GETPOST('doc_datemonth', 'int') . '&doc_dateday=' . GETPOST('doc_dateday', 'int') . '&doc_dateyear=' . GETPOST('doc_dateyear', 'int');
|
|
||||||
}
|
|
||||||
if (! empty($search_doc_ref)) {
|
|
||||||
$filter['t.doc_ref'] = $search_doc_ref;
|
|
||||||
$options .= '&search_doc_ref=' . $search_doc_ref;
|
|
||||||
}
|
|
||||||
if (! empty($search_numero_compte)) {
|
|
||||||
$filter['t.numero_compte'] = $search_numero_compte;
|
|
||||||
$options .= '&search_numero_compte=' . $search_numero_compte;
|
|
||||||
}
|
|
||||||
if (! empty($search_numero_compte_start)) {
|
|
||||||
$filter['t.numero_compte>='] = $search_numero_compte_start;
|
|
||||||
$options .= '&search_numero_compte_start=' . $search_numero_compte_start;
|
|
||||||
}
|
|
||||||
if (! empty($search_numero_compte_end)) {
|
|
||||||
$filter['t.numero_compte<='] = $search_numero_compte_end;
|
|
||||||
$options .= '&search_numero_compte_end=' . $search_numero_compte_end;
|
|
||||||
}
|
|
||||||
if (! empty($search_subledger_account)) {
|
|
||||||
$filter['t.subledger_account'] = $search_subledger_account;
|
|
||||||
$options .= '&search_subledger_account=' . $search_subledger_account;
|
|
||||||
}
|
|
||||||
if (! empty($search_subledger_account_start)) {
|
|
||||||
$filter['t.subledger_account>='] = $search_subledger_account_start;
|
|
||||||
$options .= '&search_subledger_account_start=' . $search_subledger_account_start;
|
|
||||||
}
|
|
||||||
if (! empty($search_subledger_account_end)) {
|
|
||||||
$filter['t.subledger_account<='] = $search_subledger_account_end;
|
|
||||||
$options .= '&search_subledger_account_end=' . $search_subledger_account_end;
|
|
||||||
}
|
|
||||||
if (! empty($search_label_operation)) {
|
|
||||||
$filter['t.label_operation'] = $search_label_operation;
|
|
||||||
$options .= '&search_label_operation=' . $search_label_operation;
|
|
||||||
}
|
|
||||||
if (! empty($search_sens)) {
|
|
||||||
$filter['t.sens'] = $search_sens;
|
|
||||||
$options .= '&search_sens=' . $search_sens;
|
|
||||||
}
|
|
||||||
if (! empty($search_code_journal)) {
|
|
||||||
$filter['t.code_journal'] = $search_code_journal;
|
|
||||||
$options .= '&search_code_journal=' . $search_code_journal;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Actions
|
|
||||||
*/
|
|
||||||
|
|
||||||
llxHeader('', $langs->trans("Bookkeeping"));
|
|
||||||
|
|
||||||
$nbtotalofrecords = '';
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
|
||||||
$nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0);
|
|
||||||
if ($nbtotalofrecords < 0) {
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter);
|
|
||||||
if ($result < 0) {
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
}
|
|
||||||
|
|
||||||
print_barre_liste($langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end), $page, $_SERVER['PHP_SELF'], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy');
|
|
||||||
|
|
||||||
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
|
||||||
print '<div class="liste_titre">';
|
|
||||||
print $langs->trans('DateStart') . ': ';
|
|
||||||
print $form->select_date($search_date_start, 'date_start');
|
|
||||||
print $langs->trans('DateEnd') . ': ';
|
|
||||||
print $form->select_date($search_date_end, 'date_end');
|
|
||||||
print '</div>';
|
|
||||||
print '<div class="liste_titre">';
|
|
||||||
print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': ';
|
|
||||||
print $formaccounting->select_account($search_numero_compte_start, 'search_numero_compte_start', 1, array (), 1, 1, '');
|
|
||||||
print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': ';
|
|
||||||
print $formaccounting->select_account($search_numero_compte_end, 'search_numero_compte_end', 1, array (), 1, 1, '');
|
|
||||||
print '</div>';
|
|
||||||
print '<div class="liste_titre">';
|
|
||||||
print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
|
|
||||||
print $formaccounting->select_auxaccount($search_subledger_account_start, 'search_subledger_account_start', 1);
|
|
||||||
print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
|
|
||||||
print $formaccounting->select_auxaccount($search_subledger_account_end, 'search_subledger_account_end', 1);
|
|
||||||
print '</div>';
|
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print_liste_field_titre("NumPiece", $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Doctype", $_SERVER['PHP_SELF'], "t.doc_type", "", $options, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Date", $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("ThirdPartyAccount", $_SERVER['PHP_SELF'], "t.subledger_account", "", $options, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="center"', $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Amount", $_SERVER['PHP_SELF'], "t.montant", "", $options, 'align="center"', $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Sens", $_SERVER['PHP_SELF'], "t.sens", "", $options, 'align="center"', $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print '<input type="text" size=4 class="flat" name="search_piece_num" value="' . $search_piece_num . '"/>';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print '<input type="text" size=7 class="flat" name="search_doc_type" value="' . $search_doc_type . '"/>';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print $form->select_date($search_doc_date, 'doc_date', 0, 0, 1);
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print '<input type="text" size=6 class="flat" name="search_doc_ref" value="' . $search_doc_ref . '"/>';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print '<input type="text" size=6 class="flat" name="search_numero_compte" value="' . $search_numero_compte . '"/>';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print '<input type="text" size=6 class="flat" name="search_subledger_account" value="' . $search_subledger_account . '"/>';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print '<input type="text" size=6 class="flat" name="search_label_operation" value="' . $search_label_operation . '"/>';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td class="liste_titre" align="center">';
|
|
||||||
print '<input type="text" size=2 class="flat" name="search_sens" value="' . $search_sens . '"/>';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td class="liste_titre" align="center">';
|
|
||||||
print '<input type="text" size=3 class="flat" name="search_code_journal" value="' . $search_code_journal . '"/>';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print '<td align="right" colspan="2" class="liste_titre">';
|
|
||||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
|
|
||||||
print ' ';
|
|
||||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
foreach ( $object->lines as $line ) {
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print '<td>' . $line->piece_num . '</td>' . "\n";
|
|
||||||
print '<td>' . $line->doc_type . '</td>' . "\n";
|
|
||||||
print '<td align="center">' . dol_print_date($line->doc_date) . '</td>';
|
|
||||||
print '<td>' . $line->doc_ref . '</td>';
|
|
||||||
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
|
||||||
print '<td>' . length_accounta($line->subledger_account) . '</td>';
|
|
||||||
print '<td>' . $line->label_operation . '</td>';
|
|
||||||
print '<td align="right">' . price($line->debit) . '</td>';
|
|
||||||
print '<td align="right">' . price($line->credit) . '</td>';
|
|
||||||
print '<td align="right">' . price($line->montant) . '</td>';
|
|
||||||
print '<td align="center">' . $line->sens . '</td>';
|
|
||||||
print '<td align="right">' . $line->code_journal . '</td>';
|
|
||||||
print '<td align="center"><a href="./card.php?action=update&piece_num=' . $line->piece_num . '">' . img_edit() . '</a></td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
|
||||||
print "</table>";
|
|
||||||
print '</form>';
|
|
||||||
|
|
||||||
llxFooter();
|
|
||||||
$db->close();
|
|
||||||
@ -21,11 +21,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file accounting/bookkeeping/thirdparty_lettrage.php
|
* \file accounting/bookkeeping/thirdparty_lettrage.php
|
||||||
* \ingroup Accounting Expert
|
* \ingroup Advanced accountancy
|
||||||
* \brief Onglet de gestion de parametrages des ventilations
|
* \brief Onglet de gestion de parametrages des ventilations
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
@ -34,296 +33,287 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||||
|
|
||||||
$action=GETPOST('action','aZ09');
|
$langs->loadLangs(array("compta"));
|
||||||
$massaction=GETPOST('massaction','alpha');
|
|
||||||
$show_files=GETPOST('show_files','int');
|
$action = GETPOST('action', 'aZ09');
|
||||||
$confirm=GETPOST('confirm','alpha');
|
$massaction = GETPOST('massaction', 'alpha');
|
||||||
|
$show_files = GETPOST('show_files', 'int');
|
||||||
|
$confirm = GETPOST('confirm', 'alpha');
|
||||||
$toselect = GETPOST('toselect', 'array');
|
$toselect = GETPOST('toselect', 'array');
|
||||||
|
|
||||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page", 'int');
|
||||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
if (empty($page) || $page == - 1) {
|
||||||
|
$page = 0;
|
||||||
|
} // If $page is not defined, or '' or -1
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if ($sortorder == "") $sortorder = "ASC";
|
if ($sortorder == "")
|
||||||
if ($sortfield == "") $sortfield = "bk.rowid";
|
$sortorder = "DESC";
|
||||||
|
if ($sortfield == "")
|
||||||
|
$sortfield = "bk.doc_date";
|
||||||
|
|
||||||
$search_year = GETPOST ( "search_year" );
|
$search_year = GETPOST("search_year", 'int');
|
||||||
|
$search_doc_type = GETPOST("search_doc_type", 'alpha');
|
||||||
|
$search_doc_ref = GETPOST("search_doc_ref", 'alpha');
|
||||||
|
|
||||||
|
$lettering = GETPOST('lettering');
|
||||||
|
if (! empty($lettering)) {
|
||||||
|
$action = $lettering;
|
||||||
|
}
|
||||||
|
$toselect = GETPOST('toselect', 'array');
|
||||||
|
|
||||||
|
// Did we click on purge search criteria ?
|
||||||
|
// All tests are required to be compatible with all browsers
|
||||||
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||||
|
$search_year = '';
|
||||||
|
$search_doc_type = '';
|
||||||
|
$search_doc_ref = '';
|
||||||
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST("socid",'int');
|
$socid = GETPOST("socid", 'int');
|
||||||
// if ($user->societe_id) $socid=$user->societe_id;
|
// if ($user->societe_id) $socid=$user->societe_id;
|
||||||
|
|
||||||
$object = new Societe($db);
|
$object = new Societe($db);
|
||||||
$object->id = $socid;
|
$object->id = $socid;
|
||||||
$object->fetch($socid);
|
$result = $object->fetch($socid);
|
||||||
|
if ($result < 0) {
|
||||||
|
setEventMessage($object->error, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$BookKeeping = new lettering($db);
|
$BookKeeping = new lettering($db);
|
||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'lettering') {
|
if ($action == 'lettering') {
|
||||||
|
|
||||||
$result = $BookKeeping->updatelettrage($_POST['ids']);
|
$result = $BookKeeping->updateLettrage($toselect);
|
||||||
|
|
||||||
// var_dump($result);
|
|
||||||
if( $result < 0 ){
|
|
||||||
setEventMessages('', $BookKeeping->errors, 'errors' );
|
|
||||||
$error++;
|
|
||||||
|
|
||||||
|
if ($result < 0) {
|
||||||
|
setEventMessages('', $BookKeeping->errors, 'errors');
|
||||||
|
$error ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'autolettrage') {
|
if ($action == 'autolettrage') {
|
||||||
|
|
||||||
$result = $BookKeeping->LettrageTiers($socid);
|
$result = $BookKeeping->lettrageTiers($socid);
|
||||||
|
|
||||||
if( $result < 0 ){
|
|
||||||
setEventMessages('', $BookKeeping->errors, 'errors' );
|
|
||||||
$error++;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if ($result < 0) {
|
||||||
|
setEventMessages('', $BookKeeping->errors, 'errors');
|
||||||
|
$error ++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
llxHeader('', 'Compta - Grand Livre');
|
||||||
|
|
||||||
llxHeader ( '', 'Compta - Grand Livre' );
|
/*
|
||||||
|
* Affichage onglets
|
||||||
|
*/
|
||||||
|
$head = societe_prepare_head($object);
|
||||||
|
|
||||||
|
dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error');
|
||||||
|
|
||||||
/*
|
dol_fiche_head($head, 'accounting', $langs->trans("ThirdParty"), 0, 'company');
|
||||||
* Affichage onglets
|
|
||||||
*/
|
|
||||||
$head = societe_prepare_head($object);
|
|
||||||
|
|
||||||
dol_htmloutput_mesg(is_numeric($error)?'':$error, $errors, 'error');
|
print '<table width="100%" class="border">';
|
||||||
|
print '<tr><td width="30%">' . $langs->trans("ThirdPartyName") . '</td><td width="70%" colspan="3">';
|
||||||
|
$object->next_prev_filter = "te.fournisseur = 1";
|
||||||
|
print $form->showrefnav($object, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom', '', '');
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
dol_fiche_head($head, 'TabAccounting', $langs->trans("ThirdParty"),0,'company');
|
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||||
|
{
|
||||||
|
print '<tr><td>' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<tr>';
|
||||||
|
print '<td class="nowrap">' . $langs->trans("CustomerCode") . '</td><td colspan="3">';
|
||||||
|
print $object->code_client;
|
||||||
|
if ($object->check_codeclient() != 0)
|
||||||
|
print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>';
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '<tr>';
|
||||||
|
print '<td>';
|
||||||
|
print $form->editfieldkey("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta, $object, $user->rights->societe->creer);
|
||||||
|
print '</td><td colspan="3">';
|
||||||
|
print $form->editfieldval("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta, $object, $user->rights->societe->creer);
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Address
|
||||||
|
print '<tr><td valign="top">' . $langs->trans("Address") . '</td><td colspan="3">';
|
||||||
|
dol_print_address($object->address, 'gmap', 'thirdparty', $object->id);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<table width="100%" class="border">';
|
// Zip / Town
|
||||||
print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td><td width="70%" colspan="3">';
|
print '<tr><td class="nowrap">' . $langs->trans("Zip") . ' / ' . $langs->trans("Town") . '</td><td colspan="3">' . $object->zip . (($object->zip && $object->town) ? ' / ' : '') . $object->town . '</td>';
|
||||||
$object->next_prev_filter="te.fournisseur = 1";
|
print '</tr>';
|
||||||
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
// Country
|
||||||
{
|
print '<tr><td>' . $langs->trans("Country") . '</td><td colspan="3">';
|
||||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
|
// $img=picto_from_langcode($object->country_code);
|
||||||
}
|
$img = '';
|
||||||
|
if ($object->isInEEC())
|
||||||
|
print $form->textwithpicto(($img ? $img . ' ' : '') . $object->country, $langs->trans("CountryIsInEEC"), 1, 0);
|
||||||
|
else
|
||||||
|
print ($img ? $img . ' ' : '') . $object->country;
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
print '<tr>';
|
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
|
||||||
print '<td class="nowrap">'.$langs->trans("CustomerCode"). '</td><td colspan="3">';
|
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
|
||||||
print $object->code_client;
|
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
||||||
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||||
print '</td>';
|
$sql .= " WHERE (bk.subledger_account = '" . $object->code_compta . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . "' )";
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
$langs->load('compta');
|
if (dol_strlen($search_year)) {
|
||||||
print '<tr>';
|
$date_start = dol_mktime(0, 0, 0, 1, 1, $search_year);
|
||||||
print '<td>';
|
$date_end = dol_mktime(23, 59, 59, 12, 31, $search_year);
|
||||||
print $form->editfieldkey("CustomerAccountancyCode",'customeraccountancycode',$object->code_compta,$object,$user->rights->societe->creer);
|
$sql .= " AND ( bk.doc_date BETWEEN '" . $db->idate($date_start) . "' AND '" . $db->idate($date_end) . "' )";
|
||||||
print '</td><td colspan="3">';
|
}
|
||||||
print $form->editfieldval("CustomerAccountancyCode",'customeraccountancycode',$object->code_compta,$object,$user->rights->societe->creer);
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
// Address
|
$debit = 0;
|
||||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">';
|
$credit = 0;
|
||||||
dol_print_address($object->address,'gmap','thirdparty',$object->id);
|
$solde = 0;
|
||||||
print '</td></tr>';
|
// Count total nb of records and calc total sum
|
||||||
|
$nbtotalofrecords = '';
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if (! $resql) {
|
||||||
|
dol_print_error($db);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
$nbtotalofrecords = $db->num_rows($resql);
|
||||||
|
|
||||||
// Zip / Town
|
while ( $obj = $db->fetch_object($resql) ) {
|
||||||
print '<tr><td class="nowrap">'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3">'.$object->zip.(($object->zip && $object->town)?' / ':'').$object->town.'</td>';
|
$debit += $obj->debit;
|
||||||
|
$credit += $obj->credit;
|
||||||
|
|
||||||
|
$solde += ($obj->credit - $obj->debit);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
|
dol_syslog("/accountancy/bookkeeping/thirdparty_lettrage.php", LOG_DEBUG);
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if (! $resql) {
|
||||||
|
dol_print_error($db);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
dol_syslog("/accountancy/bookkeeping/thirdparty_lettrage.php", LOG_DEBUG);
|
||||||
|
if ($resql) {
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '" method="POST">';
|
||||||
|
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
||||||
|
|
||||||
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||||
|
|
||||||
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Docref", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Labelcompte", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "bk.montant", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Sens", $_SERVER["PHP_SELF"], "bk.sens", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Solde", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print '<td></td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||||
|
print '<td><input type="text" name="search_year" value="' . $search_year . '"></td>';
|
||||||
|
print '<td><input type="text" name="search_doc_refe" value="' . $search_doc_ref . '"></td>';
|
||||||
|
print '<td colspan="7"> </td>';
|
||||||
|
print '<td align="right">';
|
||||||
|
$searchpicto = $form->showFilterButtons();
|
||||||
|
print $searchpicto;
|
||||||
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Country
|
$var = false;
|
||||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
$solde = 0;
|
||||||
//$img=picto_from_langcode($object->country_code);
|
$tmp = '';
|
||||||
$img='';
|
while ( $obj = $db->fetch_object($resql) ) {
|
||||||
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
|
|
||||||
else print ($img?$img.' ':'').$object->country;
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print '</table>';
|
if ($tmp != $obj->lettering_code || empty($tmp))
|
||||||
|
$tmp = $obj->lettering_code;
|
||||||
|
|
||||||
|
if ($tmp != $obj->lettering_code || empty($obj->lettering_code))
|
||||||
|
$var = ! $var;
|
||||||
|
|
||||||
|
$solde += ($obj->credit - $obj->debit);
|
||||||
|
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
|
if (empty($obj->lettering_code)) {
|
||||||
|
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||||
|
print img_edit();
|
||||||
|
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
||||||
|
} else
|
||||||
|
print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||||
|
|
||||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
print '<td>' . $obj->doc_ref . '</td>';
|
||||||
$sql .= " WHERE (bk.code_tiers = '" . $object->code_compta . "' AND bk.numero_compte = '" .$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER. "' )" ;
|
print '<td>' . $obj->label_compte . '</td>';
|
||||||
|
print '<td>' . price($obj->debit) . '</td>';
|
||||||
|
print '<td>' . price($obj->credit) . '</td>';
|
||||||
|
print '<td>' . price($obj->montant) . '</td>';
|
||||||
|
print '<td>' . $obj->sens . '</td>';
|
||||||
|
print '<td>' . $obj->code_journal . '</td>';
|
||||||
|
print '<td>' . round($solde, 2) . '</td>';
|
||||||
|
|
||||||
|
if (empty($obj->lettering_code)) {
|
||||||
|
print '<td class="nowrap" align="center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
||||||
|
} else
|
||||||
|
print '<td>' . $obj->lettering_code . '</td>';
|
||||||
|
|
||||||
|
|
||||||
if (dol_strlen ( $search_year )) {
|
|
||||||
$sql .= " AND ( bk.doc_date BETWEEN '" . $search_year . "-0-0' AND '" . ($search_year+1). "-0-0' )";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$sql .= " ORDER BY bk.lettering_code ASC, bk.doc_date ASC" ;//. $db->plimit ( $conf->liste_limit + 1, $offset );
|
|
||||||
|
|
||||||
// echo $sql;
|
|
||||||
// dol_syslog ( "bookkeping:liste:create sql=" . $sql, LOG_DEBUG );
|
|
||||||
$resql = $db->query ( $sql );
|
|
||||||
if ($resql) {
|
|
||||||
$num = $db->num_rows ( $resql );
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
|
|
||||||
print '<form name="add" action="?socid='.$object->id.'" method="POST">';
|
|
||||||
print '<input type="hidden" name="action" value="lettering">';
|
|
||||||
print '<input type="hidden" name="socid" value="'.$object->id.'">';
|
|
||||||
|
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<td></td>';
|
|
||||||
print_liste_field_titre("Doctype", "liste.php", "bk.doc_type" );
|
|
||||||
print_liste_field_titre("Docdate", "liste.php", "bk.doc_date" );
|
|
||||||
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
|
|
||||||
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
|
|
||||||
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
|
|
||||||
print_liste_field_titre("Labelcompte", "liste.php", "bk_label_compte" );
|
|
||||||
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
|
|
||||||
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
|
|
||||||
// print_liste_field_titre("Amount", "liste.php", "bk.montant" );
|
|
||||||
// print_liste_field_titre("Sens", "liste.php", "bk.sens" );
|
|
||||||
print_liste_field_titre("Codejournal", "liste.php", "bk.code_journal" );
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<form action="" method="GET">';
|
|
||||||
print '<input type="hidden" name="socid" value="' . $_GET ["socid"] . '">';
|
|
||||||
print '<td><input type="text" name="search_doc_type" value="' . $_GET ["search_doc_type"] . '"></td>';
|
|
||||||
print '<td><input type="text" name="search_year" value="' . $_GET ["search_year"] . '"></td>';
|
|
||||||
print '<td><input type="text" name="search_doc_refe" value="' . $_GET ["search_doc_ref"] . '"></td>';
|
|
||||||
// print '<td><input type="text" name="search_compte" value="' . $_GET ["search_compte"] . '"></td>';
|
|
||||||
// print '<td><input type="text" name="search_tiers" value="' . $_GET ["search_tiers"] . '"></td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
// print '<td> </td>';
|
|
||||||
// print '<td> </td>';
|
|
||||||
print '<td align="right">';
|
|
||||||
print '<input type="image" class="liste_titre" name="button_search" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" value="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '" title="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '">';
|
|
||||||
print '</td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '</form>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
$var = false;
|
|
||||||
|
|
||||||
$debit = 0;
|
|
||||||
$credit = 0;
|
|
||||||
$solde = 0;
|
|
||||||
$tmp = '';
|
|
||||||
while ( $i < $num ) {
|
|
||||||
$obj = $db->fetch_object ( $resql );
|
|
||||||
|
|
||||||
if($tmp !=$obj->lettering_code || empty($tmp) )
|
|
||||||
$tmp =$obj->lettering_code;
|
|
||||||
|
|
||||||
if($tmp !=$obj->lettering_code || empty($obj->lettering_code))
|
|
||||||
$var = ! $var;
|
|
||||||
|
|
||||||
|
|
||||||
$debit+= $obj->debit;
|
|
||||||
$credit+= $obj->credit;
|
|
||||||
|
|
||||||
$solde+=($obj->credit-$obj->debit);
|
|
||||||
print "<tr $bc[$var]>";
|
|
||||||
|
|
||||||
print '<td>' . $obj->rowid . '</td>';
|
|
||||||
if(empty($obj->lettering_code)){
|
|
||||||
print '<td><a href="'.dol_buildpath('/accountancy/bookkeeping/card.php', 1).'?piece_num=' . $obj->piece_num . '">';
|
|
||||||
print img_edit ();
|
|
||||||
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
print '<td>'.$obj->doc_type . '</td>' . "\n";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '<td>' . dol_print_date ( $db->jdate ( $obj->doc_date ), 'day' ) . '</td>';
|
|
||||||
print '<td>' . $obj->doc_ref . '</td>';
|
|
||||||
// print '<td>' . $obj->numero_compte . '</td>';
|
|
||||||
// print '<td>' . $obj->code_tiers . '</td>';
|
|
||||||
print '<td>' . $obj->label_compte . '</td>';
|
|
||||||
print '<td>' . $obj->debit . '</td>';
|
|
||||||
print '<td>' . $obj->credit . '</td>';
|
|
||||||
// print '<td>' . $obj->montant . '</td>';
|
|
||||||
// print '<td>' . $obj->sens . '</td>';
|
|
||||||
print '<td>' . $obj->code_journal . '</td>';
|
|
||||||
print '<td>' . round($solde, 2) . '</td>';
|
|
||||||
|
|
||||||
if(empty($obj->lettering_code)){
|
|
||||||
print '<td><input type="checkbox" name="ids[]" value="' . $obj->rowid . '" /></td>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
print '<td>' . $obj->lettering_code . '</td>';
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
$i ++;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
|
|
||||||
print '<td colspan="4">Mouvement totaux</td>' . "\n";
|
|
||||||
print '<td></td>';
|
|
||||||
// print '<td></td>';
|
|
||||||
// print '<td></td>';
|
|
||||||
print '<td><strong>' . $debit . '</strong></td>';
|
|
||||||
print '<td><strong>' . $credit . '</strong></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
|
||||||
print '<td colspan="5">Solde Comptable</td>' . "\n";
|
|
||||||
// print '<td></td>';
|
|
||||||
// print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td><strong>' . ($credit-$debit) . '</strong></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
print '<input class="butAction" type="submit" value="lettering">';
|
|
||||||
print '<a class="butAction" href="?socid='.$object->id.'&action=autolettrage">auto lettering</a>';
|
|
||||||
print "</form>";
|
|
||||||
$db->free($resql);
|
|
||||||
} else {
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
|
print '<td colspan="4">Mouvement totaux</td>' . "\n";
|
||||||
|
print '<td><strong>' . price($debit) . '</strong></td>';
|
||||||
|
print '<td><strong>' . price($credit) . '</strong></td>';
|
||||||
|
print '<td colspan="5"></td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
print '<td colspan="9">Solde Comptable</td>' . "\n";
|
||||||
|
print '<td><strong>' . price($credit - $debit) . '</strong></td>';
|
||||||
|
print '<td colspan="5"></td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
|
print '<input class="butAction" type="submit" value="lettering" name="lettering" id="lettering">';
|
||||||
|
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '&action=autolettrage">' . $langs->trans('AccountancyAutoLettering') . '</a>';
|
||||||
|
print "</form>";
|
||||||
|
$db->free($resql);
|
||||||
|
} else {
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -21,9 +21,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file accounting/bookkeeping/thirdparty_lettrage.php
|
* \file accounting/bookkeeping/thirdparty_lettrage.php
|
||||||
* \ingroup Accounting Expert
|
* \ingroup Advanced accountancy
|
||||||
* \brief Onglet de gestion de parametrages des ventilations
|
* \brief Tab to setup lettering
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Dolibarr environment
|
// Dolibarr environment
|
||||||
@ -35,300 +35,305 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||||
|
|
||||||
|
$langs->loadLangs(array("compta"));
|
||||||
|
|
||||||
$action=GETPOST('action','aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
$massaction=GETPOST('massaction','alpha');
|
$massaction = GETPOST('massaction', 'alpha');
|
||||||
$show_files=GETPOST('show_files','int');
|
$show_files = GETPOST('show_files', 'int');
|
||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm = GETPOST('confirm', 'alpha');
|
||||||
$toselect = GETPOST('toselect', 'array');
|
$toselect = GETPOST('toselect', 'array');
|
||||||
|
|
||||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page", 'int');
|
||||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
if (empty($page) || $page == - 1) {
|
||||||
|
$page = 0;
|
||||||
|
} // If $page is not defined, or '' or -1
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if ($sortorder == "") $sortorder = "ASC";
|
if ($sortorder == "")
|
||||||
if ($sortfield == "") $sortfield = "bk.rowid";
|
$sortorder = "DESC";
|
||||||
|
if ($sortfield == "")
|
||||||
|
$sortfield = "bk.doc_date";
|
||||||
|
|
||||||
$search_year = GETPOST ( "search_year" );
|
$search_year = GETPOST("search_year",'int');
|
||||||
|
$search_doc_type = GETPOST("search_doc_type",'alpha');
|
||||||
|
$search_doc_ref = GETPOST("search_doc_ref",'alpha');
|
||||||
|
|
||||||
|
$lettering = GETPOST('lettering');
|
||||||
|
if (!empty($lettering)) {
|
||||||
|
$action=$lettering;
|
||||||
|
}
|
||||||
|
$toselect = GETPOST('toselect','array');
|
||||||
|
|
||||||
|
// Did we click on purge search criteria ?
|
||||||
|
// All tests are required to be compatible with all browsers
|
||||||
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha'))
|
||||||
|
{
|
||||||
|
$search_year='';
|
||||||
|
$search_doc_type='';
|
||||||
|
$search_doc_ref='';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST("socid",'int');
|
$socid = GETPOST("socid", 'int');
|
||||||
// if ($user->societe_id) $socid=$user->societe_id;
|
// if ($user->societe_id) $socid=$user->societe_id;
|
||||||
|
|
||||||
$object = new Societe($db);
|
$object = new Societe($db);
|
||||||
$object->id = $socid;
|
$object->id = $socid;
|
||||||
$object->fetch($socid);
|
$result = $object->fetch($socid);
|
||||||
|
if ($result<0) {
|
||||||
|
setEventMessage($object->error,'errors');
|
||||||
|
}
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$BookKeeping = new lettering($db);
|
$BookKeeping = new lettering($db);
|
||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
if ($action == 'lettering') {
|
if ($action == 'lettering') {
|
||||||
|
|
||||||
$result = $BookKeeping->updatelettrage($_POST['ids']);
|
$result = $BookKeeping->updateLettrage($toselect);
|
||||||
|
|
||||||
// var_dump($result);
|
|
||||||
if( $result < 0 ){
|
|
||||||
setEventMessages('', $BookKeeping->errors, 'errors' );
|
|
||||||
$error++;
|
|
||||||
|
|
||||||
|
// var_dump($result);
|
||||||
|
if ($result < 0) {
|
||||||
|
setEventMessages('', $BookKeeping->errors, 'errors');
|
||||||
|
$error ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'autolettrage') {
|
if ($action == 'autolettrage') {
|
||||||
|
|
||||||
$result = $BookKeeping->LettrageTiers($socid);
|
$result = $BookKeeping->lettrageTiers($socid);
|
||||||
|
|
||||||
if( $result < 0 ){
|
|
||||||
setEventMessages('', $BookKeeping->errors, 'errors' );
|
|
||||||
$error++;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if ($result < 0) {
|
||||||
|
setEventMessages('', $BookKeeping->errors, 'errors');
|
||||||
|
$error ++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$title = 'AccountancyLettrage';
|
||||||
|
|
||||||
llxHeader ( '', 'Compta - Grand Livre' );
|
llxHeader('', $title);
|
||||||
|
|
||||||
|
|
||||||
/*
|
$param='';
|
||||||
* Affichage onglets
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
*/
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
$head = societe_prepare_head($object);
|
if (!empty($search_year)) $param.='&search_year='.$search_year;
|
||||||
|
if (!empty($socid)) $param.='&socid='.$socid;
|
||||||
|
if (!empty($search_doc_type)) $param.='&search_doc_type='.$search_doc_type;
|
||||||
|
if (!empty($search_doc_ref)) $param.='&search_doc_ref='.$search_doc_ref;
|
||||||
|
|
||||||
dol_htmloutput_mesg(is_numeric($error)?'':$error, $errors, 'error');
|
|
||||||
|
|
||||||
dol_fiche_head($head, 'TabAccounting', $langs->trans("ThirdParty"),0,'company');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '<table width="100%" class="border">';
|
|
||||||
print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td><td width="70%" colspan="3">';
|
|
||||||
$object->next_prev_filter="te.fournisseur = 1";
|
|
||||||
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
print '<tr>';
|
|
||||||
print '<td class="nowrap">'.$langs->trans("SupplierCode"). '</td><td colspan="3">';
|
|
||||||
print $object->code_fournisseur;
|
|
||||||
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
$langs->load('compta');
|
|
||||||
print '<tr>';
|
|
||||||
print '<td>';
|
|
||||||
print $form->editfieldkey("SupplierAccountancyCode",'supplieraccountancycode',$object->code_compta_fournisseur,$object,$user->rights->societe->creer);
|
|
||||||
print '</td><td colspan="3">';
|
|
||||||
print $form->editfieldval("SupplierAccountancyCode",'supplieraccountancycode',$object->code_compta_fournisseur,$object,$user->rights->societe->creer);
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
|
|
||||||
// Address
|
|
||||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">';
|
|
||||||
dol_print_address($object->address,'gmap','thirdparty',$object->id);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Zip / Town
|
|
||||||
print '<tr><td class="nowrap">'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3">'.$object->zip.(($object->zip && $object->town)?' / ':'').$object->town.'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
// Country
|
|
||||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
|
||||||
//$img=picto_from_langcode($object->country_code);
|
|
||||||
$img='';
|
|
||||||
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
|
|
||||||
else print ($img?$img.' ':'').$object->country;
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
// print_r($soc);
|
|
||||||
// exit;
|
|
||||||
// [code_compta] => 411DOUA
|
|
||||||
// [code_compta_fournisseur] => 401SUPPCODE
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mode Liste
|
* Affichage onglets
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
$head = societe_prepare_head($object);
|
||||||
|
|
||||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering ";
|
dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error');
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
|
||||||
$sql .= " WHERE (bk.code_tiers = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" .$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER. "' )" ;
|
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'accounting_supplier', $langs->trans("ThirdParty"), 0, 'company');
|
||||||
|
|
||||||
|
print '<table width="100%" class="border">';
|
||||||
|
print '<tr><td width="30%">' . $langs->trans("ThirdPartyName") . '</td><td width="70%" colspan="3">';
|
||||||
|
$object->next_prev_filter = "te.fournisseur = 1";
|
||||||
|
print $form->showrefnav($object, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom', '', '');
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
if (dol_strlen ( $search_year )) {
|
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||||
$sql .= " AND ( bk.doc_date BETWEEN '" . $search_year . "-0-0' AND '" . ($search_year+1). "-0-0' )";
|
{
|
||||||
}
|
print '<tr><td>' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<tr>';
|
||||||
|
print '<td class="nowrap">' . $langs->trans("SupplierCode") . '</td><td colspan="3">';
|
||||||
|
print $object->code_fournisseur;
|
||||||
|
if ($object->check_codefournisseur() != 0)
|
||||||
|
print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>';
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
$sql .= " ORDER BY bk.lettering ASC, bk.doc_date ASC" ;//. $db->plimit ( $conf->liste_limit + 1, $offset );
|
print '<tr>';
|
||||||
|
print '<td>';
|
||||||
|
print $form->editfieldkey("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->rights->societe->creer);
|
||||||
|
print '</td><td colspan="3">';
|
||||||
|
print $form->editfieldval("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->rights->societe->creer);
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// echo $sql;
|
// Address
|
||||||
// dol_syslog ( "bookkeping:liste:create sql=" . $sql, LOG_DEBUG );
|
print '<tr><td valign="top">' . $langs->trans("Address") . '</td><td colspan="3">';
|
||||||
$resql = $db->query ( $sql );
|
dol_print_address($object->address, 'gmap', 'thirdparty', $object->id);
|
||||||
if ($resql) {
|
print '</td></tr>';
|
||||||
$num = $db->num_rows ( $resql );
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
|
// Zip / Town
|
||||||
|
print '<tr><td class="nowrap">' . $langs->trans("Zip") . ' / ' . $langs->trans("Town") . '</td><td colspan="3">' . $object->zip . (($object->zip && $object->town) ? ' / ' : '') . $object->town . '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
print '<form name="add" action="?socid='.$object->id.'" method="POST">';
|
// Country
|
||||||
print '<input type="hidden" name="action" value="lettering">';
|
print '<tr><td>' . $langs->trans("Country") . '</td><td colspan="3">';
|
||||||
print '<input type="hidden" name="socid" value="'.$object->id.'">';
|
// $img=picto_from_langcode($object->country_code);
|
||||||
|
$img = '';
|
||||||
|
if ($object->isInEEC())
|
||||||
|
print $form->textwithpicto(($img ? $img . ' ' : '') . $object->country, $langs->trans("CountryIsInEEC"), 1, 0);
|
||||||
|
else
|
||||||
|
print ($img ? $img . ' ' : '') . $object->country;
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
|
||||||
|
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
|
||||||
|
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||||
|
$sql .= " WHERE (bk.subledger_account = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . "' )";
|
||||||
|
|
||||||
|
if (dol_strlen($search_year)) {
|
||||||
|
$date_start = dol_mktime(0, 0, 0, 1, 1, $search_year);
|
||||||
|
$date_end = dol_mktime(23, 59, 59, 12, 31, $search_year);
|
||||||
|
$sql .= " AND ( bk.doc_date BETWEEN '".$db->idate($date_start)."' AND '".$db->idate($date_end)."' )";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
|
|
||||||
|
$debit = 0;
|
||||||
|
$credit = 0;
|
||||||
|
$solde = 0;
|
||||||
|
// Count total nb of records and calc total sum
|
||||||
|
$nbtotalofrecords = '';
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if (! $resql)
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$nbtotalofrecords = $db->num_rows($resql);
|
||||||
|
|
||||||
|
while ($obj = $db->fetch_object($resql)) {
|
||||||
|
$debit += $obj->debit;
|
||||||
|
$credit += $obj->credit;
|
||||||
|
|
||||||
|
$solde += ($obj->credit - $obj->debit);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
|
|
||||||
|
dol_syslog ( "/accountancy/bookkeeping/thirdparty_lettrage_supplier.php", LOG_DEBUG );
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if (! $resql)
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
dol_syslog ( "/accountancy/bookkeeping/thirdparty_lettrage_supplier.php", LOG_DEBUG );
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid=' . $object->id . '" method="POST">';
|
||||||
|
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
||||||
|
|
||||||
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||||
|
|
||||||
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type","",$param,"",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date","",$param,"",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre("Docref", $_SERVER["PHP_SELF"], "bk.doc_ref","",$param,"",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre("Labelcompte", $_SERVER["PHP_SELF"], "bk.label_compte","",$param,"",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit","",$param,"",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit","",$param,"",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "bk.montant","",$param,"",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre("Sens", $_SERVER["PHP_SELF"], "bk.sens","",$param,"",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal","",$param,"",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre("Solde", $_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder);
|
||||||
|
print '<td></td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||||
|
print '<td><input type="text" name="search_year" value="' . $search_year . '"></td>';
|
||||||
|
print '<td><input type="text" name="search_doc_refe" value="' . $search_doc_ref . '"></td>';
|
||||||
|
print '<td colspan="7"> </td>';
|
||||||
|
print '<td align="right">';
|
||||||
|
$searchpicto=$form->showFilterButtons();
|
||||||
|
print $searchpicto;
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
$var = false;
|
||||||
|
$solde = 0;
|
||||||
|
$tmp = '';
|
||||||
|
while ($obj = $db->fetch_object($resql)) {
|
||||||
|
|
||||||
|
if ($tmp != $obj->lettering_code || empty($tmp))
|
||||||
|
$tmp = $obj->lettering_code;
|
||||||
|
|
||||||
|
if ($tmp != $obj->lettering_code || empty($obj->lettering_code))
|
||||||
|
$var = ! $var;
|
||||||
|
|
||||||
|
$solde += ($obj->credit - $obj->debit);
|
||||||
|
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
|
if (empty($obj->lettering_code)) {
|
||||||
|
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||||
|
print img_edit();
|
||||||
|
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
||||||
|
} else
|
||||||
|
print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||||
|
|
||||||
|
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||||
|
print '<td>' . $obj->doc_ref . '</td>';
|
||||||
|
print '<td>' . $obj->label_compte . '</td>';
|
||||||
|
print '<td>' . price($obj->debit) . '</td>';
|
||||||
|
print '<td>' . price($obj->credit) . '</td>';
|
||||||
|
print '<td>' . price($obj->montant) . '</td>';
|
||||||
|
print '<td>' . $obj->sens . '</td>';
|
||||||
|
print '<td>' . $obj->code_journal . '</td>';
|
||||||
|
print '<td>' . round($solde, 2) . '</td>';
|
||||||
|
|
||||||
|
if (empty($obj->lettering_code)) {
|
||||||
|
print '<td class="nowrap" align="center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
||||||
|
} else
|
||||||
|
print '<td>' . $obj->lettering_code . '</td>';
|
||||||
|
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<td></td>';
|
|
||||||
print_liste_field_titre("Doctype", "liste.php", "bk.doc_type" );
|
|
||||||
print_liste_field_titre("Docdate", "liste.php", "bk.doc_date" );
|
|
||||||
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
|
|
||||||
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
|
|
||||||
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
|
|
||||||
print_liste_field_titre("Labelcompte", "liste.php", "bk_label_compte" );
|
|
||||||
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
|
|
||||||
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
|
|
||||||
print_liste_field_titre("Amount", "liste.php", "bk.montant" );
|
|
||||||
print_liste_field_titre("Sens", "liste.php", "bk.sens" );
|
|
||||||
print_liste_field_titre("Codejournal", "liste.php", "bk.code_journal" );
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<form action="" method="GET">';
|
|
||||||
print '<input type="hidden" name="socid" value="' . $_GET ["socid"] . '">';
|
|
||||||
print '<td><input type="text" name="search_doc_type" value="' . $_GET ["search_doc_type"] . '"></td>';
|
|
||||||
print '<td><input type="text" name="search_year" value="' . $_GET ["search_year"] . '"></td>';
|
|
||||||
print '<td><input type="text" name="search_doc_refe" value="' . $_GET ["search_doc_ref"] . '"></td>';
|
|
||||||
// print '<td><input type="text" name="search_compte" value="' . $_GET ["search_compte"] . '"></td>';
|
|
||||||
// print '<td><input type="text" name="search_tiers" value="' . $_GET ["search_tiers"] . '"></td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td align="right">';
|
|
||||||
print '<input type="image" class="liste_titre" name="button_search" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" value="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '" title="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '">';
|
|
||||||
print '</td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '</form>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
$var = false;
|
|
||||||
|
|
||||||
$debit = 0;
|
|
||||||
$credit = 0;
|
|
||||||
$solde = 0;
|
|
||||||
$tmp = '';
|
|
||||||
while ( $i < $num ) {
|
|
||||||
$obj = $db->fetch_object ( $resql );
|
|
||||||
|
|
||||||
if($tmp !=$obj->lettering || empty($tmp) )
|
|
||||||
$tmp =$obj->lettering;
|
|
||||||
|
|
||||||
if($tmp !=$obj->lettering || empty($obj->lettering))
|
|
||||||
$var = ! $var;
|
|
||||||
|
|
||||||
|
|
||||||
$debit+= $obj->debit;
|
|
||||||
$credit+= $obj->credit;
|
|
||||||
|
|
||||||
$solde+=($obj->credit-$obj->debit);
|
|
||||||
print "<tr $bc[$var]>";
|
|
||||||
|
|
||||||
print '<td>' . $obj->rowid . '</td>';
|
|
||||||
if(empty($obj->lettering)){
|
|
||||||
print '<td><a href="'.dol_buildpath('/accountancy/bookkeeping/card.php', 1).'?piece_num=' . $obj->piece_num . '">';
|
|
||||||
print img_edit ();
|
|
||||||
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
print '<td>'.$obj->doc_type . '</td>' . "\n";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '<td>' . dol_print_date ( $db->jdate ( $obj->doc_date ), 'day' ) . '</td>';
|
|
||||||
print '<td>' . $obj->doc_ref . '</td>';
|
|
||||||
// print '<td>' . $obj->numero_compte . '</td>';
|
|
||||||
// print '<td>' . $obj->code_tiers . '</td>';
|
|
||||||
print '<td>' . $obj->label_compte . '</td>';
|
|
||||||
print '<td>' . $obj->debit . '</td>';
|
|
||||||
print '<td>' . $obj->credit . '</td>';
|
|
||||||
print '<td>' . $obj->montant . '</td>';
|
|
||||||
print '<td>' . $obj->sens . '</td>';
|
|
||||||
print '<td>' . $obj->code_journal . '</td>';
|
|
||||||
print '<td>' . round($solde, 2) . '</td>';
|
|
||||||
|
|
||||||
if(empty($obj->lettering)){
|
|
||||||
print '<td><input type="checkbox" name="ids[]" value="' . $obj->rowid . '" /></td>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
print '<td>' . $obj->lettering . '</td>';
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
$i ++;
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
|
|
||||||
print '<td colspan="4">Mouvement totaux</td>' . "\n";
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td><strong>' . $debit . '</strong></td>';
|
|
||||||
print '<td><strong>' . $credit . '</strong></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
|
||||||
print '<td colspan="5">Solde Comptable</td>' . "\n";
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td><strong>' . ($credit-$debit) . '</strong></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
print '<input class="butAction" type="submit" value="lettering">';
|
|
||||||
print '<a class="butAction" href="?socid='.$object->id.'&action=autolettrage">auto lettering</a>';
|
|
||||||
print "</form>";
|
|
||||||
$db->free ( $resql );
|
|
||||||
} else {
|
|
||||||
dol_print_error ( $db );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
|
print '<td colspan="4">Mouvement totaux</td>' . "\n";
|
||||||
|
print '<td><strong>' . price($debit) . '</strong></td>';
|
||||||
|
print '<td><strong>' . price($credit) . '</strong></td>';
|
||||||
|
print '<td colspan="5"></td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
print '<td colspan="9">Solde Comptable</td>' . "\n";
|
||||||
|
print '<td><strong>' . price($credit - $debit) . '</strong></td>';
|
||||||
|
print '<td colspan="5"></td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
|
print '<input class="butAction" type="submit" value="lettering" name="lettering" id="lettering">';
|
||||||
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid=' . $object->id . '&action=autolettrage">'.$langs->trans('AccountancyAutoLettering').'</a>';
|
||||||
|
print "</form>";
|
||||||
|
$db->free($resql);
|
||||||
|
} else {
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -28,40 +28,345 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
|||||||
/**
|
/**
|
||||||
* Class to manage categories of an accounting account
|
* Class to manage categories of an accounting account
|
||||||
*/
|
*/
|
||||||
class AccountancyCategory
|
class AccountancyCategory // extends CommonObject
|
||||||
{
|
{
|
||||||
private $db;
|
public $db; //!< To store db handler
|
||||||
public $error;
|
public $error; //!< To return error code (or message)
|
||||||
public $errors = array ();
|
public $errors=array(); //!< To return several error codes (or messages)
|
||||||
public $element = 'accounting_category';
|
public $element='c_accounting_category'; //!< Id that identify managed objects
|
||||||
public $table_element = 'c_accounting_category';
|
public $table_element='c_accounting_category'; //!< Name of table without prefix where object is stored
|
||||||
|
|
||||||
public $id;
|
public $id;
|
||||||
|
public $code;
|
||||||
|
public $label;
|
||||||
|
public $range_account;
|
||||||
|
public $sens;
|
||||||
|
public $category_type;
|
||||||
|
public $formula;
|
||||||
|
public $position;
|
||||||
|
public $fk_country;
|
||||||
|
public $active;
|
||||||
|
|
||||||
public $lines_cptbk;
|
public $lines_cptbk;
|
||||||
public $lines_display;
|
public $lines_display;
|
||||||
public $sdc;
|
public $sdc;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDb $db Database handler
|
||||||
*/
|
*/
|
||||||
public function __construct($db) {
|
function __construct($db)
|
||||||
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create object into database
|
||||||
|
*
|
||||||
|
* @param User $user User that create
|
||||||
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
|
* @return int <0 if KO, Id of created object if OK
|
||||||
|
*/
|
||||||
|
function create($user, $notrigger=0)
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
// Clean parameters
|
||||||
|
if (isset($this->code)) $this->code=trim($this->code);
|
||||||
|
if (isset($this->label)) $this->label=trim($this->label);
|
||||||
|
if (isset($this->range_account)) $this->range_account=trim($this->range_account);
|
||||||
|
if (isset($this->sens)) $this->sens=trim($this->sens);
|
||||||
|
if (isset($this->category_type)) $this->category_type=trim($this->category_type);
|
||||||
|
if (isset($this->formula)) $this->formula=trim($this->formula);
|
||||||
|
if (isset($this->position)) $this->position=trim($this->position);
|
||||||
|
if (isset($this->fk_country)) $this->fk_country=trim($this->fk_country);
|
||||||
|
if (isset($this->active)) $this->active=trim($this->active);
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
// Put here code to add control on parameters values
|
||||||
|
|
||||||
|
// Insert request
|
||||||
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_accounting_category(";
|
||||||
|
if ($this->rowid > 0) $sql.= "rowid,";
|
||||||
|
$sql.= "code,";
|
||||||
|
$sql.= "label,";
|
||||||
|
$sql.= "range_account,";
|
||||||
|
$sql.= "sens,";
|
||||||
|
$sql.= "category_type,";
|
||||||
|
$sql.= "formula,";
|
||||||
|
$sql.= "position,";
|
||||||
|
$sql.= "fk_country,";
|
||||||
|
$sql.= "active";
|
||||||
|
$sql.= ") VALUES (";
|
||||||
|
if ($this->rowid > 0) $sql.= " ".$this->rowid.",";
|
||||||
|
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
|
||||||
|
$sql.= " ".(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").",";
|
||||||
|
$sql.= " ".(! isset($this->range_account)?'NULL':"'".$this->db->escape($this->range_account)."'").",";
|
||||||
|
$sql.= " ".(! isset($this->sens)?'NULL':"'".$this->db->escape($this->sens)."'").",";
|
||||||
|
$sql.= " ".(! isset($this->category_type)?'NULL':"'".$this->db->escape($this->category_type)."'").",";
|
||||||
|
$sql.= " ".(! isset($this->formula)?'NULL':"'".$this->db->escape($this->formula)."'").",";
|
||||||
|
$sql.= " ".(! isset($this->position)?'NULL':$this->db->escape($this->position)).",";
|
||||||
|
$sql.= " ".(! isset($this->fk_country)?'NULL':$this->db->escape($this->fk_country)).",";
|
||||||
|
$sql.= " ".(! isset($this->active)?'NULL':$this->db->escape($this->active));
|
||||||
|
$sql.= ")";
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_accounting_category");
|
||||||
|
|
||||||
|
if (! $notrigger)
|
||||||
|
{
|
||||||
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
|
// want this action call a trigger.
|
||||||
|
|
||||||
|
//// Call triggers
|
||||||
|
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
|
//$interface=new Interfaces($this->db);
|
||||||
|
//$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
|
||||||
|
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||||
|
//// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error)
|
||||||
|
{
|
||||||
|
foreach($this->errors as $errmsg)
|
||||||
|
{
|
||||||
|
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1*$error;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load object in memory from database
|
||||||
|
*
|
||||||
|
* @param int $id Id object
|
||||||
|
* @param string $code Code
|
||||||
|
* @param string $label Label
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function fetch($id,$code='',$label='')
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$sql = "SELECT";
|
||||||
|
$sql.= " t.rowid,";
|
||||||
|
$sql.= " t.code,";
|
||||||
|
$sql.= " t.label,";
|
||||||
|
$sql.= " t.range_account,";
|
||||||
|
$sql.= " t.sens,";
|
||||||
|
$sql.= " t.category_type,";
|
||||||
|
$sql.= " t.formula,";
|
||||||
|
$sql.= " t.position,";
|
||||||
|
$sql.= " t.fk_country,";
|
||||||
|
$sql.= " t.active";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as t";
|
||||||
|
if ($id) $sql.= " WHERE t.rowid = ".$id;
|
||||||
|
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
|
||||||
|
elseif ($label) $sql.= " WHERE t.label = '".$this->db->escape($label)."'";
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
if ($this->db->num_rows($resql))
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
|
$this->id = $obj->rowid;
|
||||||
|
$this->code = $obj->code;
|
||||||
|
$this->label = $obj->label;
|
||||||
|
$this->range_account = $obj->range_account;
|
||||||
|
$this->sens = $obj->sens;
|
||||||
|
$this->category_type = $obj->category_type;
|
||||||
|
$this->formula = $obj->formula;
|
||||||
|
$this->position = $obj->position;
|
||||||
|
$this->fk_country = $obj->fk_country;
|
||||||
|
$this->active = $obj->active;
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error="Error ".$this->db->lasterror();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update object into database
|
||||||
|
*
|
||||||
|
* @param User $user User that modify
|
||||||
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function update($user=null, $notrigger=0)
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
// Clean parameters
|
||||||
|
if (isset($this->code)) $this->code=trim($this->code);
|
||||||
|
if (isset($this->label)) $this->label=trim($this->label);
|
||||||
|
if (isset($this->range_account)) $this->range_account=trim($this->range_account);
|
||||||
|
if (isset($this->sens)) $this->sens=trim($this->sens);
|
||||||
|
if (isset($this->category_type)) $this->category_type=trim($this->category_type);
|
||||||
|
if (isset($this->formula)) $this->formula=trim($this->formula);
|
||||||
|
if (isset($this->position)) $this->position=trim($this->position);
|
||||||
|
if (isset($this->fk_country)) $this->fk_country=trim($this->fk_country);
|
||||||
|
if (isset($this->active)) $this->active=trim($this->active);
|
||||||
|
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
// Put here code to add control on parameters values
|
||||||
|
|
||||||
|
// Update request
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."c_accounting_category SET";
|
||||||
|
$sql.= " code=".(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").",";
|
||||||
|
$sql.= " label=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
|
||||||
|
$sql.= " range_account=".(isset($this->range_account)?"'".$this->db->escape($this->range_account)."'":"null").",";
|
||||||
|
$sql.= " sens=".(isset($this->sens)?$this->sens:"null").",";
|
||||||
|
$sql.= " category_type=".(isset($this->category_type)?$this->category_type:"null").",";
|
||||||
|
$sql.= " formula=".(isset($this->formula)?"'".$this->db->escape($this->formula)."'":"null").",";
|
||||||
|
$sql.= " position=".(isset($this->position)?$this->position:"null").",";
|
||||||
|
$sql.= " fk_country=".(isset($this->fk_country)?$this->fk_country:"null").",";
|
||||||
|
$sql.= " active=".(isset($this->active)?$this->active:"null")."";
|
||||||
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
if (! $notrigger)
|
||||||
|
{
|
||||||
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
|
// want this action call a trigger.
|
||||||
|
|
||||||
|
//// Call triggers
|
||||||
|
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
|
//$interface=new Interfaces($this->db);
|
||||||
|
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
||||||
|
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||||
|
//// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error)
|
||||||
|
{
|
||||||
|
foreach($this->errors as $errmsg)
|
||||||
|
{
|
||||||
|
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1*$error;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete object in database
|
||||||
|
*
|
||||||
|
* @param User $user User that delete
|
||||||
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function delete($user, $notrigger=0)
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_accounting_category";
|
||||||
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
if (! $notrigger)
|
||||||
|
{
|
||||||
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
|
// want this action call a trigger.
|
||||||
|
|
||||||
|
//// Call triggers
|
||||||
|
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
|
//$interface=new Interfaces($this->db);
|
||||||
|
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
|
||||||
|
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||||
|
//// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error)
|
||||||
|
{
|
||||||
|
foreach($this->errors as $errmsg)
|
||||||
|
{
|
||||||
|
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1*$error;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to select all accounting accounts from an accounting category
|
* Function to select all accounting accounts from an accounting category
|
||||||
*
|
*
|
||||||
* @param int $id Id
|
* @param int $id Id
|
||||||
*
|
|
||||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function display($id) {
|
public function display($id) {
|
||||||
|
global $conf;
|
||||||
$sql = "SELECT t.rowid, t.account_number, t.label";
|
$sql = "SELECT t.rowid, t.account_number, t.label";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
||||||
$sql .= " WHERE t.fk_accounting_category = " . $id;
|
$sql .= " WHERE t.fk_accounting_category = " . $id;
|
||||||
|
$sql .= " AND t.entity = " . $conf->entity;
|
||||||
|
|
||||||
$this->lines_display = array ();
|
$this->lines_display = array();
|
||||||
|
|
||||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -97,13 +402,14 @@ class AccountancyCategory
|
|||||||
$sql .= " WHERE t.numero_compte NOT IN (";
|
$sql .= " WHERE t.numero_compte NOT IN (";
|
||||||
$sql .= " SELECT t.account_number";
|
$sql .= " SELECT t.account_number";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
||||||
$sql .= " WHERE t.fk_accounting_category = " . $id . ")";
|
$sql .= " WHERE t.fk_accounting_category = " . $id . " AND t.entity = " . $conf->entity.")";
|
||||||
$sql .= " AND t.numero_compte IN (";
|
$sql .= " AND t.numero_compte IN (";
|
||||||
$sql .= " SELECT DISTINCT aa.account_number";
|
$sql .= " SELECT DISTINCT aa.account_number";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
$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 .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||||
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||||
$sql .= " AND aa.active = 1)";
|
$sql .= " AND aa.active = 1";
|
||||||
|
$sql .= " AND aa.entity = = " . $conf->entity . ")";
|
||||||
$sql .= " GROUP BY t.numero_compte, t.label_operation, t.doc_ref";
|
$sql .= " GROUP BY t.numero_compte, t.label_operation, t.doc_ref";
|
||||||
$sql .= " ORDER BY t.numero_compte";
|
$sql .= " ORDER BY t.numero_compte";
|
||||||
|
|
||||||
@ -145,6 +451,7 @@ class AccountancyCategory
|
|||||||
$sql .= " WHERE (aa.fk_accounting_category != ".$id." OR aa.fk_accounting_category IS NULL)";
|
$sql .= " WHERE (aa.fk_accounting_category != ".$id." OR aa.fk_accounting_category IS NULL)";
|
||||||
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||||
$sql .= " AND aa.active = 1";
|
$sql .= " AND aa.active = 1";
|
||||||
|
$sql .= " AND aa.entity = " . $conf->entity;
|
||||||
$sql .= " GROUP BY aa.account_number, aa.label";
|
$sql .= " GROUP BY aa.account_number, aa.label";
|
||||||
$sql .= " ORDER BY aa.account_number, aa.label";
|
$sql .= " ORDER BY aa.account_number, aa.label";
|
||||||
|
|
||||||
@ -189,6 +496,7 @@ class AccountancyCategory
|
|||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||||
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||||
$sql .= " AND aa.active = 1";
|
$sql .= " AND aa.active = 1";
|
||||||
|
$sql .= " AND aa.entity = " . $conf->entity;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
@ -276,31 +584,27 @@ class AccountancyCategory
|
|||||||
*
|
*
|
||||||
* @return array Result in table
|
* @return array Result in table
|
||||||
*/
|
*/
|
||||||
public function getCatsCpts() {
|
public function getCatsCpts()
|
||||||
global $mysoc;
|
{
|
||||||
|
global $mysoc,$conf;
|
||||||
|
|
||||||
$sql = "";
|
$sql = "";
|
||||||
|
|
||||||
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
|
if (empty($mysoc->country_id)) {
|
||||||
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
|
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($mysoc->country_id)) {
|
$sql = "SELECT t.rowid, t.account_number, t.label as account_label, cat.code, cat.position, cat.label as name_cat, cat.sens ";
|
||||||
$sql = "SELECT t.rowid, t.account_number, t.label as name_cpt, cat.code, cat.position, cat.label as name_cat, cat.sens ";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t, " . MAIN_DB_PREFIX . "c_accounting_category as cat";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t, " . MAIN_DB_PREFIX . "c_accounting_category as cat";
|
$sql .= " WHERE t.fk_accounting_category IN ( SELECT c.rowid ";
|
||||||
$sql .= " WHERE t.fk_accounting_category IN ( SELECT c.rowid ";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
|
$sql .= " WHERE c.active = 1";
|
||||||
$sql .= " WHERE c.active = 1";
|
$sql .= " AND c.entity = " . $conf->entity;
|
||||||
$sql .= " AND c.fk_country = " . $mysoc->country_id . ")";
|
$sql .= " AND (c.fk_country = ".$mysoc->country_id." OR c.fk_country = 0)";
|
||||||
$sql .= " AND cat.rowid = t.fk_accounting_category";
|
$sql .= " AND cat.rowid = t.fk_accounting_category";
|
||||||
$sql .= " ORDER BY cat.position ASC";
|
$sql .= " AND t.entity = " . $conf->entity;
|
||||||
} else {
|
$sql .= " ORDER BY cat.position ASC";
|
||||||
$sql = "SELECT c.rowid, c.code, c.label, c.category_type ";
|
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co";
|
|
||||||
$sql .= " WHERE c.active = 1 AND c.fk_country = co.rowid";
|
|
||||||
$sql .= " AND co.code = '" . $mysoc->country_code . "'";
|
|
||||||
$sql .= " ORDER BY c.position ASC";
|
|
||||||
}
|
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
@ -316,7 +620,7 @@ class AccountancyCategory
|
|||||||
'code' => $obj->code,
|
'code' => $obj->code,
|
||||||
'position' => $obj->position,
|
'position' => $obj->position,
|
||||||
'account_number' => $obj->account_number,
|
'account_number' => $obj->account_number,
|
||||||
'name_cpt' => $obj->name_cpt,
|
'account_label' => $obj->account_label,
|
||||||
'sens' => $obj->sens
|
'sens' => $obj->sens
|
||||||
);
|
);
|
||||||
$i ++;
|
$i ++;
|
||||||
@ -334,22 +638,28 @@ class AccountancyCategory
|
|||||||
/**
|
/**
|
||||||
* Function to show result of an accounting account from the ledger with a direction and a period
|
* Function to show result of an accounting account from the ledger with a direction and a period
|
||||||
*
|
*
|
||||||
* @param int $cpt Id accounting account
|
* @param int $cpt Id accounting account
|
||||||
* @param string $month Specifig month - Can be empty
|
* @param string $month Specifig month - Can be empty
|
||||||
* @param string $year Specific year
|
* @param string $date_start Date start
|
||||||
* @param int $sens Sens of the account 0: credit - debit 1: debit - credit
|
* @param string $date_end Date end
|
||||||
*
|
* @param int $sens Sens of the account: 0: credit - debit, 1: debit - credit
|
||||||
* @return integer Result in table
|
* @param string $thirdparty_code Thirdparty code
|
||||||
|
* @return integer Result in table
|
||||||
*/
|
*/
|
||||||
public function getResult($cpt, $month, $year, $sens) {
|
public function getResult($cpt, $month, $date_start, $date_end, $sens, $thirdparty_code='nofilter')
|
||||||
|
{
|
||||||
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
|
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
|
||||||
$sql .= " WHERE t.numero_compte = '" . $cpt."'";
|
$sql .= " WHERE t.numero_compte = '" . $cpt."'";
|
||||||
$sql .= " AND YEAR(t.doc_date) = " . $year;
|
if (! empty($date_start) && ! empty($date_end))
|
||||||
|
$sql.= " AND t.doc_date >= '".$this->db->idate($date_start)."' AND t.doc_date <= '".$this->db->idate($date_end)."'";
|
||||||
if (! empty($month)) {
|
if (! empty($month)) {
|
||||||
$sql .= " AND MONTH(t.doc_date) = " . $month;
|
$sql .= " AND MONTH(t.doc_date) = " . $month;
|
||||||
}
|
}
|
||||||
|
if ($thirdparty_code != 'nofilter')
|
||||||
|
{
|
||||||
|
$sql .= " AND thirdparty_code = '".$this->db->escape($thirdparty_code)."'";
|
||||||
|
}
|
||||||
|
|
||||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -375,84 +685,28 @@ class AccountancyCategory
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to call category from a specific country
|
* Return list of personalized groups that are active
|
||||||
*
|
*
|
||||||
* @return array Result in table
|
* @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups
|
||||||
|
* @return array Array of groups
|
||||||
*/
|
*/
|
||||||
public function getCatsCal() {
|
public function getCats($categorytype=-1)
|
||||||
global $db, $langs, $user, $mysoc;
|
{
|
||||||
|
global $db, $langs, $user, $mysoc, $conf;
|
||||||
|
|
||||||
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
|
if (empty($mysoc->country_id)) {
|
||||||
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
|
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($mysoc->country_id)) {
|
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
|
||||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
|
$sql .= " WHERE c.active = 1 ";
|
||||||
$sql .= " WHERE c.active = 1 AND c.category_type = 1 ";
|
$sql .= " AND c.entity = " . $conf->entity;
|
||||||
$sql .= " AND c.fk_country = " . $mysoc->country_id;
|
if ($categorytype >= 0) $sql.=" AND c.category_type = 1";
|
||||||
$sql .= " ORDER BY c.position ASC";
|
$sql .= " AND (c.fk_country = ".$mysoc->country_id." OR c.fk_country = 0)";
|
||||||
} else {
|
$sql .= " ORDER BY c.position ASC";
|
||||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
|
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co";
|
|
||||||
$sql .= " WHERE c.active = 1 AND c.category_type = 1 AND c.fk_country = co.rowid";
|
|
||||||
$sql .= " AND co.code = '" . $mysoc->country_code . "'";
|
|
||||||
$sql .= " ORDER BY c.position ASC";
|
|
||||||
}
|
|
||||||
|
|
||||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
|
||||||
$resql = $this->db->query($sql);
|
|
||||||
if ($resql) {
|
|
||||||
$i = 0;
|
|
||||||
$obj = '';
|
|
||||||
$num = $this->db->num_rows($resql);
|
|
||||||
$data = array ();
|
|
||||||
if ($num) {
|
|
||||||
while ( $i < $num ) {
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
|
||||||
$position = $obj->position;
|
|
||||||
$data[$position] = array (
|
|
||||||
'code' => $obj->code,
|
|
||||||
'label' => $obj->label,
|
|
||||||
'formula' => $obj->formula
|
|
||||||
);
|
|
||||||
$i ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $data;
|
|
||||||
} else {
|
|
||||||
$this->error = "Error " . $this->db->lasterror();
|
|
||||||
$this->errors[] = $this->error;
|
|
||||||
dol_syslog(__METHOD__ . " " . implode(',', $this->errors), LOG_ERR);
|
|
||||||
|
|
||||||
return - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCats() {
|
|
||||||
global $db, $langs, $user, $mysoc;
|
|
||||||
|
|
||||||
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
|
|
||||||
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($mysoc->country_id)) {
|
|
||||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
|
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
|
|
||||||
$sql .= " WHERE c.active = 1 ";
|
|
||||||
$sql .= " AND c.fk_country = " . $mysoc->country_id;
|
|
||||||
$sql .= " ORDER BY c.position ASC";
|
|
||||||
} else {
|
|
||||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
|
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co";
|
|
||||||
$sql .= " WHERE c.active = 1 AND c.fk_country = co.rowid";
|
|
||||||
$sql .= " AND co.code = '" . $mysoc->country_code . "'";
|
|
||||||
$sql .= " ORDER BY c.position ASC";
|
|
||||||
}
|
|
||||||
|
|
||||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -466,12 +720,12 @@ class AccountancyCategory
|
|||||||
$data[] = array (
|
$data[] = array (
|
||||||
'rowid' => $obj->rowid,
|
'rowid' => $obj->rowid,
|
||||||
'code' => $obj->code,
|
'code' => $obj->code,
|
||||||
'position' => $obj->position,
|
|
||||||
'label' => $obj->label,
|
'label' => $obj->label,
|
||||||
'formula' => $obj->formula,
|
'formula' => $obj->formula,
|
||||||
|
'position' => $obj->position,
|
||||||
'category_type' => $obj->category_type
|
'category_type' => $obj->category_type
|
||||||
);
|
);
|
||||||
$i ++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
@ -485,78 +739,38 @@ class AccountancyCategory
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// calcule
|
|
||||||
|
|
||||||
const PATTERN = '/(?:\-?\d+(?:\.?\d+)?[\+\-\*\/])+\-?\d+(?:\.?\d+)?/';
|
|
||||||
|
|
||||||
const PARENTHESIS_DEPTH = 10;
|
|
||||||
|
|
||||||
public function calculate($input){
|
|
||||||
if(strpos($input, '+') != null || strpos($input, '-') != null || strpos($input, '/') != null || strpos($input, '*') != null){
|
|
||||||
// Remove white spaces and invalid math chars
|
|
||||||
$input = str_replace(',', '.', $input);
|
|
||||||
$input = preg_replace('[^0-9\.\+\-\*\/\(\)]', '', $input);
|
|
||||||
|
|
||||||
// Calculate each of the parenthesis from the top
|
|
||||||
$i = 0;
|
|
||||||
while(strpos($input, '(') || strpos($input, ')')){
|
|
||||||
$input = preg_replace_callback('/\(([^\(\)]+)\)/', 'self::callback', $input);
|
|
||||||
|
|
||||||
$i++;
|
|
||||||
if($i > self::PARENTHESIS_DEPTH){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate the result
|
|
||||||
if(preg_match(self::PATTERN, $input, $match)){
|
|
||||||
return $this->compute($match[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $input;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function compute($input){
|
|
||||||
$compute = create_function('', 'return '.$input.';');
|
|
||||||
|
|
||||||
return 0 + $compute();
|
|
||||||
}
|
|
||||||
|
|
||||||
private function callback($input){
|
|
||||||
if(is_numeric($input[1])){
|
|
||||||
return $input[1];
|
|
||||||
}
|
|
||||||
elseif(preg_match(self::PATTERN, $input[1], $match)){
|
|
||||||
return $this->compute($match[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get cpts of category
|
* Get all accounting account of a group.
|
||||||
|
* You must choose between first parameter (personalized group) or the second (free criteria filter)
|
||||||
*
|
*
|
||||||
* @param int $cat_id Id accounting account category
|
* @param int $cat_id Id if personalized accounting group/category
|
||||||
*
|
* @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts
|
||||||
* @return array Result in table
|
* @return array Array of accounting accounts
|
||||||
*/
|
*/
|
||||||
public function getCptsCat($cat_id) {
|
public function getCptsCat($cat_id, $predefinedgroupwhere='')
|
||||||
|
{
|
||||||
global $mysoc;
|
global $mysoc;
|
||||||
$sql = "";
|
$sql = '';
|
||||||
|
|
||||||
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
|
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
|
||||||
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
|
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT t.rowid, t.account_number, t.label as name_cpt";
|
if (! empty($cat_id))
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
{
|
||||||
$sql .= " WHERE t.fk_accounting_category = ".$cat_id;
|
$sql = "SELECT t.rowid, t.account_number, t.label as account_label";
|
||||||
$sql .= " ORDER BY t.account_number ";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
||||||
|
$sql .= " WHERE t.fk_accounting_category = ".$cat_id;
|
||||||
|
$sql .= " ORDER BY t.account_number";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql = "SELECT t.rowid, t.account_number, t.label as account_label";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
||||||
|
$sql .= " WHERE ".$predefinedgroupwhere;
|
||||||
|
$sql .= " ORDER BY t.account_number";
|
||||||
|
}
|
||||||
//echo $sql;
|
//echo $sql;
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -564,14 +778,15 @@ class AccountancyCategory
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
$obj = '';
|
$obj = '';
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
$data = array ();
|
$data = array();
|
||||||
if ($num) {
|
if ($num) {
|
||||||
while ( $obj = $this->db->fetch_object($resql) ) {
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
$name_cat = $obj->name_cat;
|
$name_cat = $obj->name_cat;
|
||||||
$data[] = array (
|
$data[] = array (
|
||||||
'id' => $obj->rowid,
|
'id' => $obj->rowid,
|
||||||
'account_number' => $obj->account_number,
|
'account_number' => $obj->account_number,
|
||||||
'name_cpt' => $obj->name_cpt,
|
'account_label' => $obj->account_label,
|
||||||
);
|
);
|
||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
|
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||||
* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2016-2018 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
|
* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
|
* Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com>
|
||||||
|
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr>
|
||||||
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -40,7 +44,7 @@ class AccountancyExport
|
|||||||
/**
|
/**
|
||||||
* @var Type of export. Defined by $conf->global->ACCOUNTING_EXPORT_MODELCSV
|
* @var Type of export. Defined by $conf->global->ACCOUNTING_EXPORT_MODELCSV
|
||||||
*/
|
*/
|
||||||
public static $EXPORT_TYPE_NORMAL = 1; // Classic CSV
|
public static $EXPORT_TYPE_NORMAL = 1; // Classic CSV
|
||||||
public static $EXPORT_TYPE_CEGID = 2;
|
public static $EXPORT_TYPE_CEGID = 2;
|
||||||
public static $EXPORT_TYPE_COALA = 3;
|
public static $EXPORT_TYPE_COALA = 3;
|
||||||
public static $EXPORT_TYPE_BOB50 = 4;
|
public static $EXPORT_TYPE_BOB50 = 4;
|
||||||
@ -49,6 +53,7 @@ class AccountancyExport
|
|||||||
public static $EXPORT_TYPE_EBP = 7;
|
public static $EXPORT_TYPE_EBP = 7;
|
||||||
public static $EXPORT_TYPE_COGILOG = 8;
|
public static $EXPORT_TYPE_COGILOG = 8;
|
||||||
public static $EXPORT_TYPE_AGIRIS = 9;
|
public static $EXPORT_TYPE_AGIRIS = 9;
|
||||||
|
public static $EXPORT_TYPE_CONFIGURABLE = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -78,11 +83,11 @@ class AccountancyExport
|
|||||||
|
|
||||||
$this->db = &$db;
|
$this->db = &$db;
|
||||||
$this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
$this->end_line = "\n";
|
$this->end_line = empty($conf->global->ACCOUNTING_EXPORT_ENDLINE)?"\n":($conf->global->ACCOUNTING_EXPORT_ENDLINE==1?"\n":"\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array wit all export type available (key + label)
|
* Array with all export type available (key + label)
|
||||||
*
|
*
|
||||||
* @return array of type
|
* @return array of type
|
||||||
*/
|
*/
|
||||||
@ -98,7 +103,70 @@ class AccountancyExport
|
|||||||
self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'),
|
self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'),
|
||||||
self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'),
|
self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'),
|
||||||
self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'),
|
self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'),
|
||||||
self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris')
|
self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'),
|
||||||
|
self::$EXPORT_TYPE_CONFIGURABLE => $langs->trans('Modelcsv_configurable'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array with all export type available (key + label) and parameters for config
|
||||||
|
*
|
||||||
|
* @return array of type
|
||||||
|
*/
|
||||||
|
public static function getTypeConfig() {
|
||||||
|
global $conf, $langs;
|
||||||
|
|
||||||
|
return array (
|
||||||
|
'param' => array(
|
||||||
|
self::$EXPORT_TYPE_NORMAL => array(
|
||||||
|
'label' => $langs->trans('Modelcsv_normal'),
|
||||||
|
'ACCOUNTING_EXPORT_FORMAT' => empty($conf->global->ACCOUNTING_EXPORT_FORMAT)?'txt':$conf->global->ACCOUNTING_EXPORT_FORMAT,
|
||||||
|
'ACCOUNTING_EXPORT_SEPARATORCSV' => empty($conf->global->ACCOUNTING_EXPORT_SEPARATORCSV)?',':$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV,
|
||||||
|
'ACCOUNTING_EXPORT_ENDLINE' => empty($conf->global->ACCOUNTING_EXPORT_ENDLINE)?1:$conf->global->ACCOUNTING_EXPORT_ENDLINE,
|
||||||
|
'ACCOUNTING_EXPORT_DATE' => empty($conf->global->ACCOUNTING_EXPORT_DATE)?'%d%m%Y':$conf->global->ACCOUNTING_EXPORT_DATE,
|
||||||
|
),
|
||||||
|
self::$EXPORT_TYPE_CEGID => array(
|
||||||
|
'label' => $langs->trans('Modelcsv_CEGID'),
|
||||||
|
),
|
||||||
|
self::$EXPORT_TYPE_COALA => array(
|
||||||
|
'label' => $langs->trans('Modelcsv_COALA'),
|
||||||
|
),
|
||||||
|
self::$EXPORT_TYPE_BOB50 => array(
|
||||||
|
'label' => $langs->trans('Modelcsv_bob50'),
|
||||||
|
),
|
||||||
|
self::$EXPORT_TYPE_CIEL => array(
|
||||||
|
'label' => $langs->trans('Modelcsv_ciel'),
|
||||||
|
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
|
||||||
|
),
|
||||||
|
self::$EXPORT_TYPE_QUADRATUS => array(
|
||||||
|
'label' => $langs->trans('Modelcsv_quadratus'),
|
||||||
|
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
|
||||||
|
),
|
||||||
|
self::$EXPORT_TYPE_EBP => array(
|
||||||
|
'label' => $langs->trans('Modelcsv_ebp'),
|
||||||
|
),
|
||||||
|
self::$EXPORT_TYPE_COGILOG => array(
|
||||||
|
'label' => $langs->trans('Modelcsv_cogilog'),
|
||||||
|
),
|
||||||
|
self::$EXPORT_TYPE_AGIRIS => array(
|
||||||
|
'label' => $langs->trans('Modelcsv_agiris'),
|
||||||
|
),
|
||||||
|
self::$EXPORT_TYPE_CONFIGURABLE => array(
|
||||||
|
'label' => $langs->trans('Modelcsv_configurable'),
|
||||||
|
'ACCOUNTING_EXPORT_FORMAT' => empty($conf->global->ACCOUNTING_EXPORT_FORMAT)?'txt':$conf->global->ACCOUNTING_EXPORT_FORMAT,
|
||||||
|
'ACCOUNTING_EXPORT_SEPARATORCSV' => empty($conf->global->ACCOUNTING_EXPORT_SEPARATORCSV)?',':$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV,
|
||||||
|
'ACCOUNTING_EXPORT_ENDLINE' => empty($conf->global->ACCOUNTING_EXPORT_ENDLINE)?1:$conf->global->ACCOUNTING_EXPORT_ENDLINE,
|
||||||
|
'ACCOUNTING_EXPORT_DATE' => empty($conf->global->ACCOUNTING_EXPORT_DATE)?'%d%m%Y':$conf->global->ACCOUNTING_EXPORT_DATE,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'cr'=> array (
|
||||||
|
'1' => $langs->trans("Unix"),
|
||||||
|
'2' => $langs->trans("Windows")
|
||||||
|
),
|
||||||
|
'format' => array (
|
||||||
|
'csv' => $langs->trans("csv"),
|
||||||
|
'txt' => $langs->trans("txt")
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +177,7 @@ class AccountancyExport
|
|||||||
*/
|
*/
|
||||||
public static function downloadFile() {
|
public static function downloadFile() {
|
||||||
global $conf;
|
global $conf;
|
||||||
$journal = 'bookkepping';
|
$filename = 'general_ledger';
|
||||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,6 +219,9 @@ class AccountancyExport
|
|||||||
case self::$EXPORT_TYPE_AGIRIS :
|
case self::$EXPORT_TYPE_AGIRIS :
|
||||||
$this->exportAgiris($TData);
|
$this->exportAgiris($TData);
|
||||||
break;
|
break;
|
||||||
|
case self::$EXPORT_TYPE_CONFIGURABLE :
|
||||||
|
$this->exportConfigurable($TData);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
|
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
|
||||||
break;
|
break;
|
||||||
@ -192,6 +263,7 @@ class AccountancyExport
|
|||||||
foreach ( $objectLines as $line ) {
|
foreach ( $objectLines as $line ) {
|
||||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||||
$separator = ";";
|
$separator = ";";
|
||||||
|
$end_line = "\n";
|
||||||
|
|
||||||
print $date . $separator;
|
print $date . $separator;
|
||||||
print $line->code_journal . $separator;
|
print $line->code_journal . $separator;
|
||||||
@ -201,7 +273,7 @@ class AccountancyExport
|
|||||||
print price($line->montant) . $separator;
|
print price($line->montant) . $separator;
|
||||||
print $line->label_operation . $separator;
|
print $line->label_operation . $separator;
|
||||||
print $line->doc_ref;
|
print $line->doc_ref;
|
||||||
print $this->end_line;
|
print $end_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,24 +287,26 @@ class AccountancyExport
|
|||||||
public function exportCogilog($objectLines) {
|
public function exportCogilog($objectLines) {
|
||||||
foreach ( $objectLines as $line ) {
|
foreach ( $objectLines as $line ) {
|
||||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||||
|
$separator = ";";
|
||||||
|
$end_line = "\n";
|
||||||
|
|
||||||
print $line->code_journal . $this->separator;
|
print $line->code_journal . $separator;
|
||||||
print $date . $this->separator;
|
print $date . $separator;
|
||||||
print $line->piece_num . $this->separator;
|
print $line->piece_num . $separator;
|
||||||
print length_accountg($line->numero_compte) . $this->separator;
|
print length_accountg($line->numero_compte) . $separator;
|
||||||
print '' . $this->separator;
|
print '' . $separator;
|
||||||
print $line->label_operation . $this->separator;
|
print $line->label_operation . $separator;
|
||||||
print $date . $this->separator;
|
print $date . $separator;
|
||||||
if ($line->sens=='D') {
|
if ($line->sens=='D') {
|
||||||
print price($line->montant) . $this->separator;
|
print price($line->montant) . $separator;
|
||||||
print '' . $this->separator;
|
print '' . $separator;
|
||||||
}elseif ($line->sens=='C') {
|
}elseif ($line->sens=='C') {
|
||||||
print '' . $this->separator;
|
print '' . $separator;
|
||||||
print price($line->montant) . $this->separator;
|
print price($line->montant) . $separator;
|
||||||
}
|
}
|
||||||
print $line->doc_ref . $this->separator;
|
print $line->doc_ref . $separator;
|
||||||
print $line->label_operation . $this->separator;
|
print $line->label_operation . $separator;
|
||||||
print $this->end_line;
|
print $end_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,18 +319,21 @@ class AccountancyExport
|
|||||||
*/
|
*/
|
||||||
public function exportCoala($objectLines) {
|
public function exportCoala($objectLines) {
|
||||||
// Coala export
|
// Coala export
|
||||||
|
$separator = ";";
|
||||||
|
$end_line = "\n";
|
||||||
|
|
||||||
foreach ( $objectLines as $line ) {
|
foreach ( $objectLines as $line ) {
|
||||||
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
||||||
print $date . $this->separator;
|
print $date . $separator;
|
||||||
print $line->code_journal . $this->separator;
|
print $line->code_journal . $separator;
|
||||||
print length_accountg($line->numero_compte) . $this->separator;
|
print length_accountg($line->numero_compte) . $separator;
|
||||||
print $line->piece_num . $this->separator;
|
print $line->piece_num . $separator;
|
||||||
print $line->doc_ref . $this->separator;
|
print $line->doc_ref . $separator;
|
||||||
print price($line->debit) . $this->separator;
|
print price($line->debit) . $separator;
|
||||||
print price($line->credit) . $this->separator;
|
print price($line->credit) . $separator;
|
||||||
print 'E' . $this->separator;
|
print 'E' . $separator;
|
||||||
print length_accountg($line->subledger_account) . $this->separator;
|
print length_accountg($line->subledger_account) . $separator;
|
||||||
print $this->end_line;
|
print $end_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,28 +347,31 @@ class AccountancyExport
|
|||||||
public function exportBob50($objectLines) {
|
public function exportBob50($objectLines) {
|
||||||
|
|
||||||
// Bob50
|
// Bob50
|
||||||
|
$separator = ";";
|
||||||
|
$end_line = "\n";
|
||||||
|
|
||||||
foreach ( $objectLines as $line ) {
|
foreach ( $objectLines as $line ) {
|
||||||
print $line->piece_num . $this->separator;
|
print $line->piece_num . $separator;
|
||||||
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
||||||
print $date . $this->separator;
|
print $date . $separator;
|
||||||
|
|
||||||
if (empty($line->subledger_account)) {
|
if (empty($line->subledger_account)) {
|
||||||
print 'G' . $this->separator;
|
print 'G' . $separator;
|
||||||
print length_accounta($line->numero_compte) . $this->separator;
|
print length_accounta($line->numero_compte) . $separator;
|
||||||
} else {
|
} else {
|
||||||
if (substr($line->numero_compte, 0, 3) == '411') {
|
if (substr($line->numero_compte, 0, 3) == '411') {
|
||||||
print 'C' . $this->separator;
|
print 'C' . $separator;
|
||||||
}
|
}
|
||||||
if (substr($line->numero_compte, 0, 3) == '401') {
|
if (substr($line->numero_compte, 0, 3) == '401') {
|
||||||
print 'F' . $this->separator;
|
print 'F' . $separator;
|
||||||
}
|
}
|
||||||
print length_accountg($line->subledger_account) . $this->separator;
|
print length_accountg($line->subledger_account) . $separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
print price($line->debit) . $this->separator;
|
print price($line->debit) . $separator;
|
||||||
print price($line->credit) . $this->separator;
|
print price($line->credit) . $separator;
|
||||||
print dol_trunc($line->label_operation, 32) . $this->separator;
|
print dol_trunc($line->label_operation, 32) . $separator;
|
||||||
print $this->end_line;
|
print $end_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,7 +385,7 @@ class AccountancyExport
|
|||||||
public function exportCiel(&$TData) {
|
public function exportCiel(&$TData) {
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$this->end_line ="\r\n";
|
$end_line ="\r\n";
|
||||||
|
|
||||||
$i = 1;
|
$i = 1;
|
||||||
$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be yyyymmdd
|
$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be yyyymmdd
|
||||||
@ -321,14 +401,14 @@ class AccountancyExport
|
|||||||
$Tab['date_ope'] = dol_print_date($data->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
|
$Tab['date_ope'] = dol_print_date($data->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||||
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 12), 12);
|
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 12), 12);
|
||||||
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 11), 11);
|
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 11), 11);
|
||||||
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . $data->label_operation, 25), 25);
|
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref) . dol_string_unaccent($data->label_operation), 25), 25);
|
||||||
$Tab['montant'] = str_pad(abs($data->montant), 13, ' ', STR_PAD_LEFT);
|
$Tab['montant'] = str_pad(abs($data->montant), 13, ' ', STR_PAD_LEFT);
|
||||||
$Tab['type_montant'] = str_pad($data->sens, 1);
|
$Tab['type_montant'] = str_pad($data->sens, 1);
|
||||||
$Tab['vide'] = str_repeat(' ', 18);
|
$Tab['vide'] = str_repeat(' ', 18);
|
||||||
$Tab['intitule_compte'] = str_pad(self::trunc($data->label_operation, 34), 34);
|
$Tab['intitule_compte'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 34), 34);
|
||||||
$Tab['end'] = 'O2003';
|
$Tab['end'] = 'O2003';
|
||||||
|
|
||||||
$Tab['end_line'] = $this->end_line;
|
$Tab['end_line'] = $end_line;
|
||||||
|
|
||||||
print implode($Tab);
|
print implode($Tab);
|
||||||
$i ++;
|
$i ++;
|
||||||
@ -345,9 +425,11 @@ class AccountancyExport
|
|||||||
public function exportQuadratus(&$TData) {
|
public function exportQuadratus(&$TData) {
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$this->end_line ="\r\n";
|
$end_line ="\r\n";
|
||||||
|
|
||||||
$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
//We should use dol_now function not time however this is wrong date to transfert in accounting
|
||||||
|
//$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||||
|
//$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||||
foreach ( $TData as $data ) {
|
foreach ( $TData as $data ) {
|
||||||
$code_compta = $data->numero_compte;
|
$code_compta = $data->numero_compte;
|
||||||
if (! empty($data->subledger_account))
|
if (! empty($data->subledger_account))
|
||||||
@ -358,29 +440,58 @@ class AccountancyExport
|
|||||||
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 8), 8);
|
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 8), 8);
|
||||||
$Tab['code_journal'] = str_pad(self::trunc($data->code_journal, 2), 2);
|
$Tab['code_journal'] = str_pad(self::trunc($data->code_journal, 2), 2);
|
||||||
$Tab['folio'] = '000';
|
$Tab['folio'] = '000';
|
||||||
$Tab['date_ecriture'] = $date_ecriture;
|
|
||||||
|
//We use invoice date $data->doc_date not $date_ecriture which is the transfert date
|
||||||
|
//maybe we should set an option for customer who prefer to keep in accounting software the tranfert date instead of invoice date ?
|
||||||
|
//$Tab['date_ecriture'] = $date_ecriture;
|
||||||
|
$Tab['date_ecriture'] = dol_print_date($data->doc_date, '%d%m%y');
|
||||||
$Tab['filler'] = ' ';
|
$Tab['filler'] = ' ';
|
||||||
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_operation, 20), 20);
|
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref) . ' ' . dol_string_unaccent($data->label_operation), 20), 20);
|
||||||
$Tab['sens'] = $data->sens; // C or D
|
$Tab['sens'] = $data->sens; // C or D
|
||||||
$Tab['signe_montant'] = '+';
|
$Tab['signe_montant'] = '+';
|
||||||
$Tab['montant'] = str_pad(abs($data->montant), 12, '0', STR_PAD_LEFT); // TODO manage negative amount
|
|
||||||
|
//elarifr le montant doit etre en centimes sans point decimal !
|
||||||
|
$Tab['montant'] = str_pad(abs($data->montant*100), 12, '0', STR_PAD_LEFT); // TODO manage negative amount
|
||||||
|
// $Tab['montant'] = str_pad(abs($data->montant), 12, '0', STR_PAD_LEFT); // TODO manage negative amount
|
||||||
$Tab['contrepartie'] = str_repeat(' ', 8);
|
$Tab['contrepartie'] = str_repeat(' ', 8);
|
||||||
|
|
||||||
|
// elarifr: date format must be fixed format : 6 char ddmmyy = %d%m%yand not defined by user / dolibarr setting
|
||||||
if (! empty($data->date_echeance))
|
if (! empty($data->date_echeance))
|
||||||
$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);
|
//$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||||
|
$Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%y' ); // elarifr: format must be ddmmyy
|
||||||
else
|
else
|
||||||
$Tab['date_echeance'] = '000000';
|
$Tab['date_echeance'] = '000000';
|
||||||
$Tab['lettrage'] = str_repeat(' ', 5);
|
|
||||||
|
//elarifr please keep quadra named field lettrage(2) + codestat(3) instead of fake lettrage(5)
|
||||||
|
//$Tab['lettrage'] = str_repeat(' ', 5);
|
||||||
|
$Tab['lettrage'] = str_repeat(' ', 2);
|
||||||
|
$Tab['codestat'] = str_repeat(' ', 3);
|
||||||
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 5), 5);
|
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 5), 5);
|
||||||
$Tab['filler2'] = str_repeat(' ', 20);
|
|
||||||
|
//elarifr keep correct quadra named field instead of anon filler
|
||||||
|
//$Tab['filler2'] = str_repeat(' ', 20);
|
||||||
|
$Tab['affaire'] = str_repeat(' ', 10);
|
||||||
|
$Tab['quantity1'] = str_repeat(' ', 10);
|
||||||
$Tab['num_piece2'] = str_pad(self::trunc($data->piece_num, 8), 8);
|
$Tab['num_piece2'] = str_pad(self::trunc($data->piece_num, 8), 8);
|
||||||
$Tab['devis'] = str_pad($conf->currency, 3);
|
$Tab['devis'] = str_pad($conf->currency, 3);
|
||||||
$Tab['code_journal2'] = str_pad(self::trunc($data->code_journal, 3), 3);
|
$Tab['code_journal2'] = str_pad(self::trunc($data->code_journal, 3), 3);
|
||||||
$Tab['filler3'] = str_repeat(' ', 3);
|
$Tab['filler3'] = str_repeat(' ', 3);
|
||||||
$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_operation, 32), 32);
|
|
||||||
$Tab['num_piece3'] = str_pad(self::trunc($data->piece_num, 10), 10);
|
//elarifr keep correct quadra named field instead of anon filler libelle_ecriture2 is 30 char not 32 !!!!
|
||||||
|
//as we use utf8, we must remove accent to have only one ascii char instead of utf8 2 chars for specials that report wrong line size that will exceed import format spec
|
||||||
|
//todo we should filter more than only accent to avoid wrong line size
|
||||||
|
//TODO: remove invoice number doc_ref in libelle,
|
||||||
|
//TODO: we should offer an option for customer to build the libelle using invoice number / name / date in accounting software
|
||||||
|
//$Tab['libelle_ecriture2'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref) . ' ' . dol_string_unaccent($data->label_operation), 30), 30);
|
||||||
|
$Tab['libelle_ecriture2'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 30), 30);
|
||||||
|
$Tab['codetva'] = str_repeat(' ', 2);
|
||||||
|
|
||||||
|
//elarifr we need to keep the 10 lastest number of invoice doc_ref not the beginning part that is the unusefull almost same part
|
||||||
|
//$Tab['num_piece3'] = str_pad(self::trunc($data->piece_num, 10), 10);
|
||||||
|
$Tab['num_piece3'] = substr(self::trunc($data->doc_ref, 20), -10);
|
||||||
$Tab['filler4'] = str_repeat(' ', 73);
|
$Tab['filler4'] = str_repeat(' ', 73);
|
||||||
|
|
||||||
$Tab['end_line'] = $this->end_line;
|
$Tab['end_line'] = $end_line;
|
||||||
|
|
||||||
print implode($Tab);
|
print implode($Tab);
|
||||||
}
|
}
|
||||||
@ -396,24 +507,25 @@ class AccountancyExport
|
|||||||
*/
|
*/
|
||||||
public function exportEbp($objectLines) {
|
public function exportEbp($objectLines) {
|
||||||
|
|
||||||
$this->separator = ',';
|
$separator = ',';
|
||||||
|
$end_line = "\n";
|
||||||
|
|
||||||
foreach ( $objectLines as $line ) {
|
foreach ( $objectLines as $line ) {
|
||||||
|
|
||||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||||
|
|
||||||
print $line->id . $this->separator;
|
print $line->id . $separator;
|
||||||
print $date . $this->separator;
|
print $date . $separator;
|
||||||
print $line->code_journal . $this->separator;
|
print $line->code_journal . $separator;
|
||||||
print length_accountg($line->numero_compte) . $this->separator;
|
print length_accountg($line->numero_compte) . $separator;
|
||||||
print substr(length_accountg($line->numero_compte),0,2) . $this->separator;
|
print substr(length_accountg($line->numero_compte),0,2) . $separator;
|
||||||
print '"'.dol_trunc($line->label_operation,40,'right','UTF-8',1).'"' . $this->separator;
|
print '"'.dol_trunc($line->label_operation,40,'right','UTF-8',1).'"' . $separator;
|
||||||
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator;
|
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$separator;
|
||||||
print price2num($line->montant).$this->separator;
|
print price2num($line->montant).$separator;
|
||||||
print $line->sens.$this->separator;
|
print $line->sens.$separator;
|
||||||
print $date . $this->separator;
|
print $date . $separator;
|
||||||
print 'EUR';
|
print 'EUR';
|
||||||
print $this->end_line;
|
print $end_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,30 +539,61 @@ class AccountancyExport
|
|||||||
*/
|
*/
|
||||||
public function exportAgiris($objectLines) {
|
public function exportAgiris($objectLines) {
|
||||||
|
|
||||||
$this->separator = ';';
|
$separator = ';';
|
||||||
|
$end_line = "\n";
|
||||||
|
|
||||||
foreach ( $objectLines as $line ) {
|
foreach ( $objectLines as $line ) {
|
||||||
|
|
||||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||||
|
|
||||||
print $line->piece_num . $this->separator;
|
print $line->piece_num . $separator;
|
||||||
print $line->label_operation . $this->separator;
|
print $line->label_operation . $separator;
|
||||||
print $date . $this->separator;
|
print $date . $separator;
|
||||||
print $line->label_operation . $this->separator;
|
print $line->label_operation . $separator;
|
||||||
|
|
||||||
if (empty($line->subledger_account)) {
|
if (empty($line->subledger_account)) {
|
||||||
print length_accountg($line->numero_compte) . $this->separator;
|
print length_accountg($line->numero_compte) . $separator;
|
||||||
} else {
|
} else {
|
||||||
print length_accounta($line->subledger_account) . $this->separator;
|
print length_accounta($line->subledger_account) . $separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
print $line->doc_ref . $this->separator;
|
print $line->doc_ref . $separator;
|
||||||
print price($line->debit) . $this->separator;
|
print price($line->debit) . $separator;
|
||||||
print price($line->credit) . $this->separator;
|
print price($line->credit) . $separator;
|
||||||
print price($line->montant).$this->separator;
|
print price($line->montant) . $separator;
|
||||||
print $line->sens.$this->separator;
|
print $line->sens . $separator;
|
||||||
print $line->code_journal;
|
print $line->code_journal;
|
||||||
print $this->end_line;
|
print $end_line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Export format : Configurable
|
||||||
|
*
|
||||||
|
* @param array $objectLines data
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function exportConfigurable($objectLines) {
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
foreach ($objectLines as $line) {
|
||||||
|
$tab = array();
|
||||||
|
// export configurable
|
||||||
|
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||||
|
$tab[] = $line->piece_num;
|
||||||
|
$tab[] = $date;
|
||||||
|
$tab[] = $line->doc_ref;
|
||||||
|
$tab[] = $line->label_operation;
|
||||||
|
$tab[] = length_accountg($line->numero_compte);
|
||||||
|
$tab[] = length_accounta($line->subledger_account);
|
||||||
|
$tab[] = price($line->debit);
|
||||||
|
$tab[] = price($line->credit);
|
||||||
|
$tab[] = price($line->montant);
|
||||||
|
$tab[] = $line->code_journal;
|
||||||
|
|
||||||
|
$separator = $this->separator;
|
||||||
|
print implode($separator, $tab) . $this->end_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -107,7 +107,7 @@ class AccountancySystem
|
|||||||
|
|
||||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_system";
|
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_system";
|
||||||
$sql .= " (date_creation, fk_user_author, numero, label)";
|
$sql .= " (date_creation, fk_user_author, numero, label)";
|
||||||
$sql .= " VALUES ('" . $this->db->idate($now) . "'," . $user->id . ",'" . $this->numero . "','" . $this->label . "')";
|
$sql .= " VALUES ('" . $this->db->idate($now) . "'," . $user->id . ",'" . $this->db->escape($this->numero) . "','" . $this->db->escape($this->label) . "')";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/class/accountingaccount.class.php
|
* \file htdocs/accountancy/class/accountingaccount.class.php
|
||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief File of class to manage accounting accounts
|
* \brief File of class to manage accounting accounts
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,6 +30,21 @@
|
|||||||
*/
|
*/
|
||||||
class AccountingAccount extends CommonObject
|
class AccountingAccount extends CommonObject
|
||||||
{
|
{
|
||||||
|
public $element='accounting_account';
|
||||||
|
public $table_element='accounting_account';
|
||||||
|
public $picto = 'billr';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $ismultientitymanaged = 1;
|
||||||
|
/**
|
||||||
|
* 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
public $restrictiononfksoc = 1;
|
||||||
|
|
||||||
var $db;
|
var $db;
|
||||||
var $error;
|
var $error;
|
||||||
var $errors;
|
var $errors;
|
||||||
@ -48,13 +63,17 @@ class AccountingAccount extends CommonObject
|
|||||||
var $active; // duplicate with status
|
var $active; // duplicate with status
|
||||||
var $status;
|
var $status;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handle
|
* @param DoliDB $db Database handle
|
||||||
*/
|
*/
|
||||||
function __construct($db) {
|
function __construct($db) {
|
||||||
|
global $conf;
|
||||||
|
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
$this->next_prev_filter='fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; // Used to add a filter in Form::showrefnav method
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,7 +82,7 @@ class AccountingAccount extends CommonObject
|
|||||||
* @param int $rowid Id
|
* @param int $rowid Id
|
||||||
* @param string $account_number Account number
|
* @param string $account_number Account number
|
||||||
* @param int $limittocurrentchart 1=Do not load record if it is into another accounting system
|
* @param int $limittocurrentchart 1=Do not load record if it is into another accounting system
|
||||||
* @return int <0 if KO, Id of record if OK and found
|
* @return int <0 if KO, 0 if not found, Id of record if OK and found
|
||||||
*/
|
*/
|
||||||
function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0) {
|
function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0) {
|
||||||
global $conf;
|
global $conf;
|
||||||
@ -91,6 +110,7 @@ class AccountingAccount extends CommonObject
|
|||||||
if ($obj) {
|
if ($obj) {
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->rowid = $obj->rowid;
|
$this->rowid = $obj->rowid;
|
||||||
|
$this->ref = $obj->account_number;
|
||||||
$this->datec = $obj->datec;
|
$this->datec = $obj->datec;
|
||||||
$this->tms = $obj->tms;
|
$this->tms = $obj->tms;
|
||||||
$this->fk_pcg_version = $obj->fk_pcg_version;
|
$this->fk_pcg_version = $obj->fk_pcg_version;
|
||||||
@ -115,7 +135,7 @@ class AccountingAccount extends CommonObject
|
|||||||
$this->errors[] = "Error " . $this->db->lasterror();
|
$this->errors[] = "Error " . $this->db->lasterror();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return - 1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,11 +172,11 @@ class AccountingAccount extends CommonObject
|
|||||||
|
|
||||||
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
||||||
{
|
{
|
||||||
$this->pcg_type = 'XXXXXX';
|
$this->pcg_type = 'XXXXXX';
|
||||||
}
|
}
|
||||||
if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1')
|
if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1')
|
||||||
{
|
{
|
||||||
$this->pcg_subtype = 'XXXXXX';
|
$this->pcg_subtype = 'XXXXXX';
|
||||||
}
|
}
|
||||||
// Check parameters
|
// Check parameters
|
||||||
// Put here code to add control on parameters values
|
// Put here code to add control on parameters values
|
||||||
@ -179,8 +199,8 @@ class AccountingAccount extends CommonObject
|
|||||||
$sql .= ", " . $conf->entity;
|
$sql .= ", " . $conf->entity;
|
||||||
$sql .= ", " . (empty($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'");
|
$sql .= ", " . (empty($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'");
|
||||||
$sql .= ", " . (empty($this->pcg_type) ? 'NULL' : "'" . $this->db->escape($this->pcg_type) . "'");
|
$sql .= ", " . (empty($this->pcg_type) ? 'NULL' : "'" . $this->db->escape($this->pcg_type) . "'");
|
||||||
$sql .= ", " . (empty($this->pcg_subtype) ? 'NULL' : "'" . $this->pcg_subtype . "'");
|
$sql .= ", " . (empty($this->pcg_subtype) ? 'NULL' : "'" . $this->db->escape($this->pcg_subtype) . "'");
|
||||||
$sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->account_number . "'");
|
$sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->db->escape($this->account_number) . "'");
|
||||||
$sql .= ", " . (empty($this->account_parent) ? 'NULL' : "'" . $this->db->escape($this->account_parent) . "'");
|
$sql .= ", " . (empty($this->account_parent) ? 'NULL' : "'" . $this->db->escape($this->account_parent) . "'");
|
||||||
$sql .= ", " . (empty($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'");
|
$sql .= ", " . (empty($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'");
|
||||||
$sql .= ", " . (empty($this->account_category) ? 'NULL' : "'" . $this->db->escape($this->account_category) . "'");
|
$sql .= ", " . (empty($this->account_category) ? 'NULL' : "'" . $this->db->escape($this->account_category) . "'");
|
||||||
@ -235,17 +255,17 @@ class AccountingAccount extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function update($user)
|
function update($user)
|
||||||
{
|
{
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
||||||
{
|
{
|
||||||
$this->pcg_type = 'XXXXXX';
|
$this->pcg_type = 'XXXXXX';
|
||||||
}
|
}
|
||||||
if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1')
|
if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1')
|
||||||
{
|
{
|
||||||
$this->pcg_subtype = 'XXXXXX';
|
$this->pcg_subtype = 'XXXXXX';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
|
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
|
||||||
$sql .= " SET fk_pcg_version = " . ($this->fk_pcg_version ? "'" . $this->db->escape($this->fk_pcg_version) . "'" : "null");
|
$sql .= " SET fk_pcg_version = " . ($this->fk_pcg_version ? "'" . $this->db->escape($this->fk_pcg_version) . "'" : "null");
|
||||||
@ -364,14 +384,15 @@ class AccountingAccount extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Return clicable name (with picto eventually)
|
* Return clicable name (with picto eventually)
|
||||||
*
|
*
|
||||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||||
* @param int $withlabel 0=No label, 1=Include label of account
|
* @param int $withlabel 0=No label, 1=Include label of account
|
||||||
* @param int $nourl 1=Disable url
|
* @param int $nourl 1=Disable url
|
||||||
* @param string $moretitle Add more text to title tooltip
|
* @param string $moretitle Add more text to title tooltip
|
||||||
* @param int $notooltip 1=Disable tooltip
|
* @param int $notooltip 1=Disable tooltip
|
||||||
|
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||||
* @return string String with URL
|
* @return string String with URL
|
||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle='',$notooltip=0)
|
function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle='',$notooltip=0, $save_lastsearch_value=-1)
|
||||||
{
|
{
|
||||||
global $langs, $conf, $user;
|
global $langs, $conf, $user;
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||||
@ -382,6 +403,11 @@ class AccountingAccount extends CommonObject
|
|||||||
|
|
||||||
$url = DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . $this->id;
|
$url = DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . $this->id;
|
||||||
|
|
||||||
|
// Add param to save lastsearch_values or not
|
||||||
|
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
|
||||||
|
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
|
||||||
|
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
|
||||||
|
|
||||||
$picto = 'billr';
|
$picto = 'billr';
|
||||||
$label='';
|
$label='';
|
||||||
|
|
||||||
@ -395,17 +421,17 @@ class AccountingAccount extends CommonObject
|
|||||||
$linkclose='';
|
$linkclose='';
|
||||||
if (empty($notooltip))
|
if (empty($notooltip))
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||||
{
|
{
|
||||||
$label=$langs->trans("ShowAccoutingAccount");
|
$label=$langs->trans("ShowAccoutingAccount");
|
||||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
}
|
}
|
||||||
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
$linkclose.=' class="classfortooltip"';
|
$linkclose.=' class="classfortooltip"';
|
||||||
}
|
}
|
||||||
|
|
||||||
$linkstart='<a href="'.$url.'"';
|
$linkstart='<a href="'.$url.'"';
|
||||||
$linkstart.=$linkclose.'>';
|
$linkstart.=$linkclose.'>';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
if ($nourl)
|
if ($nourl)
|
||||||
@ -462,10 +488,10 @@ class AccountingAccount extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Account desactivate
|
* Account deactivated
|
||||||
*
|
*
|
||||||
* @param int $id Id
|
* @param int $id Id
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function account_desactivate($id) {
|
function account_desactivate($id) {
|
||||||
$result = $this->checkUsage();
|
$result = $this->checkUsage();
|
||||||
@ -494,10 +520,10 @@ class AccountingAccount extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Account activate
|
* Account activated
|
||||||
*
|
*
|
||||||
* @param int $id Id
|
* @param int $id Id
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function account_activate($id) {
|
function account_activate($id) {
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@ -522,56 +548,56 @@ class AccountingAccount extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Retourne le libelle du statut d'un user (actif, inactif)
|
* Retourne le libelle du statut d'un user (actif, inactif)
|
||||||
*
|
*
|
||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
* @return string Label of status
|
* @return string Label of status
|
||||||
*/
|
*/
|
||||||
function getLibStatut($mode=0)
|
function getLibStatut($mode=0)
|
||||||
{
|
{
|
||||||
return $this->LibStatut($this->status,$mode);
|
return $this->LibStatut($this->status,$mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renvoi le libelle d'un statut donne
|
* Renvoi le libelle d'un statut donne
|
||||||
*
|
*
|
||||||
* @param int $statut Id statut
|
* @param int $statut Id statut
|
||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
* @return string Label of status
|
* @return string Label of status
|
||||||
*/
|
*/
|
||||||
function LibStatut($statut,$mode=0)
|
function LibStatut($statut,$mode=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load('users');
|
$langs->loadLangs(array("users"));
|
||||||
|
|
||||||
if ($mode == 0)
|
if ($mode == 0)
|
||||||
{
|
{
|
||||||
$prefix='';
|
$prefix='';
|
||||||
if ($statut == 1) return $langs->trans('Enabled');
|
if ($statut == 1) return $langs->trans('Enabled');
|
||||||
if ($statut == 0) return $langs->trans('Disabled');
|
if ($statut == 0) return $langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
if ($mode == 1)
|
if ($mode == 1)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return $langs->trans('Enabled');
|
if ($statut == 1) return $langs->trans('Enabled');
|
||||||
if ($statut == 0) return $langs->trans('Disabled');
|
if ($statut == 0) return $langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
if ($mode == 2)
|
if ($mode == 2)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||||
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
if ($mode == 3)
|
if ($mode == 3)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4');
|
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4');
|
||||||
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5');
|
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5');
|
||||||
}
|
}
|
||||||
if ($mode == 4)
|
if ($mode == 4)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||||
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
if ($mode == 5)
|
if ($mode == 5)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
|
if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
|
||||||
if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,13 +29,14 @@ class AccountingJournal extends CommonObject
|
|||||||
public $element='accounting_journal';
|
public $element='accounting_journal';
|
||||||
public $table_element='accounting_journal';
|
public $table_element='accounting_journal';
|
||||||
public $fk_element = '';
|
public $fk_element = '';
|
||||||
protected $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
public $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||||
|
public $picto = 'generic';
|
||||||
|
|
||||||
var $rowid;
|
var $rowid;
|
||||||
|
|
||||||
public $code;
|
public $code;
|
||||||
public $label;
|
public $label;
|
||||||
public $nature; // 0:various operations, 1:sale, 2:purchase, 3:bank, 4:expense-report, 9: has-new
|
public $nature; // 1:various operations, 2:sale, 3:purchase, 4:bank, 5:expense-report, 8:inventory, 9: has-new
|
||||||
public $active;
|
public $active;
|
||||||
|
|
||||||
public $lines;
|
public $lines;
|
||||||
@ -58,6 +59,8 @@ class AccountingJournal extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function fetch($rowid = null, $journal_code = null)
|
function fetch($rowid = null, $journal_code = null)
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
if ($rowid || $journal_code)
|
if ($rowid || $journal_code)
|
||||||
{
|
{
|
||||||
$sql = "SELECT rowid, code, label, nature, active";
|
$sql = "SELECT rowid, code, label, nature, active";
|
||||||
@ -65,8 +68,11 @@ class AccountingJournal extends CommonObject
|
|||||||
$sql .= " WHERE";
|
$sql .= " WHERE";
|
||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql .= " rowid = " . (int) $rowid;
|
$sql .= " rowid = " . (int) $rowid;
|
||||||
} elseif ($journal_code) {
|
}
|
||||||
|
elseif ($journal_code)
|
||||||
|
{
|
||||||
$sql .= " code = '" . $this->db->escape($journal_code) . "'";
|
$sql .= " code = '" . $this->db->escape($journal_code) . "'";
|
||||||
|
$sql .= " AND entity = " . $conf->entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch sql=" . $sql, LOG_DEBUG);
|
||||||
@ -187,9 +193,6 @@ class AccountingJournal extends CommonObject
|
|||||||
|
|
||||||
$url = DOL_URL_ROOT . '/accountancy/admin/journals_list.php?id=35';
|
$url = DOL_URL_ROOT . '/accountancy/admin/journals_list.php?id=35';
|
||||||
|
|
||||||
$picto = 'billr';
|
|
||||||
$label='';
|
|
||||||
|
|
||||||
$label = '<u>' . $langs->trans("ShowAccountingJournal") . '</u>';
|
$label = '<u>' . $langs->trans("ShowAccountingJournal") . '</u>';
|
||||||
if (! empty($this->code))
|
if (! empty($this->code))
|
||||||
$label .= '<br><b>'.$langs->trans('Code') . ':</b> ' . $this->code;
|
$label .= '<br><b>'.$langs->trans('Code') . ':</b> ' . $this->code;
|
||||||
@ -223,9 +226,11 @@ class AccountingJournal extends CommonObject
|
|||||||
$label_link = $this->code;
|
$label_link = $this->code;
|
||||||
if ($withlabel) $label_link .= ' - ' . $this->label;
|
if ($withlabel) $label_link .= ' - ' . $this->label;
|
||||||
|
|
||||||
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
|
$result .= $linkstart;
|
||||||
if ($withpicto && $withpicto != 2) $result .= ' ';
|
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||||
if ($withpicto != 2) $result.=$linkstart . $label_link . $linkend;
|
if ($withpicto != 2) $result.= $label_link;
|
||||||
|
$result .= $linkend;
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,7 +256,7 @@ class AccountingJournal extends CommonObject
|
|||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$langs->load("accountancy");
|
$langs->loadLangs(array("accountancy"));
|
||||||
|
|
||||||
if ($mode == 0)
|
if ($mode == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -32,45 +32,37 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
|
|||||||
class BookKeeping extends CommonObject
|
class BookKeeping extends CommonObject
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var string Error code (or message)
|
* @var string Error code (or message)
|
||||||
* @deprecated
|
|
||||||
*
|
|
||||||
* @see Accountingbookkeeping::errors
|
|
||||||
*/
|
*/
|
||||||
public $error;
|
public $error;
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var string[] Error codes (or messages)
|
* @var string[] Error codes (or messages)
|
||||||
*/
|
*/
|
||||||
public $errors = array ();
|
public $errors = array ();
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var string Id to identify managed objects
|
* @var string Id to identify managed objects
|
||||||
*/
|
*/
|
||||||
public $element = 'accountingbookkeeping';
|
public $element = 'accountingbookkeeping';
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var string Name of table without prefix where object is stored
|
* @var string Name of table without prefix where object is stored
|
||||||
*/
|
*/
|
||||||
public $table_element = 'accounting_bookkeeping';
|
public $table_element = 'accounting_bookkeeping';
|
||||||
|
|
||||||
public $entity = 1;
|
public $entity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var BookKeepingLine[] Lines
|
* @var BookKeepingLine[] Lines
|
||||||
*/
|
*/
|
||||||
public $lines = array ();
|
public $lines = array ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var int ID
|
* @var int ID
|
||||||
*/
|
*/
|
||||||
public $id;
|
public $id;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public $doc_date;
|
public $doc_date;
|
||||||
|
public $date_lim_reglement;
|
||||||
public $doc_type;
|
public $doc_type;
|
||||||
public $doc_ref;
|
public $doc_ref;
|
||||||
public $fk_doc;
|
public $fk_doc;
|
||||||
@ -178,7 +170,7 @@ class BookKeeping extends CommonObject
|
|||||||
// Check parameters
|
// Check parameters
|
||||||
if (empty($this->numero_compte) || $this->numero_compte == '-1' || $this->numero_compte == 'NotDefined')
|
if (empty($this->numero_compte) || $this->numero_compte == '-1' || $this->numero_compte == 'NotDefined')
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->loadLangs(array("errors"));
|
||||||
if (in_array($this->doc_type, array('bank', 'expense_report')))
|
if (in_array($this->doc_type, array('bank', 'expense_report')))
|
||||||
{
|
{
|
||||||
$this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForBankLine', $this->fk_docdet, $this->doc_type);
|
$this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForBankLine', $this->fk_docdet, $this->doc_type);
|
||||||
@ -201,13 +193,18 @@ class BookKeeping extends CommonObject
|
|||||||
|
|
||||||
$this->piece_num = 0;
|
$this->piece_num = 0;
|
||||||
|
|
||||||
// First check if line not yet already in bookkeeping
|
// First check if line not yet already in bookkeeping.
|
||||||
|
// Note that we must include doc_type - fk_doc - numero_compte - label to be sure to have unicity of line (we may have several lines
|
||||||
|
// with same doc_type, fk_odc, numero_compte for 1 invoice line when using localtaxes with same account)
|
||||||
|
// WARNING: This is not reliable, label may have been modified. This is just a small protection.
|
||||||
|
// The page to make journalization make the test on couple doc_type - fk_doc only.
|
||||||
$sql = "SELECT count(*) as nb";
|
$sql = "SELECT count(*) as nb";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sql .= " WHERE doc_type = '" . $this->db->escape($this->doc_type) . "'";
|
$sql .= " WHERE doc_type = '" . $this->db->escape($this->doc_type) . "'";
|
||||||
$sql .= " AND fk_doc = " . $this->fk_doc;
|
$sql .= " AND fk_doc = " . $this->fk_doc;
|
||||||
$sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 is record is for several lines
|
//$sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 if record is for several lines
|
||||||
$sql .= " AND numero_compte = '" . $this->db->escape($this->numero_compte) . "'";
|
$sql .= " AND numero_compte = '" . $this->db->escape($this->numero_compte) . "'";
|
||||||
|
$sql .= " AND label_operation = '" . $this->db->escape($this->label_operation) . "'";
|
||||||
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -249,12 +246,10 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
if (empty($this->date_create)) {
|
|
||||||
$this->date_create = $now;
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . " (";
|
$sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . " (";
|
||||||
$sql .= "doc_date";
|
$sql .= "doc_date";
|
||||||
|
$sql .= ", date_lim_reglement";
|
||||||
$sql .= ", doc_type";
|
$sql .= ", doc_type";
|
||||||
$sql .= ", doc_ref";
|
$sql .= ", doc_ref";
|
||||||
$sql .= ", fk_doc";
|
$sql .= ", fk_doc";
|
||||||
@ -277,6 +272,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= ', entity';
|
$sql .= ', entity';
|
||||||
$sql .= ") VALUES (";
|
$sql .= ") VALUES (";
|
||||||
$sql .= "'" . $this->db->idate($this->doc_date) . "'";
|
$sql .= "'" . $this->db->idate($this->doc_date) . "'";
|
||||||
|
$sql .= ", ".(! isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'" . $this->db->idate($this->date_lim_reglement) . "'");
|
||||||
$sql .= ",'" . $this->db->escape($this->doc_type) . "'";
|
$sql .= ",'" . $this->db->escape($this->doc_type) . "'";
|
||||||
$sql .= ",'" . $this->db->escape($this->doc_ref) . "'";
|
$sql .= ",'" . $this->db->escape($this->doc_ref) . "'";
|
||||||
$sql .= "," . $this->fk_doc;
|
$sql .= "," . $this->fk_doc;
|
||||||
@ -292,11 +288,11 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= "," . $this->montant;
|
$sql .= "," . $this->montant;
|
||||||
$sql .= ",'" . $this->db->escape($this->sens) . "'";
|
$sql .= ",'" . $this->db->escape($this->sens) . "'";
|
||||||
$sql .= ",'" . $this->db->escape($this->fk_user_author) . "'";
|
$sql .= ",'" . $this->db->escape($this->fk_user_author) . "'";
|
||||||
$sql .= ",'" . $this->db->idate($this->date_create). "'";
|
$sql .= ",'" . $this->db->idate($now). "'";
|
||||||
$sql .= ",'" . $this->db->escape($this->code_journal) . "'";
|
$sql .= ",'" . $this->db->escape($this->code_journal) . "'";
|
||||||
$sql .= ",'" . $this->db->escape($this->journal_label) . "'";
|
$sql .= ",'" . $this->db->escape($this->journal_label) . "'";
|
||||||
$sql .= "," . $this->db->escape($this->piece_num);
|
$sql .= "," . $this->db->escape($this->piece_num);
|
||||||
$sql .= ", " . (! isset($this->entity) ? '1' : $this->entity);
|
$sql .= ", " . (! isset($this->entity) ? $conf->entity : $this->entity);
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG);
|
||||||
@ -355,6 +351,67 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a link to the object card (with optionaly the picto)
|
||||||
|
*
|
||||||
|
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
|
||||||
|
* @param string $option On what the link point to ('nolink', ...)
|
||||||
|
* @param int $notooltip 1=Disable tooltip
|
||||||
|
* @param string $morecss Add more css on link
|
||||||
|
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||||
|
* @return string String with URL
|
||||||
|
*/
|
||||||
|
function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
|
||||||
|
{
|
||||||
|
global $db, $conf, $langs;
|
||||||
|
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
||||||
|
global $menumanager;
|
||||||
|
|
||||||
|
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||||
|
|
||||||
|
$result = '';
|
||||||
|
$companylink = '';
|
||||||
|
|
||||||
|
$label = '<u>' . $langs->trans("Transaction") . '</u>';
|
||||||
|
$label.= '<br>';
|
||||||
|
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->piece_num;
|
||||||
|
|
||||||
|
$url = DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$this->piece_num;
|
||||||
|
|
||||||
|
if ($option != 'nolink')
|
||||||
|
{
|
||||||
|
// Add param to save lastsearch_values or not
|
||||||
|
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
|
||||||
|
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
|
||||||
|
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
|
||||||
|
}
|
||||||
|
|
||||||
|
$linkclose='';
|
||||||
|
if (empty($notooltip))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||||
|
{
|
||||||
|
$label=$langs->trans("ShowTransaction");
|
||||||
|
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
|
}
|
||||||
|
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
|
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
|
||||||
|
}
|
||||||
|
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
|
||||||
|
|
||||||
|
$linkstart = '<a href="'.$url.'"';
|
||||||
|
$linkstart.=$linkclose.'>';
|
||||||
|
$linkend='</a>';
|
||||||
|
|
||||||
|
$result .= $linkstart;
|
||||||
|
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||||
|
if ($withpicto != 2) $result.= $this->piece_num;
|
||||||
|
$result .= $linkend;
|
||||||
|
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create object into database
|
* Create object into database
|
||||||
*
|
*
|
||||||
@ -364,6 +421,8 @@ class BookKeeping extends CommonObject
|
|||||||
* @return int <0 if KO, Id of created object if OK
|
* @return int <0 if KO, Id of created object if OK
|
||||||
*/
|
*/
|
||||||
public function createStd(User $user, $notrigger = false, $mode='') {
|
public function createStd(User $user, $notrigger = false, $mode='') {
|
||||||
|
global $conf;
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -434,9 +493,6 @@ class BookKeeping extends CommonObject
|
|||||||
$this->credit = price2num($this->credit, 'MT');
|
$this->credit = price2num($this->credit, 'MT');
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
if (empty($this->date_create)) {
|
|
||||||
$this->date_create = $now;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
// Put here code to add control on parameters values
|
// Put here code to add control on parameters values
|
||||||
@ -444,6 +500,7 @@ class BookKeeping extends CommonObject
|
|||||||
// Insert request
|
// Insert request
|
||||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . $mode.'(';
|
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . $mode.'(';
|
||||||
$sql .= 'doc_date,';
|
$sql .= 'doc_date,';
|
||||||
|
$sql .= 'date_lim_reglement,';
|
||||||
$sql .= 'doc_type,';
|
$sql .= 'doc_type,';
|
||||||
$sql .= 'doc_ref,';
|
$sql .= 'doc_ref,';
|
||||||
$sql .= 'fk_doc,';
|
$sql .= 'fk_doc,';
|
||||||
@ -466,6 +523,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= 'entity';
|
$sql .= 'entity';
|
||||||
$sql .= ') VALUES (';
|
$sql .= ') VALUES (';
|
||||||
$sql .= ' ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) == 0 ? 'NULL' : "'" . $this->db->idate($this->doc_date) . "'") . ',';
|
$sql .= ' ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) == 0 ? 'NULL' : "'" . $this->db->idate($this->doc_date) . "'") . ',';
|
||||||
|
$sql .= ' ' . (! isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'" . $this->db->idate($this->date_lim_reglement) . "'") . ',';
|
||||||
$sql .= ' ' . (! isset($this->doc_type) ? 'NULL' : "'" . $this->db->escape($this->doc_type) . "'") . ',';
|
$sql .= ' ' . (! isset($this->doc_type) ? 'NULL' : "'" . $this->db->escape($this->doc_type) . "'") . ',';
|
||||||
$sql .= ' ' . (! isset($this->doc_ref) ? 'NULL' : "'" . $this->db->escape($this->doc_ref) . "'") . ',';
|
$sql .= ' ' . (! isset($this->doc_ref) ? 'NULL' : "'" . $this->db->escape($this->doc_ref) . "'") . ',';
|
||||||
$sql .= ' ' . (empty($this->fk_doc) ? '0' : $this->fk_doc) . ',';
|
$sql .= ' ' . (empty($this->fk_doc) ? '0' : $this->fk_doc) . ',';
|
||||||
@ -481,11 +539,11 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= ' ' . (! isset($this->montant) ? 'NULL' : $this->montant ). ',';
|
$sql .= ' ' . (! isset($this->montant) ? 'NULL' : $this->montant ). ',';
|
||||||
$sql .= ' ' . (! isset($this->sens) ? 'NULL' : "'" . $this->db->escape($this->sens) . "'") . ',';
|
$sql .= ' ' . (! isset($this->sens) ? 'NULL' : "'" . $this->db->escape($this->sens) . "'") . ',';
|
||||||
$sql .= ' ' . $user->id . ',';
|
$sql .= ' ' . $user->id . ',';
|
||||||
$sql .= ' ' . "'" . $this->db->idate($this->date_create) . "',";
|
$sql .= ' ' . "'" . $this->db->idate($now) . "',";
|
||||||
$sql .= ' ' . (empty($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ',';
|
$sql .= ' ' . (empty($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ',';
|
||||||
$sql .= ' ' . (empty($this->journal_label) ? 'NULL' : "'" . $this->db->escape($this->journal_label) . "'") . ',';
|
$sql .= ' ' . (empty($this->journal_label) ? 'NULL' : "'" . $this->db->escape($this->journal_label) . "'") . ',';
|
||||||
$sql .= ' ' . (empty($this->piece_num) ? 'NULL' : $this->db->escape($this->piece_num)).',';
|
$sql .= ' ' . (empty($this->piece_num) ? 'NULL' : $this->db->escape($this->piece_num)).',';
|
||||||
$sql .= ' ' . (! isset($this->entity) ? '1' : $this->entity);
|
$sql .= ' ' . (! isset($this->entity) ? $conf->entity : $this->entity);
|
||||||
$sql .= ')';
|
$sql .= ')';
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@ -498,7 +556,7 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element . $mode);
|
||||||
|
|
||||||
if (! $notrigger) {
|
if (! $notrigger) {
|
||||||
// Uncomment this and change MYOBJECT to your own tag if you
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
@ -540,6 +598,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql = 'SELECT';
|
$sql = 'SELECT';
|
||||||
$sql .= ' t.rowid,';
|
$sql .= ' t.rowid,';
|
||||||
$sql .= " t.doc_date,";
|
$sql .= " t.doc_date,";
|
||||||
|
$sql .= " t.date_lim_reglement,";
|
||||||
$sql .= " t.doc_type,";
|
$sql .= " t.doc_type,";
|
||||||
$sql .= " t.doc_ref,";
|
$sql .= " t.doc_ref,";
|
||||||
$sql .= " t.fk_doc,";
|
$sql .= " t.fk_doc,";
|
||||||
@ -558,7 +617,8 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " t.import_key,";
|
$sql .= " t.import_key,";
|
||||||
$sql .= " t.code_journal,";
|
$sql .= " t.code_journal,";
|
||||||
$sql .= " t.journal_label,";
|
$sql .= " t.journal_label,";
|
||||||
$sql .= " t.piece_num";
|
$sql .= " t.piece_num,";
|
||||||
|
$sql .= " t.date_creation";
|
||||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element.$mode. ' as t';
|
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element.$mode. ' as t';
|
||||||
$sql .= ' WHERE 1 = 1';
|
$sql .= ' WHERE 1 = 1';
|
||||||
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
||||||
@ -577,6 +637,7 @@ class BookKeeping extends CommonObject
|
|||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
|
|
||||||
$this->doc_date = $this->db->jdate($obj->doc_date);
|
$this->doc_date = $this->db->jdate($obj->doc_date);
|
||||||
|
$this->date_lim_reglement = $this->db->jdate($obj->date_lim_reglement);
|
||||||
$this->doc_type = $obj->doc_type;
|
$this->doc_type = $obj->doc_type;
|
||||||
$this->doc_ref = $obj->doc_ref;
|
$this->doc_ref = $obj->doc_ref;
|
||||||
$this->fk_doc = $obj->fk_doc;
|
$this->fk_doc = $obj->fk_doc;
|
||||||
@ -596,6 +657,7 @@ class BookKeeping extends CommonObject
|
|||||||
$this->code_journal = $obj->code_journal;
|
$this->code_journal = $obj->code_journal;
|
||||||
$this->journal_label = $obj->journal_label;
|
$this->journal_label = $obj->journal_label;
|
||||||
$this->piece_num = $obj->piece_num;
|
$this->piece_num = $obj->piece_num;
|
||||||
|
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
@ -623,13 +685,15 @@ class BookKeeping extends CommonObject
|
|||||||
* @param array $filter filter array
|
* @param array $filter filter array
|
||||||
* @param string $filtermode filter mode (AND or OR)
|
* @param string $filtermode filter mode (AND or OR)
|
||||||
*
|
*
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >=0 if OK
|
||||||
*/
|
*/
|
||||||
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') {
|
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') {
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
|
$this->lines = array();
|
||||||
|
|
||||||
$sql = 'SELECT';
|
$sql = 'SELECT';
|
||||||
$sql .= ' t.rowid,';
|
$sql .= ' t.rowid,';
|
||||||
$sql .= " t.doc_date,";
|
$sql .= " t.doc_date,";
|
||||||
@ -651,7 +715,8 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " t.import_key,";
|
$sql .= " t.import_key,";
|
||||||
$sql .= " t.code_journal,";
|
$sql .= " t.code_journal,";
|
||||||
$sql .= " t.journal_label,";
|
$sql .= " t.journal_label,";
|
||||||
$sql .= " t.piece_num";
|
$sql .= " t.piece_num,";
|
||||||
|
$sql .= " t.date_creation";
|
||||||
// Manage filter
|
// Manage filter
|
||||||
$sqlwhere = array ();
|
$sqlwhere = array ();
|
||||||
if (count($filter) > 0) {
|
if (count($filter) > 0) {
|
||||||
@ -666,10 +731,12 @@ class BookKeeping extends CommonObject
|
|||||||
$sqlwhere[] = $key . '=' . $value;
|
$sqlwhere[] = $key . '=' . $value;
|
||||||
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
|
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
|
||||||
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
|
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
|
||||||
} elseif ($key == 't.label_operation') {
|
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
|
||||||
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
|
$sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\'';
|
||||||
|
} elseif ($key == 't.credit' || $key == 't.debit') {
|
||||||
|
$sqlwhere[] = natural_search($key, $value, 1, 1);
|
||||||
} else {
|
} else {
|
||||||
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
$sqlwhere[] = natural_search($key, $value, 0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -687,7 +754,6 @@ class BookKeeping extends CommonObject
|
|||||||
if (! empty($limit)) {
|
if (! empty($limit)) {
|
||||||
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||||
}
|
}
|
||||||
$this->lines = array ();
|
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
@ -718,6 +784,7 @@ class BookKeeping extends CommonObject
|
|||||||
$line->code_journal = $obj->code_journal;
|
$line->code_journal = $obj->code_journal;
|
||||||
$line->journal_label = $obj->journal_label;
|
$line->journal_label = $obj->journal_label;
|
||||||
$line->piece_num = $obj->piece_num;
|
$line->piece_num = $obj->piece_num;
|
||||||
|
$line->date_creation = $obj->date_creation;
|
||||||
|
|
||||||
$this->lines[] = $line;
|
$this->lines[] = $line;
|
||||||
}
|
}
|
||||||
@ -728,7 +795,7 @@ class BookKeeping extends CommonObject
|
|||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
|
|
||||||
return - 1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -770,7 +837,9 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " t.import_key,";
|
$sql .= " t.import_key,";
|
||||||
$sql .= " t.code_journal,";
|
$sql .= " t.code_journal,";
|
||||||
$sql .= " t.journal_label,";
|
$sql .= " t.journal_label,";
|
||||||
$sql .= " t.piece_num";
|
$sql .= " t.piece_num,";
|
||||||
|
$sql .= " t.date_creation,";
|
||||||
|
$sql .= " t.tms as date_modification";
|
||||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||||
// Manage filter
|
// Manage filter
|
||||||
$sqlwhere = array ();
|
$sqlwhere = array ();
|
||||||
@ -786,13 +855,18 @@ class BookKeeping extends CommonObject
|
|||||||
$sqlwhere[] = $key . '=' . $value;
|
$sqlwhere[] = $key . '=' . $value;
|
||||||
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
|
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
|
||||||
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
|
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
|
||||||
|
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
|
||||||
|
$sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\'';
|
||||||
|
} elseif ($key == 't.tms>=' || $key == 't.tms<=') {
|
||||||
|
$sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\'';
|
||||||
|
} elseif ($key == 't.credit' || $key == 't.debit') {
|
||||||
|
$sqlwhere[] = natural_search($key, $value, 1, 1);
|
||||||
} else {
|
} else {
|
||||||
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
$sqlwhere[] = natural_search($key, $value, 0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql.= ' WHERE 1 = 1';
|
$sql.= ' WHERE entity IN (' . getEntity('accountancy') . ')';
|
||||||
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
|
||||||
if (count($sqlwhere) > 0) {
|
if (count($sqlwhere) > 0) {
|
||||||
$sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere);
|
$sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere);
|
||||||
}
|
}
|
||||||
@ -834,6 +908,8 @@ class BookKeeping extends CommonObject
|
|||||||
$line->code_journal = $obj->code_journal;
|
$line->code_journal = $obj->code_journal;
|
||||||
$line->journal_label = $obj->journal_label;
|
$line->journal_label = $obj->journal_label;
|
||||||
$line->piece_num = $obj->piece_num;
|
$line->piece_num = $obj->piece_num;
|
||||||
|
$line->date_creation = $this->db->jdate($obj->date_creation);
|
||||||
|
$line->date_modification = $this->db->jdate($obj->date_modification);
|
||||||
|
|
||||||
$this->lines[] = $line;
|
$this->lines[] = $line;
|
||||||
}
|
}
|
||||||
@ -860,9 +936,12 @@ class BookKeeping extends CommonObject
|
|||||||
*
|
*
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') {
|
public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
|
||||||
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
$this->lines = array();
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
$sql = 'SELECT';
|
$sql = 'SELECT';
|
||||||
@ -905,7 +984,6 @@ class BookKeeping extends CommonObject
|
|||||||
if (! empty($limit)) {
|
if (! empty($limit)) {
|
||||||
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||||
}
|
}
|
||||||
$this->lines = array ();
|
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
@ -1072,22 +1150,26 @@ class BookKeeping extends CommonObject
|
|||||||
* @param string $mode Mode
|
* @param string $mode Mode
|
||||||
* @return number <0 if KO, >0 if OK
|
* @return number <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function updateByMvt($piece_num='', $field='', $value='', $mode='') {
|
public function updateByMvt($piece_num='', $field='', $value='', $mode='')
|
||||||
|
{
|
||||||
|
$error=0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . $mode . " as ab";
|
$sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . $mode . " as ab";
|
||||||
$sql .= ' SET ab.' . $field . '=' . (is_numeric($value)?$value:"'".$value."'");
|
$sql .= ' SET ab.' . $field . '=' . (is_numeric($value)?$value:"'".$this->db->escape($value)."'");
|
||||||
$sql .= ' WHERE ab.piece_num=' . $piece_num ;
|
$sql .= ' WHERE ab.piece_num=' . $piece_num ;
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
if (! $resql) {
|
if (! $resql) {
|
||||||
$error ++;
|
$error++;
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
if ($error) {
|
if ($error) {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
|
|
||||||
return - 1 * $error;
|
return -1 * $error;
|
||||||
} else {
|
} else {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|
||||||
@ -1158,7 +1240,7 @@ class BookKeeping extends CommonObject
|
|||||||
// first check if line not yet in bookkeeping
|
// first check if line not yet in bookkeeping
|
||||||
$sql = "DELETE";
|
$sql = "DELETE";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sql .= " WHERE import_key = '" . $importkey . "'";
|
$sql .= " WHERE import_key = '" . $this->db->escape($importkey) . "'";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
@ -1196,7 +1278,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql.= " FROM " . MAIN_DB_PREFIX . $this->table_element.$mode;
|
$sql.= " FROM " . MAIN_DB_PREFIX . $this->table_element.$mode;
|
||||||
$sql.= " WHERE 1 = 1";
|
$sql.= " WHERE 1 = 1";
|
||||||
if (! empty($delyear)) $sql.= " AND YEAR(doc_date) = " . $delyear; // FIXME Must use between
|
if (! empty($delyear)) $sql.= " AND YEAR(doc_date) = " . $delyear; // FIXME Must use between
|
||||||
if (! empty($journal)) $sql.= " AND code_journal = '".$journal."'";
|
if (! empty($journal)) $sql.= " AND code_journal = '".$this->db->escape($journal)."'";
|
||||||
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
@ -1217,19 +1299,18 @@ class BookKeeping extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Delete bookkepping by piece number
|
* Delete bookkepping by piece number
|
||||||
*
|
*
|
||||||
* @param int $piecenum peicenum to delete
|
* @param int $piecenum Piecenum to delete
|
||||||
* @param string $mode Mode
|
* @return int Result
|
||||||
* @return int Result
|
|
||||||
*/
|
*/
|
||||||
function deleteMvtNum($piecenum, $mode) {
|
function deleteMvtNum($piecenum) {
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// first check if line not yet in bookkeeping
|
// first check if line not yet in bookkeeping
|
||||||
$sql = "DELETE";
|
$sql = "DELETE";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element. $mode;
|
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sql .= " WHERE piece_num = " . $piecenum;
|
$sql .= " WHERE piece_num = " . (int) $piecenum;
|
||||||
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -1326,6 +1407,7 @@ class BookKeeping extends CommonObject
|
|||||||
$this->code_journal = 'VT';
|
$this->code_journal = 'VT';
|
||||||
$this->journal_label = 'Journal de vente';
|
$this->journal_label = 'Journal de vente';
|
||||||
$this->piece_num = '';
|
$this->piece_num = '';
|
||||||
|
$this->date_creation = $now;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1338,7 +1420,7 @@ class BookKeeping extends CommonObject
|
|||||||
public function fetchPerMvt($piecenum, $mode='') {
|
public function fetchPerMvt($piecenum, $mode='') {
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT piece_num,doc_date,code_journal,journal_label,doc_ref,doc_type";
|
$sql = "SELECT piece_num,doc_date,code_journal,journal_label,doc_ref,doc_type,date_creation";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element.$mode;
|
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element.$mode;
|
||||||
$sql .= " WHERE piece_num = " . $piecenum;
|
$sql .= " WHERE piece_num = " . $piecenum;
|
||||||
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
||||||
@ -1354,6 +1436,7 @@ class BookKeeping extends CommonObject
|
|||||||
$this->doc_date = $this->db->jdate($obj->doc_date);
|
$this->doc_date = $this->db->jdate($obj->doc_date);
|
||||||
$this->doc_ref = $obj->doc_ref;
|
$this->doc_ref = $obj->doc_ref;
|
||||||
$this->doc_type = $obj->doc_type;
|
$this->doc_type = $obj->doc_type;
|
||||||
|
$this->date_creation = $obj->date_creation;
|
||||||
} else {
|
} else {
|
||||||
$this->error = "Error " . $this->db->lasterror();
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
dol_syslog(get_class($this) . "::" . __METHOD__ . $this->error, LOG_ERR);
|
dol_syslog(get_class($this) . "::" . __METHOD__ . $this->error, LOG_ERR);
|
||||||
@ -1404,7 +1487,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql = "SELECT rowid, doc_date, doc_type,";
|
$sql = "SELECT rowid, doc_date, doc_type,";
|
||||||
$sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,";
|
$sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,";
|
||||||
$sql .= " numero_compte, label_compte, label_operation, debit, credit,";
|
$sql .= " numero_compte, label_compte, label_operation, debit, credit,";
|
||||||
$sql .= " montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num";
|
$sql .= " montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element.$mode;
|
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element.$mode;
|
||||||
$sql .= " WHERE piece_num = " . $piecenum;
|
$sql .= " WHERE piece_num = " . $piecenum;
|
||||||
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
||||||
@ -1437,6 +1520,7 @@ class BookKeeping extends CommonObject
|
|||||||
$line->code_journal = $obj->code_journal;
|
$line->code_journal = $obj->code_journal;
|
||||||
$line->journal_label = $obj->journal_label;
|
$line->journal_label = $obj->journal_label;
|
||||||
$line->piece_num = $obj->piece_num;
|
$line->piece_num = $obj->piece_num;
|
||||||
|
$line->date_creation = $obj->date_creation;
|
||||||
|
|
||||||
$this->linesmvt[] = $line;
|
$this->linesmvt[] = $line;
|
||||||
}
|
}
|
||||||
@ -1515,11 +1599,16 @@ class BookKeeping extends CommonObject
|
|||||||
* @param string $piece_num Piece num
|
* @param string $piece_num Piece num
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function transformTransaction($direction=0,$piece_num='') {
|
public function transformTransaction($direction=0,$piece_num='')
|
||||||
|
{
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
if ($direction==0) {
|
|
||||||
|
if ($direction==0)
|
||||||
|
{
|
||||||
$next_piecenum=$this->getNextNumMvt();
|
$next_piecenum=$this->getNextNumMvt();
|
||||||
if ($result < 0) {
|
if ($next_piecenum < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element.'(doc_date, doc_type,';
|
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element.'(doc_date, doc_type,';
|
||||||
@ -1770,4 +1859,5 @@ class BookKeepingLine
|
|||||||
public $code_journal;
|
public $code_journal;
|
||||||
public $journal_label;
|
public $journal_label;
|
||||||
public $piece_num;
|
public $piece_num;
|
||||||
|
public $date_creation;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,313 +18,297 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file accountancy/class/bookkeeping.class.php
|
* \file accountancy/class/bookkeeping.class.php
|
||||||
* \ingroup Accounting Expert
|
* \ingroup Advanced accountancy
|
||||||
* \brief Fichier de la classe des comptes comptable
|
* \brief File of class for lettering
|
||||||
*/
|
*/
|
||||||
|
include_once DOL_DOCUMENT_ROOT . "/accountancy/class/bookkeeping.class.php";
|
||||||
include_once DOL_DOCUMENT_ROOT."/accountancy/class/bookkeeping.class.php";
|
include_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php";
|
||||||
include_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
|
include_once DOL_DOCUMENT_ROOT . "/core/lib/date.lib.php";
|
||||||
include_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php";
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class lettering
|
* Class lettering
|
||||||
*/
|
*/
|
||||||
class lettering extends BookKeeping
|
class lettering extends BookKeeping
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* lettrageTiers
|
* lettrageTiers
|
||||||
*
|
*
|
||||||
* @param int $socid Thirdparty id
|
* @param int $socid Thirdparty id
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function lettrageTiers($socid) {
|
public function lettrageTiers($socid)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
$db = $this->db;
|
$error = 0;
|
||||||
|
|
||||||
$object = new Societe($this->db);
|
$object = new Societe($this->db);
|
||||||
$object->id = $socid;
|
$object->id = $socid;
|
||||||
$object->fetch($socid);
|
$object->fetch($socid);
|
||||||
|
|
||||||
|
if ($object->code_compta == '411CUSTCODE') {
|
||||||
if( $object->code_compta == '411CUSTCODE')
|
|
||||||
$object->code_compta = '';
|
$object->code_compta = '';
|
||||||
|
|
||||||
if( $object->code_compta_fournisseur == '401SUPPCODE')
|
|
||||||
$object->code_compta_fournisseur = '';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.lettering_code, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering ";
|
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
|
||||||
$sql .= " WHERE code_journal = 'BQ' AND ( ";
|
|
||||||
if(!empty($object->code_compta) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
|
||||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " OR ";
|
|
||||||
if(!empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
|
||||||
|
|
||||||
$sql .= " ) AND ( bk.date_lettering ='' OR bk.date_lettering IS NULL ) AND bk.lettering_code !='' ";
|
|
||||||
|
|
||||||
$sql .= " GROUP BY bk.lettering_code ";
|
|
||||||
|
|
||||||
|
|
||||||
$resql = $db->query ( $sql );
|
|
||||||
if ($resql) {
|
|
||||||
$num = $db->num_rows ( $resql );
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
while ( $i < $num ) {
|
|
||||||
$obj = $db->fetch_object ( $resql );
|
|
||||||
$i++;
|
|
||||||
|
|
||||||
$sql = "SELECT bk.rowid ";
|
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
|
||||||
$sql .= " WHERE bk.lettering_code = '".$obj->lettering_code."' ";
|
|
||||||
$sql .= " AND ( ";
|
|
||||||
if(!empty($object->code_compta) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
|
||||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " OR ";
|
|
||||||
if(!empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
|
||||||
$sql .= " ) ";
|
|
||||||
// echo $sql;
|
|
||||||
$resql2 = $db->query ( $sql );
|
|
||||||
if ($resql2) {
|
|
||||||
$num2 = $db->num_rows ( $resql2 );
|
|
||||||
$i2 = 0;
|
|
||||||
$ids = array();
|
|
||||||
while ( $i2 < $num2 ) {
|
|
||||||
$obj2 = $db->fetch_object ( $resql2 );
|
|
||||||
$i2++;
|
|
||||||
$ids[] = $obj2->rowid;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(count($ids) > 1 ){
|
|
||||||
$result = $this->updatelettrage($ids);
|
|
||||||
|
|
||||||
// var_dump($result);
|
|
||||||
// if( $result < 0 ){
|
|
||||||
// setEventMessages('', $BookKeeping->errors, 'errors' );
|
|
||||||
// $error++;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($object->code_compta_fournisseur == '401SUPPCODE') {
|
||||||
|
$object->code_compta_fournisseur = '';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Prise en charge des lettering complexe avec prelevment , virement
|
* Prise en charge des lettering complexe avec prelevment , virement
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering, bu.url_id , bu.type ";
|
$sql = "SELECT DISTINCT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.subledger_account, ";
|
||||||
|
$sql .= " bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant ";
|
||||||
|
$sql .= " , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering, bu.url_id , bu.type ";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu ON(bk.fk_doc = bu.fk_bank AND bu.type IN ('payment', 'payment_supplier') ) ";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu ON(bk.fk_doc = bu.fk_bank AND bu.type IN ('payment', 'payment_supplier') ) ";
|
||||||
$sql .= " WHERE code_journal = 'BQ' AND ( ";
|
$sql .= " WHERE ( ";
|
||||||
if(!empty($object->code_compta) )
|
if (! empty($object->code_compta))
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur))
|
||||||
$sql .= " OR ";
|
$sql .= " OR ";
|
||||||
if(!empty($object->code_compta_fournisseur) )
|
if (! empty($object->code_compta_fournisseur))
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||||
|
|
||||||
$sql .= " ) AND date_lettering ='' ";
|
$sql .= " ) AND (bk.date_lettering ='' OR bk.date_lettering IS NULL) ";
|
||||||
$sql .= " GROUP BY bk.lettering_code ";
|
$sql .= " AND (bk.lettering_code != '' OR bk.lettering_code IS NULL) ";
|
||||||
|
$sql .= $this->db->order('bk.doc_date', 'DESC');
|
||||||
|
|
||||||
// echo $sql;
|
// echo $sql;
|
||||||
//
|
//
|
||||||
$resql = $db->query ( $sql );
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows ( $resql );
|
$num = $this->db->num_rows($resql);
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
while ( $i < $num ) {
|
while ($obj = $this->db->fetch_object($resql) ) {
|
||||||
$obj = $db->fetch_object ( $resql );
|
|
||||||
$ids = array();
|
$ids = array();
|
||||||
$i++;
|
$ids_fact = array();
|
||||||
|
|
||||||
// print_r($obj);
|
if ($obj->type == 'payment_supplier')
|
||||||
|
{
|
||||||
|
$sql = 'SELECT DISTINCT bk.rowid, facf.ref, facf.ref_supplier, payf.fk_bank, facf.rowid as fact_id';
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
|
||||||
if($obj->type =='payment_supplier' ) {
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
|
||||||
$ids[] = $obj->rowid;
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON (bk.fk_doc = payf.fk_bank AND bk.code_journal='" . $obj->code_journal . "')";
|
||||||
$sql= 'SELECT bk.rowid, facf.ref, facf.ref_supplier, payf.fk_bank ';
|
$sql .= " WHERE payfacf.fk_paiementfourn = '" . $obj->url_id . "' ";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
|
$sql .= " AND facf.entity = ".$conf->entity;
|
||||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
|
$sql .= " AND code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=4 AND entity=".$conf->entity.") ";
|
||||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid";
|
$sql .= " AND ( ";
|
||||||
$sql.= " INNER JOIN " .MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = facf.ref) ";
|
if (! empty($object->code_compta)) {
|
||||||
// $sqlmid.= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc ON soc.rowid=facf.fk_soc";
|
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||||
// $sqlmid.= " INNER JOIN " . MAIN_DB_PREFIX . "c_paiement as payc ON payc.id=payf.fk_paiement";
|
|
||||||
$sql .= " WHERE 1 ";
|
|
||||||
$sql .= " AND fk_paiementfourn = '".$obj->url_id."' ";
|
|
||||||
// $sql .= " AND (bk.numero_compte = '" . $object->code_compta . "' OR bk.numero_compte = '" . $object->code_compta_fournisseur . "') ";
|
|
||||||
$sql .= " AND ( ";
|
|
||||||
if(!empty($object->code_compta) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
|
||||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " OR ";
|
|
||||||
if(!empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
|
||||||
$sql .= " ) ";
|
|
||||||
// echo $sql;
|
|
||||||
// exit;
|
|
||||||
}
|
}
|
||||||
elseif($obj->type =='payment' ){
|
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
|
||||||
$ids[] = $obj->rowid;
|
$sql .= " OR ";
|
||||||
|
|
||||||
$sql= 'SELECT bk.rowid,fac.facnumber , pay.fk_bank ';
|
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facture fac ";
|
|
||||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
|
|
||||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid";
|
|
||||||
$sql.= " INNER JOIN " .MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = fac.rowid) ";
|
|
||||||
$sql .= " WHERE 1 ";
|
|
||||||
$sql .= " AND payfac.fk_paiement = '".$obj->url_id."' ";
|
|
||||||
$sql .= " AND ( ";
|
|
||||||
if(!empty($object->code_compta) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
|
||||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " OR ";
|
|
||||||
if(!empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
|
||||||
$sql .= " ) ";
|
|
||||||
|
|
||||||
// echo $sql;
|
|
||||||
}
|
}
|
||||||
|
if (! empty($object->code_compta_fournisseur)) {
|
||||||
|
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||||
|
}
|
||||||
|
$sql .= " ) ";
|
||||||
|
|
||||||
|
$resql2 = $this->db->query($sql);
|
||||||
|
|
||||||
$resql2 = $db->query ( $sql );
|
|
||||||
if ($resql2) {
|
if ($resql2) {
|
||||||
$num2 = $db->num_rows ( $resql2 );
|
while ( $obj2 = $this->db->fetch_object($resql2) ) {
|
||||||
$i2 = 0;
|
$ids[$obj2->rowid] = $obj2->rowid;
|
||||||
|
$ids_fact[] = $obj2->fact_id;
|
||||||
while ( $i2 < $num2 ) {
|
|
||||||
$obj2 = $db->fetch_object ( $resql2 );
|
|
||||||
$i2++;
|
|
||||||
$ids[] = $obj2->rowid;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
// print_r($ids);
|
$this->errors[] = $this->db->lasterror;
|
||||||
// exit;
|
return - 1;
|
||||||
if(count($ids) > 1 ){
|
|
||||||
$result = $this->updatelettrage($ids);
|
|
||||||
|
|
||||||
// var_dump($result);
|
|
||||||
// if( $result < 0 ){
|
|
||||||
// setEventMessages('', $BookKeeping->errors, 'errors' );
|
|
||||||
// $error++;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
// exit;
|
|
||||||
}
|
}
|
||||||
|
if (count($ids_fact)) {
|
||||||
|
$sql = 'SELECT bk.rowid, facf.ref, facf.ref_supplier ';
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = facf.rowid AND facf.rowid IN (" . implode(',', $ids_fact) . "))";
|
||||||
|
$sql .= " WHERE bk.code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=3 AND entity=".$conf->entity.") ";
|
||||||
|
$sql .= " AND facf.entity = ".$conf->entity;
|
||||||
|
$sql .= " AND ( ";
|
||||||
|
if (! empty($object->code_compta)) {
|
||||||
|
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||||
|
}
|
||||||
|
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
|
||||||
|
$sql .= " OR ";
|
||||||
|
}
|
||||||
|
if (! empty($object->code_compta_fournisseur)) {
|
||||||
|
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||||
|
}
|
||||||
|
$sql .= " ) ";
|
||||||
|
|
||||||
|
$resql2 = $this->db->query($sql);
|
||||||
|
if ($resql2) {
|
||||||
|
while ( $obj2 = $this->db->fetch_object($resql2) ) {
|
||||||
|
$ids[$obj2->rowid] = $obj2->rowid;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->errors[] = $this->db->lasterror;
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif ($obj->type == 'payment') {
|
||||||
|
|
||||||
|
$sql = 'SELECT DISTINCT bk.rowid, fac.ref, fac.ref, pay.fk_bank, fac.rowid as fact_id';
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON (bk.fk_doc = pay.fk_bank AND bk.code_journal='" . $obj->code_journal . "')";
|
||||||
|
$sql .= " WHERE payfac.fk_paiement = '" . $obj->url_id . "' ";
|
||||||
|
$sql .= " AND bk.code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=4 AND entity=".$conf->entity.") ";
|
||||||
|
$sql .= " AND fac.entity = ".$conf->entity;
|
||||||
|
$sql .= " AND ( ";
|
||||||
|
if (! empty($object->code_compta)) {
|
||||||
|
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||||
|
}
|
||||||
|
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
|
||||||
|
$sql .= " OR ";
|
||||||
|
}
|
||||||
|
if (! empty($object->code_compta_fournisseur)) {
|
||||||
|
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||||
|
}
|
||||||
|
$sql .= " ) ";
|
||||||
|
|
||||||
|
$resql2 = $this->db->query($sql);
|
||||||
|
if ($resql2) {
|
||||||
|
while ( $obj2 = $this->db->fetch_object($resql2) ) {
|
||||||
|
$ids[$obj2->rowid] = $obj2->rowid;
|
||||||
|
$ids_fact[] = $obj2->fact_id;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->errors[] = $this->db->lasterror;
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
if (count($ids_fact)) {
|
||||||
|
$sql = 'SELECT bk.rowid, fac.ref, fac.ref_supplier ';
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = fac.rowid AND fac.rowid IN (" . implode(',', $ids_fact) . "))";
|
||||||
|
$sql .= " WHERE code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=2 AND entity=".$conf->entity.") ";
|
||||||
|
$sql .= " AND fac.entity = ".$conf->entity;
|
||||||
|
$sql .= " AND ( ";
|
||||||
|
if (! empty($object->code_compta)) {
|
||||||
|
$sql .= " bk.subledger_account = '" . $object->code_compta . "' ";
|
||||||
|
}
|
||||||
|
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
|
||||||
|
$sql .= " OR ";
|
||||||
|
}
|
||||||
|
if (! empty($object->code_compta_fournisseur)) {
|
||||||
|
$sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' ";
|
||||||
|
}
|
||||||
|
$sql .= " ) ";
|
||||||
|
|
||||||
|
$resql2 = $this->db->query($sql);
|
||||||
|
if ($resql2) {
|
||||||
|
while ( $obj2 = $this->db->fetch_object($resql2) ) {
|
||||||
|
$ids[$obj2->rowid] = $obj2->rowid;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->errors[] = $this->db->lasterror;
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($ids) > 1) {
|
||||||
|
$result = $this->updatelettrage($ids);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($error) {
|
||||||
|
foreach ( $this->errors as $errmsg ) {
|
||||||
|
dol_syslog(get_class($this) . "::" . __METHOD__ . $errmsg, LOG_ERR);
|
||||||
|
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
|
||||||
|
}
|
||||||
|
return - 1 * $error;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
public function updatelettrage($ids, $notrigger=false){
|
*
|
||||||
|
* @param array $ids ids array
|
||||||
|
* @param boolean $notrigger no trigger
|
||||||
|
* @return number
|
||||||
|
*/
|
||||||
|
public function updateLettrage($ids = array(), $notrigger = false)
|
||||||
|
{
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
$lettre = 'AAA';
|
||||||
|
|
||||||
$sql = "SELECT lettering_code FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
|
||||||
$sql .= " lettering_code != '' GROUP BY lettering_code ORDER BY lettering_code DESC limit 1; ";
|
|
||||||
// echo $sql;
|
$sql = "SELECT DISTINCT lettering_code FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||||
$result = $this->db->query ( $sql );
|
$sql .= " lettering_code != '' ORDER BY lettering_code DESC limit 1; ";
|
||||||
|
|
||||||
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$obj = $this->db->fetch_object ( $result );
|
$obj = $this->db->fetch_object($result);
|
||||||
$lettre = (empty($obj->lettering_code)? 'AAA' : $obj->lettering_code );
|
$lettre = (empty($obj->lettering_code) ? 'AAA' : $obj->lettering_code);
|
||||||
if(!empty($obj->lettering_code))
|
if (! empty($obj->lettering_code))
|
||||||
$lettre++;
|
$lettre++;
|
||||||
}
|
} else {
|
||||||
else{
|
$this->errors[] = 'Error' . $this->db->lasterror();
|
||||||
$this->errors[] = 'Error'.$this->db->lasterror();;
|
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
// var_dump(__line__, $error);
|
|
||||||
|
|
||||||
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||||
$sql .= " rowid IN (".implode(',', $ids).") ";
|
$sql .= " rowid IN (" . implode(',', $ids) . ") ";
|
||||||
$result = $this->db->query ( $sql );
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$obj = $this->db->fetch_object ( $result );
|
$obj = $this->db->fetch_object($result);
|
||||||
// print_r($obj);
|
if (! (round(abs($obj->deb), 2) === round(abs($obj->cred), 2))) {
|
||||||
if( !(round(abs($obj->deb),2) === round(abs($obj->cred),2)) ){
|
$this->errors[] = 'Total not exacts ' . round(abs($obj->deb), 2) . ' vs ' . round(abs($obj->cred), 2);
|
||||||
// echo $sql;
|
|
||||||
// print_r($obj);
|
|
||||||
$this->errors[] = 'Total not exacts '.round(abs($obj->deb),2).' vs '. round(abs($obj->cred),2);
|
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
$this->errors[] = 'Erreur sql' . $this->db->lasterror();
|
||||||
$this->errors[] = 'Erreur sql'.$this->db->lasterror();;
|
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Update request
|
// Update request
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
|
if (! $error)
|
||||||
$sql.= " lettering_code='".$lettre."'";
|
{
|
||||||
$sql.= " , date_lettering = " .$now ; // todo correct date it's false
|
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET";
|
||||||
$sql.= " WHERE rowid IN (".implode(',', $ids).") ";
|
$sql .= " lettering_code='" . $lettre . "'";
|
||||||
// echo $sql ;
|
$sql .= " , date_lettering = '" . $this->db->idate($now) . "'"; // todo correct date it's false
|
||||||
//
|
$sql .= " WHERE rowid IN (" . implode(',', $ids) . ") ";
|
||||||
// var_dump(__line__, $error);
|
$this->db->begin();
|
||||||
// print_r($this->errors);
|
|
||||||
// exit;
|
|
||||||
$this->db->begin();
|
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
if (! $resql) {
|
||||||
|
$error++;
|
||||||
|
$this->errors[] = "Error " . $this->db->lasterror();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error) {
|
||||||
{
|
if (! $notrigger) {
|
||||||
if (! $notrigger)
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
{
|
// want this action calls a trigger.
|
||||||
// Uncomment this and change MYOBJECT to your own tag if you
|
|
||||||
// want this action calls a trigger.
|
|
||||||
|
|
||||||
//// Call triggers
|
// // Call triggers
|
||||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
// include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
//$interface=new Interfaces($this->db);
|
// $interface=new Interfaces($this->db);
|
||||||
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
// $result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
||||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
// if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||||
//// End call triggers
|
// // End call triggers
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// var_dump(__line__, $error);
|
}
|
||||||
// Commit or rollback
|
// Commit or rollback
|
||||||
if ($error)
|
if ($error) {
|
||||||
{
|
foreach ( $this->errors as $errmsg ) {
|
||||||
// foreach($this->errors as $errmsg)
|
dol_syslog(get_class($this) . "::update " . $errmsg, LOG_ERR);
|
||||||
// {
|
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
|
||||||
// dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
|
||||||
// $this->error.=($this->error?', '.$errmsg:$errmsg);
|
|
||||||
// }
|
|
||||||
$this->db->rollback();
|
|
||||||
// echo $this->error;
|
|
||||||
// var_dump(__line__, $error);
|
|
||||||
return -1*$error;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->db->commit();
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
return - 1 * $error;
|
||||||
|
} else {
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -18,21 +18,21 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/customer/card.php
|
* \file htdocs/accountancy/customer/card.php
|
||||||
* \ingroup Accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Card customer ventilation
|
* \brief Card customer ventilation
|
||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
// Class
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
|
|
||||||
// Langs
|
$langs->loadLangs(array("bills","accountancy"));
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
$cancel = GETPOST('cancel', 'alpha');
|
||||||
|
$backtopage = GETPOST('backtopage', 'alpha');
|
||||||
|
|
||||||
$codeventil = GETPOST('codeventil');
|
$codeventil = GETPOST('codeventil');
|
||||||
$id = GETPOST('id');
|
$id = GETPOST('id');
|
||||||
|
|
||||||
@ -40,12 +40,15 @@ $id = GETPOST('id');
|
|||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
if ($action == 'ventil' && $user->rights->accounting->bind->write)
|
||||||
if (! GETPOST('cancel', 'alpha')) {
|
{
|
||||||
|
if (! $cancel)
|
||||||
|
{
|
||||||
if ($codeventil < 0) $codeventil = 0;
|
if ($codeventil < 0) $codeventil = 0;
|
||||||
|
|
||||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
||||||
@ -59,6 +62,11 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||||
|
if ($backtopage)
|
||||||
|
{
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header("Location: ./lines.php");
|
header("Location: ./lines.php");
|
||||||
@ -109,6 +117,7 @@ if (! empty($id)) {
|
|||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
|
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="ventil">';
|
print '<input type="hidden" name="action" value="ventil">';
|
||||||
|
print '<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).'">';
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans('CustomersVentilation'), '', 'title_setup');
|
print load_fiche_titre($langs->trans('CustomersVentilation'), '', 'title_setup');
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -21,9 +21,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/customer/index.php
|
* \file htdocs/accountancy/customer/index.php
|
||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Home customer journalization page
|
* \brief Home customer journalization page
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
@ -32,11 +32,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
$langs->load("compta");
|
$langs->loadLangs(array("compta","bills","other","main","accountancy"));
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("other");
|
|
||||||
$langs->load("main");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (empty($conf->accounting->enabled)) {
|
if (empty($conf->accounting->enabled)) {
|
||||||
@ -47,15 +43,24 @@ if ($user->societe_id > 0)
|
|||||||
if (! $user->rights->accounting->bind->write)
|
if (! $user->rights->accounting->bind->write)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
// Filter
|
|
||||||
$year = GETPOST("year",'int');
|
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||||
if ($year == 0) {
|
if (GETPOST("year",'int')) $year_start = GETPOST("year",'int');
|
||||||
$year_current = strftime("%Y", time());
|
else
|
||||||
$year_start = $year_current;
|
{
|
||||||
} else {
|
$year_start = dol_print_date(dol_now(), '%Y');
|
||||||
$year_current = $year;
|
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||||
$year_start = $year;
|
|
||||||
}
|
}
|
||||||
|
$year_end = $year_start + 1;
|
||||||
|
$month_end = $month_start - 1;
|
||||||
|
if ($month_end < 1)
|
||||||
|
{
|
||||||
|
$month_end = 12;
|
||||||
|
$year_end--;
|
||||||
|
}
|
||||||
|
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||||
|
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||||
|
$year_current = $year_start;
|
||||||
|
|
||||||
// Validate History
|
// Validate History
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
@ -108,53 +113,6 @@ if ($action == 'validatehistory') {
|
|||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
} elseif ($action == 'fixaccountancycode') {
|
|
||||||
$error = 0;
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
|
||||||
$sql1 .= " SET fk_code_ventilation = 0";
|
|
||||||
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
|
||||||
$sql1 .= ' (SELECT accnt.rowid ';
|
|
||||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
|
||||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
|
||||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
|
||||||
|
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
|
||||||
|
|
||||||
$resql1 = $db->query($sql1);
|
|
||||||
if (! $resql1) {
|
|
||||||
$error ++;
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessage($db->lasterror(), 'errors');
|
|
||||||
} else {
|
|
||||||
$db->commit();
|
|
||||||
setEventMessage($langs->trans('Done'), 'mesgs');
|
|
||||||
}
|
|
||||||
} elseif ($action == 'cleanaccountancycode') {
|
|
||||||
$error = 0;
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
// Now clean
|
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
|
||||||
$sql1.= " SET fk_code_ventilation = 0";
|
|
||||||
$sql1.= " WHERE fd.fk_facture IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture as f";
|
|
||||||
$sql1.= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
|
|
||||||
$sql1.= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
|
|
||||||
$sql1.= " AND f.entity IN (" . getEntity('accountancy') . ")";
|
|
||||||
$sql1.=")";
|
|
||||||
|
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
|
||||||
|
|
||||||
$resql1 = $db->query($sql1);
|
|
||||||
if (! $resql1) {
|
|
||||||
$error ++;
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessage($db->lasterror(), 'errors');
|
|
||||||
} else {
|
|
||||||
$db->commit();
|
|
||||||
setEventMessage($langs->trans('Done'), 'mesgs');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -167,63 +125,66 @@ llxHeader('', $langs->trans("CustomersVentilation"));
|
|||||||
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
|
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
|
||||||
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
|
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
|
||||||
|
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
|
print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
|
||||||
|
|
||||||
|
// Clean database
|
||||||
|
$db->begin();
|
||||||
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||||
|
$sql1 .= " SET fk_code_ventilation = 0";
|
||||||
|
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||||
|
$sql1 .= ' (SELECT accnt.rowid ';
|
||||||
|
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||||
|
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||||
|
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||||
|
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||||
|
$resql1 = $db->query($sql1);
|
||||||
|
if (! $resql1) {
|
||||||
|
$error ++;
|
||||||
|
$db->rollback();
|
||||||
|
setEventMessage($db->lasterror(), 'errors');
|
||||||
|
} else {
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
// End clean database
|
||||||
|
|
||||||
print $langs->trans("DescVentilCustomer") . '<br>';
|
print $langs->trans("DescVentilCustomer") . '<br>';
|
||||||
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
//print '<div class="inline-block divButAction">';
|
|
||||||
// TODO Remove this. Should be done always or into the repair.php script.
|
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
|
||||||
//print '</div>';
|
|
||||||
|
|
||||||
$sql = "SELECT count(*) FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
|
||||||
$sql .= " , " . MAIN_DB_PREFIX . "facture as f";
|
|
||||||
$sql .= " WHERE fd.fk_code_ventilation = 0";
|
|
||||||
$sql .= " AND f.rowid = fd.fk_facture";
|
|
||||||
$sql .= " AND f.fk_statut > 0";
|
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
|
||||||
} else {
|
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
|
||||||
}
|
|
||||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
|
||||||
|
|
||||||
dol_syslog('htdocs/accountancy/customer/index.php');
|
|
||||||
$result = $db->query($sql);
|
|
||||||
if ($result) {
|
|
||||||
$row = $db->fetch_row($result);
|
|
||||||
$nbfac = $row[0];
|
|
||||||
$db->free($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
$y = $year_current;
|
$y = $year_current;
|
||||||
|
|
||||||
$buttonbind = '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
|
$buttonbind = '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
|
||||||
$buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
|
|
||||||
|
|
||||||
|
print_barre_liste($langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
|
||||||
|
//print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||||
|
|
||||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
print '<div class="div-table-responsive-no-min">';
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
|
if ($j > 12) $j-=12;
|
||||||
|
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||||
}
|
}
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,";
|
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,";
|
||||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
|
if ($j > 12) $j-=12;
|
||||||
|
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $j, 'fd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
$sql .= " SUM(fd.total_ht) as total";
|
$sql .= " SUM(fd.total_ht) as total";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
$sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'";
|
||||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
|
||||||
|
$sql .= " AND f.fk_statut > 0";
|
||||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||||
$sql .= " AND aa.account_number IS NULL";
|
$sql .= " AND aa.account_number IS NULL";
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
@ -266,33 +227,41 @@ if ($resql) {
|
|||||||
print $db->lasterror(); // Show last sql error
|
print $db->lasterror(); // Show last sql error
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
print_barre_liste($langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
|
||||||
|
//print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', '');
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
|
if ($j > 12) $j-=12;
|
||||||
|
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||||
}
|
}
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,";
|
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,";
|
||||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
|
if ($j > 12) $j-=12;
|
||||||
|
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $j, 'fd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
$sql .= " SUM(fd.total_ht) as total";
|
$sql .= " SUM(fd.total_ht) as total";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
$sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'";
|
||||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
|
||||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||||
|
$sql .= " AND f.fk_statut > 0";
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||||
} else {
|
} else {
|
||||||
@ -315,6 +284,7 @@ if ($resql) {
|
|||||||
}
|
}
|
||||||
else print length_accountg($row[0]);
|
else print length_accountg($row[0]);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="left">';
|
print '<td align="left">';
|
||||||
if ($row[0] == 'tobind')
|
if ($row[0] == 'tobind')
|
||||||
{
|
{
|
||||||
@ -322,7 +292,8 @@ if ($resql) {
|
|||||||
}
|
}
|
||||||
else print $row[1];
|
else print $row[1];
|
||||||
print '</td>';
|
print '</td>';
|
||||||
for($i = 2; $i <= 12; $i ++) {
|
|
||||||
|
for($i = 2; $i <= 12; $i++) {
|
||||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||||
}
|
}
|
||||||
print '<td align="right">' . price($row[13]) . '</td>';
|
print '<td align="right">' . price($row[13]) . '</td>';
|
||||||
@ -334,7 +305,7 @@ if ($resql) {
|
|||||||
print $db->lasterror(); // Show last sql error
|
print $db->lasterror(); // Show last sql error
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ?
|
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ?
|
||||||
@ -342,26 +313,32 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
print_barre_liste($langs->trans("OtherInfo"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
|
||||||
|
//print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||||
|
|
||||||
print "<br>\n";
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
|
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
|
if ($j > 12) $j-=12;
|
||||||
|
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||||
}
|
}
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT '" . $langs->trans("TotalVente") . "' AS total,";
|
$sql = "SELECT '" . $langs->trans("TotalVente") . "' AS total,";
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
|
if ($j > 12) $j-=12;
|
||||||
|
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $j, 'fd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
$sql .= " SUM(fd.total_ht) as total";
|
$sql .= " SUM(fd.total_ht) as total";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
$sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'";
|
||||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
|
||||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||||
|
$sql .= " AND f.fk_statut > 0";
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||||
} else {
|
} else {
|
||||||
@ -386,27 +363,34 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
print $db->lasterror(); // Show last sql error
|
print $db->lasterror(); // Show last sql error
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
if (! empty($conf->margin->enabled)) {
|
if (! empty($conf->margin->enabled)) {
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>';
|
print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
|
if ($j > 12) $j-=12;
|
||||||
|
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||||
}
|
}
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT '" . $langs->trans("Vide") . "' AS marge,";
|
$sql = "SELECT '" . $langs->trans("Vide") . "' AS marge,";
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, '(fd.total_ht-(fd.qty * fd.buy_price_ht))', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
|
if ($j > 12) $j-=12;
|
||||||
|
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $j, '(fd.total_ht-(fd.qty * fd.buy_price_ht))', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
$sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total";
|
$sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
$sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'";
|
||||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
|
||||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||||
|
$sql .= " AND f.fk_statut > 0";
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||||
} else {
|
} else {
|
||||||
@ -432,6 +416,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
print $db->lasterror(); // Show last sql error
|
print $db->lasterror(); // Show last sql error
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,18 +27,14 @@
|
|||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
// Class
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
|
||||||
// Langs
|
$langs->loadLangs(array("bills","compta","accountancy","productbatch"));
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("compta");
|
|
||||||
$langs->load("main");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
$langs->load("productbatch");
|
|
||||||
|
|
||||||
$account_parent = GETPOST('account_parent');
|
$account_parent = GETPOST('account_parent');
|
||||||
$changeaccount = GETPOST('changeaccount');
|
$changeaccount = GETPOST('changeaccount');
|
||||||
@ -51,6 +47,9 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
|||||||
$search_amount = GETPOST('search_amount', 'alpha');
|
$search_amount = GETPOST('search_amount', 'alpha');
|
||||||
$search_account = GETPOST('search_account', 'alpha');
|
$search_account = GETPOST('search_account', 'alpha');
|
||||||
$search_vat = GETPOST('search_vat', 'alpha');
|
$search_vat = GETPOST('search_vat', 'alpha');
|
||||||
|
$search_day=GETPOST("search_day","int");
|
||||||
|
$search_month=GETPOST("search_month","int");
|
||||||
|
$search_year=GETPOST("search_year","int");
|
||||||
$search_country = GETPOST('search_country', 'alpha');
|
$search_country = GETPOST('search_country', 'alpha');
|
||||||
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||||
|
|
||||||
@ -59,7 +58,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->AC
|
|||||||
$sortfield = GETPOST('sortfield', 'alpha');
|
$sortfield = GETPOST('sortfield', 'alpha');
|
||||||
$sortorder = GETPOST('sortorder', 'alpha');
|
$sortorder = GETPOST('sortorder', 'alpha');
|
||||||
$page = GETPOST('page', 'int');
|
$page = GETPOST('page', 'int');
|
||||||
if ($page < 0) $page = 0;
|
if (empty($page) || $page < 0) $page = 0;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
@ -95,6 +94,9 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
$search_account = '';
|
$search_account = '';
|
||||||
$search_vat = '';
|
$search_vat = '';
|
||||||
|
$search_day = '';
|
||||||
|
$search_month = '';
|
||||||
|
$search_year = '';
|
||||||
$search_country = '';
|
$search_country = '';
|
||||||
$search_tvaintra = '';
|
$search_tvaintra = '';
|
||||||
}
|
}
|
||||||
@ -102,27 +104,37 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$db->begin();
|
if (! (GETPOST('account_parent','int') >= 0))
|
||||||
|
{
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as l";
|
$error++;
|
||||||
$sql1 .= " SET l.fk_code_ventilation=" . $account_parent;
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors');
|
||||||
$sql1 .= ' WHERE l.rowid IN (' . implode(',', $changeaccount) . ')';
|
}
|
||||||
|
|
||||||
dol_syslog('accountancy/customer/lines.php::changeaccount sql= ' . $sql1);
|
if (! $error)
|
||||||
$resql1 = $db->query($sql1);
|
{
|
||||||
if (! $resql1) {
|
$db->begin();
|
||||||
$error ++;
|
|
||||||
setEventMessages($db->lasterror(), null, 'errors');
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as l";
|
||||||
}
|
$sql1 .= " SET l.fk_code_ventilation=" . (GETPOST('account_parent','int') > 0 ? GETPOST('account_parent','int') : '0');
|
||||||
if (! $error) {
|
$sql1 .= ' WHERE l.rowid IN (' . implode(',', $changeaccount) . ')';
|
||||||
$db->commit();
|
|
||||||
setEventMessages($langs->trans('Save'), null, 'mesgs');
|
dol_syslog('accountancy/customer/lines.php::changeaccount sql= ' . $sql1);
|
||||||
} else {
|
$resql1 = $db->query($sql1);
|
||||||
$db->rollback();
|
if (! $resql1) {
|
||||||
setEventMessages($db->lasterror(), null, 'errors');
|
$error ++;
|
||||||
|
setEventMessages($db->lasterror(), null, 'errors');
|
||||||
|
}
|
||||||
|
if (! $error) {
|
||||||
|
$db->commit();
|
||||||
|
setEventMessages($langs->trans('Save'), null, 'mesgs');
|
||||||
|
} else {
|
||||||
|
$db->rollback();
|
||||||
|
setEventMessages($db->lasterror(), null, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
|
$account_parent = ''; // Protection to avoid to mass apply it a second time
|
||||||
}
|
}
|
||||||
|
|
||||||
$account_parent = ''; // Protection to avoid to mass apply it a second time
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -130,6 +142,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
|
|
||||||
llxHeader('', $langs->trans("CustomersVentilation") . ' - ' . $langs->trans("Dispatched"));
|
llxHeader('', $langs->trans("CustomersVentilation") . ' - ' . $langs->trans("Dispatched"));
|
||||||
|
|
||||||
print '<script type="text/javascript">
|
print '<script type="text/javascript">
|
||||||
@ -152,20 +167,24 @@ print '<script type="text/javascript">
|
|||||||
/*
|
/*
|
||||||
* Customer Invoice lines
|
* Customer Invoice lines
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT f.rowid as factid, f.facnumber, f.type, f.datef, f.ref_client,";
|
$sql = "SELECT f.rowid as facid, f.facnumber as ref, f.type, f.datef, f.ref_client,";
|
||||||
$sql .= " fd.rowid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
|
$sql.= " fd.rowid, fd.description, fd.product_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_compta, s.code_client,";
|
$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
|
||||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number, aa.label as label_compte,";
|
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number, aa.label as label_compte,";
|
||||||
$sql .= " fd.situation_percent, co.label as country, s.tva_intra";
|
$sql.= " fd.situation_percent,";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
$sql.= " co.label as country, s.tva_intra";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product";
|
$parameters=array();
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
$sql.=$hookmanager->resPrint;
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
$sql.= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product";
|
||||||
$sql .= " WHERE fd.fk_code_ventilation > 0 ";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||||
$sql .= " AND f.fk_statut > 0";
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||||
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
||||||
|
$sql.= " WHERE fd.fk_code_ventilation > 0";
|
||||||
|
$sql.= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||||
|
$sql.= " AND f.fk_statut > 0";
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||||
} else {
|
} else {
|
||||||
@ -193,13 +212,26 @@ if (strlen(trim($search_account))) {
|
|||||||
$sql .= natural_search("aa.account_number", $search_account);
|
$sql .= natural_search("aa.account_number", $search_account);
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_vat))) {
|
if (strlen(trim($search_vat))) {
|
||||||
$sql .= natural_search("fd.tva_tx", $search_vat);
|
$sql .= natural_search("fd.tva_tx", price2num($search_vat), 1);
|
||||||
|
}
|
||||||
|
if ($search_month > 0)
|
||||||
|
{
|
||||||
|
if ($search_year > 0 && empty($search_day))
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
|
||||||
|
else if ($search_year > 0 && ! empty($search_day))
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
|
||||||
|
else
|
||||||
|
$sql.= " AND date_format(f.datef, '%m') = '".$db->escape($search_month)."'";
|
||||||
|
}
|
||||||
|
else if ($search_year > 0)
|
||||||
|
{
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_country))) {
|
if (strlen(trim($search_country))) {
|
||||||
$sql .= natural_search("co.label", $search_country);
|
$sql .= natural_search("co.label", $search_country);
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_tvaintra))) {
|
if (strlen(trim($search_tvaintra))) {
|
||||||
$sql .= natural_search("s.tva_intra", $search_tva_intra);
|
$sql .= natural_search("s.tva_intra", $search_tvaintra);
|
||||||
}
|
}
|
||||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
@ -210,6 +242,11 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
{
|
{
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
$nbtotalofrecords = $db->num_rows($result);
|
$nbtotalofrecords = $db->num_rows($result);
|
||||||
|
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||||
|
{
|
||||||
|
$page = 0;
|
||||||
|
$offset = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
@ -221,25 +258,19 @@ if ($result) {
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||||
if ($search_invoice)
|
if ($search_invoice) $param .= "&search_invoice=" . urlencode($search_invoice);
|
||||||
$param .= "&search_invoice=" . $search_invoice;
|
if ($search_ref) $param .= "&search_ref=" . urlencode($search_ref);
|
||||||
if ($search_ref)
|
if ($search_label) $param .= "&search_label=" . urlencode($search_label);
|
||||||
$param .= "&search_ref=" . $search_ref;
|
if ($search_desc) $param .= "&search_desc=" . urlencode($search_desc);
|
||||||
if ($search_label)
|
if ($search_account) $param .= "&search_account=" . urlencode($search_account);
|
||||||
$param .= "&search_label=" . $search_label;
|
if ($search_vat) $param .= "&search_vat=" . urlencode($search_vat);
|
||||||
if ($search_desc)
|
if ($search_day) $param .= '&search_day='.urlencode($search_day);
|
||||||
$param .= "&search_desc=" . $search_desc;
|
if ($search_month) $param .= '&search_month='.urlencode($search_month);
|
||||||
if ($search_account)
|
if ($search_year) $param .= '&search_year='.urlencode($search_year);
|
||||||
$param .= "&search_account=" . $search_account;
|
if ($search_country) $param .= "&search_country=" . urlencode($search_country);
|
||||||
if ($search_vat)
|
if ($search_tvaintra) $param .= "&search_tvaintra=" . urlencode($search_tvaintra);
|
||||||
$param .= "&search_vat=" . $search_vat;
|
|
||||||
if ($search_country)
|
|
||||||
$param .= "&search_country=" . $search_country;
|
|
||||||
if ($search_tvaintra)
|
|
||||||
$param .= "&search_tvaintra=" . $search_tvaintra;
|
|
||||||
|
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
||||||
print '<input type="hidden" name="action" value="ventil">';
|
print '<input type="hidden" name="action" value="ventil">';
|
||||||
@ -254,7 +285,7 @@ if ($result) {
|
|||||||
print $langs->trans("DescVentilDoneCustomer") . '<br>';
|
print $langs->trans("DescVentilDoneCustomer") . '<br>';
|
||||||
|
|
||||||
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
|
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
|
||||||
print $formaccounting->select_account($account_parent, 'account_parent', 1);
|
print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle');
|
||||||
print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("ChangeBinding") . '"/></div>';
|
print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("ChangeBinding") . '"/></div>';
|
||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
@ -263,17 +294,21 @@ if ($result) {
|
|||||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
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_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre center">';
|
||||||
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.dol_escape_htmltag($search_day).'">';
|
||||||
|
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">';
|
||||||
|
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||||
|
print '</td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></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"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" placeholder="%" name="search_vat" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" placeholder="%" name="search_vat" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||||
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '"></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" align="center"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||||
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '"></td>';
|
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tavintra" value="' . dol_escape_htmltag($search_tavintra) . '"></td>';
|
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
$searchpicto=$form->showFilterButtons();
|
$searchpicto=$form->showFilterButtons();
|
||||||
print $searchpicto;
|
print $searchpicto;
|
||||||
@ -288,9 +323,9 @@ if ($result) {
|
|||||||
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
$clickpicto=$form->showCheckAddButtons();
|
$clickpicto=$form->showCheckAddButtons();
|
||||||
print_liste_field_titre($clickpicto, '', '', '', '', 'align="center"');
|
print_liste_field_titre($clickpicto, '', '', '', '', 'align="center"');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -301,16 +336,18 @@ if ($result) {
|
|||||||
while ( $objp = $db->fetch_object($result) ) {
|
while ( $objp = $db->fetch_object($result) ) {
|
||||||
$codecompta = length_accountg($objp->account_number) . ' - ' . $objp->label_compte;
|
$codecompta = length_accountg($objp->account_number) . ' - ' . $objp->label_compte;
|
||||||
|
|
||||||
$facture_static->ref = $objp->facnumber;
|
$facture_static->ref = $objp->ref;
|
||||||
$facture_static->id = $objp->factid;
|
$facture_static->id = $objp->facid;
|
||||||
|
$facture_static->type = $objp->ftype;
|
||||||
|
|
||||||
$product_static->ref = $objp->product_ref;
|
$product_static->ref = $objp->product_ref;
|
||||||
$product_static->id = $objp->product_id;
|
$product_static->id = $objp->product_id;
|
||||||
$product_static->type = $objp->product_type;
|
$product_static->type = $objp->type;
|
||||||
$product_static->label = $objp->product_label;
|
$product_static->label = $objp->product_label;
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
|
// Line id
|
||||||
print '<td>' . $objp->rowid . '</td>';
|
print '<td>' . $objp->rowid . '</td>';
|
||||||
|
|
||||||
// Ref Invoice
|
// Ref Invoice
|
||||||
@ -325,7 +362,7 @@ if ($result) {
|
|||||||
if ($objp->product_label) print '<br>'.$objp->product_label;
|
if ($objp->product_label) print '<br>'.$objp->product_label;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td>';
|
print '<td class="tdoverflowonsmartphone">';
|
||||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
||||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||||
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
|
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
|
||||||
@ -333,16 +370,17 @@ if ($result) {
|
|||||||
|
|
||||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||||
print '<td align="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
print '<td align="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||||
|
|
||||||
|
print '<td>' . $objp->country .'</td>';
|
||||||
|
|
||||||
|
print '<td>' . $objp->tva_intra . '</td>';
|
||||||
|
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
|
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:'')).'">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="center">' . $objp->country .'</td>';
|
|
||||||
|
|
||||||
print '<td>' . $objp->tva_intra . '</td>';
|
|
||||||
|
|
||||||
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="' . $objp->rowid . '"/></td>';
|
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="' . $objp->rowid . '"/></td>';
|
||||||
|
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|||||||
@ -27,20 +27,16 @@
|
|||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
// Class
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
|
||||||
// Langs
|
// Load traductions files requiredby by page
|
||||||
$langs->load("compta");
|
$langs->loadLangs(array("bills","compta","accountancy","other","productbatch"));
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("other");
|
|
||||||
$langs->load("main");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
$langs->load("productbatch");
|
|
||||||
|
|
||||||
$action=GETPOST('action','alpha');
|
$action=GETPOST('action','alpha');
|
||||||
$massaction=GETPOST('massaction','alpha');
|
$massaction=GETPOST('massaction','alpha');
|
||||||
@ -53,13 +49,19 @@ $mesCasesCochees = GETPOST('toselect', 'array');
|
|||||||
|
|
||||||
// Search Getpost
|
// Search Getpost
|
||||||
$search_lineid = GETPOST('search_lineid', 'int');
|
$search_lineid = GETPOST('search_lineid', 'int');
|
||||||
$search_invoice = GETPOST('search_invoice', 'alpha');
|
|
||||||
$search_ref = GETPOST('search_ref', 'alpha');
|
$search_ref = GETPOST('search_ref', 'alpha');
|
||||||
|
$search_invoice = GETPOST('search_invoice', 'alpha');
|
||||||
$search_label = GETPOST('search_label', 'alpha');
|
$search_label = GETPOST('search_label', 'alpha');
|
||||||
$search_desc = GETPOST('search_desc', 'alpha');
|
$search_desc = GETPOST('search_desc', 'alpha');
|
||||||
$search_amount = GETPOST('search_amount', 'alpha');
|
$search_amount = GETPOST('search_amount', 'alpha');
|
||||||
$search_account = GETPOST('search_account', 'alpha');
|
$search_account = GETPOST('search_account', 'alpha');
|
||||||
$search_vat = GETPOST('search_vat', 'alpha');
|
$search_vat = GETPOST('search_vat', 'alpha');
|
||||||
|
$search_day=GETPOST("search_day","int");
|
||||||
|
$search_month=GETPOST("search_month","int");
|
||||||
|
$search_year=GETPOST("search_year","int");
|
||||||
|
$search_country = GETPOST('search_country', 'alpha');
|
||||||
|
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||||
|
|
||||||
$btn_ventil = GETPOST('ventil', 'alpha');
|
$btn_ventil = GETPOST('ventil', 'alpha');
|
||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
@ -67,7 +69,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->AC
|
|||||||
$sortfield = GETPOST('sortfield', 'alpha');
|
$sortfield = GETPOST('sortfield', 'alpha');
|
||||||
$sortorder = GETPOST('sortorder', 'alpha');
|
$sortorder = GETPOST('sortorder', 'alpha');
|
||||||
$page = GETPOST('page','int');
|
$page = GETPOST('page','int');
|
||||||
if ($page < 0) { $page = 0; }
|
if (empty($page) || $page < 0) { $page = 0; }
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
@ -93,13 +95,15 @@ $accounting = new AccountingAccount($db);
|
|||||||
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
|
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
|
||||||
$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1);
|
$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1);
|
||||||
|
|
||||||
|
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
@ -118,6 +122,11 @@ if (empty($reshook))
|
|||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
$search_account = '';
|
$search_account = '';
|
||||||
$search_vat = '';
|
$search_vat = '';
|
||||||
|
$search_day = '';
|
||||||
|
$search_month = '';
|
||||||
|
$search_year = '';
|
||||||
|
$search_country = '';
|
||||||
|
$search_tvaintra = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mass actions
|
// Mass actions
|
||||||
@ -131,6 +140,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
if ($massaction == 'ventil') {
|
if ($massaction == 'ventil') {
|
||||||
$msg='';
|
$msg='';
|
||||||
|
|
||||||
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
||||||
if (! empty($mesCasesCochees)) {
|
if (! empty($mesCasesCochees)) {
|
||||||
$msg = '<div>' . $langs->trans("SelectedLines") . ': '.count($mesCasesCochees).'</div>';
|
$msg = '<div>' . $langs->trans("SelectedLines") . ': '.count($mesCasesCochees).'</div>';
|
||||||
@ -158,7 +168,7 @@ if ($massaction == 'ventil') {
|
|||||||
$accountventilated = new AccountingAccount($db);
|
$accountventilated = new AccountingAccount($db);
|
||||||
$accountventilated->fetch($monCompte, '');
|
$accountventilated->fetch($monCompte, '');
|
||||||
|
|
||||||
dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
|
dol_syslog("accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
|
||||||
if ($db->query($sql)) {
|
if ($db->query($sql)) {
|
||||||
$msg.= '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
|
$msg.= '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
|
||||||
$ok++;
|
$ok++;
|
||||||
@ -184,55 +194,85 @@ if ($massaction == 'ventil') {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
|
|
||||||
llxHeader('', $langs->trans("Ventilation"));
|
llxHeader('', $langs->trans("Ventilation"));
|
||||||
|
|
||||||
|
if (empty($chartaccountcode))
|
||||||
|
{
|
||||||
|
print $langs->trans("ErrorChartOfAccountSystemNotSelected");
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Customer Invoice lines
|
// Customer Invoice lines
|
||||||
$sql = "SELECT f.facnumber, f.rowid as facid, f.datef, f.type as ftype,";
|
$sql = "SELECT f.rowid as facid, f.facnumber as ref, f.datef, f.type as ftype,";
|
||||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
|
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
|
||||||
$sql .= " aa.rowid as aarowid";
|
$sql.= " aa.rowid as aarowid,";
|
||||||
|
$sql.= " co.label as country, s.tva_intra";
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
$sql.=$hookmanager->resPrint;
|
$sql.=$hookmanager->resPrint;
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
|
$sql.= " FROM " . MAIN_DB_PREFIX . "facture as f";
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number";
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."'";
|
||||||
$sql .= " AND product_type <= 2";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.fk_pcg_version = '" . $chartaccountcode."'";
|
||||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='' OR p.accountancy_code_sell NOT IN
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.fk_pcg_version = '" . $chartaccountcode."'";
|
||||||
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid ='" . $conf->global->CHARTOFACCOUNTS . "'))";
|
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||||
|
$sql.= " AND l.product_type <= 2";
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
if ($search_lineid) {
|
if ($search_lineid) {
|
||||||
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_invoice))) {
|
if (strlen(trim($search_invoice))) {
|
||||||
$sql .= natural_search("f.facnumber",$search_invoice);
|
$sql .= natural_search("f.facnumber", $search_invoice);
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_ref))) {
|
if (strlen(trim($search_ref))) {
|
||||||
$sql .= natural_search("p.ref",$search_ref);
|
$sql .= natural_search("p.ref", $search_ref);
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_label))) {
|
if (strlen(trim($search_label))) {
|
||||||
$sql .= natural_search("p.label",$search_label);
|
$sql .= natural_search("p.label", $search_label);
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_desc))) {
|
if (strlen(trim($search_desc))) {
|
||||||
$sql .= natural_search("l.description",$search_desc);
|
$sql .= natural_search("l.description", $search_desc);
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_amount))) {
|
if (strlen(trim($search_amount))) {
|
||||||
$sql .= natural_search("l.total_ht",$search_amount,1);
|
$sql .= natural_search("l.total_ht", $search_amount, 1);
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_account))) {
|
if (strlen(trim($search_account))) {
|
||||||
$sql .= natural_search("aa.account_number",$search_account);
|
$sql .= natural_search("aa.account_number", $search_account);
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_vat))) {
|
if (strlen(trim($search_vat))) {
|
||||||
$sql .= natural_search("l.tva_tx",$search_vat,1);
|
$sql .= natural_search("l.tva_tx", $search_vat, 1);
|
||||||
|
}
|
||||||
|
if ($search_month > 0)
|
||||||
|
{
|
||||||
|
if ($search_year > 0 && empty($search_day))
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
|
||||||
|
else if ($search_year > 0 && ! empty($search_day))
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
|
||||||
|
else
|
||||||
|
$sql.= " AND date_format(f.datef, '%m') = '".$db->escape($search_month)."'";
|
||||||
|
}
|
||||||
|
else if ($search_year > 0)
|
||||||
|
{
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||||
|
}
|
||||||
|
if (strlen(trim($search_country))) {
|
||||||
|
$sql .= natural_search("co.label", $search_country);
|
||||||
|
}
|
||||||
|
if (strlen(trim($search_tvaintra))) {
|
||||||
|
$sql .= natural_search("s.tva_intra", $search_tvaintra);
|
||||||
}
|
}
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||||
} else {
|
} else {
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_STANDARD . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||||
}
|
}
|
||||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||||
|
|
||||||
@ -249,11 +289,16 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
{
|
{
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
$nbtotalofrecords = $db->num_rows($result);
|
$nbtotalofrecords = $db->num_rows($result);
|
||||||
|
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||||
|
{
|
||||||
|
$page = 0;
|
||||||
|
$offset = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
dol_syslog("/accountancy/customer/list.php", LOG_DEBUG);
|
dol_syslog("accountancy/customer/list.php", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num_lines = $db->num_rows($result);
|
$num_lines = $db->num_rows($result);
|
||||||
@ -264,14 +309,25 @@ if ($result) {
|
|||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
|
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
|
||||||
|
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||||
|
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||||
|
if ($search_year) $param.='&search_year='.urlencode($search_year);
|
||||||
|
if ($search_invoice) $param.='&search_invoice='.urlencode($search_invoice);
|
||||||
|
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
||||||
|
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
||||||
|
if ($search_amount) $param.='&search_amount='.urlencode($search_amount);
|
||||||
|
if ($search_vat) $param.='&search_vat='.urlencode($search_vat);
|
||||||
|
if ($search_country) $param .= "&search_country=" . urlencode($search_country);
|
||||||
|
if ($search_tvaintra) $param .= "&search_tvaintra=" . urlencode($search_tvaintra);
|
||||||
|
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
'ventil'=>$langs->trans("Ventilate")
|
'ventil'=>$langs->trans("Ventilate")
|
||||||
//'presend'=>$langs->trans("SendByMail"),
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||||
//if ($massaction == 'presend') $arrayofmassactions=array();
|
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||||
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
||||||
@ -287,6 +343,12 @@ if ($result) {
|
|||||||
|
|
||||||
print $langs->trans("DescVentilTodoCustomer") . '</br><br>';
|
print $langs->trans("DescVentilTodoCustomer") . '</br><br>';
|
||||||
|
|
||||||
|
/*$topicmail="Information";
|
||||||
|
$modelmail="project";
|
||||||
|
$objecttmp=new Project($db);
|
||||||
|
$trackid='prj'.$object->id;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';*/
|
||||||
|
|
||||||
if ($msg) print $msg.'<br>';
|
if ($msg) print $msg.'<br>';
|
||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
@ -296,14 +358,20 @@ if ($result) {
|
|||||||
|
|
||||||
// We add search filter
|
// We add search filter
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
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_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre center nowraponall">';
|
||||||
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||||
|
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||||
|
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||||
|
print '</td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></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"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50 right" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50 right" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||||
print '<td class="liste_titre" align="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" align="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 maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '"></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"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td align="center" class="liste_titre">';
|
print '<td align="center" class="liste_titre">';
|
||||||
@ -321,6 +389,8 @@ if ($result) {
|
|||||||
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"');
|
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"');
|
||||||
print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"');
|
print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"');
|
||||||
$checkpicto='';
|
$checkpicto='';
|
||||||
@ -330,9 +400,7 @@ if ($result) {
|
|||||||
|
|
||||||
$facture_static = new Facture($db);
|
$facture_static = new Facture($db);
|
||||||
$product_static = new Product($db);
|
$product_static = new Product($db);
|
||||||
$form = new Form($db);
|
|
||||||
|
|
||||||
$var = true;
|
|
||||||
while ( $i < min($num_lines, $limit) ) {
|
while ( $i < min($num_lines, $limit) ) {
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
@ -345,7 +413,7 @@ if ($result) {
|
|||||||
$product_static->type = $objp->type;
|
$product_static->type = $objp->type;
|
||||||
$product_static->label = $objp->product_label;
|
$product_static->label = $objp->product_label;
|
||||||
|
|
||||||
$facture_static->ref = $objp->facnumber;
|
$facture_static->ref = $objp->ref;
|
||||||
$facture_static->id = $objp->facid;
|
$facture_static->id = $objp->facid;
|
||||||
$facture_static->type = $objp->ftype;
|
$facture_static->type = $objp->ftype;
|
||||||
|
|
||||||
@ -409,6 +477,10 @@ if ($result) {
|
|||||||
print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''));
|
print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td>' . $objp->country .'</td>';
|
||||||
|
|
||||||
|
print '<td>' . $objp->tva_intra . '</td>';
|
||||||
|
|
||||||
// Current account
|
// Current account
|
||||||
print '<td align="center" style="' . $code_sell_p_notset . '">';
|
print '<td align="center" style="' . $code_sell_p_notset . '">';
|
||||||
print (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")) . ' = ' . ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : $langs->trans("Unknown"));
|
print (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")) . ' = ' . ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : $langs->trans("Unknown"));
|
||||||
@ -421,12 +493,14 @@ if ($result) {
|
|||||||
|
|
||||||
// Suggested accounting account
|
// Suggested accounting account
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
// Column with checkbox
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<input type="checkbox" class="flat checkforselect" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
@ -438,5 +512,17 @@ if ($result) {
|
|||||||
print $db->error();
|
print $db->error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add code to auto check the box when we select an account
|
||||||
|
print '<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
jQuery(".codeventil").change(function() {
|
||||||
|
var s=$(this).attr("id").replace("codeventil", "")
|
||||||
|
console.log(s+" "+$(this).val());
|
||||||
|
if ($(this).val() == -1) jQuery(".checkforselect"+s).prop("checked", false);
|
||||||
|
else jQuery(".checkforselect"+s).prop("checked", true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
@ -23,21 +23,20 @@
|
|||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/supplier/card.php
|
* \file htdocs/accountancy/supplier/card.php
|
||||||
* \ingroup Accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Card expense report ventilation
|
* \brief Card expense report ventilation
|
||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
// Class
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
|
|
||||||
// Langs
|
$langs->loadLangs(array("bills","accountancy","trips"));
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
$langs->load("trips");
|
|
||||||
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
$cancel = GETPOST('cancel', 'alpha');
|
||||||
|
$backtopage = GETPOST('backtopage', 'alpha');
|
||||||
|
|
||||||
$codeventil = GETPOST('codeventil');
|
$codeventil = GETPOST('codeventil');
|
||||||
$id = GETPOST('id');
|
$id = GETPOST('id');
|
||||||
|
|
||||||
@ -45,12 +44,15 @@ $id = GETPOST('id');
|
|||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
if ($action == 'ventil' && $user->rights->accounting->bind->write)
|
||||||
if (! GETPOST('cancel', 'alpha')) {
|
{
|
||||||
|
if (! $cancel)
|
||||||
|
{
|
||||||
if ($codeventil < 0) $codeventil = 0;
|
if ($codeventil < 0) $codeventil = 0;
|
||||||
|
|
||||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "expensereport_det";
|
$sql = " UPDATE " . MAIN_DB_PREFIX . "expensereport_det";
|
||||||
@ -64,6 +66,11 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||||
|
if ($backtopage)
|
||||||
|
{
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header("Location: ./lines.php");
|
header("Location: ./lines.php");
|
||||||
@ -111,6 +118,7 @@ if (! empty($id)) {
|
|||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
|
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="ventil">';
|
print '<input type="hidden" name="action" value="ventil">';
|
||||||
|
print '<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).'">';
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans('ExpenseReportsVentilation'), '', 'title_setup');
|
print load_fiche_titre($langs->trans('ExpenseReportsVentilation'), '', 'title_setup');
|
||||||
|
|
||||||
|
|||||||
@ -27,37 +27,43 @@
|
|||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
$langs->load("compta");
|
$langs->loadLangs(array("compta","bills","other","main","accountancy"));
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("other");
|
|
||||||
$langs->load("main");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (empty($conf->accounting->enabled)) {
|
if (empty($conf->accounting->enabled)) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
if (! $user->rights->accounting->bind->write)
|
if (! $user->rights->accounting->bind->write)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
// Filter
|
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||||
$year = GETPOST('year', 'int');
|
if (GETPOST("year",'int')) $year_start = GETPOST("year",'int');
|
||||||
if ($year == 0) {
|
else
|
||||||
$year_current = strftime("%Y", time());
|
{
|
||||||
$year_start = $year_current;
|
$year_start = dol_print_date(dol_now(), '%Y');
|
||||||
} else {
|
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||||
$year_current = $year;
|
|
||||||
$year_start = $year;
|
|
||||||
}
|
}
|
||||||
|
$year_end = $year_start + 1;
|
||||||
|
$month_end = $month_start - 1;
|
||||||
|
if ($month_end < 1)
|
||||||
|
{
|
||||||
|
$month_end = 12;
|
||||||
|
$year_end--;
|
||||||
|
}
|
||||||
|
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||||
|
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||||
|
$year_current = $year_start;
|
||||||
|
|
||||||
// Validate History
|
// Validate History
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
@ -104,55 +110,9 @@ if ($action == 'validatehistory') {
|
|||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
} elseif ($action == 'fixaccountancycode') {
|
|
||||||
$error = 0;
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
|
||||||
$sql1 .= " SET fk_code_ventilation = 0";
|
|
||||||
$sql1 .= ' WHERE erd.fk_code_ventilation NOT IN ';
|
|
||||||
$sql1 .= ' (SELECT accnt.rowid ';
|
|
||||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
|
||||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
|
||||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
|
||||||
|
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
|
||||||
|
|
||||||
$resql1 = $db->query($sql1);
|
|
||||||
if (! $resql1) {
|
|
||||||
$error ++;
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessage($db->lasterror(), 'errors');
|
|
||||||
} else {
|
|
||||||
$db->commit();
|
|
||||||
setEventMessage($langs->trans('Done'), 'mesgs');
|
|
||||||
}
|
|
||||||
} elseif ($action == 'cleanaccountancycode') {
|
|
||||||
$error = 0;
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
// Now clean
|
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
|
||||||
$sql1.= " SET fk_code_ventilation = 0";
|
|
||||||
$sql1.= " WHERE erd.fk_expensereport IN ( SELECT er.rowid FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
|
||||||
$sql1.= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
|
|
||||||
$sql1.= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
|
|
||||||
$sql1.= " AND er.entity IN (" . getEntity('accountancy') . ")";
|
|
||||||
$sql1.=")";
|
|
||||||
|
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
|
||||||
|
|
||||||
$resql1 = $db->query($sql1);
|
|
||||||
if (! $resql1) {
|
|
||||||
$error ++;
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessage($db->lasterror(), 'errors');
|
|
||||||
} else {
|
|
||||||
$db->commit();
|
|
||||||
setEventMessage($langs->trans('Done'), 'mesgs');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -164,48 +124,64 @@ $textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
|
|||||||
|
|
||||||
print load_fiche_titre($langs->trans("ExpenseReportsVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
|
print load_fiche_titre($langs->trans("ExpenseReportsVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
|
||||||
|
|
||||||
|
// Clean database
|
||||||
|
$db->begin();
|
||||||
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||||
|
$sql1 .= " SET fk_code_ventilation = 0";
|
||||||
|
$sql1 .= ' WHERE erd.fk_code_ventilation NOT IN ';
|
||||||
|
$sql1 .= ' (SELECT accnt.rowid ';
|
||||||
|
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||||
|
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||||
|
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||||
|
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||||
|
$resql1 = $db->query($sql1);
|
||||||
|
if (! $resql1) {
|
||||||
|
$error ++;
|
||||||
|
$db->rollback();
|
||||||
|
setEventMessage($db->lasterror(), 'errors');
|
||||||
|
} else {
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
// End clean database
|
||||||
|
|
||||||
print $langs->trans("DescVentilExpenseReport") . '<br>';
|
print $langs->trans("DescVentilExpenseReport") . '<br>';
|
||||||
print $langs->trans("DescVentilExpenseReportMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
print $langs->trans("DescVentilExpenseReportMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
//print '<div class="inline-block divButAction">';
|
|
||||||
// TODO Remove this. Should be done always or into the repair.php script.
|
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
|
||||||
//print '</div>';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$y = $year_current;
|
$y = $year_current;
|
||||||
|
|
||||||
$buttonbind = '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
|
$buttonbind = '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
|
||||||
$buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
|
|
||||||
|
|
||||||
|
|
||||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
print_barre_liste($langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
|
||||||
|
//print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
|
if ($j > 12) $j-=12;
|
||||||
|
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||||
}
|
}
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
|
if ($j > 12) $j-=12;
|
||||||
|
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $j, 'erd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
$sql .= " SUM(erd.total_ht) as total";
|
$sql .= " SUM(erd.total_ht) as total";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
|
||||||
$sql .= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
$sql .= " WHERE er.date_debut >= '" . $db->idate($search_date_start) . "'";
|
||||||
$sql .= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
$sql .= " AND er.date_debut <= '" . $db->idate($search_date_end) . "'";
|
||||||
$sql .= " AND er.fk_statut > 0 ";
|
$sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.")";
|
||||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||||
$sql .= " AND aa.account_number IS NULL";
|
$sql .= " AND aa.account_number IS NULL";
|
||||||
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
||||||
@ -213,9 +189,9 @@ $sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
|||||||
dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql);
|
dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
if ($row[0] == 'tobind')
|
if ($row[0] == 'tobind')
|
||||||
@ -243,34 +219,41 @@ if ($resql) {
|
|||||||
print $db->lasterror(); // Show last sql error
|
print $db->lasterror(); // Show last sql error
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
|
||||||
|
print_barre_liste($langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
|
||||||
|
//print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', '');
|
||||||
|
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
|
if ($j > 12) $j-=12;
|
||||||
|
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||||
}
|
}
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
|
if ($j > 12) $j-=12;
|
||||||
|
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $j, 'erd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
$sql .= " ROUND(SUM(erd.total_ht),2) as total";
|
$sql .= " ROUND(SUM(erd.total_ht),2) as total";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
|
||||||
$sql .= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
$sql .= " WHERE er.date_debut >= '" . $db->idate($search_date_start) . "'";
|
||||||
$sql .= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
$sql .= " AND er.date_debut <= '" . $db->idate($search_date_end) . "'";
|
||||||
$sql .= " AND er.fk_statut > 0 ";
|
$sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.")";
|
||||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||||
$sql .= " AND aa.account_number IS NOT NULL";
|
$sql .= " AND aa.account_number IS NOT NULL";
|
||||||
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
||||||
@ -278,9 +261,9 @@ $sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
|||||||
dol_syslog('htdocs/accountancy/expensereport/index.php');
|
dol_syslog('htdocs/accountancy/expensereport/index.php');
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
if ($row[0] == 'tobind')
|
if ($row[0] == 'tobind')
|
||||||
@ -289,6 +272,7 @@ if ($resql) {
|
|||||||
}
|
}
|
||||||
else print length_accountg($row[0]);
|
else print length_accountg($row[0]);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="left">';
|
print '<td align="left">';
|
||||||
if ($row[0] == 'tobind')
|
if ($row[0] == 'tobind')
|
||||||
{
|
{
|
||||||
@ -308,35 +292,40 @@ if ($resql) {
|
|||||||
print $db->lasterror(); // Show last sql error
|
print $db->lasterror(); // Show last sql error
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report where results depends on next step (so not yet available) ?
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ?
|
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
print_barre_liste($langs->trans("OtherInfo"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
|
||||||
|
//print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||||
|
|
||||||
print "<br>\n";
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
|
if ($j > 12) $j-=12;
|
||||||
|
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||||
}
|
}
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT '" . $langs->trans("TotalExpenseReport") . "' AS label,";
|
$sql = "SELECT '" . $langs->trans("TotalExpenseReport") . "' AS label,";
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_create)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||||
|
if ($j > 12) $j-=12;
|
||||||
|
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_create)=' . $j, 'erd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
$sql .= " SUM(erd.total_ht) as total";
|
$sql .= " SUM(erd.total_ht) as total";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
|
||||||
$sql .= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
$sql .= " WHERE er.date_debut >= '" . $db->idate($search_date_start) . "'";
|
||||||
$sql .= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
$sql .= " AND er.date_debut <= '" . $db->idate($search_date_end) . "'";
|
||||||
$sql .= " AND er.fk_statut > 0 ";
|
$sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.")";
|
||||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||||
|
|
||||||
dol_syslog('htdocs/accountancy/expensereport/index.php');
|
dol_syslog('htdocs/accountancy/expensereport/index.php');
|
||||||
@ -344,7 +333,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ($row = $db->fetch_row($resql)) {
|
||||||
print '<tr><td>' . $row[0] . '</td>';
|
print '<tr><td>' . $row[0] . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||||
@ -358,6 +347,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
print $db->lasterror(); // Show last sql error
|
print $db->lasterror(); // Show last sql error
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -26,22 +26,16 @@
|
|||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
// Class
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
|
||||||
// Langs
|
$langs->loadLangs(array("compta","bills","other","accountancy","trips","productbatch"));
|
||||||
$langs->load("compta");
|
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("other");
|
|
||||||
$langs->load("main");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
$langs->load("trips");
|
|
||||||
$langs->load("productbatch");
|
|
||||||
|
|
||||||
$account_parent = GETPOST('account_parent');
|
$account_parent = GETPOST('account_parent','int');
|
||||||
$changeaccount = GETPOST('changeaccount');
|
$changeaccount = GETPOST('changeaccount');
|
||||||
// Search Getpost
|
// Search Getpost
|
||||||
$search_expensereport = GETPOST('search_expensereport', 'alpha');
|
$search_expensereport = GETPOST('search_expensereport', 'alpha');
|
||||||
@ -50,16 +44,19 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
|||||||
$search_amount = GETPOST('search_amount', 'alpha');
|
$search_amount = GETPOST('search_amount', 'alpha');
|
||||||
$search_account = GETPOST('search_account', 'alpha');
|
$search_account = GETPOST('search_account', 'alpha');
|
||||||
$search_vat = GETPOST('search_vat', 'alpha');
|
$search_vat = GETPOST('search_vat', 'alpha');
|
||||||
|
$search_day=GETPOST("search_day","int");
|
||||||
|
$search_month=GETPOST("search_month","int");
|
||||||
|
$search_year=GETPOST("search_year","int");
|
||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||||
$sortfield = GETPOST('sortfield', 'alpha');
|
$sortfield = GETPOST('sortfield', 'alpha');
|
||||||
$sortorder = GETPOST('sortorder', 'alpha');
|
$sortorder = GETPOST('sortorder', 'alpha');
|
||||||
$page = GETPOST('page', 'int');
|
$page = GETPOST('page', 'int');
|
||||||
if ($page < 0) $page = 0;
|
if (empty($page) || $page < 0) $page = 0;
|
||||||
$offset = $conf->liste_limit * $page;
|
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
$offset = $limit * $page;
|
||||||
if (! $sortfield)
|
if (! $sortfield)
|
||||||
$sortfield = "erd.date, erd.rowid";
|
$sortfield = "erd.date, erd.rowid";
|
||||||
if (! $sortorder) {
|
if (! $sortorder) {
|
||||||
@ -90,32 +87,44 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
$search_account = '';
|
$search_account = '';
|
||||||
$search_vat = '';
|
$search_vat = '';
|
||||||
|
$search_day = '';
|
||||||
|
$search_month = '';
|
||||||
|
$search_year = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
|
if (! (GETPOST('account_parent','int') >= 0))
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
if (! $error)
|
||||||
$sql1 .= " SET erd.fk_code_ventilation=" . GETPOST('account_parent');
|
{
|
||||||
$sql1 .= ' WHERE erd.rowid IN (' . implode(',', $changeaccount) . ')';
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||||
|
$sql1 .= " SET erd.fk_code_ventilation=" . (GETPOST('account_parent','int') > 0 ? GETPOST('account_parent','int') : '0');
|
||||||
|
$sql1 .= ' WHERE erd.rowid IN (' . implode(',', $changeaccount) . ')';
|
||||||
|
|
||||||
dol_syslog('accountancy/expensereport/lines.php::changeaccount sql= ' . $sql1);
|
dol_syslog('accountancy/expensereport/lines.php::changeaccount sql= ' . $sql1);
|
||||||
$resql1 = $db->query($sql1);
|
$resql1 = $db->query($sql1);
|
||||||
if (! $resql1) {
|
if (! $resql1) {
|
||||||
$error ++;
|
$error ++;
|
||||||
setEventMessages($db->lasterror(), null, 'errors');
|
setEventMessages($db->lasterror(), null, 'errors');
|
||||||
}
|
}
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessages($langs->trans('Save'), null, 'mesgs');
|
setEventMessages($langs->trans('Save'), null, 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
setEventMessages($db->lasterror(), null, 'errors');
|
setEventMessages($db->lasterror(), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
$account_parent = ''; // Protection to avoid to mass apply it a second time
|
$account_parent = ''; // Protection to avoid to mass apply it a second time
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -123,6 +132,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
|
|
||||||
llxHeader('', $langs->trans("ExpenseReportsVentilation") . ' - ' . $langs->trans("Dispatched"));
|
llxHeader('', $langs->trans("ExpenseReportsVentilation") . ' - ' . $langs->trans("Dispatched"));
|
||||||
|
|
||||||
print '<script type="text/javascript">
|
print '<script type="text/javascript">
|
||||||
@ -153,25 +165,38 @@ $sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
|||||||
$sql .= " , " . MAIN_DB_PREFIX . "accounting_account as aa";
|
$sql .= " , " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||||
$sql .= " , " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
$sql .= " , " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
||||||
$sql .= " WHERE er.rowid = erd.fk_expensereport and er.fk_statut >= 5 AND erd.fk_code_ventilation <> 0 ";
|
$sql .= " WHERE er.rowid = erd.fk_expensereport and er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <> 0 ";
|
||||||
$sql .= " AND aa.rowid = erd.fk_code_ventilation";
|
$sql .= " AND aa.rowid = erd.fk_code_ventilation";
|
||||||
if (strlen(trim($search_expensereport))) {
|
if (strlen(trim($search_expensereport))) {
|
||||||
$sql .= " AND er.ref like '%" . $search_expensereport . "%'";
|
$sql .= natural_search("er.ref", $search_expensereport);
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_label))) {
|
if (strlen(trim($search_label))) {
|
||||||
$sql .= " AND f.label like '%" . $search_label . "%'";
|
$sql .= natural_search("f.label", $search_label);
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_desc))) {
|
if (strlen(trim($search_desc))) {
|
||||||
$sql .= " AND er.comments like '%" . $search_desc . "%'";
|
$sql .= natural_search("er.comments", $search_desc);
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_amount))) {
|
if (strlen(trim($search_amount))) {
|
||||||
$sql .= " AND erd.total_ht like '%" . $search_amount . "%'";
|
$sql .= natural_search("erd.total_ht", $search_amount, 1);
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_account))) {
|
if (strlen(trim($search_account))) {
|
||||||
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
|
$sql .= natural_search("aa.account_number", $search_account);
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_vat))) {
|
if (strlen(trim($search_vat))) {
|
||||||
$sql .= " AND (erd.tva_tx like '" . $search_vat . "%')";
|
$sql .= natural_search("erd.tva_tx", price2num($search_vat), 1);
|
||||||
|
}
|
||||||
|
if ($search_month > 0)
|
||||||
|
{
|
||||||
|
if ($search_year > 0 && empty($search_day))
|
||||||
|
$sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
|
||||||
|
else if ($search_year > 0 && ! empty($search_day))
|
||||||
|
$sql.= " AND erd.date BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
|
||||||
|
else
|
||||||
|
$sql.= " AND date_format(erd.date, '%m') = '".$db->escape($search_month)."'";
|
||||||
|
}
|
||||||
|
else if ($search_year > 0)
|
||||||
|
{
|
||||||
|
$sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||||
}
|
}
|
||||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||||
|
|
||||||
@ -183,6 +208,11 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
{
|
{
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
$nbtotalofrecords = $db->num_rows($result);
|
$nbtotalofrecords = $db->num_rows($result);
|
||||||
|
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||||
|
{
|
||||||
|
$page = 0;
|
||||||
|
$offset = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
@ -195,22 +225,18 @@ if ($result) {
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||||
if ($search_expensereport)
|
if ($search_expensereport) $param .= "&search_expensereport=" . urlencode($search_expensereport);
|
||||||
$param .= "&search_expensereport=" . $search_expensereport;
|
if ($search_label) $param .= "&search_label=" . urlencode($search_label);
|
||||||
if ($search_label)
|
if ($search_desc) $param .= "&search_desc=" . urlencode($search_desc);
|
||||||
$param .= "&search_label=" . $search_label;
|
if ($search_account) $param .= "&search_account=" . urlencode($search_account);
|
||||||
if ($search_desc)
|
if ($search_vat) $param .= "&search_vat=" . urlencode($search_vat);
|
||||||
$param .= "&search_desc=" . $search_desc;
|
if ($search_day) $param .= '&search_day='.urlencode($search_day);
|
||||||
if ($search_account)
|
if ($search_month) $param .= '&search_month='.urlencode($search_month);
|
||||||
$param .= "&search_account=" . $search_account;
|
if ($search_year) $param .= '&search_year='.urlencode($search_year);
|
||||||
if ($search_vat)
|
if ($search_country) $param .= "&search_country=" . urlencode($search_country);
|
||||||
$param .= "&search_vat=" . $search_vat;
|
if ($search_tvaintra) $param .= "&search_tvaintra=" . urlencode($search_tvaintra);
|
||||||
if ($search_country)
|
|
||||||
$param .= "&search_country=" . $search_country;
|
|
||||||
if ($search_tvaintra)
|
|
||||||
$param .= "&search_tvaintra=" . $search_tvaintra;
|
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
||||||
print '<input type="hidden" name="action" value="ventil">';
|
print '<input type="hidden" name="action" value="ventil">';
|
||||||
@ -226,7 +252,7 @@ if ($result) {
|
|||||||
print $langs->trans("DescVentilDoneExpenseReport") . '<br>';
|
print $langs->trans("DescVentilDoneExpenseReport") . '<br>';
|
||||||
|
|
||||||
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
|
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
|
||||||
print $formaccounting->select_account(GETPOST('account_parent'), 'account_parent', 1);
|
print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle');
|
||||||
print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("ChangeBinding") . '" /></div>';
|
print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("ChangeBinding") . '" /></div>';
|
||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
@ -237,7 +263,11 @@ if ($result) {
|
|||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td><input type="text" class="flat maxwidth50" name="search_expensereport" value="' . dol_escape_htmltag($search_expensereport) . '"></td>';
|
print '<td><input type="text" class="flat maxwidth50" name="search_expensereport" value="' . dol_escape_htmltag($search_expensereport) . '"></td>';
|
||||||
print '<td class="liste_titre" align="right"></td>';
|
print '<td class="liste_titre center">';
|
||||||
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||||
|
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||||
|
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||||
|
print '</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"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||||
@ -266,7 +296,6 @@ if ($result) {
|
|||||||
|
|
||||||
$expensereport_static = new ExpenseReport($db);
|
$expensereport_static = new ExpenseReport($db);
|
||||||
|
|
||||||
$var = True;
|
|
||||||
while ( $i < min($num_lines, $limit) ) {
|
while ( $i < min($num_lines, $limit) ) {
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$codeCompta = length_accountg($objp->account_number) . ' - ' . $objp->label;
|
$codeCompta = length_accountg($objp->account_number) . ' - ' . $objp->label;
|
||||||
@ -297,7 +326,7 @@ if ($result) {
|
|||||||
|
|
||||||
print '<td>' . $codeCompta . '</td>';
|
print '<td>' . $codeCompta . '</td>';
|
||||||
|
|
||||||
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '">';
|
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:'')). '">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a></td>';
|
print '</a></td>';
|
||||||
|
|
||||||
@ -316,7 +345,7 @@ if ($result) {
|
|||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
} else {
|
} else {
|
||||||
print $db->error();
|
print $db->lasterror();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -27,20 +27,15 @@
|
|||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
// Class
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
|
||||||
// Langs
|
// Load traductions files requiredby by page
|
||||||
$langs->load("compta");
|
$langs->loadLangs(array("bills","compta","accountancy","other","trips","productbatch"));
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("other");
|
|
||||||
$langs->load("trips");
|
|
||||||
$langs->load("main");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
$langs->load("productbatch");
|
|
||||||
|
|
||||||
$action=GETPOST('action','alpha');
|
$action=GETPOST('action','alpha');
|
||||||
$massaction=GETPOST('massaction','alpha');
|
$massaction=GETPOST('massaction','alpha');
|
||||||
@ -58,6 +53,10 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
|||||||
$search_amount = GETPOST('search_amount', 'alpha');
|
$search_amount = GETPOST('search_amount', 'alpha');
|
||||||
$search_account = GETPOST('search_account', 'alpha');
|
$search_account = GETPOST('search_account', 'alpha');
|
||||||
$search_vat = GETPOST('search_vat', 'alpha');
|
$search_vat = GETPOST('search_vat', 'alpha');
|
||||||
|
$search_day=GETPOST("search_day","int");
|
||||||
|
$search_month=GETPOST("search_month","int");
|
||||||
|
$search_year=GETPOST("search_year","int");
|
||||||
|
|
||||||
$btn_ventil = GETPOST('ventil', 'alpha');
|
$btn_ventil = GETPOST('ventil', 'alpha');
|
||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
@ -65,7 +64,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->AC
|
|||||||
$sortfield = GETPOST('sortfield', 'alpha');
|
$sortfield = GETPOST('sortfield', 'alpha');
|
||||||
$sortorder = GETPOST('sortorder', 'alpha');
|
$sortorder = GETPOST('sortorder', 'alpha');
|
||||||
$page = GETPOST('page','int');
|
$page = GETPOST('page','int');
|
||||||
if ($page < 0) { $page = 0; }
|
if (empty($page) || $page < 0) { $page = 0; }
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
@ -86,13 +85,15 @@ if (! $user->rights->accounting->bind->write)
|
|||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
$accounting = new AccountingAccount($db);
|
$accounting = new AccountingAccount($db);
|
||||||
|
|
||||||
|
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||||
@ -103,14 +104,17 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
$search_account = '';
|
$search_account = '';
|
||||||
$search_vat = '';
|
$search_vat = '';
|
||||||
|
$search_day = '';
|
||||||
|
$search_month = '';
|
||||||
|
$search_year = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mass actions
|
// Mass actions
|
||||||
$objectclass='Skeleton';
|
$objectclass='ExpenseReport';
|
||||||
$objectlabel='Skeleton';
|
$objectlabel='ExpenseReport';
|
||||||
$permtoread = $user->rights->accounting->read;
|
$permtoread = $user->rights->expensereport->read;
|
||||||
$permtodelete = $user->rights->accounting->delete;
|
$permtodelete = $user->rights->expensereport->delete;
|
||||||
$uploaddir = $conf->accounting->dir_output;
|
$uploaddir = $conf->expensereport->dir_output;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
|
|
||||||
if ($massaction == 'ventil') {
|
if ($massaction == 'ventil') {
|
||||||
@ -169,21 +173,28 @@ if ($massaction == 'ventil') {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
|
|
||||||
llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
||||||
|
|
||||||
|
if (empty($chartaccountcode))
|
||||||
|
{
|
||||||
|
print $langs->trans("ErrorChartOfAccountSystemNotSelected");
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Expense report lines
|
// Expense report lines
|
||||||
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut,";
|
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut,";
|
||||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.vat_src_code, erd.date,";
|
$sql.= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.vat_src_code, erd.date,";
|
||||||
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,";
|
$sql.= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,";
|
||||||
$sql .= " aa.rowid as aarowid";
|
$sql.= " aa.rowid as aarowid";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
$sql.= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "expensereport_det as erd ON er.rowid = erd.fk_expensereport";
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "expensereport_det as erd ON er.rowid = erd.fk_expensereport";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON f.accountancy_code = aa.account_number";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON f.accountancy_code = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."'";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
$sql.= " WHERE er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0";
|
||||||
$sql .= " WHERE er.fk_statut > 4 AND erd.fk_code_ventilation <= 0";
|
|
||||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR f.accountancy_code IS NULL OR f.accountancy_code ='')";
|
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
if (strlen(trim($search_expensereport))) {
|
if (strlen(trim($search_expensereport))) {
|
||||||
$sql .= natural_search("er.ref",$search_expensereport);
|
$sql .= natural_search("er.ref",$search_expensereport);
|
||||||
@ -203,6 +214,19 @@ if (strlen(trim($search_account))) {
|
|||||||
if (strlen(trim($search_vat))) {
|
if (strlen(trim($search_vat))) {
|
||||||
$sql .= natural_search("erd.tva_tx",$search_vat,1);
|
$sql .= natural_search("erd.tva_tx",$search_vat,1);
|
||||||
}
|
}
|
||||||
|
if ($search_month > 0)
|
||||||
|
{
|
||||||
|
if ($search_year > 0 && empty($search_day))
|
||||||
|
$sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
|
||||||
|
else if ($search_year > 0 && ! empty($search_day))
|
||||||
|
$sql.= " AND erd.date BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
|
||||||
|
else
|
||||||
|
$sql.= " AND date_format(erd.date, '%m') = '".$db->escape($search_month)."'";
|
||||||
|
}
|
||||||
|
else if ($search_year > 0)
|
||||||
|
{
|
||||||
|
$sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||||
|
}
|
||||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||||
|
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
@ -213,6 +237,11 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
{
|
{
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
$nbtotalofrecords = $db->num_rows($result);
|
$nbtotalofrecords = $db->num_rows($result);
|
||||||
|
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||||
|
{
|
||||||
|
$page = 0;
|
||||||
|
$offset = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
@ -228,14 +257,23 @@ if ($result) {
|
|||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
|
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
|
||||||
|
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||||
|
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||||
|
if ($search_year) $param.='&search_year='.urlencode($search_year);
|
||||||
|
if ($search_expensereport) $param.='&search_expensereport='.urlencode($search_expensereport);
|
||||||
|
if ($search_label) $param.='&search_label='.urlencode($search_label);
|
||||||
|
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
||||||
|
if ($search_amount) $param.='&search_amount='.urlencode($search_amount);
|
||||||
|
if ($search_vat) $param.='&search_vat='.urlencode($search_vat);
|
||||||
|
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
'ventil'=>$langs->trans("Ventilate")
|
'ventil'=>$langs->trans("Ventilate")
|
||||||
//'presend'=>$langs->trans("SendByMail"),
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||||
//if ($massaction == 'presend') $arrayofmassactions=array();
|
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||||
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||||
|
|
||||||
|
|
||||||
@ -252,6 +290,12 @@ if ($result) {
|
|||||||
|
|
||||||
print $langs->trans("DescVentilTodoExpenseReport") . '</br><br>';
|
print $langs->trans("DescVentilTodoExpenseReport") . '</br><br>';
|
||||||
|
|
||||||
|
/*$topicmail="Information";
|
||||||
|
$modelmail="project";
|
||||||
|
$objecttmp=new Project($db);
|
||||||
|
$trackid='prj'.$object->id;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';*/
|
||||||
|
|
||||||
if ($msg) print $msg.'<br>';
|
if ($msg) print $msg.'<br>';
|
||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
@ -263,7 +307,11 @@ if ($result) {
|
|||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_expensereport" value="' . dol_escape_htmltag($search_expensereport) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_expensereport" value="' . dol_escape_htmltag($search_expensereport) . '"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre center">';
|
||||||
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||||
|
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||||
|
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||||
|
print '</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"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||||
@ -295,7 +343,6 @@ if ($result) {
|
|||||||
$expensereport_static = new ExpenseReport($db);
|
$expensereport_static = new ExpenseReport($db);
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$var = true;
|
|
||||||
while ( $i < min($num_lines, $limit) ) {
|
while ( $i < min($num_lines, $limit) ) {
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
@ -313,6 +360,7 @@ if ($result) {
|
|||||||
// Ref Expense report
|
// Ref Expense report
|
||||||
print '<td>' . $expensereport_static->getNomUrl(1) . '</td>';
|
print '<td>' . $expensereport_static->getNomUrl(1) . '</td>';
|
||||||
|
|
||||||
|
// Date
|
||||||
print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
|
print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
|
||||||
|
|
||||||
// Fees label
|
// Fees label
|
||||||
@ -343,11 +391,11 @@ if ($result) {
|
|||||||
|
|
||||||
// Suggested accounting account
|
// Suggested accounting account
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<input type="checkbox" class="flat checkforselect" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
@ -362,5 +410,17 @@ if ($result) {
|
|||||||
print $db->error();
|
print $db->error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add code to auto check the box when we select an account
|
||||||
|
print '<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
jQuery(".codeventil").change(function() {
|
||||||
|
var s=$(this).attr("id").replace("codeventil", "")
|
||||||
|
console.log(s+" "+$(this).val());
|
||||||
|
if ($(this).val() == -1) jQuery(".checkforselect"+s).prop("checked", false);
|
||||||
|
else jQuery(".checkforselect"+s).prop("checked", true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -26,26 +26,12 @@ require '../main.inc.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
|
||||||
// Langs
|
$langs->loadLangs(array("compta","bills","other","accountancy","loans","banks","admin","dict"));
|
||||||
$langs->load("compta");
|
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("other");
|
|
||||||
$langs->load("main");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
$langs->load("admin");
|
|
||||||
$langs->load("dict");
|
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
$langs->load("compta");
|
|
||||||
$langs->load("banks");
|
|
||||||
$langs->load("loans");
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
@ -63,108 +49,118 @@ print load_fiche_titre($langs->trans("AccountancyArea"), '', 'title_accountancy'
|
|||||||
|
|
||||||
$step = 0;
|
$step = 0;
|
||||||
|
|
||||||
print $langs->trans("AccountancyAreaDescIntro")."<br>\n";
|
if ($conf->accounting->enabled)
|
||||||
print "<br>\n";print "<br>\n";
|
|
||||||
|
|
||||||
print_fiche_titre($langs->trans("AccountancyAreaDescActionOnce"), '', 'object_calendar')."<br>\n";
|
|
||||||
print '<hr>';
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
// STEPS
|
|
||||||
$step++;
|
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("AccountingJournals").'</strong>');
|
|
||||||
print "<br>\n";
|
|
||||||
$step++;
|
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").'</strong>');
|
|
||||||
print "<br>\n";
|
|
||||||
$step++;
|
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").'</strong>');
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
print "<br>\n";
|
|
||||||
print $langs->trans("AccountancyAreaDescActionOnceBis");
|
|
||||||
print "<br>\n";
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
$step++;
|
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>')."\n";
|
|
||||||
print "<br>\n";
|
|
||||||
$step++;
|
|
||||||
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>';
|
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
|
|
||||||
print "<br>\n";
|
|
||||||
if (! empty($conf->tax->enabled))
|
|
||||||
{
|
{
|
||||||
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong>';
|
print $langs->trans("AccountancyAreaDescIntro")."<br>\n";
|
||||||
$step++;
|
print "<br>\n";print "<br>\n";
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
|
|
||||||
print "<br>\n";
|
print_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."<br>\n";
|
||||||
|
print '<hr>';
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
// STEPS
|
||||||
|
$step++;
|
||||||
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("AccountingJournals").'</strong>');
|
||||||
|
print "<br>\n";
|
||||||
|
$step++;
|
||||||
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").'</strong>');
|
||||||
|
print "<br>\n";
|
||||||
|
$step++;
|
||||||
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").'</strong>');
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
print "<br>\n";
|
||||||
|
print $langs->trans("AccountancyAreaDescActionOnceBis");
|
||||||
|
print "<br>\n";
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
$step++;
|
||||||
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
$step++;
|
||||||
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong>')."\n";
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
$step++;
|
||||||
|
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>';
|
||||||
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
|
||||||
|
print "<br>\n";
|
||||||
|
if (! empty($conf->tax->enabled))
|
||||||
|
{
|
||||||
|
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong>';
|
||||||
|
$step++;
|
||||||
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
|
||||||
|
print "<br>\n";
|
||||||
|
}
|
||||||
|
/*if (! empty($conf->salaries->enabled))
|
||||||
|
{
|
||||||
|
$step++;
|
||||||
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||||
|
// htdocs/admin/salaries.php
|
||||||
|
print "<br>\n";
|
||||||
|
print "<br>\n";
|
||||||
|
}*/
|
||||||
|
if (! empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
|
||||||
|
{
|
||||||
|
$step++;
|
||||||
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong>');
|
||||||
|
print "<br>\n";
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
if (! empty($conf->loan->enabled))
|
||||||
|
{
|
||||||
|
$step++;
|
||||||
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").'-'.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||||
|
print "<br>\n";
|
||||||
|
}
|
||||||
|
if (! empty($conf->don->enabled))
|
||||||
|
{
|
||||||
|
$step++;
|
||||||
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDonationAccounts").'</strong>');
|
||||||
|
print "<br>\n";
|
||||||
|
}*/
|
||||||
|
|
||||||
|
$step++;
|
||||||
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").'</strong>');
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
|
print "<br>\n";
|
||||||
|
print_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionFreq"), '', '');
|
||||||
|
print '<hr>';
|
||||||
|
print "<br>\n";
|
||||||
|
$step = 0;
|
||||||
|
|
||||||
|
$langs->loadLangs(array('bills', 'trips'));
|
||||||
|
|
||||||
|
$step++;
|
||||||
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>')."\n";
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
$step++;
|
||||||
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>')."\n";
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
$step++;
|
||||||
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>')."\n";
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
$step++;
|
||||||
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64+$step), $langs->transnoentitiesnoconv("Journalization"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n";
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
$step++;
|
||||||
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64+$step))."<br>\n";
|
||||||
|
print "<br>\n";
|
||||||
}
|
}
|
||||||
/*if (! empty($conf->salaries->enabled))
|
else
|
||||||
{
|
{
|
||||||
$step++;
|
print $langs->trans("Module10Desc")."<br>\n";
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
|
||||||
// htdocs/admin/salaries.php
|
|
||||||
print "<br>\n";
|
|
||||||
print "<br>\n";
|
|
||||||
}*/
|
|
||||||
if (! empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
|
|
||||||
{
|
|
||||||
$step++;
|
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong>');
|
|
||||||
print "<br>\n";
|
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if (! empty($conf->loan->enabled))
|
|
||||||
{
|
|
||||||
$step++;
|
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").'-'.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
|
||||||
print "<br>\n";
|
|
||||||
}
|
|
||||||
if (! empty($conf->don->enabled))
|
|
||||||
{
|
|
||||||
$step++;
|
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDonationAccounts").'</strong>');
|
|
||||||
print "<br>\n";
|
|
||||||
}*/
|
|
||||||
|
|
||||||
$step++;
|
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").'</strong>');
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
$step++;
|
|
||||||
$textlink='<strong>'.$langs->transnoentitiesnoconv("MenuBankCash").'</strong>';
|
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, $textlink);
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
|
|
||||||
print "<br>\n";
|
|
||||||
print_fiche_titre($langs->trans("AccountancyAreaDescActionFreq"), '', 'object_calendarweek');
|
|
||||||
print '<hr>';
|
|
||||||
print "<br>\n";
|
|
||||||
$step = 0;
|
|
||||||
|
|
||||||
$langs->loadLangs(array('bills', 'trips'));
|
|
||||||
|
|
||||||
$step++;
|
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>')."\n";
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
$step++;
|
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>')."\n";
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
$step++;
|
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>')."\n";
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
$step++;
|
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64+$step), $langs->transnoentitiesnoconv("Journalization"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n";
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
$step++;
|
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64+$step))."<br>\n";
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user