Merge branch 'develop' into dev_change_notetaskivoice
This commit is contained in:
commit
97042001f6
5081 changed files with 142859 additions and 85366 deletions
|
|
@ -1,7 +1,7 @@
|
|||
name: Qodana
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 20 * * *"
|
||||
- cron: "0 20 * * 1,3,5"
|
||||
workflow_dispatch:
|
||||
branches:
|
||||
- develop
|
||||
|
|
@ -9,6 +9,9 @@ on:
|
|||
# branches:
|
||||
# - develop
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
qodana:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -18,7 +21,7 @@ jobs:
|
|||
fetch-depth: 1
|
||||
#php-version: '7.1'
|
||||
- name: 'Qodana Scan'
|
||||
uses: JetBrains/qodana-action@v2022.3.4
|
||||
uses: JetBrains/qodana-action@v2023.2.1
|
||||
#with:
|
||||
# php-version: '7.1'
|
||||
env:
|
||||
|
|
@ -2,8 +2,9 @@
|
|||
name: "Exakat analysis"
|
||||
|
||||
on:
|
||||
# execute once a month, the 1st
|
||||
schedule:
|
||||
- cron: "0 20 * * *"
|
||||
- cron: "0 20 1 * *"
|
||||
workflow_dispatch:
|
||||
branches:
|
||||
- develop
|
||||
|
|
@ -22,4 +23,6 @@ jobs:
|
|||
uses: docker://exakat/exakat-ga
|
||||
with:
|
||||
ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/UndefinedFunctions,Functions/WrongNumberOfArguments,Functions/WrongTypeWithCall,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Php/WrongTypeForNativeFunction,Structures/AddZero,Structures/DropElseAfterReturn,Structures/IfWithSameConditions,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/ExitUsage,Structures/RepeatedPrint,Structures/RepeatedRegex,Structures/SameConditions,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UselessParenthesis,Structures/UseConstant'
|
||||
ignore_dirs: '/htdocs/includes,/build,/dev,/doc,/scripts,/test'
|
||||
ignore_dirs: '/htdocs/includes/,/htdocs/install/doctemplates/,/build/,/dev/,/doc/,/scripts/,/test/'
|
||||
file_extensions: php
|
||||
project_reports: Perfile
|
||||
365
.github/workflows/github_ci_php71_pgsql.yml.disabled
vendored
Normal file
365
.github/workflows/github_ci_php71_pgsql.yml.disabled
vendored
Normal file
|
|
@ -0,0 +1,365 @@
|
|||
name: GitHub CI PHP 7.1 Postgres
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
- 1*
|
||||
- 2*
|
||||
pull_request:
|
||||
types: [opened]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
github_ci_php71_pgsql:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
ports:
|
||||
- 32574:3306
|
||||
postgres:
|
||||
image: postgres
|
||||
env:
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_DB: postgres
|
||||
# Set health checks to wait until postgres has started
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
ports:
|
||||
- 5432:5432
|
||||
|
||||
steps:
|
||||
# git clone dolibarr into GITHUB_WORKSPACE = /home/runner/work/dolibarr/dolibarr
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Version PHP
|
||||
run: |
|
||||
php -i | head -
|
||||
|
||||
- name: Install packages for PHP 7.1
|
||||
run: |
|
||||
sudo composer self-update 2.2.18
|
||||
sudo chmod -R a+rwx /home/runner
|
||||
composer -n config -g vendor-dir htdocs/includes
|
||||
|
||||
sudo add-apt-repository -y ppa:ondrej/php
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y pgloader memcached
|
||||
sudo apt install apache2 php7.1 php7.1-cli php7.1-curl php7.1-mysql php7.1-pgsql php7.1-gd php7.1-imap php7.1-intl php7.1-ldap php7.1-xml php7.1-mbstring php7.1-xml php7.1-zip libapache2-mod-php7.1
|
||||
sudo update-alternatives --set php /usr/bin/php7.1
|
||||
php -i | head -
|
||||
|
||||
cd $GITHUB_WORKSPACE
|
||||
ls $GITHUB_WORKSPACE
|
||||
composer -n require --ignore-platform-reqs phpunit/phpunit ^7.5 \
|
||||
php-parallel-lint/php-parallel-lint ^1 \
|
||||
php-parallel-lint/php-console-highlighter ^0 \
|
||||
php-parallel-lint/php-var-dump-check ~0.4 \
|
||||
squizlabs/php_codesniffer ^3
|
||||
#For php7.3
|
||||
#composer -n require phpunit/phpunit ^7.5 \
|
||||
# php-parallel-lint/php-parallel-lint ^1.2 \
|
||||
# php-parallel-lint/php-console-highlighter ^0 \
|
||||
# php-parallel-lint/php-var-dump-check ~0.4 \
|
||||
# squizlabs/php_codesniffer ^3
|
||||
sudo rm -fr htdocs/includes/phpunit/php-code-coverage/src/Report/Html
|
||||
|
||||
- name: Adding path of binaries tools installed by composer to the PATH
|
||||
run: |
|
||||
export PATH="$GITHUB_WORKSPACE/htdocs/includes/bin:$PATH"
|
||||
echo $PATH
|
||||
# We must have a directory bin created by the previous composer call
|
||||
ls $GITHUB_WORKSPACE/htdocs/includes/bin
|
||||
|
||||
- name: Version information
|
||||
run: |
|
||||
composer -V
|
||||
# Check Parallel-lint version
|
||||
echo "Parallel-lint version"
|
||||
htdocs/includes/bin/parallel-lint -V
|
||||
# Check PHP CodeSniffer version
|
||||
echo "PHPCS version"
|
||||
htdocs/includes/bin/phpcs --version | head -
|
||||
htdocs/includes/bin/phpcs -i | head -
|
||||
# Check PHP Vardump check version
|
||||
echo "PHP Vardump check version"
|
||||
htdocs/includes/bin/var-dump-check --version
|
||||
# Check PHPUnit version
|
||||
echo "PHPUnit version"
|
||||
htdocs/includes/bin/phpunit --version | head -
|
||||
# Check Apache version
|
||||
echo "Apache version"
|
||||
apache2 -v | head -
|
||||
# Check Database
|
||||
echo "Database version"
|
||||
mysql --version | head -
|
||||
psql --version
|
||||
echo "Check pgloader version"
|
||||
pgloader --version
|
||||
|
||||
- name: Create database
|
||||
run: |
|
||||
pwd
|
||||
echo GITHUB_WORKSPACE = $GITHUB_WORKSPACE
|
||||
sudo apt-get install -y mysql-client
|
||||
mysql --version | head -
|
||||
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e "SELECT VERSION();" | head -
|
||||
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e "SHOW DATABASES"
|
||||
|
||||
echo "Drop and create database"
|
||||
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e 'DROP DATABASE IF EXISTS travis;'
|
||||
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e "CREATE DATABASE IF NOT EXISTS travis CHARACTER SET = 'utf8';"
|
||||
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e "CREATE USER 'travis'@'127.0.0.1' IDENTIFIED BY 'password';"
|
||||
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;'
|
||||
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e 'FLUSH PRIVILEGES;'
|
||||
|
||||
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||
|
||||
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -D travis -e "UPDATE llx_const set value = '0666' WHERE name = 'MAIN_UMASK';"
|
||||
|
||||
echo "Init postgresql database"
|
||||
ps fauxww | grep postgres
|
||||
ls /etc/postgresql/14/main/
|
||||
sudo chmod -R a+rwx /etc/postgresql/14/main/pg_hba.conf
|
||||
|
||||
sudo sed -i -e '/local.*peer/s/postgres/all/' -e 's/peer\|md5/trust/g' /etc/postgresql/14/main/pg_hba.conf
|
||||
sudo cat /etc/postgresql/14/main/pg_hba.conf
|
||||
|
||||
sudo /etc/init.d/postgresql restart
|
||||
|
||||
psql postgresql://postgres:postgres@127.0.0.1:5432 -l -A
|
||||
|
||||
psql postgresql://postgres:postgres@127.0.0.1:5432 -c 'create database travis;'
|
||||
|
||||
sudo mkdir -p /tmp/pgloader
|
||||
sudo chmod -R a+rwx /tmp/pgloader/
|
||||
|
||||
echo sudo pgloader mysql://root:password@127.0.0.1:32574/travis postgresql://postgres:postgres@127.0.0.1:5432/travis
|
||||
sudo pgloader mysql://root:password@127.0.0.1:32574/travis postgresql://postgres:postgres@127.0.0.1:5432/travis
|
||||
echo 'ALTER SEQUENCE llx_accountingaccount_rowid_seq RENAME TO llx_accounting_account_rowid_seq' | psql postgresql://postgres:postgres@127.0.0.1:5432/travis
|
||||
echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql postgresql://postgres:postgres@127.0.0.1:5432/travis
|
||||
|
||||
# Create pgsql compatibility functions
|
||||
psql postgresql://postgres:postgres@127.0.0.1:5432/travis < htdocs/install/pgsql/functions/functions.sql
|
||||
|
||||
- name: Generate Dolibarr conf file
|
||||
run: |
|
||||
export CONF_FILE=$GITHUB_WORKSPACE/htdocs/conf/conf.php
|
||||
echo "Setting up Dolibarr $CONF_FILE"
|
||||
echo '<?php' > $CONF_FILE
|
||||
echo '$'dolibarr_main_url_root=\'http://127.0.0.1\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_document_root=\'/var/www/html\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_data_root=\'/var/www/html/documents\'';' >> $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_user=\'postgres\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_db_pass=\'postgres\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_instance_unique_id=\'travis1234567890\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_db_type=\'pgsql\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_db_port=\'5432\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> $CONF_FILE
|
||||
cat $CONF_FILE
|
||||
- name: Generate install.forced.php file to test installation
|
||||
run: |
|
||||
export INSTALL_FORCED_FILE=$GITHUB_WORKSPACE/htdocs/install/install.forced.php
|
||||
echo "Setting up Dolibarr $INSTALL_FORCED_FILE to test installation"
|
||||
# Ensure we catch errors
|
||||
set +e
|
||||
echo '<?php' > $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_noedit=2';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_type=\'pgsql\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_dbserver=\'127.0.0.1\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_database=\'travis\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_databaselogin=\'postgres\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_databasepass=\'postgres\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_port=\'5432\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_prefix=\'llx_\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_createdatabase=false';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_createuser=false';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_mainforcehttps=false';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_main_data_root=\'/var/www/html\'';' >> $INSTALL_FORCED_FILE
|
||||
cat $INSTALL_FORCED_FILE
|
||||
|
||||
- name: Create document directory
|
||||
run: |
|
||||
echo "Create documents directory and set permissions"
|
||||
# and admin/temp subdirectory needed for unit tests
|
||||
sudo mkdir -p /var/www/html/documents/admin/temp
|
||||
sudo chmod -R a+rwx /var/www/html/documents
|
||||
sudo echo "***** First line of dolibarr.log" > /var/www/html/documents/dolibarr.log
|
||||
sudo chmod a+rwx /var/www/html/documents/dolibarr.log
|
||||
|
||||
- name: Copy app into /var/www
|
||||
run: |
|
||||
sudo cp -r $GITHUB_WORKSPACE/htdocs/. /var/www/html
|
||||
sudo mv /var/www/html/index.html /var/www/html/index.disabled.html
|
||||
sudo ln -fs /var/www/html /var/www/htdocs
|
||||
sudo cp -r $GITHUB_WORKSPACE/test/. /var/www/test
|
||||
sudo cp -r $GITHUB_WORKSPACE/dev/. /var/www/dev
|
||||
sudo cp -r $GITHUB_WORKSPACE/scripts/. /var/www/scripts
|
||||
|
||||
- name: Setup Apache
|
||||
run: |
|
||||
pwd
|
||||
whoami
|
||||
# install apache web server
|
||||
a2query -s
|
||||
a2query -m
|
||||
ls /etc/apache2/sites-available
|
||||
#sudo cp -f $GITHUB_WORKSPACE/build/travis-ci/apache-githubaction.conf /etc/apache2/sites-available/000-default.conf
|
||||
#sudo sed -e "s?%GITHUB_WORKSPACE%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
|
||||
a2ensite 000-default
|
||||
a2enmod php7.1
|
||||
ls /etc/apache2/sites-enabled
|
||||
sudo adduser $(whoami) www-data
|
||||
sudo adduser $(whoami) root
|
||||
sudo adduser root www-data
|
||||
sudo chown -R www-data:www-data /etc/apache2/sites-available/
|
||||
sudo chmod -R 777 /etc/apache2/sites-available/
|
||||
sudo chown -R www-data:www-data /var/www/html/
|
||||
ls -l /var/www/html
|
||||
#ls -l /var/www/html/conf
|
||||
#ls -l /var/www/html/install/
|
||||
set +e
|
||||
sudo cat /etc/apache2/sites-enabled/000-default.conf
|
||||
sudo service apache2 restart
|
||||
curl -I localhost
|
||||
- name: Chech Apache availability
|
||||
run: |
|
||||
echo "Checking webserver availability by a wget -O - --debug http://127.0.0.1"
|
||||
# Ensure we stop on error with set -e
|
||||
set +e
|
||||
ls /var/log/apache2
|
||||
#wget -O - --debug http://127.0.0.1/robots.txt
|
||||
# The wget should return a page with line '<meta name="generator" content="Dolibarr installer">
|
||||
wget -O - --debug http://127.0.0.1 > $GITHUB_WORKSPACE/test.html 2>&1
|
||||
head -n 200 $GITHUB_WORKSPACE/test.html
|
||||
|
||||
echo Logs are...
|
||||
#sudo cat /tmp/install.log
|
||||
sudo cat /var/log/apache2/access.log
|
||||
sudo cat /var/log/apache2/error.log
|
||||
sudo cat /var/log/apache2/other_vhosts_access.log
|
||||
set +e
|
||||
|
||||
- name: Upgrading Dolibarr
|
||||
run: |
|
||||
# Ensure we catch errors. Set this to +e if you want to go to the end to see log files.
|
||||
set -e
|
||||
sudo chmod -R a+rwx $GITHUB_WORKSPACE
|
||||
sudo chmod -R a+rwx /var/www
|
||||
ls -l /var/www
|
||||
cd /var/www/html/install
|
||||
|
||||
echo Execute upgrade, upgrade2 and step5 for each major version
|
||||
php upgrade.php 3.5.0 3.6.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade350360.log
|
||||
php upgrade2.php 3.5.0 3.6.0 > $GITHUB_WORKSPACE/upgrade350360-2.log
|
||||
php step5.php 3.5.0 3.6.0 > $GITHUB_WORKSPACE/upgrade350360-3.log
|
||||
php upgrade.php 3.6.0 3.7.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade360370.log
|
||||
php upgrade2.php 3.6.0 3.7.0 > $GITHUB_WORKSPACE/upgrade360370-2.log
|
||||
php step5.php 3.6.0 3.7.0 > $GITHUB_WORKSPACE/upgrade360370-3.log
|
||||
php upgrade.php 3.7.0 3.8.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade370380.log
|
||||
php upgrade2.php 3.7.0 3.8.0 > $GITHUB_WORKSPACE/upgrade370380-2.log
|
||||
php step5.php 3.7.0 3.8.0 > $GITHUB_WORKSPACE/upgrade370380-3.log
|
||||
php upgrade.php 3.8.0 3.9.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade380390.log
|
||||
php upgrade2.php 3.8.0 3.9.0 > $GITHUB_WORKSPACE/upgrade380390-2.log
|
||||
php step5.php 3.8.0 3.9.0 > $GITHUB_WORKSPACE/upgrade380390-3.log
|
||||
php upgrade.php 3.9.0 4.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade390400.log
|
||||
php upgrade2.php 3.9.0 4.0.0 > $GITHUB_WORKSPACE/upgrade390400-2.log
|
||||
php step5.php 3.9.0 4.0.0 > $GITHUB_WORKSPACE/upgrade390400-3.log
|
||||
php upgrade.php 4.0.0 5.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade400500.log
|
||||
php upgrade2.php 4.0.0 5.0.0 > $GITHUB_WORKSPACE/upgrade400500-2.log
|
||||
php step5.php 4.0.0 5.0.0 > $GITHUB_WORKSPACE/upgrade400500-3.log
|
||||
php upgrade.php 5.0.0 6.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade500600.log
|
||||
php upgrade2.php 5.0.0 6.0.0 > $GITHUB_WORKSPACE/upgrade500600-2.log
|
||||
php step5.php 5.0.0 6.0.0 > $GITHUB_WORKSPACE/upgrade500600-3.log
|
||||
php upgrade.php 6.0.0 7.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade600700.log
|
||||
php upgrade2.php 6.0.0 7.0.0 > $GITHUB_WORKSPACE/upgrade600700-2.log
|
||||
php step5.php 6.0.0 7.0.0 > $GITHUB_WORKSPACE/upgrade600700-3.log
|
||||
|
||||
echo "\dt llx_c_paiement" | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
|
||||
echo "\dt llx_c_payment_term" | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
|
||||
|
||||
php upgrade.php 7.0.0 8.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade700800.log
|
||||
php upgrade2.php 7.0.0 8.0.0 > $GITHUB_WORKSPACE/upgrade700800-2.log
|
||||
php step5.php 7.0.0 8.0.0 > $GITHUB_WORKSPACE/upgrade700800-3.log
|
||||
php upgrade.php 8.0.0 9.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade800900.log
|
||||
php upgrade2.php 8.0.0 9.0.0 > $GITHUB_WORKSPACE/upgrade800900-2.log
|
||||
php step5.php 8.0.0 9.0.0 > $GITHUB_WORKSPACE/upgrade800900-3.log
|
||||
php upgrade.php 9.0.0 10.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade9001000.log
|
||||
php upgrade2.php 9.0.0 10.0.0 > $GITHUB_WORKSPACE/upgrade9001000-2.log
|
||||
php step5.php 9.0.0 10.0.0 > $GITHUB_WORKSPACE/upgrade9001000-3.log
|
||||
php upgrade.php 10.0.0 11.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade10001100.log
|
||||
php upgrade2.php 10.0.0 11.0.0 > $GITHUB_WORKSPACE/upgrade10001100-2.log
|
||||
php step5.php 10.0.0 11.0.0 > $GITHUB_WORKSPACE/upgrade10001100-3.log
|
||||
php upgrade.php 11.0.0 12.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade11001200.log
|
||||
php upgrade2.php 11.0.0 12.0.0 > $GITHUB_WORKSPACE/upgrade11001200-2.log
|
||||
php step5.php 11.0.0 12.0.0 > $GITHUB_WORKSPACE/upgrade11001200-3.log
|
||||
php upgrade.php 12.0.0 13.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade12001300.log
|
||||
php upgrade2.php 12.0.0 13.0.0 > $GITHUB_WORKSPACE/upgrade12001300-2.log
|
||||
php step5.php 12.0.0 13.0.0 > $GITHUB_WORKSPACE/upgrade12001300-3.log
|
||||
php upgrade.php 13.0.0 14.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade13001400.log
|
||||
php upgrade2.php 13.0.0 14.0.0 > $GITHUB_WORKSPACE/upgrade13001400-2.log
|
||||
php step5.php 13.0.0 14.0.0 > $GITHUB_WORKSPACE/upgrade13001400-3.log
|
||||
php upgrade.php 14.0.0 15.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade14001500.log
|
||||
php upgrade2.php 14.0.0 15.0.0 > $GITHUB_WORKSPACE/upgrade14001500-2.log
|
||||
php step5.php 14.0.0 15.0.0 > $GITHUB_WORKSPACE/upgrade14001500-3.log
|
||||
php upgrade.php 15.0.0 16.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade15001600.log
|
||||
php upgrade2.php 15.0.0 16.0.0 > $GITHUB_WORKSPACE/upgrade15001600-2.log
|
||||
php step5.php 15.0.0 16.0.0 > $GITHUB_WORKSPACE/upgrade15001600-3.log
|
||||
php upgrade.php 16.0.0 17.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade16001700.log
|
||||
php upgrade2.php 16.0.0 17.0.0 > $GITHUB_WORKSPACE/upgrade16001700-2.log
|
||||
php step5.php 16.0.0 17.0.0 > $GITHUB_WORKSPACE/upgrade16001700-3.log
|
||||
php upgrade.php 17.0.0 18.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade17001800.log
|
||||
php upgrade2.php 17.0.0 18.0.0 > $GITHUB_WORKSPACE/upgrade17001800-2.log
|
||||
php step5.php 17.0.0 18.0.0 > $GITHUB_WORKSPACE/upgrade17001800-3.log
|
||||
|
||||
- name: Result of migration scripts
|
||||
if: always()
|
||||
run: |
|
||||
ls -alrt $GITHUB_WORKSPACE/
|
||||
|
||||
echo Show content of last file
|
||||
cat "$(ls -rt $GITHUB_WORKSPACE/ | tail -n1)"
|
||||
|
||||
- name: Enabling new modules
|
||||
run: |
|
||||
# Enable modules not enabled into original dump
|
||||
set -e
|
||||
cd /var/www/html/install
|
||||
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_ProductBatch,MAIN_MODULE_SupplierProposal,MAIN_MODULE_STRIPE,MAIN_MODULE_ExpenseReport > $GITHUB_WORKSPACE/enablemodule.log
|
||||
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP >> $GITHUB_WORKSPACE/enablemodule.log
|
||||
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $GITHUB_WORKSPACE/enablemodule.log
|
||||
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_KnowledgeManagement,MAIN_MODULE_EventOrganization,MAIN_MODULE_PARTNERSHIP >> $GITHUB_WORKSPACE/enablemodule.log
|
||||
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_EmailCollector >> $GITHUB_WORKSPACE/enablemodule.log
|
||||
echo $?
|
||||
cd -
|
||||
|
||||
- name: Result of enabling modules scripts
|
||||
if: always()
|
||||
run: |
|
||||
echo Show content of enablemodule.log file
|
||||
cat $GITHUB_WORKSPACE/enablemodule.log
|
||||
|
||||
- name: Unit testing
|
||||
run: |
|
||||
# Ensure we catch errors. Set this to +e instead of -e if you want to go to the end to see dolibarr.log file.
|
||||
set -e
|
||||
cd /var/www/html
|
||||
sudo chmod -R a+rwx /var/www/html/documents
|
||||
includes/bin/phpunit -d memory_limit=-1 -c /var/www/test/phpunit/phpunittest.xml /var/www/test/phpunit/AllTests.php
|
||||
phpunitresult=$?
|
||||
echo "Phpunit return code = $phpunitresult"
|
||||
set +e
|
||||
|
||||
334
.github/workflows/github_ci_php81_mysql.yml.disabled
vendored
Normal file
334
.github/workflows/github_ci_php81_mysql.yml.disabled
vendored
Normal file
|
|
@ -0,0 +1,334 @@
|
|||
name: GitHub CI PHP 8.1 MySQL
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
- 1*
|
||||
- 2*
|
||||
pull_request:
|
||||
types: [opened]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
github_ci_php81_mysql:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
ports:
|
||||
- 32574:3306
|
||||
|
||||
steps:
|
||||
# git clone dolibarr into GITHUB_WORKSPACE = /home/runner/work/dolibarr/dolibarr
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Version PHP
|
||||
run: |
|
||||
php -i | head -
|
||||
|
||||
- name: Install packages for PHP 8.1
|
||||
run: |
|
||||
sudo composer self-update 2.2.18
|
||||
sudo chmod -R a+rwx /home/runner
|
||||
composer -n config -g vendor-dir htdocs/includes
|
||||
|
||||
sudo add-apt-repository -y ppa:ondrej/php
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y pgloader memcached
|
||||
sudo apt install apache2 php8.1 php8.1-cli php8.1-curl php8.1-mysql php8.1-pgsql php8.1-gd php8.1-imap php8.1-intl php8.1-ldap php8.1-xml php8.1-mbstring php8.1-xml php8.1-zip libapache2-mod-php8.1
|
||||
sudo update-alternatives --set php /usr/bin/php8.1
|
||||
php -i | head -
|
||||
|
||||
cd $GITHUB_WORKSPACE
|
||||
ls $GITHUB_WORKSPACE
|
||||
composer -n require --ignore-platform-reqs phpunit/phpunit ^8 \
|
||||
php-parallel-lint/php-parallel-lint ^1.2 \
|
||||
php-parallel-lint/php-console-highlighter ^0 \
|
||||
php-parallel-lint/php-var-dump-check ~0.4 \
|
||||
squizlabs/php_codesniffer ^3
|
||||
sudo rm -fr htdocs/includes/phpunit/php-code-coverage/src/Report/Html
|
||||
|
||||
- name: Adding path of binaries tools installed by composer to the PATH
|
||||
run: |
|
||||
export PATH="$GITHUB_WORKSPACE/htdocs/includes/bin:$PATH"
|
||||
echo $PATH
|
||||
# We must have a directory bin created by the previous composer call
|
||||
ls $GITHUB_WORKSPACE/htdocs/includes/bin
|
||||
|
||||
- name: Version information
|
||||
run: |
|
||||
composer -V
|
||||
# Check Parallel-lint version
|
||||
echo "Parallel-lint version"
|
||||
htdocs/includes/bin/parallel-lint -V
|
||||
# Check PHP CodeSniffer version
|
||||
echo "PHPCS version"
|
||||
htdocs/includes/bin/phpcs --version | head -
|
||||
htdocs/includes/bin/phpcs -i | head -
|
||||
# Check PHP Vardump check version
|
||||
echo "PHP Vardump check version"
|
||||
htdocs/includes/bin/var-dump-check --version
|
||||
# Check PHPUnit version
|
||||
echo "PHPUnit version"
|
||||
htdocs/includes/bin/phpunit --version | head -
|
||||
# Check Apache version
|
||||
echo "Apache version"
|
||||
apache2 -v | head -
|
||||
# Check Database
|
||||
echo "Database version"
|
||||
mysql --version | head -
|
||||
psql --version
|
||||
echo "Check pgloader version"
|
||||
pgloader --version
|
||||
|
||||
- name: Create database
|
||||
run: |
|
||||
pwd
|
||||
echo GITHUB_WORKSPACE = $GITHUB_WORKSPACE
|
||||
sudo apt-get install -y mysql-client
|
||||
mysql --version | head -
|
||||
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e "SELECT VERSION();" | head -
|
||||
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e "SHOW DATABASES"
|
||||
|
||||
echo "Drop and create database"
|
||||
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e 'DROP DATABASE IF EXISTS travis;'
|
||||
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e "CREATE DATABASE IF NOT EXISTS travis CHARACTER SET = 'utf8';"
|
||||
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e "CREATE USER 'travis'@'127.0.0.1' IDENTIFIED BY 'password';"
|
||||
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;'
|
||||
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e 'FLUSH PRIVILEGES;'
|
||||
|
||||
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||
|
||||
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -D travis -e "UPDATE llx_const set value = '0666' WHERE name = 'MAIN_UMASK';"
|
||||
|
||||
- name: Generate Dolibarr conf file
|
||||
run: |
|
||||
export CONF_FILE=$GITHUB_WORKSPACE/htdocs/conf/conf.php
|
||||
echo "Setting up Dolibarr $CONF_FILE"
|
||||
echo '<?php' > $CONF_FILE
|
||||
echo '$'dolibarr_main_url_root=\'http://127.0.0.1\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_document_root=\'/var/www/html\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_data_root=\'/var/www/html/documents\'';' >> $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_user=\'root\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_db_pass=\'password\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_instance_unique_id=\'travis1234567890\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_db_type=\'mysqli\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_db_port=\'32574\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> $CONF_FILE
|
||||
cat $CONF_FILE
|
||||
- name: Generate install.forced.php file to test installation
|
||||
run: |
|
||||
export INSTALL_FORCED_FILE=$GITHUB_WORKSPACE/htdocs/install/install.forced.php
|
||||
echo "Setting up Dolibarr $INSTALL_FORCED_FILE to test installation"
|
||||
# Ensure we catch errors
|
||||
set +e
|
||||
echo '<?php' > $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_noedit=2';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_type=\'mysqli\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_dbserver=\'127.0.0.1\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_database=\'travis\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_databaselogin=\'root\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_databasepass=\'password\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_port=\'32574\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_prefix=\'llx_\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_createdatabase=false';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_createuser=false';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_mainforcehttps=false';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_main_data_root=\'/var/www/html\'';' >> $INSTALL_FORCED_FILE
|
||||
cat $INSTALL_FORCED_FILE
|
||||
|
||||
- name: Create document directory
|
||||
run: |
|
||||
echo "Create documents directory and set permissions"
|
||||
# and admin/temp subdirectory needed for unit tests
|
||||
sudo mkdir -p /var/www/html/documents/admin/temp
|
||||
sudo chmod -R a+rwx /var/www/html/documents
|
||||
sudo echo "***** First line of dolibarr.log" > /var/www/html/documents/dolibarr.log
|
||||
sudo chmod a+rwx /var/www/html/documents/dolibarr.log
|
||||
|
||||
- name: Copy app into /var/www
|
||||
run: |
|
||||
sudo cp -r $GITHUB_WORKSPACE/htdocs/. /var/www/html
|
||||
sudo mv /var/www/html/index.html /var/www/html/index.disabled.html
|
||||
sudo ln -fs /var/www/html /var/www/htdocs
|
||||
sudo cp -r $GITHUB_WORKSPACE/test/. /var/www/test
|
||||
sudo cp -r $GITHUB_WORKSPACE/dev/. /var/www/dev
|
||||
sudo cp -r $GITHUB_WORKSPACE/scripts/. /var/www/scripts
|
||||
|
||||
- name: Setup Apache
|
||||
run: |
|
||||
pwd
|
||||
whoami
|
||||
# install apache web server
|
||||
a2query -s
|
||||
a2query -m
|
||||
ls /etc/apache2/sites-available
|
||||
#sudo cp -f $GITHUB_WORKSPACE/build/travis-ci/apache-githubaction.conf /etc/apache2/sites-available/000-default.conf
|
||||
#sudo sed -e "s?%GITHUB_WORKSPACE%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
|
||||
a2ensite 000-default
|
||||
a2enmod php8.1
|
||||
ls /etc/apache2/sites-enabled
|
||||
sudo adduser $(whoami) www-data
|
||||
sudo adduser $(whoami) root
|
||||
sudo adduser root www-data
|
||||
sudo chown -R www-data:www-data /etc/apache2/sites-available/
|
||||
sudo chmod -R 777 /etc/apache2/sites-available/
|
||||
sudo chown -R www-data:www-data /var/www/html/
|
||||
ls -l /var/www/html
|
||||
#ls -l /var/www/html/conf
|
||||
#ls -l /var/www/html/install/
|
||||
set +e
|
||||
sudo cat /etc/apache2/sites-enabled/000-default.conf
|
||||
sudo service apache2 restart
|
||||
curl -I localhost
|
||||
- name: Chech Apache availability
|
||||
run: |
|
||||
echo "Checking webserver availability by a wget -O - --debug http://127.0.0.1"
|
||||
# Ensure we stop on error with set -e
|
||||
set +e
|
||||
ls /var/log/apache2
|
||||
#wget -O - --debug http://127.0.0.1/robots.txt
|
||||
# The wget should return a page with line '<meta name="generator" content="Dolibarr installer">
|
||||
wget -O - --debug http://127.0.0.1 > $GITHUB_WORKSPACE/test.html 2>&1
|
||||
head -n 200 $GITHUB_WORKSPACE/test.html
|
||||
|
||||
echo Logs are...
|
||||
#sudo cat /tmp/install.log
|
||||
sudo cat /var/log/apache2/access.log
|
||||
sudo cat /var/log/apache2/error.log
|
||||
sudo cat /var/log/apache2/other_vhosts_access.log
|
||||
set +e
|
||||
|
||||
- name: Upgrading Dolibarr
|
||||
run: |
|
||||
# Ensure we catch errors. Set this to +e if you want to go to the end to see log files.
|
||||
set -e
|
||||
sudo chmod -R a+rwx $GITHUB_WORKSPACE
|
||||
sudo chmod -R a+rwx /var/www
|
||||
ls -l /var/www
|
||||
cd /var/www/html/install
|
||||
echo Execute upgrade, upgrade2 and step5 for each major version
|
||||
php upgrade.php 3.5.0 3.6.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade350360.log
|
||||
php upgrade2.php 3.5.0 3.6.0 > $GITHUB_WORKSPACE/upgrade350360-2.log
|
||||
php step5.php 3.5.0 3.6.0 > $GITHUB_WORKSPACE/upgrade350360-3.log
|
||||
php upgrade.php 3.6.0 3.7.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade360370.log
|
||||
php upgrade2.php 3.6.0 3.7.0 > $GITHUB_WORKSPACE/upgrade360370-2.log
|
||||
php step5.php 3.6.0 3.7.0 > $GITHUB_WORKSPACE/upgrade360370-3.log
|
||||
php upgrade.php 3.7.0 3.8.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade370380.log
|
||||
php upgrade2.php 3.7.0 3.8.0 > $GITHUB_WORKSPACE/upgrade370380-2.log
|
||||
php step5.php 3.7.0 3.8.0 > $GITHUB_WORKSPACE/upgrade370380-3.log
|
||||
php upgrade.php 3.8.0 3.9.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade380390.log
|
||||
php upgrade2.php 3.8.0 3.9.0 > $GITHUB_WORKSPACE/upgrade380390-2.log
|
||||
php step5.php 3.8.0 3.9.0 > $GITHUB_WORKSPACE/upgrade380390-3.log
|
||||
php upgrade.php 3.9.0 4.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade390400.log
|
||||
php upgrade2.php 3.9.0 4.0.0 > $GITHUB_WORKSPACE/upgrade390400-2.log
|
||||
php step5.php 3.9.0 4.0.0 > $GITHUB_WORKSPACE/upgrade390400-3.log
|
||||
php upgrade.php 4.0.0 5.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade400500.log
|
||||
php upgrade2.php 4.0.0 5.0.0 > $GITHUB_WORKSPACE/upgrade400500-2.log
|
||||
php step5.php 4.0.0 5.0.0 > $GITHUB_WORKSPACE/upgrade400500-3.log
|
||||
php upgrade.php 5.0.0 6.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade500600.log
|
||||
php upgrade2.php 5.0.0 6.0.0 > $GITHUB_WORKSPACE/upgrade500600-2.log
|
||||
php step5.php 5.0.0 6.0.0 > $GITHUB_WORKSPACE/upgrade500600-3.log
|
||||
php upgrade.php 6.0.0 7.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade600700.log
|
||||
php upgrade2.php 6.0.0 7.0.0 > $GITHUB_WORKSPACE/upgrade600700-2.log
|
||||
php step5.php 6.0.0 7.0.0 > $GITHUB_WORKSPACE/upgrade600700-3.log
|
||||
php upgrade.php 7.0.0 8.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade700800.log
|
||||
php upgrade2.php 7.0.0 8.0.0 > $GITHUB_WORKSPACE/upgrade700800-2.log
|
||||
php step5.php 7.0.0 8.0.0 > $GITHUB_WORKSPACE/upgrade700800-3.log
|
||||
php upgrade.php 8.0.0 9.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade800900.log
|
||||
php upgrade2.php 8.0.0 9.0.0 > $GITHUB_WORKSPACE/upgrade800900-2.log
|
||||
php step5.php 8.0.0 9.0.0 > $GITHUB_WORKSPACE/upgrade800900-3.log
|
||||
php upgrade.php 9.0.0 10.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade9001000.log
|
||||
php upgrade2.php 9.0.0 10.0.0 > $GITHUB_WORKSPACE/upgrade9001000-2.log
|
||||
php step5.php 9.0.0 10.0.0 > $GITHUB_WORKSPACE/upgrade9001000-3.log
|
||||
php upgrade.php 10.0.0 11.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade10001100.log
|
||||
php upgrade2.php 10.0.0 11.0.0 > $GITHUB_WORKSPACE/upgrade10001100-2.log
|
||||
php step5.php 10.0.0 11.0.0 > $GITHUB_WORKSPACE/upgrade10001100-3.log
|
||||
php upgrade.php 11.0.0 12.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade11001200.log
|
||||
php upgrade2.php 11.0.0 12.0.0 > $GITHUB_WORKSPACE/upgrade11001200-2.log
|
||||
php step5.php 11.0.0 12.0.0 > $GITHUB_WORKSPACE/upgrade11001200-3.log
|
||||
php upgrade.php 12.0.0 13.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade12001300.log
|
||||
php upgrade2.php 12.0.0 13.0.0 > $GITHUB_WORKSPACE/upgrade12001300-2.log
|
||||
php step5.php 12.0.0 13.0.0 > $GITHUB_WORKSPACE/upgrade12001300-3.log
|
||||
php upgrade.php 13.0.0 14.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade13001400.log
|
||||
php upgrade2.php 13.0.0 14.0.0 > $GITHUB_WORKSPACE/upgrade13001400-2.log
|
||||
php step5.php 13.0.0 14.0.0 > $GITHUB_WORKSPACE/upgrade13001400-3.log
|
||||
php upgrade.php 14.0.0 15.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade14001500.log
|
||||
php upgrade2.php 14.0.0 15.0.0 > $GITHUB_WORKSPACE/upgrade14001500-2.log
|
||||
php step5.php 14.0.0 15.0.0 > $GITHUB_WORKSPACE/upgrade14001500-3.log
|
||||
php upgrade.php 15.0.0 16.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade15001600.log
|
||||
php upgrade2.php 15.0.0 16.0.0 > $GITHUB_WORKSPACE/upgrade15001600-2.log
|
||||
php step5.php 15.0.0 16.0.0 > $GITHUB_WORKSPACE/upgrade15001600-3.log
|
||||
php upgrade.php 16.0.0 17.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade16001700.log
|
||||
php upgrade2.php 16.0.0 17.0.0 > $GITHUB_WORKSPACE/upgrade16001700-2.log
|
||||
php step5.php 16.0.0 17.0.0 > $GITHUB_WORKSPACE/upgrade16001700-3.log
|
||||
php upgrade.php 17.0.0 18.0.0 ignoredbversion > $GITHUB_WORKSPACE/upgrade17001800.log
|
||||
php upgrade2.php 17.0.0 18.0.0 > $GITHUB_WORKSPACE/upgrade17001800-2.log
|
||||
php step5.php 17.0.0 18.0.0 > $GITHUB_WORKSPACE/upgrade17001800-3.log
|
||||
|
||||
- name: Result of migration scripts
|
||||
if: always()
|
||||
run: |
|
||||
ls -alrt $GITHUB_WORKSPACE/
|
||||
|
||||
echo Show content of last file
|
||||
cat "$(ls -rt $GITHUB_WORKSPACE/ | tail -n1)"
|
||||
|
||||
- name: Enabling new modules
|
||||
run: |
|
||||
# Enable modules not enabled into original dump
|
||||
set -e
|
||||
cd /var/www/html/install
|
||||
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_ProductBatch,MAIN_MODULE_SupplierProposal,MAIN_MODULE_STRIPE,MAIN_MODULE_ExpenseReport > $GITHUB_WORKSPACE/enablemodule.log
|
||||
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP >> $GITHUB_WORKSPACE/enablemodule.log
|
||||
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $GITHUB_WORKSPACE/enablemodule.log
|
||||
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_KnowledgeManagement,MAIN_MODULE_EventOrganization,MAIN_MODULE_PARTNERSHIP >> $GITHUB_WORKSPACE/enablemodule.log
|
||||
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_EmailCollector >> $GITHUB_WORKSPACE/enablemodule.log
|
||||
echo $?
|
||||
cd -
|
||||
|
||||
- name: Result of enabling modules scripts
|
||||
if: always()
|
||||
run: |
|
||||
echo Show content of enablemodule.log file
|
||||
cat $GITHUB_WORKSPACE/enablemodule.log
|
||||
|
||||
- name: Unit testing
|
||||
run: |
|
||||
# Ensure we catch errors. Set this to +e instead of -e if you want to go to the end to see dolibarr.log file.
|
||||
set -e
|
||||
cd /var/www/html
|
||||
sudo chmod -R a+rwx /var/www/html/documents
|
||||
includes/bin/phpunit -d memory_limit=-1 -c /var/www/test/phpunit/phpunittest.xml /var/www/test/phpunit/AllTests.php
|
||||
phpunitresult=$?
|
||||
echo "Phpunit return code = $phpunitresult"
|
||||
set +e
|
||||
|
||||
- name: Code quality check - Lint
|
||||
if: github.event_name == 'push'
|
||||
run: |
|
||||
htdocs/includes/bin/parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \
|
||||
--exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \
|
||||
--exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \
|
||||
--exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \
|
||||
--exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --exclude htdocs/includes/webklex --blame .
|
||||
|
||||
- name: Code quality check - phpcs
|
||||
if: github.event_name == 'push'
|
||||
run: |
|
||||
htdocs/includes/bin/phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .;
|
||||
|
||||
- name: Code quality check - var-dump-check
|
||||
if: github.event_name == 'push'
|
||||
run: |
|
||||
htdocs/includes/bin/var-dump-check --extensions php --tracy --exclude htdocs/includes --exclude test/ --exclude htdocs/public/test/ --exclude htdocs/core/lib/functions.lib.php .
|
||||
|
||||
30
.github/workflows/phpcs.yml
vendored
Normal file
30
.github/workflows/phpcs.yml
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
name: "PHPCS"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- "**.php"
|
||||
- "phpcs.xml"
|
||||
- ".github/workflows/phpcs.yml"
|
||||
|
||||
jobs:
|
||||
phpcs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 50 # important!
|
||||
|
||||
# we may use whatever way to install phpcs, just specify the path on the next step
|
||||
# however, curl seems to be the fastest
|
||||
- name: Install PHP_CodeSniffer
|
||||
run: |
|
||||
curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
|
||||
php phpcs.phar --version
|
||||
|
||||
- uses: thenabeel/action-phpcs@v8
|
||||
with:
|
||||
files: "**.php" # you may customize glob as needed
|
||||
phpcs_path: php phpcs.phar
|
||||
standard: dev/setup/codesniffer/ruleset.xml
|
||||
fail_on_warnings: false
|
||||
62
.github/workflows/phpcsfixer.yml
vendored
Normal file
62
.github/workflows/phpcsfixer.yml
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
name: GitHub CI PHPCS and PHPCBF
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened]
|
||||
#on:
|
||||
# push:
|
||||
# paths:
|
||||
# - '**.php'
|
||||
|
||||
jobs:
|
||||
#filesChanged:
|
||||
# uses: ./.github/workflows/files_changed.yaml
|
||||
# with:
|
||||
# folder_path: .*
|
||||
|
||||
linter_name:
|
||||
name: Run & fix PHP Code Sniffer
|
||||
runs-on: ubuntu-latest
|
||||
#needs: filesChanged
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
# fetch-depth: 10
|
||||
|
||||
- name: echo Get list of all changed files
|
||||
run: |
|
||||
#echo ${{ needs.filesChanged.outputs.all_changed_files }}
|
||||
#echo boolean_output=${{ needs.filesChanged.outputs.boolean_output }}
|
||||
echo github.head_ref=${{github.head_ref}}
|
||||
echo github.base_ref=${{github.base_ref}}
|
||||
echo github.ref_name=${{github.ref_name}}
|
||||
|
||||
- uses: eldy/phpcsfixer-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.github_token }}
|
||||
use_default_configuration_file: false
|
||||
phpcs_standard: 'dev/setup/codesniffer/ruleset.xml'
|
||||
phpcs_head_ref: ${{github.head_ref}}
|
||||
phpcs_base_ref: ${{github.base_ref}}
|
||||
phpcs_ref_name: ${{github.ref_name}}
|
||||
phpcs_github_event_name: ${{github.event_name}}
|
||||
phpcs_files: ${{ needs.filesChanged.outputs.all_changed_files }}
|
||||
|
||||
#- uses: stefanzweifel/git-auto-commit-action@v4 # auto commit the fixes action for GitHub
|
||||
# with:
|
||||
# commit_message: Fix PHPCS errors by GitHub PHPCSfixer action
|
||||
|
||||
- name: Commit changes
|
||||
uses: EndBug/add-and-commit@v9.1.3
|
||||
with:
|
||||
default_author: github_actions
|
||||
committer_name: GitHub Actions
|
||||
committer_email: actions@github.com
|
||||
#author_name: PHP CS fixer
|
||||
#author_email: eldy@destailleur.fr
|
||||
#committer_name: PHP CS fixer
|
||||
#committer_email: eldy@destailleur.fr
|
||||
message: 'PHP CS fixer github action'
|
||||
add: '*.php'
|
||||
25
.github/workflows/stale-issues.yml.disabled
vendored
25
.github/workflows/stale-issues.yml.disabled
vendored
|
|
@ -1,25 +0,0 @@
|
|||
# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
|
||||
name: "Close stale issues (bugs and feature requests)"
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 20 * * *"
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: Dolibarr/stale@master
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. This issue may be closed automatically by stale bot in 15 days (you should still be able to re-open it if required).'
|
||||
stale-issue-label: 'Issue Stale (automatic label)'
|
||||
exempt-issue-label: 'Priority High / Blocking'
|
||||
days-before-stale: 365
|
||||
days-before-close: -1
|
||||
operations-per-run: 100
|
||||
#stale-pr-message: 'This PR is stale because it has been open 1 year with no activity. If this PR is still mergeable (no conflict, nor Continuous Integration errors), please comment to confirm this merge is still expected. Without comment, this issue will be closed automatically by stale bot in 15 days.'
|
||||
stale-pr-label: 'PR Stale (automatic label)'
|
||||
stale-pr-message:
|
||||
exempt-pr-label: 'Priority Top Strategic'
|
||||
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -58,3 +58,7 @@ package-lock.json
|
|||
|
||||
doc/install.lock
|
||||
/.asciidoctorconfig.adoc
|
||||
|
||||
.idea
|
||||
/composer.json
|
||||
/composer.lock
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="7.1">
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="7.1" />
|
||||
</project>
|
||||
|
||||
236
.scrutinizer.yml
236
.scrutinizer.yml
|
|
@ -1,236 +0,0 @@
|
|||
# .scrutinizer.yml
|
||||
#build:
|
||||
# - php-scrutinizer-run
|
||||
build:
|
||||
nodes:
|
||||
analysis:
|
||||
tests:
|
||||
override:
|
||||
- command: php-scrutinizer-run
|
||||
idle_timeout: 8000
|
||||
#- php-scrutinizer-run --sub-project-dir=htdocs/admin
|
||||
|
||||
imports:
|
||||
- php
|
||||
|
||||
filter:
|
||||
excluded_paths:
|
||||
- build/
|
||||
- dev/
|
||||
- doc/
|
||||
- documents/
|
||||
- node_modules/
|
||||
- test/
|
||||
- htdocs/custom/
|
||||
- htdocs/includes/
|
||||
- htdocs/install/doctemplates/
|
||||
#dependency_paths:
|
||||
# - htdocs/includes/
|
||||
paths:
|
||||
- htdocs/*
|
||||
- scripts/*
|
||||
|
||||
tools:
|
||||
# php_analyzer. Doc on https://scrutinizer-ci.com/docs/tools/php/php-analyzer/
|
||||
php_analyzer:
|
||||
enabled: true
|
||||
extensions:
|
||||
- php
|
||||
#dependency_paths:
|
||||
# - htdocs/includes/
|
||||
filter:
|
||||
excluded_paths:
|
||||
- build/
|
||||
- dev/
|
||||
- doc/
|
||||
- documents/
|
||||
- htdocs/custom/
|
||||
- htdocs/includes/
|
||||
- htdocs/install/doctemplates/
|
||||
- htdocs/core/class/lessc.class.php
|
||||
- node_modules/
|
||||
- test/
|
||||
paths:
|
||||
- htdocs/*
|
||||
- scripts/*
|
||||
config:
|
||||
parameter_reference_check:
|
||||
enabled: true
|
||||
checkstyle:
|
||||
enabled: false
|
||||
no_trailing_whitespace: true
|
||||
naming:
|
||||
enabled: true
|
||||
local_variable: ^[a-z][a-zA-Z0-9]*$
|
||||
abstract_class_name: ^Abstract|Factory$
|
||||
utility_class_name: Utils?$
|
||||
constant_name: ^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$
|
||||
property_name: ^[a-z][a-zA-Z0-9]*$
|
||||
method_name: ^(?:[a-z]|__)[a-zA-Z0-9]*$
|
||||
parameter_name: ^[a-z][a-zA-Z0-9]*$
|
||||
interface_name: ^[A-Z][a-zA-Z0-9]*Interface$
|
||||
type_name: ^[A-Z][a-zA-Z0-9]*$
|
||||
exception_name: ^[A-Z][a-zA-Z0-9]*Exception$
|
||||
isser_method_name: ^(?:is|has|should|may|supports)
|
||||
unreachable_code:
|
||||
enabled: true
|
||||
check_access_control:
|
||||
enabled: true
|
||||
typo_checks:
|
||||
enabled: true
|
||||
check_variables:
|
||||
enabled: true
|
||||
check_calls:
|
||||
enabled: true
|
||||
too_many_arguments: true
|
||||
missing_argument: true
|
||||
argument_type_checks: lenient # Allowed Values: "disabled", "lenient", "strict"
|
||||
suspicious_code:
|
||||
enabled: true
|
||||
overriding_parameter: false
|
||||
overriding_closure_use: true
|
||||
parameter_closure_use_conflict: true
|
||||
parameter_multiple_times: true
|
||||
non_existent_class_in_instanceof_check: true
|
||||
non_existent_class_in_catch_clause: true
|
||||
assignment_of_null_return: true
|
||||
non_commented_switch_fallthrough: true
|
||||
non_commented_empty_catch_block: true
|
||||
overriding_private_members: true
|
||||
use_statement_alias_conflict: true
|
||||
precedence_in_condition_assignment: true
|
||||
dead_assignments:
|
||||
enabled: true
|
||||
verify_php_doc_comments:
|
||||
enabled: false
|
||||
parameters: true
|
||||
return: true
|
||||
suggest_more_specific_types: true
|
||||
ask_for_return_if_not_inferrable: true
|
||||
ask_for_param_type_annotation: true
|
||||
loops_must_use_braces:
|
||||
enabled: true
|
||||
check_usage_context:
|
||||
enabled: true
|
||||
simplify_boolean_return:
|
||||
enabled: false
|
||||
phpunit_checks:
|
||||
enabled: false
|
||||
reflection_checks:
|
||||
enabled: true
|
||||
|
||||
# Checks Common Precedence Mistakes
|
||||
precedence_checks:
|
||||
enabled: true
|
||||
assignment_in_condition: true
|
||||
comparison_of_bit_result: true
|
||||
basic_semantic_checks:
|
||||
enabled: true
|
||||
# Disabled unused code. In most cases, we want to keep it.
|
||||
unused_code:
|
||||
enabled: false
|
||||
deprecation_checks:
|
||||
enabled: true
|
||||
useless_function_calls:
|
||||
enabled: true
|
||||
metrics_lack_of_cohesion_methods:
|
||||
enabled: true
|
||||
metrics_coupling:
|
||||
enabled: true
|
||||
stable_code:
|
||||
namespace_prefixes: []
|
||||
classes: []
|
||||
doctrine_parameter_binding:
|
||||
enabled: false
|
||||
doctrine_entity_manager_injection:
|
||||
enabled: false
|
||||
symfony_request_injection:
|
||||
enabled: false
|
||||
doc_comment_fixes:
|
||||
enabled: true
|
||||
reflection_fixes:
|
||||
enabled: false
|
||||
use_statement_fixes:
|
||||
enabled: true
|
||||
remove_unused: true
|
||||
# Whether you would like multiple imports in one USE statement to be preserved, e.g. ``use A, B;``.
|
||||
preserve_multiple: false
|
||||
# Whether you would like to preserve blank lines between use statements.
|
||||
preserve_blanklines: false
|
||||
order_alphabetically: false
|
||||
# To use specific config for a specific path, use path_configs: (see example on page https://scrutinizer-ci.com/docs/configuration/tool_config_structure)
|
||||
|
||||
# php_depend
|
||||
#php_pdepend:
|
||||
# enabled: false
|
||||
# configuration_file: null
|
||||
# suffixes:
|
||||
# - php
|
||||
# excluded_dirs: { }
|
||||
# filter:
|
||||
# excluded_paths:
|
||||
# - 'build/*'
|
||||
# - 'dev/*'
|
||||
# - 'doc/*'
|
||||
# - 'test/*'
|
||||
# - 'htdocs/includes/*'
|
||||
# paths: { }
|
||||
|
||||
# change tracking
|
||||
#php_changetracking:
|
||||
# enabled: false
|
||||
# bug_patterns:
|
||||
# - '\bfix(?:es|ed)?\b'
|
||||
# feature_patterns:
|
||||
# - '\badd(?:s|ed)?\b'
|
||||
# - '\bimplement(?:s|ed)?\b'
|
||||
# filter:
|
||||
# excluded_paths:
|
||||
# - 'build/*'
|
||||
# - 'dev/*'
|
||||
# - 'doc/*'
|
||||
# - 'documents/*'
|
||||
# - 'htdocs/includes/*'
|
||||
# - 'node_modules/*'
|
||||
# - 'test/*'
|
||||
# paths: { }
|
||||
|
||||
# Similar code detection
|
||||
#php_sim:
|
||||
# enabled: false
|
||||
# min_mass: 30
|
||||
# filter:
|
||||
# excluded_paths:
|
||||
# - 'build/*'
|
||||
# - 'dev/*'
|
||||
# - 'doc/*'
|
||||
# - 'documents/*'
|
||||
# - 'htdocs/includes/*'
|
||||
# - 'node_modules/*'
|
||||
# - 'test/*'
|
||||
# paths: { }
|
||||
|
||||
# Coding-Style / Bug Detection
|
||||
#js_hint:
|
||||
# enabled: false
|
||||
# use_native_config: true
|
||||
# extensions:
|
||||
# - js
|
||||
# filter:
|
||||
# excluded_paths:
|
||||
# - 'build/*'
|
||||
# - 'dev/*'
|
||||
# - 'doc/*'
|
||||
# - 'documents/*'
|
||||
# - 'htdocs/includes/*'
|
||||
# - 'node_modules/*'
|
||||
# - 'test/*'
|
||||
# paths: { }
|
||||
# config: { }
|
||||
# path_configs: { }
|
||||
|
||||
|
||||
before_commands: { }
|
||||
after_commands: { }
|
||||
artifacts: { }
|
||||
build_failure_conditions: { }
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
---
|
||||
linters:
|
||||
phpcs:
|
||||
standard: 'dev/setup/codesniffer/ruleset.xml'
|
||||
extensions: 'php'
|
||||
tab_width: 4
|
||||
fixer: true
|
||||
|
||||
fixers:
|
||||
enable: true
|
||||
|
||||
files:
|
||||
ignore:
|
||||
- 'htdocs/includes/*'
|
||||
684
.travis.yml
684
.travis.yml
|
|
@ -2,11 +2,13 @@
|
|||
# from Dolibarr GitHub repository.
|
||||
# For syntax, see https://docs.travis-ci.com/user/languages/php/
|
||||
|
||||
# We use dist: bionic = 18.04
|
||||
# We use dist: bionic = 18.04, focal = 20.04
|
||||
os: linux
|
||||
dist: bionic
|
||||
dist: focal
|
||||
|
||||
language: php
|
||||
language: generic
|
||||
|
||||
scan_logs: false
|
||||
|
||||
git:
|
||||
depth: 1
|
||||
|
|
@ -14,54 +16,18 @@ git:
|
|||
# Start on every boot
|
||||
services:
|
||||
- memcached
|
||||
- mysql
|
||||
#- mysql
|
||||
- postgresql
|
||||
|
||||
|
||||
before_install:
|
||||
- |
|
||||
echo "Add ondrej PPA"
|
||||
sudo add-apt-repository -y ppa:ondrej/php
|
||||
sudo apt-get update
|
||||
echo "Disabling Xdebug for composer"
|
||||
export PHP_VERSION_NAME=$(phpenv version-name)
|
||||
echo $PHP_VERSION_NAME
|
||||
ls ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/
|
||||
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini
|
||||
phpenv config-rm xdebug.ini
|
||||
phpenv rehash
|
||||
echo
|
||||
|
||||
addons:
|
||||
# Force postgresql version
|
||||
postgresql: '10'
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:ondrej/php'
|
||||
packages:
|
||||
# We need a webserver to test the webservices
|
||||
# Let's install Apache with.
|
||||
- apache2
|
||||
# We need pgloader for import mysql database into pgsql
|
||||
- pgloader
|
||||
- php
|
||||
- php7.1-pgsql
|
||||
- php7.1-mysqli
|
||||
- php7.1-xml
|
||||
- php7.1-intl
|
||||
- php8.1-pgsql
|
||||
- php8.1-mysqli
|
||||
- php8.1-xml
|
||||
- php8.1-intl
|
||||
- php8.2-pgsql
|
||||
- php8.2-mysqli
|
||||
- php8.2-xml
|
||||
- php8.2-intl
|
||||
|
||||
mariadb: '10.5'
|
||||
|
||||
|
||||
env:
|
||||
global:
|
||||
# Set to true for very verbose output
|
||||
- DEBUG=false
|
||||
- DEBUG=true
|
||||
|
||||
jobs:
|
||||
fast_finish: true
|
||||
|
|
@ -71,15 +37,19 @@ jobs:
|
|||
- stage: PHP 7.0-8.1
|
||||
if: type = push
|
||||
php: '7.1'
|
||||
env: DB=postgresql
|
||||
env:
|
||||
- DB=postgresql
|
||||
- TRAVIS_PHP_VERSION=7.1
|
||||
- stage: PHP 7.0-8.1
|
||||
if: type = pull_request OR type = push
|
||||
php: '8.1'
|
||||
env: DB=mysql
|
||||
- stage: PHP Dev
|
||||
if: type = push AND branch = developdisabled
|
||||
php: '8.2'
|
||||
env: DB=mysql
|
||||
env:
|
||||
- DB=mysql
|
||||
- TRAVIS_PHP_VERSION=8.1
|
||||
#- stage: PHP Dev
|
||||
# if: type = push AND branch = developdisabled
|
||||
# php: '8.2'
|
||||
# env: DB=mysql
|
||||
|
||||
notifications:
|
||||
email:
|
||||
|
|
@ -93,31 +63,83 @@ notifications:
|
|||
use_notice: true
|
||||
|
||||
|
||||
before_install:
|
||||
- |
|
||||
echo "Remove awful phpenv and install packages"
|
||||
sudo rm -fr ~/.phpenv
|
||||
sudo rm -fr /root/.phpenv
|
||||
sudo add-apt-repository -y ppa:ondrej/php
|
||||
sudo apt-get update
|
||||
echo TRAVIS_PHP_VERSION=$TRAVIS_PHP_VERSION
|
||||
|
||||
- |
|
||||
echo Install packages for PHP
|
||||
sudo apt-get install -y pgloader memcached
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.1' ]; then
|
||||
sudo apt install unzip apache2 php7.1 php7.1-cli php7.1-curl php7.1-mysql php7.1-pgsql php7.1-gd php7.1-imap php7.1-intl php7.1-ldap php7.1-xml php7.1-mbstring php7.1-xml php7.1-zip libapache2-mod-php7.1
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = '8.1' ]; then
|
||||
sudo apt install unzip apache2 php8.1 php8.1-cli php8.1-curl php8.1-mysql php8.1-pgsql php8.1-gd php8.1-imap php8.1-intl php8.1-ldap php8.1-xml php8.1-mbstring php8.1-xml php8.1-zip libapache2-mod-php8.1
|
||||
fi
|
||||
|
||||
- |
|
||||
echo Install pgsql if run is for pgsql
|
||||
if [ "$DB" = 'postgresql' ]; then
|
||||
echo "Check pgloader version"
|
||||
pgloader --version
|
||||
#ps fauxww | grep postgres
|
||||
ls /etc/postgresql/13/main/
|
||||
|
||||
sudo sed -i -e '/local.*peer/s/postgres/all/' -e 's/peer\|md5/trust/g' /etc/postgresql/13/main/pg_hba.conf
|
||||
sudo cat /etc/postgresql/13/main/pg_hba.conf
|
||||
|
||||
sudo service postgresql restart
|
||||
|
||||
psql postgresql://postgres:postgres@127.0.0.1:5432 -l -A
|
||||
|
||||
psql postgresql://postgres:postgres@127.0.0.1:5432 -c 'create database travis;'
|
||||
psql postgresql://postgres:postgres@127.0.0.1:5432 -c "CREATE USER travis WITH ENCRYPTED PASSWORD 'travis';"
|
||||
psql postgresql://postgres:postgres@127.0.0.1:5432 -c 'GRANT ALL PRIVILEGES ON DATABASE travis TO travis;'
|
||||
|
||||
psql postgresql://postgres:postgres@127.0.0.1:5432 -l -A
|
||||
fi
|
||||
|
||||
install:
|
||||
- |
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.1' ]; then
|
||||
sudo update-alternatives --set php /usr/bin/php7.1
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = '8.1' ]; then
|
||||
sudo update-alternatives --set php /usr/bin/php8.1
|
||||
fi
|
||||
php -i | head -
|
||||
|
||||
- |
|
||||
echo "Updating Composer config"
|
||||
curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
|
||||
HASH=`curl -sS https://composer.github.io/installer.sig`
|
||||
echo $HASH
|
||||
php -r "if (hash_file('SHA384', '/tmp/composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
|
||||
sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
|
||||
sudo chmod -R a+rwx /usr/local/bin/composer
|
||||
composer -V
|
||||
#rm $TRAVIS_BUILD_DIR/composer.json
|
||||
#rm $TRAVIS_BUILD_DIR/composer.lock
|
||||
#composer -n init
|
||||
#composer -n config vendor-dir htdocs/includes
|
||||
composer -n config -g vendor-dir htdocs/includes
|
||||
echo
|
||||
|
||||
- |
|
||||
echo "Update Composer version and Install tools - PHP Unit, Parallel Lint, PHP CodeSniffer, PHP Vardump check - for $TRAVIS_PHP_VERSION"
|
||||
echo "(version 2.5 is bugged and generate phpunit error Exception: Serialization of 'Closure' is not allowed)"
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then
|
||||
composer self-update 2.2.18
|
||||
composer -n require phpunit/phpunit ^6 \
|
||||
echo "(composer version 2.5 is bugged and generate phpunit error Exception: Serialization of 'Closure' is not allowed)"
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then
|
||||
sudo composer self-update 2.2.18
|
||||
composer -n require phpunit/phpunit ^7.5 \
|
||||
php-parallel-lint/php-parallel-lint ^1 \
|
||||
php-parallel-lint/php-console-highlighter ^0 \
|
||||
php-parallel-lint/php-var-dump-check ~0.4 \
|
||||
squizlabs/php_codesniffer ^3
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ]; then
|
||||
composer self-update 2.2.18
|
||||
composer -n require phpunit/phpunit ^7 \
|
||||
sudo composer self-update 2.2.18
|
||||
composer -n require phpunit/phpunit ^7.5 \
|
||||
php-parallel-lint/php-parallel-lint ^1.2 \
|
||||
php-parallel-lint/php-console-highlighter ^0 \
|
||||
php-parallel-lint/php-var-dump-check ~0.4 \
|
||||
|
|
@ -125,13 +147,14 @@ install:
|
|||
fi
|
||||
# phpunit 9 is required for php 8
|
||||
if [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = '8.2' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
||||
composer self-update 2.4.4
|
||||
sudo composer self-update 2.4.4
|
||||
composer -n require --ignore-platform-reqs phpunit/phpunit ^8 \
|
||||
php-parallel-lint/php-parallel-lint ^1.2 \
|
||||
php-parallel-lint/php-console-highlighter ^0 \
|
||||
php-parallel-lint/php-var-dump-check ~0.4 \
|
||||
squizlabs/php_codesniffer ^3
|
||||
fi
|
||||
|
||||
# Remove non expected files
|
||||
rm -fr /home/travis/build/Dolibarr/dolibarr/htdocs/includes/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js
|
||||
echo
|
||||
|
|
@ -140,7 +163,7 @@ install:
|
|||
echo "Adding path of binaries tools installed by composer to the PATH"
|
||||
export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH"
|
||||
echo $PATH
|
||||
ls $TRAVIS_BUILD_DIR/vendor
|
||||
ls $TRAVIS_BUILD_DIR/htdocs/includes
|
||||
ls $TRAVIS_BUILD_DIR/htdocs/includes/bin
|
||||
echo
|
||||
|
||||
|
|
@ -148,24 +171,11 @@ install:
|
|||
|
||||
before_script:
|
||||
- |
|
||||
echo Start travis
|
||||
echo Start before_script
|
||||
echo Current dir is `pwd`
|
||||
echo Home dir is `echo ~`
|
||||
echo TRAVIS_BUILD_DIR is $TRAVIS_BUILD_DIR
|
||||
|
||||
- |
|
||||
echo "Re-enabling Xdebug for PHP CodeSniffer and PHP Unit"
|
||||
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
|
||||
phpenv rehash
|
||||
echo
|
||||
|
||||
- |
|
||||
echo "Versions information"
|
||||
echo
|
||||
|
|
@ -195,32 +205,51 @@ before_script:
|
|||
# Check Database
|
||||
echo "Database version"
|
||||
mysql --version | head -
|
||||
mysql -e "SELECT VERSION();" | head -
|
||||
psql --version
|
||||
if [ "$DB" = 'postgresql' ]; then
|
||||
echo "Check pgloader version"
|
||||
pgloader --version
|
||||
fi
|
||||
echo
|
||||
|
||||
- |
|
||||
echo "Setting up database"
|
||||
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then
|
||||
echo "MySQL"
|
||||
mysql -u root -e 'DROP DATABASE IF EXISTS travis;'
|
||||
mysql -u root -e 'CREATE DATABASE IF NOT EXISTS travis;'
|
||||
mysql -u root -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;'
|
||||
mysql -u root -e 'FLUSH PRIVILEGES;'
|
||||
mysql -u root -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||
echo "MySQL stop"
|
||||
sudo systemctl stop mariadb.service
|
||||
echo "MySQL restart without pass"
|
||||
#sudo mysqld_safe --skip-grant-tables --socket=/tmp/aaa
|
||||
sudo mysqld_safe --skip-grant-tables --socket=/tmp/aaa &
|
||||
sleep 3
|
||||
sudo ps fauxww
|
||||
echo "MySQL set root password"
|
||||
sudo mysql -u root -h 127.0.0.1 -e "FLUSH PRIVILEGES; CREATE DATABASE IF NOT EXISTS travis CHARACTER SET = 'utf8'; ALTER USER 'root'@'localhost' IDENTIFIED BY 'password'; CREATE USER 'root'@'127.0.0.1' IDENTIFIED BY 'password'; CREATE USER 'travis'@'127.0.0.1' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON travis.* TO root@127.0.0.1; GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1; FLUSH PRIVILEGES;"
|
||||
echo "MySQL grant"
|
||||
sudo mysql -u root -h 127.0.0.1 -ppassword -e 'FLUSH PRIVILEGES; GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1; FLUSH PRIVILEGES;'
|
||||
echo "MySQL list current users"
|
||||
sudo mysql -u root -h 127.0.0.1 -ppassword -e 'use mysql; select * from user;'
|
||||
echo "List pid file"
|
||||
sudo mysql -u root -h 127.0.0.1 -ppassword -e "show variables like '%pid%';"
|
||||
|
||||
#sudo kill `cat /var/lib/mysqld/mysqld.pid`
|
||||
#sudo systemctl start mariadb
|
||||
|
||||
echo "MySQL grant"
|
||||
sudo mysql -u root -h 127.0.0.1 -ppassword -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;'
|
||||
echo "MySQL flush"
|
||||
sudo mysql -u root -h 127.0.0.1 -ppassword -e 'FLUSH PRIVILEGES;'
|
||||
|
||||
echo "MySQL load sql"
|
||||
sudo mysql -u root -h 127.0.0.1 -ppassword -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||
fi
|
||||
if [ "$DB" = 'postgresql' ]; then
|
||||
#psql -c 'create database travis;' -U postgres
|
||||
#psql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||
#pgloader mysql://root:pass@127.0.0.1/dolibarr_src postgresql://dolibarrowner:dolibarrownerpass@127.0.0.1/dolibarr_dest
|
||||
echo pgloader mysql://root@127.0.0.1/travis postgresql://postgres@/travis
|
||||
pgloader mysql://root@127.0.0.1/travis postgresql://postgres@/travis
|
||||
echo 'ALTER SEQUENCE llx_accountingaccount_rowid_seq RENAME TO llx_accounting_account_rowid_seq' | psql -U postgres travis
|
||||
echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql -U postgres travis
|
||||
echo "PGSQL"
|
||||
sudo mkdir -p /tmp/pgloader
|
||||
sudo chmod -R a+rwx /tmp/pgloader/
|
||||
sudo pgloader 'mysql://root:password@127.0.0.1/travis' 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
|
||||
echo 'ALTER SEQUENCE llx_accountingaccount_rowid_seq RENAME TO llx_accounting_account_rowid_seq' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
|
||||
echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
|
||||
|
||||
#echo '\d llx_adherent' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
|
||||
#echo '\d llx_c_country' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
|
||||
|
||||
# Create pgsql compatibility functions
|
||||
psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis' < htdocs/install/pgsql/functions/functions.sql
|
||||
fi
|
||||
echo
|
||||
|
||||
|
|
@ -233,15 +262,18 @@ before_script:
|
|||
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_name=\'travis\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_db_user=\'travis\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_instance_unique_id=\'travis1234567890\'';' >> $CONF_FILE
|
||||
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then
|
||||
echo '$'dolibarr_main_db_type=\'mysqli\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_db_port=\'3306\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_db_port=3306';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_db_user=\'root\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_db_pass=\'password\'';' >> $CONF_FILE
|
||||
fi
|
||||
if [ "$DB" = 'postgresql' ]; then
|
||||
echo '$'dolibarr_main_db_type=\'pgsql\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_db_port=\'5432\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_db_port=5432';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_db_user=\'postgres\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_db_pass=\'postgres\'';' >> $CONF_FILE
|
||||
fi
|
||||
echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> $CONF_FILE
|
||||
cat $CONF_FILE
|
||||
|
|
@ -249,275 +281,235 @@ before_script:
|
|||
|
||||
- |
|
||||
echo "Create documents directory and set permissions"
|
||||
# and admin/temp subdirectory needed for unit tests
|
||||
# Add admin/temp subdirectory needed for unit tests
|
||||
mkdir -p $TRAVIS_BUILD_DIR/documents/admin/temp
|
||||
sudo chmod -R a+rwx $TRAVIS_BUILD_DIR/documents
|
||||
echo "***** First line of dolibarr.log" > $TRAVIS_BUILD_DIR/documents/dolibarr.log
|
||||
echo
|
||||
|
||||
|
||||
- echo "Setting up Apache + FPM"
|
||||
# setup link for php legacy
|
||||
- sudo ln -s ~/.phpenv/versions/$(phpenv version-name)/bin/php /bin/php
|
||||
# install apache web server
|
||||
- sudo apt-get install apache2 php-fpm php-mysql php-pgsql php-gd php-ldap php-xml php-mbstring libapache2-mod-php
|
||||
# enable php-fpm
|
||||
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
|
||||
- |
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = '8.2' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
||||
# Copy the included pool
|
||||
sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf
|
||||
fi
|
||||
- sudo a2enmod proxy_fcgi rewrite setenvif cgi alias
|
||||
- echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||
- sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars
|
||||
#- sudo chown -R travis:travis /var/lib/apache2/fastcgi
|
||||
# start php-fpm
|
||||
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
|
||||
# configure apache virtual hosts
|
||||
- sudo cp -f build/travis-ci/apache.conf /etc/apache2/sites-available/000-default.conf
|
||||
- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
|
||||
- sudo cat /etc/apache2/sites-available/000-default.conf
|
||||
- sudo service apache2 restart
|
||||
|
||||
echo "Setting up Apache"
|
||||
sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars
|
||||
sudo cp -f build/travis-ci/apache.conf /etc/apache2/sites-available/000-default.conf
|
||||
sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
|
||||
sudo cat /etc/apache2/sites-available/000-default.conf
|
||||
sudo service apache2 restart
|
||||
|
||||
|
||||
script:
|
||||
- |
|
||||
echo "Checking webserver availability by a wget -O - http://127.0.0.1"
|
||||
# Ensure we stop on error with set -e
|
||||
set +e
|
||||
# The wget should return a page with line '<meta name="generator" content="Dolibarr installer">
|
||||
wget -O - http://127.0.0.1 > test.html
|
||||
head test.html
|
||||
sudo cat /var/log/apache2/travis_error_log
|
||||
set +e
|
||||
echo
|
||||
- |
|
||||
echo "Checking webserver availability by a wget -O - --debug http://127.0.0.1"
|
||||
# Ensure we stop on error with set -e
|
||||
set +e
|
||||
# The wget should return a page with line '<meta name="generator" content="Dolibarr installer">
|
||||
wget -O - --debug http://127.0.0.1 > test.html
|
||||
head -n 200 test.html
|
||||
sudo cat /var/log/apache2/travis_error_log
|
||||
set +e
|
||||
echo
|
||||
|
||||
- |
|
||||
echo "Checking PHP syntax errors (only 1 version to not overload travis and avoid duplicate tests)"
|
||||
# Ensure we catch errors
|
||||
set -e
|
||||
#parallel-lint --exclude htdocs/includes --blame .
|
||||
# Exclusions are defined in the ruleset.xml file
|
||||
if [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
|
||||
parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \
|
||||
--exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \
|
||||
--exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \
|
||||
--exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \
|
||||
--exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --exclude htdocs/includes/webklex --blame .
|
||||
fi
|
||||
set +e
|
||||
echo
|
||||
- |
|
||||
echo "Checking PHP syntax errors (only 1 version to not overload travis and avoid duplicate tests)"
|
||||
# Ensure we catch errors
|
||||
set -e
|
||||
# Exclusions are defined in the ruleset.xml file
|
||||
if [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
|
||||
parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \
|
||||
--exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \
|
||||
--exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \
|
||||
--exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \
|
||||
--exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --exclude htdocs/includes/webklex --blame .
|
||||
fi
|
||||
set +e
|
||||
echo
|
||||
|
||||
- |
|
||||
echo "Checking coding style (only for Pull Requests builds and 1 version to not overload travis and avoid duplicate tests)"
|
||||
# Ensure we catch errors
|
||||
set -e
|
||||
# Exclusions are defined in the ruleset.xml file
|
||||
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
|
||||
phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .;
|
||||
fi
|
||||
set +e
|
||||
echo
|
||||
- |
|
||||
echo "Checking coding style (only for Pull Requests builds and 1 version to not overload travis and avoid duplicate tests)"
|
||||
# Ensure we catch errors
|
||||
set -e
|
||||
# Exclusions are defined in the ruleset.xml file
|
||||
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
|
||||
phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .;
|
||||
fi
|
||||
set +e
|
||||
echo
|
||||
|
||||
- |
|
||||
echo "Checking missing debug"
|
||||
# Ensure we catch errors
|
||||
set -e
|
||||
# Exclusions are defined in the ruleset.xml file
|
||||
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
|
||||
var-dump-check --extensions php --tracy --exclude htdocs/includes --exclude test/ --exclude htdocs/public/test/ --exclude htdocs/core/lib/functions.lib.php .
|
||||
fi
|
||||
set +e
|
||||
echo
|
||||
- |
|
||||
echo "Checking missing debug"
|
||||
# Ensure we catch errors
|
||||
set -e
|
||||
# Exclusions are defined in the ruleset.xml file
|
||||
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
|
||||
var-dump-check --extensions php --tracy --exclude htdocs/includes --exclude test/ --exclude htdocs/public/test/ --exclude htdocs/core/lib/functions.lib.php .
|
||||
fi
|
||||
set +e
|
||||
echo
|
||||
|
||||
- |
|
||||
export INSTALL_FORCED_FILE=htdocs/install/install.forced.php
|
||||
echo "Setting up Dolibarr $INSTALL_FORCED_FILE to test installation"
|
||||
# Ensure we catch errors
|
||||
set +e
|
||||
echo '<?php ' > $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_noedit=2';' >> $INSTALL_FORCED_FILE
|
||||
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then
|
||||
echo '$'force_install_type=\'mysqli\'';' >> $INSTALL_FORCED_FILE
|
||||
fi
|
||||
if [ "$DB" = 'postgresql' ]; then
|
||||
echo '$'force_install_type=\'pgsql\'';' >> $INSTALL_FORCED_FILE
|
||||
fi
|
||||
echo '$'force_install_dbserver=\'127.0.0.1\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_database=\'travis\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_databaselogin=\'travis\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_databasepass=\'\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_port=\'5432\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_prefix=\'llx_\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_createdatabase=false';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_createuser=false';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_mainforcehttps=false';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_main_data_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $INSTALL_FORCED_FILE
|
||||
#cat $INSTALL_FORCED_FILE
|
||||
- |
|
||||
export INSTALL_FORCED_FILE=htdocs/install/install.forced.php
|
||||
echo "Setting up Dolibarr $INSTALL_FORCED_FILE to test installation"
|
||||
# Ensure we catch errors
|
||||
set +e
|
||||
echo '<?php ' > $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_noedit=2';' >> $INSTALL_FORCED_FILE
|
||||
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then
|
||||
echo '$'force_install_type=\'mysqli\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_port=3306';' >> $INSTALL_FORCED_FILE
|
||||
fi
|
||||
if [ "$DB" = 'postgresql' ]; then
|
||||
echo '$'force_install_type=\'pgsql\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_port=5432';' >> $INSTALL_FORCED_FILE
|
||||
fi
|
||||
echo '$'force_install_dbserver=\'127.0.0.1\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_database=\'travis\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_databaselogin=\'travis\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_databasepass=\'\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_prefix=\'llx_\'';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_createdatabase=false';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_createuser=false';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_mainforcehttps=false';' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_main_data_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $INSTALL_FORCED_FILE
|
||||
#cat $INSTALL_FORCED_FILE
|
||||
|
||||
- |
|
||||
echo "Upgrading Dolibarr"
|
||||
# Ensure we catch errors with -e. Set this to +e if you want to go to the end to see log files.
|
||||
# Note: We keep +e because with pgsql, one of upgrade process fails even if migration seems ok, so
|
||||
# I disable stop on error to be able to continue.
|
||||
set +e
|
||||
cd htdocs/install
|
||||
php upgrade.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360.log
|
||||
php upgrade2.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-2.log
|
||||
php step5.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-3.log
|
||||
php upgrade.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370.log
|
||||
php upgrade2.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-2.log
|
||||
php step5.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-3.log
|
||||
php upgrade.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380.log
|
||||
php upgrade2.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-2.log
|
||||
php step5.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-3.log
|
||||
php upgrade.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390.log
|
||||
php upgrade2.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-2.log
|
||||
php step5.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-3.log
|
||||
php upgrade.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400.log
|
||||
php upgrade2.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-2.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 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 upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.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 upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log
|
||||
php upgrade2.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-2.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 > $TRAVIS_BUILD_DIR/upgrade700800-2.log
|
||||
php step5.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-3.log
|
||||
php upgrade.php 8.0.0 9.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade800900.log
|
||||
php upgrade2.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-2.log
|
||||
php step5.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-3.log
|
||||
php upgrade.php 9.0.0 10.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log
|
||||
php upgrade2.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log
|
||||
php step5.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log
|
||||
php upgrade.php 10.0.0 11.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade10001100.log
|
||||
php upgrade2.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-2.log
|
||||
php step5.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-3.log
|
||||
php upgrade.php 11.0.0 12.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade11001200.log
|
||||
php upgrade2.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-2.log
|
||||
php step5.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-3.log
|
||||
php upgrade.php 12.0.0 13.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade12001300.log
|
||||
php upgrade2.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-2.log
|
||||
php step5.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-3.log
|
||||
php upgrade.php 13.0.0 14.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade13001400.log
|
||||
php upgrade2.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-2.log
|
||||
php step5.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-3.log
|
||||
php upgrade.php 14.0.0 15.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade14001500.log
|
||||
php upgrade2.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-2.log
|
||||
php step5.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-3.log
|
||||
php upgrade.php 15.0.0 16.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade15001600.log
|
||||
php upgrade2.php 15.0.0 16.0.0 > $TRAVIS_BUILD_DIR/upgrade15001600-2.log
|
||||
php step5.php 15.0.0 16.0.0 > $TRAVIS_BUILD_DIR/upgrade15001600-3.log
|
||||
php upgrade.php 16.0.0 17.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade16001700.log
|
||||
php upgrade2.php 16.0.0 17.0.0 > $TRAVIS_BUILD_DIR/upgrade16001700-2.log
|
||||
php step5.php 16.0.0 17.0.0 > $TRAVIS_BUILD_DIR/upgrade16001700-3.log
|
||||
php upgrade.php 17.0.0 18.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade17001800.log
|
||||
php upgrade2.php 17.0.0 18.0.0 > $TRAVIS_BUILD_DIR/upgrade17001800-2.log
|
||||
php step5.php 17.0.0 18.0.0 > $TRAVIS_BUILD_DIR/upgrade17001800-3.log
|
||||
php upgrade.php 18.0.0 19.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade18001900.log
|
||||
php upgrade2.php 18.0.0 19.0.0 > $TRAVIS_BUILD_DIR/upgrade18001900-2.log
|
||||
php step5.php 18.0.0 19.0.0 > $TRAVIS_BUILD_DIR/upgrade18001900-3.log
|
||||
|
||||
#- |
|
||||
# echo "Installing Dolibarr"
|
||||
# cd htdocs/install
|
||||
# php step1.php $TRAVIS_BUILD_DIR/htdocs > $TRAVIS_BUILD_DIR/install.log
|
||||
# php step2.php set >> $TRAVIS_BUILD_DIR/install.log
|
||||
# if [ "$?" -ne "0" ]; then
|
||||
# echo "SORRY, AN ERROR OCCURED DURING INSTALLATION PROCESS"
|
||||
# cat $TRAVIS_BUILD_DIR/install.log
|
||||
# exit 1
|
||||
# fi
|
||||
# cd ../..
|
||||
# rm $INSTALL_FORCED_FILE
|
||||
# #cat $TRAVIS_BUILD_DIR/install.log
|
||||
# set +e
|
||||
# echo
|
||||
#show table content and log
|
||||
#echo '\d llx_adherent' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
|
||||
#cat $TRAVIS_BUILD_DIR/upgrade500600.log
|
||||
|
||||
- |
|
||||
echo "Setting up database to test migrations"
|
||||
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then
|
||||
echo "MySQL"
|
||||
mysql -e 'DROP DATABASE IF 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 'FLUSH PRIVILEGES;'
|
||||
mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||
fi
|
||||
if [ "$DB" = 'postgresql' ]; then
|
||||
#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
|
||||
echo pgloader mysql://root@127.0.0.1/travis postgresql:///travis
|
||||
pgloader mysql://root@127.0.0.1/travis postgresql:///travis
|
||||
echo 'ALTER SEQUENCE llx_accountingaccount_rowid_seq RENAME TO llx_accounting_account_rowid_seq' | psql travis
|
||||
echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql travis
|
||||
#echo 'select * from INFORMATION_SCHEMA.COLUMNS where table_name = 'llx_accountingaccount' | psql travis
|
||||
#echo 'select * from information_schema.table_constraints;' | psql travis
|
||||
#echo 'ALTER TABLE "llx_accounting_account" DROP CONSTRAINT "idx_16390_primary"' | psql travis
|
||||
fi
|
||||
echo
|
||||
- |
|
||||
echo Result of migration scripts
|
||||
ls -alrt $TRAVIS_BUILD_DIR/
|
||||
|
||||
echo Show content of last file
|
||||
cat $TRAVIS_BUILD_DIR/"$(ls -rt $TRAVIS_BUILD_DIR/ | tail -n1)"
|
||||
|
||||
- |
|
||||
echo "Upgrading Dolibarr"
|
||||
# Ensure we catch errors. Set this to +e if you want to go to the end to see log files.
|
||||
set +e
|
||||
cd htdocs/install
|
||||
php upgrade.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360.log
|
||||
php upgrade2.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-2.log
|
||||
php step5.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-3.log
|
||||
php upgrade.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370.log
|
||||
php upgrade2.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-2.log
|
||||
php step5.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-3.log
|
||||
php upgrade.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380.log
|
||||
php upgrade2.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-2.log
|
||||
php step5.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-3.log
|
||||
php upgrade.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390.log
|
||||
php upgrade2.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-2.log
|
||||
php step5.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-3.log
|
||||
php upgrade.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400.log
|
||||
php upgrade2.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-2.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 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 upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.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 upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log
|
||||
php upgrade2.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-2.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 > $TRAVIS_BUILD_DIR/upgrade700800-2.log
|
||||
php step5.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-3.log
|
||||
php upgrade.php 8.0.0 9.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade800900.log
|
||||
php upgrade2.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-2.log
|
||||
php step5.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-3.log
|
||||
php upgrade.php 9.0.0 10.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log
|
||||
php upgrade2.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log
|
||||
php step5.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log
|
||||
php upgrade.php 10.0.0 11.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade10001100.log
|
||||
php upgrade2.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-2.log
|
||||
php step5.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-3.log
|
||||
php upgrade.php 11.0.0 12.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade11001200.log
|
||||
php upgrade2.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-2.log
|
||||
php step5.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-3.log
|
||||
php upgrade.php 12.0.0 13.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade12001300.log
|
||||
php upgrade2.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-2.log
|
||||
php step5.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-3.log
|
||||
php upgrade.php 13.0.0 14.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade13001400.log
|
||||
php upgrade2.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-2.log
|
||||
php step5.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-3.log
|
||||
php upgrade.php 14.0.0 15.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade14001500.log
|
||||
php upgrade2.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-2.log
|
||||
php step5.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-3.log
|
||||
php upgrade.php 15.0.0 16.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade15001600.log
|
||||
php upgrade2.php 15.0.0 16.0.0 > $TRAVIS_BUILD_DIR/upgrade15001600-2.log
|
||||
php step5.php 15.0.0 16.0.0 > $TRAVIS_BUILD_DIR/upgrade15001600-3.log
|
||||
php upgrade.php 16.0.0 17.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade16001700.log
|
||||
php upgrade2.php 16.0.0 17.0.0 > $TRAVIS_BUILD_DIR/upgrade16001700-2.log
|
||||
php step5.php 16.0.0 17.0.0 > $TRAVIS_BUILD_DIR/upgrade16001700-3.log
|
||||
php upgrade.php 17.0.0 18.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade17001800.log
|
||||
php upgrade2.php 17.0.0 18.0.0 > $TRAVIS_BUILD_DIR/upgrade17001800-2.log
|
||||
php step5.php 17.0.0 18.0.0 > $TRAVIS_BUILD_DIR/upgrade17001800-3.log
|
||||
ls -alrt $TRAVIS_BUILD_DIR/
|
||||
- |
|
||||
echo "Enabling new modules"
|
||||
# Enable modules not enabled into original dump
|
||||
set -e
|
||||
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_ProductBatch,MAIN_MODULE_SupplierProposal,MAIN_MODULE_STRIPE,MAIN_MODULE_ExpenseReport > $TRAVIS_BUILD_DIR/enablemodule.log
|
||||
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP >> $TRAVIS_BUILD_DIR/enablemodule.log
|
||||
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $TRAVIS_BUILD_DIR/enablemodule.log
|
||||
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_KnowledgeManagement,MAIN_MODULE_EventOrganization,MAIN_MODULE_PARTNERSHIP >> $TRAVIS_BUILD_DIR/enablemodule.log
|
||||
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_EmailCollector >> $TRAVIS_BUILD_DIR/enablemodule.log
|
||||
echo $?
|
||||
cd -
|
||||
set +e
|
||||
echo
|
||||
#cat /tmp/dolibarr_install.log
|
||||
cat $TRAVIS_BUILD_DIR/enablemodule.log
|
||||
|
||||
- |
|
||||
echo "Enabling new modules"
|
||||
# Enable modules not enabled into original dump
|
||||
set -e
|
||||
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_PRODUCTBATCH,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_STRIPE,MAIN_MODULE_EXPENSEREPORT > $TRAVIS_BUILD_DIR/enablemodule.log
|
||||
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP >> $TRAVIS_BUILD_DIR/enablemodule.log
|
||||
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $TRAVIS_BUILD_DIR/enablemodule.log
|
||||
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_KNOWLEDGEMANAGEMENT,MAIN_MODULE_EVENTORGANIZATION,MAIN_MODULE_PARTNERSHIP >> $TRAVIS_BUILD_DIR/enablemodule.log
|
||||
echo $?
|
||||
cd -
|
||||
set +e
|
||||
echo
|
||||
#cat /tmp/dolibarr_install.log
|
||||
cat $TRAVIS_BUILD_DIR/enablemodule.log
|
||||
|
||||
- |
|
||||
echo "Unit testing"
|
||||
# Ensure we catch errors. Set this to +e instead of -e if you want to go to the end to see dolibarr.log file.
|
||||
set -e
|
||||
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||
phpunitresult=$?
|
||||
echo "Phpunit return code = $phpunitresult"
|
||||
set +e
|
||||
- |
|
||||
echo "Unit testing"
|
||||
# Ensure we catch errors with -e. Set this to +e instead of -e if you want to go to the end to see dolibarr.log file.
|
||||
set -e
|
||||
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||
phpunitresult=$?
|
||||
echo "Phpunit return code = $phpunitresult"
|
||||
set +e
|
||||
|
||||
after_script:
|
||||
- |
|
||||
echo "After script - Output last lines of dolibarr.log"
|
||||
ls $TRAVIS_BUILD_DIR/documents
|
||||
#cat $TRAVIS_BUILD_DIR/documents/dolibarr.log
|
||||
sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log
|
||||
echo "After script - Output last lines of apache error.log"
|
||||
sudo ls /var/log/apache2
|
||||
sudo tail -n 50 /var/log/apache2/travis_error_log
|
||||
- |
|
||||
echo "After script - Output last lines of dolibarr.log"
|
||||
ls $TRAVIS_BUILD_DIR/documents
|
||||
#cat $TRAVIS_BUILD_DIR/documents/dolibarr.log
|
||||
sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log
|
||||
echo "After script - Output last lines of apache error.log"
|
||||
sudo ls /var/log/apache2
|
||||
sudo tail -n 200 /var/log/apache2/travis_error_log
|
||||
|
||||
after_success:
|
||||
- |
|
||||
echo Success
|
||||
- |
|
||||
echo Success
|
||||
|
||||
after_failure:
|
||||
- |
|
||||
echo Failure detected, so we show samples of log to help diagnose
|
||||
# This part of code is executed only if the command that fails are enclosed with set +e
|
||||
# Show upgrade log files
|
||||
for ficlog in `ls $TRAVIS_BUILD_DIR/*.log`
|
||||
do
|
||||
#echo "Debugging informations for file $ficlog"
|
||||
#cat $ficlog
|
||||
done
|
||||
# Show Apache log file
|
||||
echo "Debugging informations for file apache error.log"
|
||||
sudo tail -n 50 /var/log/apache2/travis_error_log
|
||||
if [ "$DEBUG" = true ]; then
|
||||
# Dolibarr log file
|
||||
echo "Debugging informations for file dolibarr.log (latest 50 lines)"
|
||||
tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log
|
||||
# Database log file
|
||||
echo "Debugging informations for file mysql error.log"
|
||||
sudo tail -n 50 /var/log/mysql/error.log
|
||||
# TODO: PostgreSQL log file
|
||||
echo
|
||||
fi
|
||||
- |
|
||||
echo Failure detected, so we show samples of log to help diagnose
|
||||
# This part of code is executed only if the command that fails are enclosed with set +e
|
||||
# Show upgrade log files
|
||||
#for ficlog in `ls $TRAVIS_BUILD_DIR/*.log`
|
||||
#do
|
||||
#echo "Debugging informations for file $ficlog"
|
||||
#cat $ficlog
|
||||
#done
|
||||
# Show Apache log file
|
||||
echo "Debugging informations for file apache error.log"
|
||||
sudo tail -n 200 /var/log/apache2/travis_error_log
|
||||
if [ "$DEBUG" = true ]; then
|
||||
# Dolibarr log file
|
||||
echo "Debugging informations for file dolibarr.log (latest 50 lines)"
|
||||
tail -n 200 $TRAVIS_BUILD_DIR/documents/dolibarr.log
|
||||
# Database log file
|
||||
echo "Debugging informations for file mysql error.log"
|
||||
sudo tail -n 200 /var/log/mysql/error.log
|
||||
# TODO: PostgreSQL log file
|
||||
echo
|
||||
fi
|
||||
|
|
|
|||
10
COPYRIGHT
10
COPYRIGHT
|
|
@ -24,7 +24,7 @@ Component Version License GPL Compatible
|
|||
-------------------------------------------------------------------------------------
|
||||
PHP libraries:
|
||||
EvalMath 1.0 BSD Yes Safe math expressions evaluation
|
||||
Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
||||
Escpos-php 3.0 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
||||
GeoIP2 0.2.0 Apache License 2.0 Yes Lib to make geoip convert
|
||||
Mobiledetect 2.8.41 MIT License Yes Detect mobile devices browsers
|
||||
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
|
||||
|
|
@ -40,17 +40,19 @@ PHPPrintIPP 1.3 GPL-2+ Yes
|
|||
PSR/Logs 1.0 MIT License Yes Library for logs (used by DebugBar)
|
||||
PSR/simple-cache ? MIT License Yes Library for cache (used by PHPSpreadSheet)
|
||||
Restler 3.1.1 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer)
|
||||
Sabre 3.2.2 BSD Yes DAV support
|
||||
Sabre 4.0.2 BSD Yes DAV support
|
||||
Swift Mailer 5.4.2-DEV MIT License Yes Comprehensive mailing tools for PHP
|
||||
Symfony/var-dumper ??? MIT License Yes Library to make var dump (used by DebugBar)
|
||||
Stripe 7.67.0 MIT Licence Yes Library for Stripe module
|
||||
Stripe 10.7.0 MIT Licence Yes Library for Stripe module
|
||||
TCPDF 6.3.2 LGPL-3+ Yes PDF generation
|
||||
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
|
||||
|
||||
bacon, dasprid, swiss-qr-bill, kmukku, symfony/validator
|
||||
|
||||
JS libraries:
|
||||
Ace 1.4.14 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||
ChartJS 3.7.1 MIT License Yes JS library for graph
|
||||
CKEditor 4.18 LGPL-2.1+ Yes Editor WYSIWYG
|
||||
CKEditor 4.22.1 LGPL-2.1+ Yes Editor WYSIWYG
|
||||
jQuery 3.6.4 MIT License Yes JS library
|
||||
jQuery UI 1.13.2 GPL and MIT License Yes JS library plugin UI
|
||||
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css
|
||||
|
|
|
|||
372
ChangeLog
372
ChangeLog
|
|
@ -3,24 +3,382 @@ English Dolibarr ChangeLog
|
|||
--------------------------------------------------------------
|
||||
|
||||
|
||||
***** ChangeLog for 1.0.0 compared to 18.0.0 *****
|
||||
|
||||
|
||||
WARNING:
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* The property ->brouillon has been removed from all classes. It was not reliable and was a duplicate of ->status == self::STATUS_DRAFT.
|
||||
* The method get_substitutionarray_shipment_lines() has been removed. Use the generic get_substitutionarray_lines() instead.
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 18.0.0 compared to 17.0.0 *****
|
||||
|
||||
NEW: PHP 8.2 compatibility.
|
||||
For uses:
|
||||
---------
|
||||
|
||||
NEW: PHP 8.2 compatibility (test not yet completed)
|
||||
NEW: Module Workstations Management upgraded to stable status
|
||||
NEW: Module Webhook upgraded to stable status
|
||||
NEW: #23436 Group social networks fields
|
||||
NEW: Accountancy - Add specific page to export accounting data rather than the journals page
|
||||
NEW: Accountancy - Add sub-account balance FPC22
|
||||
NEW: Accountancy - Manage customer retained warranty FPC21+
|
||||
NEW: Accountancy - Manage intra-community VAT on supplier invoices - FPC22
|
||||
NEW: Accountancy - iSuiteExpert export model
|
||||
NEW: Accountancy - Quadratus export with attachments in accountancy export
|
||||
NEW: Accountancy - Can filter on a custom group of accounts. Perf or ledger list.
|
||||
NEW: Accountancy - Can select the export format during export of journals
|
||||
NEW: Accountancy - sort of column of custom group of account
|
||||
NEW: Can upload a file with drag and drop on purchase invoice, vats, salaries and social contributions
|
||||
NEW: Authentication: #22740 add OpenID Connect impl
|
||||
NEW: Authentication: add experimental support for Google OAuth2 connexion
|
||||
NEW: Authentication: can now edit service name for OAuth token
|
||||
NEW: add bookmarks in selectable landing pages for users
|
||||
NEW: Add column ext_payment_site into societe_rib to allow multiple payment mode
|
||||
NEW: add convertion of images to webp for a single image in website media editor
|
||||
NEW: Add CRC for currency symbol before amount
|
||||
NEW: Add filter on nb of generation done in list of recurring invoices
|
||||
NEW: Add filters and sort on product unit column
|
||||
NEW: Add link to edit VAT list from error message of missing VAT
|
||||
NEW: add margins in paiement/card.php
|
||||
NEW: Add mass action delete on VAT
|
||||
NEW: Add possibility to choose format #21426
|
||||
NEW: An external module can modify the quick search fields
|
||||
NEW: Bank: Bank name no more mandatory on creation. Can be generated if empty.
|
||||
NEW: Bank: Add fields zip, town, country for owner of a bank account
|
||||
NEW: batch referential objets
|
||||
NEW: Can add the add now link on date into addfieldvalue()
|
||||
NEW: Can add an array of several links in date selector
|
||||
NEW: Can bin accounting line for a given month
|
||||
NEW: Can edit inline the VAT number from supplier tab
|
||||
NEW: Can go back to draft on shipment when stock change not on validate
|
||||
NEW: Can modify bank account of sepa payment (if file not sent yet)
|
||||
NEW: Can set a checkbox in formconfirm by clicking on the label
|
||||
NEW: Can set the page "List of opportunities" as landing page
|
||||
NEW: Can show the SQL request used on emailing selection
|
||||
NEW: can stay on edit field when errors occurs
|
||||
NEW: comment in api_mymodule for seperate methods
|
||||
NEW: create email substitution variable for intervention signature URL
|
||||
NEW: Contacts: presend mass action in contact list
|
||||
NEW: Contacts: hook printFieldListFrom in contact list
|
||||
NEW: Customers: add date due and labels into customer comm card
|
||||
NEW: Debug the custom CSS feature to avoid a directory search/scan at
|
||||
NEW: dev name
|
||||
NEW: Disable bad reputation product price
|
||||
NEW: Email: autofill email form with the email template with status "Default" on
|
||||
NEW: Email: don't have closed contact proposed as receiver for the mails
|
||||
NEW: Email: can set flag default value on email templates
|
||||
NEW: Email-Collector: add field reply-to in email collector as possible filter
|
||||
NEW: Email-Collector: substitute date now in email collector
|
||||
NEW: Email-Collector: operation type in email collector to load or create contact
|
||||
NEW: Email-Collector: easier setup - can also use ! for negative search
|
||||
NEW: Email-Templates: show module into list of email templates
|
||||
NEW: Events: can add any contact on events if global MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT is set at 1
|
||||
NEW: Events: list with color
|
||||
NEW: Events: remove default percentage for event creation url
|
||||
NEW: formconfirm can support field with format datetime
|
||||
NEW: GeoIP: Can test a geoip conversion from the geoip setup page
|
||||
NEW: GUI: add a CSS editor into the admin GUI
|
||||
NEW: GUI: add dropdown button actions (example on Create button on project)
|
||||
NEW: GUI: color for start date and owner
|
||||
NEW: GUI: new tab for reception and shipment
|
||||
NEW: GUI: better design for the page of discounts of a thirdparty
|
||||
NEW: GUI: can set background style with MAIN_LOGIN_BACKGROUND_STYLE
|
||||
NEW: Help: Tooltip to explain how to add a photo on a product
|
||||
NEW: Help: Possibility to link to German pages in help
|
||||
NEW: helper functions for dates + small demo case
|
||||
NEW: HR - Salary: can fill date of salary payment with date of start of salary
|
||||
NEW: HR - Salary: can modify the date of payment of a salary (if not reconciled)
|
||||
NEW: HR - Salary: date for salary payment includes the hour/min
|
||||
NEW: HR - Salary: adding button Send Email on the salary file
|
||||
NEW: Import: filter on entity in import
|
||||
NEW: Import: map table to element for get entity in import
|
||||
NEW: inc.php: handle parameters from argv
|
||||
NEW: Installation: Auto activate some modules on install (Export/Import/Wysiwyg editor)
|
||||
NEW: Invoice: show category of operations
|
||||
NEW: Invoice: add customer code to invoices listing
|
||||
NEW: Keep a link between user created from recruitment and application
|
||||
NEW: Mass Actions: Better responsive for mass actions
|
||||
NEW: Members: add numbering modules for members
|
||||
NEW: Members: add widget box_members_by_tags.php
|
||||
NEW: Members: Captcha for public member's subscription form
|
||||
NEW: migration script + delete old table + rename fields and indexes
|
||||
NEW: MRP MO: Dynamic choice of warehouse and batch in MO production.
|
||||
NEW: Multicurrency REST API to create, update, delete, update rate...
|
||||
NEW: Multiselect for filter on prospection status
|
||||
NEW: [Bulk delete Project tasks]
|
||||
NEW: No overwrite of optionals during put() contact
|
||||
NEW: Notifications: add Customer Order delivered (ORDER_NEW) in module Notification
|
||||
NEW: Notifications: for Sign or Refused Propal from Online Page
|
||||
NEW: Now we can edit amount on VAT and salaries clone action
|
||||
NEW: only get opened contact from liste_contact function, to not have access to closed contact as mail receiver
|
||||
NEW: Option: MAIN_SECURITY_MAXFILESIZE_DOWNLOADED #yogosha10660
|
||||
NEW: Option to manage deposit slips for more payment modes (not only
|
||||
NEW: Option to show column for field and line selection on the left
|
||||
NEW: Orders: add sub total in order list det
|
||||
NEW: Orders: list product in orders
|
||||
NEW: Orders export: allow to export field 'shipment method'
|
||||
NEW: payment default values when supplier order created from reception
|
||||
NEW: Payment: manage contracts
|
||||
NEW: Payment: sepaStripe now creates the payment mode with type pm_ using new API
|
||||
NEW: Payment: add partial payment reason "withholding tax"
|
||||
NEW: Payment: Can edit account on miscellaneous payment (if not transfered)
|
||||
NEW: Print PDF: category of operation for crabe PDF model
|
||||
NEW: Print PDF: Name and date to print on PDF Sign
|
||||
NEW: Print PDF: Use the more recent PDF templates for documents by default on a fresh install
|
||||
NEW: Print PDF: Option PDF_SHOW_PHONE_AFTER_USER_CONTACT to show phone after specific assigned contact on PDF
|
||||
NEW: Print PDF: Option PDF_SHOW_EMAIL_AFTER_USER_CONTACT to show email after specific assigned contact on PDF
|
||||
NEW: product images on popup are cached
|
||||
NEW: Products: Add origin info when create a product batch when created from a movement stock
|
||||
NEW: Products: Add statistics by amount on statistics of products.
|
||||
NEW: Products: Add SQL contraint on product_stock table to allow only existing product and warehouse #23543
|
||||
NEW: Proposals: filter for Signed+Billed in proposals
|
||||
NEW: Proposals: can modify margin rates in offers like VAT rates
|
||||
NEW: Proposals: option filter for NoSalesRepresentativeAffected in proposals list
|
||||
NEW: Proposals: constant PROPALE_ADDON_NOTE_PUBLIC_DEFAULT
|
||||
NEW: Reception: can receive more than qty ordered on reception
|
||||
NEW: referential objects of batch
|
||||
NEW: remove keys whose table element is the same as element in map list
|
||||
NEW: repair script skip views
|
||||
NEW: search on time spent duration range
|
||||
NEW: Security: Save date to invalidate other session into user table
|
||||
NEW: Security: Invalidate all sessions of a user when password is modified.
|
||||
NEW: Service Contracts: Filter on amount and qty on list of service's contracts
|
||||
NEW: set today start time at beginning
|
||||
NEW: Show main currency in company info user tooltip
|
||||
NEW: Show supplier invoice ref of direct debit transfer tab invoices
|
||||
NEW: Social Networks: expend/collapse list of social networks
|
||||
NEW: Stock limit for alert and desired optimal stock by product and warehouse import
|
||||
NEW: Stock: Add warehouse create and modify triggers.
|
||||
NEW: Stock: Can select several warehouses into the view stock at date in past
|
||||
NEW: Stripe: add STRIPE_DEBUG, a way to log Stripe IPN
|
||||
NEW: Supplier Invoices: add ability of ODT support to supplier invoices
|
||||
NEW: Supplier Order: show supplier name in getNomUrl of supplier order
|
||||
NEW: Supplier Order: set payment default values when supplier order created from reception
|
||||
NEW: Supplier Price: Add a status on supplier price ref (WIP to close a supplier ref)
|
||||
NEW: Support different bank account for several direct debit payments
|
||||
NEW: Support multiselect in the warehouse selection combo box
|
||||
NEW: Survey: Comment on survey is possible only after vote.
|
||||
NEW: TakePOS: adapt category and product pictures sizes on TakePOS
|
||||
NEW: TakePOS: limit load products in TakePOS
|
||||
NEW: The batch for remind on due date can be setup for using validation date
|
||||
NEW: The refresh link for IMAP collector is always visible
|
||||
NEW: Third-Party: use an ajax component to switch prospection status on thirdparty list
|
||||
NEW: Tickets: Send a notification email when ticket assigned
|
||||
NEW: Tickets: set ticket status to answered if the client has answered from the public interface
|
||||
NEW: Tickets: added an option to display the progress of tickets on the public interface
|
||||
NEW: Tickets: add link to thirdparty tickets history
|
||||
NEW: Tickets: notify also the contributor affected to a ticket if a new message public is post (add global TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ALSO_CONTRIBUTOR)
|
||||
NEW: Upgrades: The upgrade process can be done by creating a file upgrade.unlock
|
||||
NEW: Use a cache file for external RSS in calendar
|
||||
NEW: Use by default the domain $dolibarr_main_url_root for SMTP HELO
|
||||
NEW: Users: add a public virtual card page for each user
|
||||
NEW: VAT can be modified during add of line
|
||||
NEW: Website Module: Increment website counter on each page access in website module
|
||||
NEW: Website Module: Show counter of access of website in website list
|
||||
NEW: Widgets: Show picto into the combobox of widgets
|
||||
NEW: Widgets: Implement MAIN_ACTIVATE_FILECACHE on birthday widget
|
||||
NEW: Widgets: Add widget "The next upcoming events"
|
||||
NEW: Widgets: Add widget of open opportunities
|
||||
|
||||
|
||||
|
||||
For developers or integrators:
|
||||
------------------------------
|
||||
|
||||
NEW: Make it possible to select hours and minutes in form_confirm
|
||||
NEW: add triggers on mailing
|
||||
NEW: Add a trigger when create a shipping line batch and fix propagate missing errors
|
||||
NEW: add function for listing objects from directory
|
||||
NEW: add helplist property to describe fields of objects
|
||||
NEW: API: Support contact in post() document API
|
||||
NEW: API: more APIs (update currency rate, upload of supplier documents, ...)
|
||||
NEW: Hooks: printFieldListFrom in contact list
|
||||
NEW: Hooks: add hook in loadLotStock() in html.formproduct.class.php file
|
||||
NEW: Hooks: add hook 'llxFooter'
|
||||
NEW: Hooks: add hook online sign
|
||||
NEW: Hooks: add sent info in the parameters provided to the hook sendMailAfter
|
||||
NEW: Libraries: Update libs parsedownto 1.7.4, phpspreadsheet lib to v1.12, ESCPOS v3.0, jquery, Stripe.
|
||||
NEW: ModuleBuilder: updating in modulbuilder on tab Menu when adding object
|
||||
NEW: ModuleBuilder: add/edit permissions
|
||||
NEW: ModuleBuilder: better generated documentation
|
||||
NEW: add setAsSelectUser into factory for generic setup page
|
||||
NEW: add option keepspace into dol_string_nospecialchar()
|
||||
NEW: dol_sort_array can sort on alphabetical order even if val is num
|
||||
NEW: dolExplodeIntoArray can accept regex
|
||||
NEW: element time integration code + SQL
|
||||
NEW: tables: llx_element_time to store time spent on several elements (mo, ticket...)
|
||||
NEW: Provide the oldcopy value when calling setValueFrom() function with a trigger key
|
||||
NEW: getCommonSubstitutionArray to have more substitute keys
|
||||
NEW: write all fields and their properties in asciidoc format
|
||||
|
||||
|
||||
WARNING:
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* Minimal PHP version is now PHP 7.1 instead of PHP 7.0
|
||||
* Sensitive datas like keys in setup pages, that need encyption (for example the API keys of users, the CRON security key, the keys into the Stripe module, or
|
||||
external modules setup pages that store sensitive keys or password), are using the $dolibarr_main_instance_unique_id as part of the key for encryption. So,
|
||||
if you restore or duplicate the data from another instance dump, you must also update this parameter in ther conf.php file to allow decryption in the new instance, or
|
||||
better, you must reenter the sensitive data into the setup pages of the new instance to resave them correctly.
|
||||
Note that to find all the parameters that are encrypted into the setup database, you can do a "SELECT * FROM llx_const WHERE value LIKE '%dolcrypt%';"
|
||||
* The deprecated method "escapeunderscore()" of database handlers has been removed. You must use "escapeforlike()" instead.
|
||||
* The method "nb_expedition()" has been renamed into "countNbOfShipments()"
|
||||
* Revert default type of hooks. Default is now 'addreplace' hooks (and exception become 'output' hooks, that become deprecated).
|
||||
* Deprecated property libelle removed from entrepot class.
|
||||
* The type 'text' in ->fields property dos not accept html content anymore. Use the type 'html' for that.
|
||||
* The type 'text' in ->fields property does not accept html content anymore. Use the type 'html' for that.
|
||||
* The module for WebService SOAP API have been deprecated. Use instead the Webservice REST API module.
|
||||
* The method htmlPrintOnlinePaymentFooter() used for public footer pages has been renamed into htmlPrintOnlineFooter() and moved into company.lib.php
|
||||
* The method getCheckOption() and deleteCPUser() of class Holiday has been removed (it was not used)
|
||||
|
||||
|
||||
***** ChangeLog for 17.0.3 compared to 17.0.2 *****
|
||||
FIX: #20304 propaldates update
|
||||
FIX: #24508 Label not reported when creating a supplier invoice template (#25340)
|
||||
FIX: #24569 filters on stockadate page
|
||||
FIX: #24631 Filter on categories of warehouses faulty
|
||||
FIX: #24695
|
||||
FIX: #24756 Total sum on annual report bank
|
||||
FIX: #24918
|
||||
FIX: #24985 Societe - Function thirdparty merging not working with module whose tables are not deployed by default
|
||||
FIX: #24991
|
||||
FIX: #24997 Update slovakia vat rate
|
||||
FIX: #25223
|
||||
FIX: ability to disable forcing focus on select2 to avoid side effects
|
||||
FIX: Add hidden conf to add extrafields in canelle template : INVOICE_ADD_EXTRAFIELD_IN_NOTE
|
||||
FIX: Add/Update required modules for thirdparties (by categ) & partnership
|
||||
FIX: ajax on off setup type
|
||||
FIX: avoid php8 warning
|
||||
FIX: Bad management of localtax on TakePOS due to typo error in var name
|
||||
FIX: can define empty qty by default when create object line
|
||||
FIX: can not remove the last selected value with checkbox
|
||||
FIX: case special char for password in email admin page
|
||||
FIX: Change $key into $tmpkey
|
||||
FIX: CommonObject::getRights()
|
||||
FIX: commonobject: getRights() did not find rights correctly for objects built using modulebuilder
|
||||
FIX: CVE reported by BELABED Skander (Akerva)
|
||||
FIX: CVE XSS on company name reported by Belabed Skander from Akerva
|
||||
FIX: decimal values were not possible on shipment quantities (introduced by #24882)
|
||||
FIX: default value for condition of payment on proposal
|
||||
FIX: default values were not set for specimen objects
|
||||
FIX: Delete of bank of a thirdparty must need the edit thirdparty perm
|
||||
FIX: display project tasks list columns (#24557)
|
||||
FIX: dol_print_error parameters on ticket fetch method (#25318)
|
||||
FIX: dol_trunc may not have the desired behaviour for truncating a cryptographic initialiszation vector, for instance when MAIN_DISABLE_TRUNC is used
|
||||
FIX: Donation - Missing Language key
|
||||
FIX: error expedition qty 0
|
||||
FIX: extrafield quick edit not working on products
|
||||
FIX: fatal error on Stripe setup page and security when terminal not used
|
||||
FIX: Fatal Error PHP 8 : division by 0 (#25384)
|
||||
FIX|Fix Change strpos for expedition and receipt in files.lib.php $haystack and $needle inversion
|
||||
FIX: Fix main and left menu info for the root menu of the list of accountancy journal
|
||||
FIX: Homogenise handling of null extrafield value in create/update
|
||||
FIX: Langs was not loaded for extrafields error
|
||||
FIX: Missing localtaxes on receipt in TakePOS
|
||||
FIX: no change on thirdparties.modules.php required modules
|
||||
FIX: OAUth2 module for Google with scopes for people and calendar
|
||||
FIX: php8.1 warning on lists with total due to unset array key (#25460)
|
||||
FIX: quickedit code missing on product card
|
||||
FIX: Selection of customer on second or more parallel sell in TakePOS
|
||||
FIX: Showing bank account on list for direct debit
|
||||
FIX: SQL migration file
|
||||
FIX: String was compared to an integer
|
||||
FIX: to avoid wrong path of file (#25320)
|
||||
FIX: Total sum on annual report bank
|
||||
FIX: translation extrafield mass action #24080
|
||||
FIX: Try to fix the date of invoice on TakePOS on eastern timezone
|
||||
FIX: TVA calc option must be the same on update line as on create line
|
||||
FIX: Update mouvementstock.class.php (#25396)
|
||||
FIX: update product on translation update
|
||||
FIX: use dol_substr instead of dol_trunc for truncating openssl initialization vector
|
||||
FIX: We should always be able to filter on action type no matter if we can't read actions of others (#24462)
|
||||
FIX: wrong var name
|
||||
|
||||
***** ChangeLog for 17.0.2 compared to 17.0.1 *****
|
||||
FIX: Change strpos for expedition and receipt in files.lib $haystack and $needle inversion
|
||||
FIX: Add hidden conf to add extrafields in canelle template : INVOICE_ADD_EXTRAFIELD_IN_NOTE
|
||||
FIX: #24414
|
||||
FIX: #24798 Deleting member subscription is not possible
|
||||
FIX: add a test for updating date on task update in tab time consummed pro…
|
||||
FIX: add charchesociales in security.lib.php
|
||||
FIX: Add Missing rights check on holiday calendar
|
||||
FIX: Add the possibility to events owner to check their events from the list when the perm "Read the actions (events or tasks) of others" is not active
|
||||
FIX: Authorize '0' subprice in supplier proposal line
|
||||
FIX: avoid error when computed property of extrafields is used
|
||||
FIX: avoid warnings php8
|
||||
FIX: Back to cancel on reception creation
|
||||
FIX: Bad deletion of email when there is several emails processed
|
||||
FIX: bank account not visible on credit transfer
|
||||
FIX: Better support for option MAIN_NO_INPUT_PRICE_WITH_TAX
|
||||
FIX: broken feature : send private message by email
|
||||
FIX: categorie compatibility with actioncomm
|
||||
FIX: Click on "NEW" in simple POS was broken
|
||||
FIX: Compress in xz for better debian old version compatibility
|
||||
FIX: Correct Evaluation for extrafields
|
||||
FIX: Count only attendee draft of validated.
|
||||
FIX: Creation of thumbs when images.lib.php was already included
|
||||
FIX: delete of warehouse
|
||||
FIX: deletion of a line of time spent (backport e3aa438d2a582313dfd5178b8cc5975e0c912c25)
|
||||
FIX: Deployment of external module failed with copy dir error.
|
||||
FIX: edit field value of url
|
||||
FIX: error management on emoji and utf8 validity by emailcollector
|
||||
FIX: expense report autofill ttc input if force ttc conf is enabled
|
||||
FIX: filter missing id on consumption contact card
|
||||
FIX: Filter on member status
|
||||
FIX: Filter status orders in list no invoiced if validated + in progress + delivered
|
||||
FIX: Fiscal year list ref display
|
||||
FIX: for empty shipping
|
||||
FIX: INVOICE_SHOW_SHIPPING_ADDRESS
|
||||
FIX: jump to direct record on member search was broken
|
||||
FIX: label of columns must be short into invoice PDF table
|
||||
FIX: making search in takepos broken when TAKEPOS_PRODUCT_IN_STOCK is set
|
||||
FIX: Margin calculation for credit notes on margin reports
|
||||
FIX: message MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US
|
||||
FIX: missing checking if file is uploaded
|
||||
FIX: missing constant and avoid submit button conflict
|
||||
FIX: missing entity field in unique index (since v16)
|
||||
FIX: Missing error message display on insertExtrafields()
|
||||
FIX: missing mrp module dependency
|
||||
FIX: More complete fix for #24411
|
||||
FIX: No error message because $price_ht_devise is equal to '0' if not filled because of price2num
|
||||
FIX: No usage of the function updateProduction in the update function
|
||||
FIX: On company change, we must reuse the company parameters
|
||||
FIX: Operator to search category Knowledge
|
||||
FIX: Pb in install when password start with some special char like !
|
||||
FIX: pb in sending email when mail contains data src image.
|
||||
FIX: PDF Font for turkish language
|
||||
FIX: product notes rights
|
||||
FIX: Propagate correct origin/origin_id when creating order from proposal
|
||||
FIX: Propagate extrafields from supplier order to reception
|
||||
FIX: reassortlot search categorie + add inithooks
|
||||
FIX: Reception process loose some lines on first error.
|
||||
FIX: redesign of the function : updateProduction
|
||||
FIX: ref_client on Project Overview for propale
|
||||
FIX: reference id in getnomurl function.
|
||||
FIX: regression Undefined $datepaid
|
||||
FIX: remove NOTOKENRENOWAL (backport commit v17 7c316229db8060781ee50f4465b1133b5aeef156)
|
||||
FIX: Remove warning on lettering - Impossible to write in ledger v16 v17 v18
|
||||
FIX: Report of date of task suggested only if there is tasks
|
||||
FIX: Rounding on total margin on invoice list
|
||||
FIX: Search List Select Extrafields with condition
|
||||
FIX: Search when criteria start with !
|
||||
FIX: Sending email from attendee list
|
||||
FIX: Shipping address same third party
|
||||
FIX: special chars in generated file name from build doc mass action
|
||||
FIX: supplier invoice status on bank transfer line
|
||||
FIX: supplier link on bank transfer line
|
||||
FIX: Task events not displayed
|
||||
FIX: token errors on public interface
|
||||
FIX: Transfer between accounts with different currencies was broken
|
||||
FIX: Update hour of intervention line
|
||||
FIX: Upload of files on public ticket interface
|
||||
FIX: Use max parameters of widget graph product distribution
|
||||
FIX: Warehouse total line
|
||||
FIX: When salary module is not enabled, bad permission check on user list
|
||||
FIX: wrong colspan for tasks list
|
||||
|
||||
***** ChangeLog for 17.0.1 compared to 17.0.0 *****
|
||||
|
||||
|
|
@ -269,18 +627,20 @@ WARNING:
|
|||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* Minimal PHP version is now PHP 7.0 instead of PHP 5.6
|
||||
* Core has introduced a Universal Filter Syntax for seach criteria. Example: ((((field1:=:value1) OR (field2:in:1,2,3)) AND ...). In rare case, some filters
|
||||
could be provided by URL parameters. For such cases (societe/ajax/company.php), use of Universal Filter Syntax become mandatory.
|
||||
* The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product->getNomUrl()
|
||||
* Trigger ORDER_SUPPLIER_DISPATCH is removed, use ORDER_SUPPLIER_RECEIVE and/or LINEORDER_SUPPLIER_DISPATCH instead.
|
||||
* All functions fetch_all() have been set to deprecated for naming consitency, use fetchAll() instead.
|
||||
* Code standardization: '$user->rights->propale' is now '$user->rights->propal' everywhere.
|
||||
* Deprecated method set_billed() on shipment and reception class has been removed. Use setBilled() instead.
|
||||
* Tables llx_prelevement_facture and llx_prelevement_facture_demande have been renamed into llx_prelevement and llx_prelevement_demande.
|
||||
* Rename MAIN_LIST_ALLOW_NOTES into MAIN_LIST_HIDE_NOTES and rename MAIN_LIST_ALLOW_PRIVATE_NOTES into MAIN_LIST_HIDE_PRIVATE_NOTES
|
||||
* Rename the substitution for "project label" instead of "project title" in substitution variables
|
||||
* You must use "$objectoffield" to manipulate the current object inside the formulare of computed custom extrafields instead of $obj/$object.
|
||||
* Renamed MAIN_LIST_ALLOW_NOTES into MAIN_LIST_HIDE_NOTES and renamed MAIN_LIST_ALLOW_PRIVATE_NOTES into MAIN_LIST_HIDE_PRIVATE_NOTES
|
||||
* Renamed the substitution for "project label" instead of "project title" in substitution variables
|
||||
* You must use "$objectoffield" to manipulate the current object inside the form of computed custom extrafields instead of $obj/$object.
|
||||
* Making a global search is sending the parameter using always the name search_all (instead of sometimes sall and search_all)
|
||||
* The property $url_last_version must be public if defined into module descriptor files;
|
||||
* Filters in class field definitions must be a Dolibarr filter syntax string.
|
||||
|
||||
|
||||
***** ChangeLog for 16.0.5 compared to 16.0.4 *****
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
# DOLIBARR ERP & CRM
|
||||
|
||||

|
||||

|
||||
[](https://php.net/)
|
||||
[](https://php.net/)
|
||||
[](https://github.com/Dolibarr/dolibarr)
|
||||
[](https://bestpractices.coreinfrastructure.org/projects/5521)
|
||||
|
||||
|
|
|
|||
38
SECURITY.md
38
SECURITY.md
|
|
@ -4,16 +4,15 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
|
|||
|
||||
## Supported Versions for security reports
|
||||
|
||||
| Version | Supported |
|
||||
| ---------- | ---------------------- |
|
||||
| <= 16.0.2 | :x: |
|
||||
| >= 16.0.3 | :white_check_mark: |
|
||||
| >= develop | :white_check_mark: |
|
||||
Security report are valid only on current stable version (see https://dolibarr.org web site to get current stable version) or on development version (branch "develop" on https://github.com/Dolibarr/dolibarr).
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
To report a vulnerability, for a private report, please use GitHub security advisory at [https://github.com/Dolibarr/dolibarr/security/advisories/new](https://github.com/Dolibarr/dolibarr/security/advisories/new) (if you have permissions).
|
||||
Alternatively send an email to security@dolibarr.org (for everybody)
|
||||
To report a vulnerability, for a private report, you can:
|
||||
|
||||
- Send your report on [https://app.yogosha.com/cvd/dolibarr/10VxeNx6Ui3rSEhAgX63US](https://app.yogosha.com/cvd/dolibarr/10VxeNx6Ui3rSEhAgX63US) (recommended for everybody)
|
||||
- Or if you have permissions, use GitHub security advisory at [https://github.com/Dolibarr/dolibarr/security/advisories/new](https://github.com/Dolibarr/dolibarr/security/advisories/new)
|
||||
- Or send by email to security@dolibarr.org a clear textual description of the report along with steps to reproduce the issue, include attachments such as screenshots or proof of concept code as necessary
|
||||
|
||||
## Hunting vulnerabilities on Dolibarr
|
||||
|
||||
|
|
@ -39,31 +38,32 @@ We are happy to thank everyone who submits valid reports which help us improve t
|
|||
|
||||
You must be the first reporter of the vulnerability (duplicate reports are closed).
|
||||
|
||||
You must send a clear textual description of the report along with steps to reproduce the issue, include attachments such as screenshots or proof of concept code as necessary.
|
||||
|
||||
You must avoid tests that could cause degradation or interruption of our service (refrain from using automated tools, and limit yourself about requests per second), that's why we recommand to install software on your own platform.
|
||||
|
||||
You must not leak, manipulate, or destroy any user data of third parties to find your vulnerability.
|
||||
|
||||
Reports are processed around once a month.
|
||||
|
||||
## Scope for qualified vulnerabilities
|
||||
|
||||
ONLY vulnerabilities discovered, when the following setup on test platform is used, are "valid":
|
||||
|
||||
* The version to analyze must be the last version available into "develop" branch or into last stable "vX.Y" released version. Reports on vulnerabilities already fixed (so already reported) into the develop branch will not be validated.
|
||||
* $dolibarr_main_prod must be set to 1 into conf.php
|
||||
* $dolibarr_nocsrfcheck must be kept to the value 0 into conf.php (this is the default value)
|
||||
* $dolibarr_main_force_https must be set to something else than 0.
|
||||
* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 3 into backoffice menu Home - Setup - Other (this protection should be set to 3 soon by default)
|
||||
* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 3 into backoffice menu Home - Setup - Other (this protection should be set to 3 soon by default). CSRF attacks are accepted but
|
||||
double check that you have set MAIN_SECURITY_CSRF_WITH_TOKEN to value 3.
|
||||
* ONLY security reports on modules provided by default and with the "stable" status are valid (troubles into "experimental", "developement" or external modules are not valid vulnerabilities).
|
||||
* The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer).
|
||||
* The web server setup must be done so that only the documents directory is in write mode. The root directory called htdocs must be read-only.
|
||||
* CSRF attacks are accepted but double check that you have set MAIN_SECURITY_CSRF_WITH_TOKEN to value 3.
|
||||
* The module DebugBar and ModuleBuilder must NOT be enabled (by default, these modules are not enabled. They are developer tools)
|
||||
* The modules DebugBar and ModuleBuilder must NOT be enabled. (by default, these modules are not enabled. They are developer tools)
|
||||
* Ability for a high level user to edit web site pages into the CMS by including HTML or Javascript is an expected feature. Vulnerabilities into the website module are validated only if HTML or Javascript injection can be done by a non allowed user.
|
||||
* Fail2ban rules for rate limit on the login page,password forgotten page and all public pages (/public/*) must be installed as recommendend into the section "About - Admin tools - Section Access limits and mitigation".
|
||||
* Fail2ban rules for rate limit on the login page,password forgotten page, api calls and all public pages (/public/*) must be installed as recommendend into the section "About - Admin tools - Section Access limits and mitigation".
|
||||
|
||||
Scope is the web application (back office) and the APIs.
|
||||
|
||||
## Example of vulnerabilities Qualified for reporting.
|
||||
## Examples of vulnerabilities that are Qualified for reporting.
|
||||
|
||||
* Remote code execution (RCE)
|
||||
* Local files access and manipulation (LFI, RFI, XXE, SSRF, XSPA)
|
||||
|
|
@ -72,14 +72,14 @@ Scope is the web application (back office) and the APIs.
|
|||
* Cross-Site Requests Forgery (CSRF) with real security impact (when using GET URLs, CSRF are qualified only for creating, updating or deleting data from pages restricted to admin users)
|
||||
* Open redirect
|
||||
* Broken authentication & session management
|
||||
* Insecure direct object references
|
||||
* CORS with real security impact
|
||||
* Insecure direct object references (IDOR)
|
||||
* Cross-Origin Resource Sharing (CORS) with real security impact
|
||||
* Horizontal and vertical privilege escalation
|
||||
* "HTTP Host Header" XSS
|
||||
* Software version disclosure (for non admin users only)
|
||||
* Stack traces or path disclosure (for non admin users only)
|
||||
|
||||
## Example of vulnerabilities non Non-qualified for reporting.
|
||||
## Examples of vulnerabilities that are Non-qualified for reporting.
|
||||
|
||||
* "Self" XSS
|
||||
* SSL/TLS best practices
|
||||
|
|
@ -93,7 +93,7 @@ Scope is the web application (back office) and the APIs.
|
|||
* Reports from automated web vulnerability scanners (Acunetix, Vega, etc.) that have not been validated
|
||||
* Invalid or missing SPF (Sender Policy Framework) records (Incomplete or missing SPF/DKIM/DMARC)
|
||||
* Reports on features flagged as "experimental" or "development"
|
||||
* Software version or private IP disclosure when logged user is admin
|
||||
* Stack traces or path disclosure when logged user is admin
|
||||
* Software version or private IP disclosure when logged-in user is admin
|
||||
* Stack traces or path disclosure when logged-in user is admin
|
||||
* Any vulnerabilities due to a configuration different than the one defined into chapter "Scope for qualified vulnerabilities".
|
||||
* Brute force attacks on login page, password forgotten page or any public pages (/public/*) are not qualified if the fail2ban recommended fail2ban rules were not installed.
|
||||
|
|
|
|||
|
|
@ -33,5 +33,5 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
|
|||
+$conffile = "/etc/dolibarr/conf.php";
|
||||
+$conffiletoshow = "/etc/dolibarr/conf.php";
|
||||
|
||||
|
||||
// Load conf file if it is already defined
|
||||
$short_options = "c:h";
|
||||
$long_options = array(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# How to use it ?
|
||||
|
||||
The docker-compose.yml file is used to build and run Dolibarr in the current workspace.
|
||||
This docker image intended for developpement usage.
|
||||
The docker-compose.yml file is a sample of a config file to use to build and run Dolibarr in the current workspace with Docker.
|
||||
This docker image is intended for developpement usage.
|
||||
For production usage you should consider other contributor reference like https://hub.docker.com/r/tuxgasy/dolibarr
|
||||
|
||||
Before build/run, define the variable HOST_USER_ID as following:
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ services:
|
|||
mariadb:
|
||||
image: mariadb:latest
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
MYSQL_ROOT_PASSWORD: rootpassfordev
|
||||
MYSQL_DATABASE: dolibarr
|
||||
ports:
|
||||
- "3306:3306"
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ chmod g+rwx /var/www/html/conf
|
|||
|
||||
if [ ! -d /var/documents ]; then
|
||||
echo "[docker-run] => create volume directory /var/documents ..."
|
||||
mkdir -p /var/documents
|
||||
mkdir -p /var/documents
|
||||
fi
|
||||
echo "[docker-run] => Set Permission to www-data for /var/documents"
|
||||
chown -R www-data:www-data /var/documents
|
||||
|
|
|
|||
|
|
@ -220,7 +220,8 @@ OPTIMIZE_OUTPUT_VHDL = NO
|
|||
# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
|
||||
# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
|
||||
|
||||
EXTENSION_MAPPING =
|
||||
#EXTENSION_MAPPING = example=PHP
|
||||
EXTENSION_MAPPING =
|
||||
|
||||
# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
|
||||
# to include (a tag file for) the STL sources as input, then you should
|
||||
|
|
@ -602,6 +603,7 @@ INPUT_ENCODING = UTF-8
|
|||
# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
|
||||
# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
|
||||
|
||||
#FILE_PATTERNS = *.php *.pl *.sql *.example
|
||||
FILE_PATTERNS = *.php *.pl
|
||||
|
||||
# The RECURSIVE tag can be used to turn specify whether or not subdirectories
|
||||
|
|
|
|||
|
|
@ -43,5 +43,5 @@ DoliWampWillStartApacheMysql=L'instal·lador DoliWamp intentarà iniciar o reini
|
|||
OldVersionFoundAndMoveInNew=S'ha trobat una versió antiga de base de dades i ha estat moguda per a ser utilitzada per la nova versió de Dolibarr
|
||||
OldVersionFoundButFailedToMoveInNew=S'ha trobat una versió antiga de base de dades, però no es pot moure per a ser utilitzada per la nova versió de Dolibarr
|
||||
|
||||
DLLMissing=La teva instal·lació windows no té el component "Microsoft Visual C++ Redistributable for Visual Studio 2012". Instal·la primer la versió de 32-bit (vcredist_x86.exe) (pots trobar-la a https://www.microsoft.com/en-us/download/) i reiniciar després la instal·lació/actualització de DoliWamp.
|
||||
DLLMissing=La teva instal·lació windows no té el component "Microsoft Visual C++ Redistributable for Visual Studio 2015". Instal·la primer la versió de 32-bit (vcredist_x86.exe) (pots trobar-la a https://www.microsoft.com/en-us/download/) i reiniciar després la instal·lació/actualització de DoliWamp.
|
||||
ContinueAnyway=Continua igualment (el procés d'instal·lació podria fallar sense aquest prerequisit)
|
||||
|
|
|
|||
|
|
@ -44,5 +44,5 @@ DoliWampWillStartApacheMysql=DoliWamp installer will now start or restart Apache
|
|||
OldVersionFoundAndMoveInNew=An old database version has been found and moved to be used by the new Dolibarr version
|
||||
OldVersionFoundButFailedToMoveInNew=An old database version has been found but could not be moved to be used with the new Dolibarr version
|
||||
|
||||
DLLMissing=Your Windows installation is missing the "Microsoft Visual C++ Redistributable for Visual Studio 2012" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after.
|
||||
DLLMissing=Your Windows installation is missing The "Microsoft Visual C++ Redistributable for Visual Studio 2015" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after.
|
||||
ContinueAnyway=Continue anyway (install process may fail without this prerequisite)
|
||||
|
|
|
|||
|
|
@ -44,5 +44,5 @@ DoliWampWillStartApacheMysql=L'installeur DoliWamp va maintenant d
|
|||
OldVersionFoundAndMoveInNew=Une ancienne version de base a été trouvée et déplacée pour fonctionner avec la nouvelle version de Dolibarr.
|
||||
OldVersionFoundButFailedToMoveInNew=Une ancienne version de base a été trouvée mais ne peut être déplacée pour être utilisée avec la nouvelle version de Dolibarr.
|
||||
|
||||
DLLMissing=L'installation de votre Windows est incomplète. Il manque le composant "Micrsoft Visual C++ Redistributable for Visual Studio 2012". Installer la version 32-bit (vcredist_x86.exe) d'abord (vous pourrez le trouver à https://www.microsoft.com/fr-fr/download/) puis relancer l'installation de DoliWamp après.
|
||||
DLLMissing=L'installation de votre Windows est incomplète. Il manque le composant "Micrsoft Visual C++ Redistributable for Visual Studio 2015". Installer la version 32-bit (vcredist_x86.exe) d'abord (vous pourrez le trouver à https://www.microsoft.com/fr-fr/download/) puis relancer l'installation de DoliWamp après.
|
||||
ContinueAnyway=Continuer malgré tout (le process d'installaton échouera)
|
||||
|
|
|
|||
|
|
@ -43,5 +43,5 @@ DoliWampWillStartApacheMysql=Die DoliWamp-Installation wird nun starten oder Apa
|
|||
OldVersionFoundAndMoveInNew=Eine alte Datenbankversion wurde gefunden und verschoben, um von der neuen Dolibarr-Version verwendet zu werden.
|
||||
OldVersionFoundButFailedToMoveInNew=Eine alte Datenbankversion wurde gefunden, konnte jedoch nicht verschoben werden, um mit der neuen Dolibarr-Version verwendet zu werden.
|
||||
|
||||
DLLMissing=Your Windows installation is missing The "Micrsoft Visual C++ Redistributable for Visual Studio 2012" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after.
|
||||
DLLMissing=Your Windows installation is missing The "Micrsoft Visual C++ Redistributable for Visual Studio 2015" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after.
|
||||
ContinueAnyway=Fahren Sie trotzdem fort (der Installationsvorgang kann ohne diese Voraussetzung fehlschlagen).
|
||||
|
|
|
|||
|
|
@ -43,5 +43,5 @@ DoliWampWillStartApacheMysql=El instalador DoliWamp intentará iniciar o reinici
|
|||
OldVersionFoundAndMoveInNew=Se ha encontrado una versión antigua de base de datos y ha sido movida para ser utilizada por la nueva versión de Dolibarr
|
||||
OldVersionFoundButFailedToMoveInNew=Se ha encontrado una versión antigua de base de datos, pero no se pudo mover para ser utilizada por la nueva versión de Dolibarr
|
||||
|
||||
DLLMissing=Su instalación Windows no tiene el componente "Microsoft Visual C++ Redistributable for Visual Studio 2012". Instale primero la versión de 32-bit (vcredist_x86.exe) (puedes encontrarlo en https://www.microsoft.com/en-us/download/) y reiniciar después la instalación/actualización de DoliWamp.
|
||||
DLLMissing=Su instalación Windows no tiene el componente "Microsoft Visual C++ Redistributable for Visual Studio 2015". Instale primero la versión de 32-bit (vcredist_x86.exe) (puedes encontrarlo en https://www.microsoft.com/en-us/download/) y reiniciar después la instalación/actualización de DoliWamp.
|
||||
ContinueAnyway=Continua igualmente (el proceso de instalación podría fallar sin este prerequisito)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#-------------------------------------------------------------------#
|
||||
# Makefile
|
||||
# Makefile to build UsedPort exe
|
||||
#-------------------------------------------------------------------#
|
||||
# 1.0 Laurent Destailleur Creation
|
||||
#-------------------------------------------------------------------#
|
||||
|
|
|
|||
|
|
@ -27,12 +27,12 @@ Prerequisites to build autoexe DoliWamp package from Linux (solution seems broke
|
|||
|
||||
Prerequisites to build autoexe DoliWamp package from Windows:
|
||||
|
||||
> Install Perl for Windwos (https://strawberryperl.com/)
|
||||
> Install Perl for Windows (https://strawberryperl.com/)
|
||||
> Install isetup-5.5.8.exe (https://www.jrsoftware.org)
|
||||
> Install WampServer-3.2.*-64.exe (Apache 2.4.51, PHP 7.3.33, MariaDB 10.6.5 for example. Version must match the values found into doliwamp.iss)
|
||||
> Install GIT for Windows (https://git-scm.com/ => You must choose option "Add Git bash profile", "Git commit as-is")
|
||||
> Install Dolibarr verions:
|
||||
git clone https://github.com/dolibarr/dolibarr
|
||||
> Install Dolibarr current version:
|
||||
git clone https://github.com/dolibarr/dolibarr or git clone --branch X.Y https://github.com/dolibarr/dolibarr
|
||||
|
||||
> Add the path of PHP (C:\wamp64\bin\php\php7.3.33) and InnoSetup (C:\Program Files (x86)\Inno Setup 5) into the %PATH% of Windows.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,21 @@
|
|||
PHPStan
|
||||
|
||||
https://phpstan.org
|
||||
PHPStan (https://phpstan.org)
|
||||
-----------------------------
|
||||
|
||||
PHPStan requires PHP >= 7.1
|
||||
|
||||
Install: composer require --dev phpstan/phpstan
|
||||
Config File is: ./phpstan.neon
|
||||
|
||||
Config File: phpstan.neon
|
||||
Install phpstan:
|
||||
cd git; mkdir phpstan
|
||||
cd phpstan
|
||||
composer require --dev phpstan/phpstan
|
||||
|
||||
Build report from CLI:
|
||||
cd git/dolibarr; mv htdocs/custom /tmp/
|
||||
php ../phpstan/htdocs/includes/bin/phpstan -v analyze -a build/phpstan/bootstrap.php --memory-limit 4G --error-format=table htdocs/commande/class
|
||||
php ../phpstan/htdocs/includes/bin/phpstan -v analyze -a build/phpstan/bootstrap.php --memory-limit 4G --error-format=table
|
||||
mv /tmp/custom htdocs
|
||||
|
||||
Build HTML report from Cron:
|
||||
Example of line to add into a cron to generate a HTML report:
|
||||
0 1 5 * * cd /home/dolibarr/preview.dolibarr.org/dolibarr; chmod -R u+w /home/dolibarr/preview.dolibarr.org/dolibarr; git pull; /home/dolibarr/phpstan/vendor/bin/phpstan -v analyze -a build/phpstan/bootstrap.php --memory-limit 4G --error-format=github | awk ' BEGIN{ print "Date "strftime("%Y-%m-%d")"<br>" } { print $0"<br>" } END{ print NR } ' > /home/dolibarr/doxygen.dolibarr.org/phpstan/index.html
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
<?php
|
||||
// Example to use PHPStan
|
||||
// cd git/dolibarr
|
||||
// /usr/bin/php7.2 ../phpstan.phar -l1 analyze htdocs/societe/website.php --memory-limit 2G
|
||||
|
||||
// Defined some constants and load Dolibarr env to reduce PHPStan bootstrap that fails to load a lot of things.
|
||||
define('DOL_DOCUMENT_ROOT', __DIR__ . '/../../htdocs');
|
||||
define('DOL_DATA_ROOT', __DIR__ . '/../../documents');
|
||||
define('DOL_URL_ROOT', '/');
|
||||
//define('DOL_DOCUMENT_ROOT', __DIR__ . '/../../htdocs');
|
||||
//define('DOL_DATA_ROOT', __DIR__ . '/../../documents');
|
||||
//define('DOL_URL_ROOT', '/');
|
||||
|
||||
// Load the main.inc.php file to have functions llx_Header and llx_Footer defined
|
||||
// Load the main.inc.php file to have functions env defined
|
||||
if (! defined("NOLOGIN")) define("NOLOGIN", '1');
|
||||
if (! defined("NOHTTPSREDIRECT")) define("NOHTTPSREDIRECT", '1');
|
||||
global $conf, $langs, $user, $db;
|
||||
include_once __DIR__ . '/../../htdocs/main.inc.php';
|
||||
|
|
|
|||
8
build/rector/README
Normal file
8
build/rector/README
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
How to use Rector to fix code
|
||||
-----------------------------
|
||||
|
||||
First, move rector.php file into htdocs
|
||||
|
||||
Then install rector.
|
||||
|
||||
Then ...
|
||||
99
build/rector/rector.php
Normal file
99
build/rector/rector.php
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Set\ValueObject\LevelSetList;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
|
||||
return static function (RectorConfig $rectorConfig): void {
|
||||
$rectorConfig->paths([
|
||||
__DIR__ . '/accountancy',
|
||||
/* __DIR__ . '/adherents',
|
||||
__DIR__ . '/admin',
|
||||
__DIR__ . '/api',
|
||||
__DIR__ . '/asset',
|
||||
__DIR__ . '/asterisk',
|
||||
__DIR__ . '/barcode',
|
||||
__DIR__ . '/blockedlog',
|
||||
__DIR__ . '/bom',
|
||||
__DIR__ . '/bookcal',
|
||||
__DIR__ . '/bookmarks',
|
||||
__DIR__ . '/categories',
|
||||
__DIR__ . '/collab',
|
||||
__DIR__ . '/comm',
|
||||
__DIR__ . '/commande',
|
||||
__DIR__ . '/compta',
|
||||
__DIR__ . '/conf',
|
||||
__DIR__ . '/contact',
|
||||
__DIR__ . '/contrat',
|
||||
__DIR__ . '/core',
|
||||
__DIR__ . '/cron',
|
||||
__DIR__ . '/custom',
|
||||
__DIR__ . '/datapolicy',
|
||||
__DIR__ . '/dav',
|
||||
__DIR__ . '/debugbar',
|
||||
__DIR__ . '/delivery',
|
||||
__DIR__ . '/don',
|
||||
__DIR__ . '/ecm',
|
||||
__DIR__ . '/emailcollector',
|
||||
__DIR__ . '/eventorganization',
|
||||
__DIR__ . '/expedition',
|
||||
__DIR__ . '/expensereport',
|
||||
__DIR__ . '/exports',
|
||||
__DIR__ . '/externalsite',
|
||||
__DIR__ . '/fichinter',
|
||||
__DIR__ . '/fourn',
|
||||
__DIR__ . '/ftp',
|
||||
__DIR__ . '/holiday',
|
||||
__DIR__ . '/hrm',
|
||||
__DIR__ . '/imports',
|
||||
__DIR__ . '/install',
|
||||
__DIR__ . '/intracommreport',
|
||||
__DIR__ . '/knowledgemanagement',
|
||||
__DIR__ . '/loan',
|
||||
__DIR__ . '/mailmanspip',
|
||||
__DIR__ . '/margin',
|
||||
__DIR__ . '/mrp',
|
||||
__DIR__ . '/multicurrency',
|
||||
__DIR__ . '/opensurvey',
|
||||
__DIR__ . '/partnership',
|
||||
__DIR__ . '/paybox',
|
||||
__DIR__ . '/paypal',
|
||||
__DIR__ . '/printing',
|
||||
__DIR__ . '/product',
|
||||
__DIR__ . '/projet',
|
||||
__DIR__ . '/public',
|
||||
__DIR__ . '/reception',
|
||||
__DIR__ . '/recruitment',
|
||||
__DIR__ . '/resource',
|
||||
__DIR__ . '/salaries',
|
||||
__DIR__ . '/societe',
|
||||
__DIR__ . '/stripe',
|
||||
__DIR__ . '/supplier_proposal',
|
||||
__DIR__ . '/support',
|
||||
__DIR__ . '/takepos',
|
||||
__DIR__ . '/theme',
|
||||
__DIR__ . '/ticket',
|
||||
__DIR__ . '/user',
|
||||
__DIR__ . '/webhook',
|
||||
__DIR__ . '/webservices',
|
||||
__DIR__ . '/website',
|
||||
__DIR__ . '/workstation',
|
||||
__DIR__ . '/zapier',*/
|
||||
]);
|
||||
|
||||
// register a single rule
|
||||
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
|
||||
|
||||
// define sets of rules
|
||||
$rectorConfig->sets([
|
||||
//LevelSetList::UP_TO_PHP_81,
|
||||
SetList::CODE_QUALITY,
|
||||
SetList::CODING_STYLE,
|
||||
SetList::DEAD_CODE,
|
||||
SetList::EARLY_RETURN,
|
||||
SetList::NAMING
|
||||
]);
|
||||
};
|
||||
|
|
@ -24,5 +24,5 @@ diff -up htdocs/install/inc.php.patch htdocs/install/inc.php
|
|||
+$conffile = "/etc/dolibarr/conf.php";
|
||||
+$conffiletoshow = "/etc/dolibarr/conf.php";
|
||||
|
||||
|
||||
// Load conf file if it is already defined
|
||||
$short_options = "c:h";
|
||||
$long_options = array(
|
||||
|
|
|
|||
|
|
@ -9,14 +9,14 @@
|
|||
</Directory>
|
||||
|
||||
# Wire up Apache to use Travis CI's php-fpm.
|
||||
<IfModule mod_fastcgi.c>
|
||||
AddHandler php5-fcgi .php
|
||||
Action php5-fcgi /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
|
||||
|
||||
<Directory /usr/lib/cgi-bin>
|
||||
Require all granted
|
||||
</Directory>
|
||||
</IfModule>
|
||||
#<IfModule mod_fastcgi.c>
|
||||
# AddHandler php5-fcgi .php
|
||||
# Action php5-fcgi /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
|
||||
#
|
||||
#<Directory /usr/lib/cgi-bin>
|
||||
# Require all granted
|
||||
#</Directory>
|
||||
#</IfModule>
|
||||
</VirtualHost>
|
||||
|
|
|
|||
|
|
@ -24,32 +24,30 @@
|
|||
"vendor-dir" : "htdocs/includes"
|
||||
},
|
||||
"require" : {
|
||||
"php" : ">=5.6.0",
|
||||
"ext-curl" : "*",
|
||||
"php" : ">=7.1.0",
|
||||
"ckeditor/ckeditor" : "4.12.1",
|
||||
"mike42/escpos-php" : "2.2",
|
||||
"mobiledetect/mobiledetectlib" : "2.8.39",
|
||||
"phpoffice/phpexcel" : "1.8.2",
|
||||
"mike42/escpos-php" : "3.0",
|
||||
"mobiledetect/mobiledetectlib" : "2.8.41",
|
||||
"phpoffice/phpspreadsheet" : ">=1.12",
|
||||
"restler/framework" : "3.0.0-RC6",
|
||||
"tecnickcom/tcpdf" : "6.3.2",
|
||||
"nnnick/chartjs" : "^2.9",
|
||||
"stripe/stripe-php" : "6.43.1",
|
||||
"maximebf/debugbar" : "1.15.1",
|
||||
"symfony/var-dumper" : "3.2"
|
||||
"nnnick/chartjs" : "^3.7.1",
|
||||
"stripe/stripe-php" : "10.7.0",
|
||||
"maximebf/debugbar" : "1.18.2",
|
||||
"symfony/var-dumper" : ">=3.2"
|
||||
},
|
||||
"require-dev" : {
|
||||
"php-parallel-lint/php-parallel-lint" : "^0",
|
||||
"php-parallel-lint/php-console-highlighter" : "^0",
|
||||
"phpunit/phpunit" : "^4",
|
||||
"squizlabs/php_codesniffer" : "^2",
|
||||
"phpunit/phpunit-selenium" : "^2"
|
||||
"phpunit/phpunit-selenium" : "^2",
|
||||
"rector/rector" : "^0.16.0"
|
||||
},
|
||||
"suggest" : {
|
||||
"ext-mysqlnd" : "To use with MySQL or MariaDB",
|
||||
"ext-mysqli" : "To use with MySQL or MariaDB",
|
||||
"ext-pgsql" : "To use with PostgreSQL",
|
||||
"ext-mssql" : "To use with MSSQL (experimental)",
|
||||
"ext-pdo_sqlite" : "To use with SQLite (experimental)",
|
||||
"ext-gd" : "Image manipulation (Required but maybe built-in PHP)",
|
||||
"ext-imagick" : "Generation of thumbs from PDF",
|
||||
"ext-mcrypt" : "(Required but maybe built-in PHP)",
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
"npm": ">=5.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"zapier-platform-core": "11.3.1"
|
||||
"zapier-platform-core": "15.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "^5.2.0",
|
||||
|
|
|
|||
|
|
@ -152,14 +152,13 @@ fi
|
|||
|
||||
if [ "x${demopasshash}" != "xpassword_hash" ]
|
||||
then
|
||||
echo '<?php echo MD5("$demopass"); ?>' > /tmp/tmp.php
|
||||
echo '<?php echo MD5("'$demopass'"); ?>' > /tmp/tmp.php
|
||||
newpass=`php -f /tmp/tmp.php`
|
||||
rm /tmp/tmp.php
|
||||
else
|
||||
echo '<?php echo password_hash("'$demopass'", PASSWORD_DEFAULT); ?>' > /tmp/tmp.php
|
||||
newpass=`php -f /tmp/tmp.php`
|
||||
rm /tmp/tmp.php
|
||||
fi
|
||||
#rm /tmp/tmp.php
|
||||
|
||||
echo "echo \"UPDATE llx_user SET pass_crypted = '$newpass' WHERE login = '$demologin';\" | mysql -P$port $base"
|
||||
echo "UPDATE llx_user SET pass_crypted = '$newpass' WHERE login = '$demologin';" | mysql -P$port $base
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -13,7 +13,7 @@
|
|||
# fail2ban-client status web-accesslog-limit403
|
||||
#
|
||||
# To test rule file on a existing log file
|
||||
# fail2ban-regex /var/log/apache2/access.log /etc/fail2ban/filter.d/web-accesslog-limit403.conf
|
||||
# fail2ban-regex /var/log/apache2/access.log /etc/fail2ban/filter.d/web-accesslog-limit403.conf --print-all-matched
|
||||
|
||||
failregex = <HOST> - - .*HTTP/[0-9]+(.[0-9]+)?" 403
|
||||
ignoreregex =
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
# fail2ban-client status web-dolibarr-limitpublic
|
||||
#
|
||||
# To test rule file on a existing log file
|
||||
# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-limitpublic.conf
|
||||
# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-limitpublic.conf --print-all-matched
|
||||
|
||||
failregex = ^ [A-Z\s]+ <HOST>\s+--- Access to .*/public/
|
||||
ignoreregex =
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
# fail2ban-client status web-dolibarr-rulesbruteforce
|
||||
#
|
||||
# To test rule file on a existing log file
|
||||
# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf
|
||||
# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf --print-all-matched
|
||||
|
||||
failregex = ^ [A-Z\s]+ <HOST>\s+functions_dolibarr::check_user_password_.* Authentication KO
|
||||
failregex = ^ [A-Z\s]+ <HOST>\s+functions_.*::check_user_.* Authentication KO
|
||||
ignoreregex =
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
# fail2ban-client status web-dolibarr-rulespassforgotten
|
||||
#
|
||||
# To test rule file on a existing log file
|
||||
# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf
|
||||
# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-rulespassforgotten.conf --print-all-matched
|
||||
|
||||
failregex = ^ [A-Z\s]+ <HOST>\s+--- Access to .*/passwordforgotten.php - action=buildnewpassword
|
||||
ignoreregex =
|
||||
|
|
|
|||
|
|
@ -2,6 +2,35 @@
|
|||
# Examle of rule you can add to fail2ban to restrict bruteforce attacks.
|
||||
#
|
||||
|
||||
|
||||
[web-accesslog-limit403]
|
||||
|
||||
; rule against call of 403 forbidden access
|
||||
; note: you must change the path of log file to the one of the web server for the virtual host of the Dolibarr
|
||||
enabled = true
|
||||
port = http,https
|
||||
filter = web-accesslog-limit403
|
||||
logpath = /var/log/apache2/access.log
|
||||
;logpath = /var/log/apache2/other_vhosts_access.log
|
||||
action = %(action_mw)s
|
||||
bantime = 4320000 ; 50 days
|
||||
findtime = 86400 ; 1 day
|
||||
maxretry = 100
|
||||
|
||||
|
||||
[web-dol-bruteforce]
|
||||
|
||||
; rule against bruteforce hacking (login + api)
|
||||
enabled = true
|
||||
port = http,https
|
||||
filter = web-dolibarr-rulesbruteforce
|
||||
logpath = /mypath/documents/documents/dolibarr.log
|
||||
action = %(action_mw)s
|
||||
bantime = 86400 ; 1 day
|
||||
findtime = 14400 ; 4 hours
|
||||
maxretry = 20
|
||||
|
||||
|
||||
[web-dol-passforgotten]
|
||||
|
||||
; rule against call of passwordforgottenpage
|
||||
|
|
@ -15,23 +44,10 @@ findtime = 86400 ; 1 day
|
|||
maxretry = 10
|
||||
|
||||
|
||||
[web-dol-bruteforce]
|
||||
|
||||
; rule against bruteforce hacking (login + api)
|
||||
enabled = true
|
||||
port = http,https
|
||||
filter = web-dolibarr-rulesbruteforce
|
||||
logpath = /mypath/documents/documents/dolibarr.log
|
||||
action = %(action_mw)s
|
||||
bantime = 86400 ; 1 day
|
||||
findtime = 3600 ; 1 hour
|
||||
maxretry = 10
|
||||
|
||||
|
||||
[web-dol-limitpublic]
|
||||
|
||||
; rule to add rate limit on some public pages
|
||||
; note you must keep enough for public access like agenda export, emailing trackers, stripe ipn access, ...
|
||||
; note: you must keep enough for public access like agenda export, emailing trackers, stripe ipn access, ...
|
||||
enabled = true
|
||||
port = http,https
|
||||
filter = web-dolibarr-limitpublic
|
||||
|
|
|
|||
|
|
@ -45,12 +45,11 @@ if [ "$FILES" != "" ]
|
|||
then
|
||||
echo "Running PHPCS Code Sniffer..."
|
||||
|
||||
#~/vendor/bin/phpcs --version
|
||||
#phpcs --standard=PSR2 --encoding=utf-8 -n -p $FILES
|
||||
# Check Dolibarr standard
|
||||
${DIRPHPCS}phpcs -s -p -d memory_limit=-1 --parallel=2 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
|
||||
# Check your own standard
|
||||
#${DIRPHPCS}phpcs -s -p -d memory_limit=-1 --parallel=2 --extensions=php --colors --tab-width=4 --standard=htdocs/custom/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
|
||||
|
||||
# Check a common standard
|
||||
#${DIRPHPCS}phpcs -s -p -d memory_limit=-1 --parallel=2 --extensions=php --colors --tab-width=4 --standard=PSR2 --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
|
||||
|
||||
result2=$?
|
||||
|
||||
|
|
@ -60,7 +59,9 @@ then
|
|||
if [ "x$AUTOFIX" != "x0" ]
|
||||
then
|
||||
${DIRPHPCS}phpcbf -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
|
||||
|
||||
#${DIRPHPCS}phpcbf -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=htdocs/custom/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
|
||||
|
||||
echo "Found some errors in syntax rules. An automatic fix has been applied. Check it before commit." 1>&2;
|
||||
exit 1
|
||||
else
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ QODANA TUTO
|
|||
This README explains how to use qodana to generate static analytics reports on the code
|
||||
|
||||
Install docker
|
||||
apt install docker
|
||||
|
||||
|
||||
Install qodana
|
||||
|
||||
Install qodana into ~/.loca/bin/qodana
|
||||
curl -fsSL https://jb.gg/qodana-cli/install | bash
|
||||
|
||||
To run inspection on CLI
|
||||
cd ~/git/dirtoscan
|
||||
|
|
|
|||
15
dev/setup/sonarqube/README.md
Normal file
15
dev/setup/sonarqube/README.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
= Install SonarQube locally
|
||||
|
||||
Check you are using Install Java SDK 17
|
||||
java --version must show 61
|
||||
|
||||
To install java sdk 17 on ubuntu:
|
||||
sudo apt update
|
||||
sudo apt install -y openjdk-17-jdk
|
||||
|
||||
Unzip the sonar package into a directory
|
||||
|
||||
Edit the file conf/sonar.properties to modify port 9000 and 9001 (already used by Eclipse or xdebug) into 9080 and 9081
|
||||
|
||||
Launch sonar with
|
||||
bin/linux*/sonar.sh console
|
||||
354
dev/tools/apstats.php
Executable file
354
dev/tools/apstats.php
Executable file
|
|
@ -0,0 +1,354 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/tools/apstats.php
|
||||
* \brief Script to report Advanced Statistics on a coding project
|
||||
*/
|
||||
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path = dirname(__FILE__) . '/';
|
||||
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n";
|
||||
exit();
|
||||
}
|
||||
|
||||
error_reporting(E_ALL & ~ E_DEPRECATED);
|
||||
define('PRODUCT', "apstats");
|
||||
define('VERSION', "1.0");
|
||||
|
||||
|
||||
print '***** '.constant('PRODUCT').' - '.constant('VERSION').' *****'."\n";
|
||||
if (empty($argv[1])) {
|
||||
print 'You must run this tool being into the root of the project.'."\n";
|
||||
print 'Usage: '.constant('PRODUCT').'.php pathto/index.html [--dir-scc=pathtoscc] [--dir-phpstan=pathtophpstan]'."\n";
|
||||
print 'Example: '.constant('PRODUCT').'.php dev/tools/apstats.php documents/apstats/index.html --dir-scc=/snap/bin --dir-phpstan=~/git/phpstan/htdocs/includes/bin';
|
||||
exit(0);
|
||||
}
|
||||
|
||||
$outputpath = $argv[1];
|
||||
$outputdir = dirname($outputpath);
|
||||
$outputfile = basename($outputpath);
|
||||
|
||||
if (! is_dir($outputdir)) {
|
||||
print 'Error: dir '.$outputdir.' does not exists or is not writable'."\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$dirscc = '';
|
||||
$dirphpstan = '';
|
||||
|
||||
$i = 0;
|
||||
while ($i < $argc) {
|
||||
$reg = array();
|
||||
if (preg_match('/--dir-scc=(.*)$/', $argv[$i], $reg)) {
|
||||
$dirscc = $reg[1];
|
||||
}
|
||||
if (preg_match('/--dir-phpstan=(.*)$/', $argv[$i], $reg)) {
|
||||
$dirphpstan = $reg[1];
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
// Count lines of code of Dolibarr itself
|
||||
/*
|
||||
$commandcheck = 'cloc . --exclude-dir=includes --exclude-dir=custom --ignore-whitespace --vcs=git';
|
||||
$resexec = shell_exec($commandcheck);
|
||||
$resexec = (int) (empty($resexec) ? 0 : trim($resexec));
|
||||
|
||||
|
||||
// Count lines of code of external dependencies
|
||||
$commandcheck = 'cloc htdocs/includes --ignore-whitespace --vcs=git';
|
||||
$resexec = shell_exec($commandcheck);
|
||||
$resexec = (int) (empty($resexec) ? 0 : trim($resexec));
|
||||
*/
|
||||
|
||||
// Count lines of code of application
|
||||
$commandcheck = ($dirscc ? $dirscc.'/' : '').'scc . --exclude-dir=includes,custom';
|
||||
print 'Execute SCC to count lines of code in project: '.$commandcheck."\n";
|
||||
$output_arrproj = array();
|
||||
$resexecproj = 0;
|
||||
exec($commandcheck, $output_arrproj, $resexecproj);
|
||||
|
||||
|
||||
// Count lines of code of dependencies
|
||||
$commandcheck = ($dirscc ? $dirscc.'/' : '').'scc htdocs/includes';
|
||||
print 'Execute SCC to count lines of code in dependencies: '.$commandcheck."\n";
|
||||
$output_arrdep = array();
|
||||
$resexecdep = 0;
|
||||
exec($commandcheck, $output_arrdep, $resexecdep);
|
||||
|
||||
|
||||
// Get technical debt
|
||||
$commandcheck = ($dirphpstan ? $dirphpstan.'/' : '').'phpstan -v analyze -a build/phpstan/bootstrap.php --memory-limit 5G --error-format=github';
|
||||
print 'Execute PHPStan to get the technical debt: '.$commandcheck."\n";
|
||||
$output_arrtd = array();
|
||||
$resexectd = 0;
|
||||
exec($commandcheck, $output_arrtd, $resexectd);
|
||||
|
||||
$arrayoflineofcode = array();
|
||||
$arraycocomo = array();
|
||||
$arrayofmetrics = array(
|
||||
'proj'=>array('Bytes'=>0, 'Files'=>0, 'Lines'=>0, 'Blanks'=>0, 'Comments'=>0, 'Code'=>0, 'Complexity'=>0),
|
||||
'dep'=>array('Bytes'=>0, 'Files'=>0, 'Lines'=>0, 'Blanks'=>0, 'Comments'=>0, 'Code'=>0, 'Complexity'=>0)
|
||||
);
|
||||
|
||||
// Analyse $output_arrproj
|
||||
foreach (array('proj', 'dep') as $source) {
|
||||
print 'Analyze SCC result for lines of code for '.$source."\n";
|
||||
if ($source == 'proj') {
|
||||
$output_arr = &$output_arrproj;
|
||||
} elseif ($source == 'dep') {
|
||||
$output_arr = &$output_arrdep;
|
||||
} else {
|
||||
print 'Bad value for $source';
|
||||
die();
|
||||
}
|
||||
|
||||
foreach ($output_arr as $line) {
|
||||
if (preg_match('/^(───|Language|Total)/', $line)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//print $line."<br>\n";
|
||||
|
||||
if (preg_match('/^Estimated Cost.*\$(.*)/i', $line, $reg)) {
|
||||
$arraycocomo[$source]['currency'] = preg_replace('/[^\d\.]/', '', str_replace(array(',', ' '), array('', ''), $reg[1]));
|
||||
}
|
||||
if (preg_match('/^Estimated Schedule Effort.*\s([\d\s,]+)/i', $line, $reg)) {
|
||||
$arraycocomo[$source]['effort'] = str_replace(array(',', ' '), array('.', ''), $reg[1]);
|
||||
}
|
||||
if (preg_match('/^Estimated People.*\s([\d\s,]+)/i', $line, $reg)) {
|
||||
$arraycocomo[$source]['people'] = str_replace(array(',', ' '), array('.', ''), $reg[1]);
|
||||
}
|
||||
if (preg_match('/^Processed\s(\d+)\s/i', $line, $reg)) {
|
||||
$arrayofmetrics[$source]['Bytes'] = $reg[1];
|
||||
}
|
||||
|
||||
if (preg_match('/^(.*)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)$/', $line, $reg)) {
|
||||
$arrayoflineofcode[$source][$reg[1]]['Files'] = $reg[2];
|
||||
$arrayoflineofcode[$source][$reg[1]]['Lines'] = $reg[3];
|
||||
$arrayoflineofcode[$source][$reg[1]]['Blanks'] = $reg[4];
|
||||
$arrayoflineofcode[$source][$reg[1]]['Comments'] = $reg[5];
|
||||
$arrayoflineofcode[$source][$reg[1]]['Code'] = $reg[6];
|
||||
$arrayoflineofcode[$source][$reg[1]]['Complexity'] = $reg[7];
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($arrayoflineofcode[$source])) {
|
||||
foreach ($arrayoflineofcode[$source] as $key => $val) {
|
||||
$arrayofmetrics[$source]['Files'] += $val['Files'];
|
||||
$arrayofmetrics[$source]['Lines'] += $val['Lines'];
|
||||
$arrayofmetrics[$source]['Blanks'] += $val['Blanks'];
|
||||
$arrayofmetrics[$source]['Comments'] += $val['Comments'];
|
||||
$arrayofmetrics[$source]['Code'] += $val['Code'];
|
||||
$arrayofmetrics[$source]['Complexity'] += $val['Complexity'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$html = '<html>';
|
||||
$html .= '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css" integrity="sha512-q3eWabyZPc1XTCmF+8/LuE1ozpg5xxn7iO89yfSOd5/oKvyqLngoNGsx8jq92Y8eXJ/IRxQbEC+FGSYxtk2oiw==" crossorigin="anonymous" referrerpolicy="no-referrer" />';
|
||||
$html .= '<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js" integrity="sha512-3gJwYpMe3QewGELv8k/BX9vcqhryRdzRMxVfq6ngyWXwo03GFEzjsUm8Q7RZcHPHksttq7/GFoxjCVUjkjvPdw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>';
|
||||
$html .= '
|
||||
<style>
|
||||
body {
|
||||
margin: 10px;
|
||||
margin-left: 50px;
|
||||
margin-right: 50px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.5em;
|
||||
font-weight: bold;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
header {
|
||||
text-align: center;
|
||||
}
|
||||
header, section.chapter {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
th,td {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
.left {
|
||||
text-align: left;
|
||||
}
|
||||
.right {
|
||||
text-align: right;
|
||||
}
|
||||
.opacity {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.centpercent {
|
||||
width: 100%;
|
||||
}
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
.trgroup {
|
||||
background-color: #EEE;
|
||||
}
|
||||
</style>';
|
||||
|
||||
$html .= '<body>';
|
||||
|
||||
$html .= '<header>';
|
||||
$html .= '<h1>Advanced Project Statistics</h1>';
|
||||
$currentDate = date("Y-m-d H:i:s"); // Format: Year-Month-Day Hour:Minute:Second
|
||||
$html .= '<span class="opacity">Generated on '.$currentDate.'</span>';
|
||||
$html .= '</header>';
|
||||
|
||||
$html .= '<section class="chapter">';
|
||||
$html .= '<h2>Lines of code</h2>';
|
||||
$html .= '<table class="centpercent">';
|
||||
$html .= '<tr class="loc">';
|
||||
$html .= '<th class="left">Language</td>';
|
||||
$html .= '<th class="right">Bytes</th>';
|
||||
$html .= '<th class="right">Files</th>';
|
||||
$html .= '<th class="right">Lines</th>';
|
||||
$html .= '<th class="right">Blanks</th>';
|
||||
$html .= '<th class="right">Comments</th>';
|
||||
$html .= '<th class="right">Code</th>';
|
||||
//$html .= '<td class="right">'.$val['Complexity'].'</td>';
|
||||
$html .= '</th>';
|
||||
foreach (array('proj', 'dep') as $source) {
|
||||
$html .= '<tr class="trgroup" id="source'.$source.'">';
|
||||
if ($source == 'proj') {
|
||||
$html .= '<td>All files from project only';
|
||||
} elseif ($source == 'dep') {
|
||||
$html .= '<td>All files from dependencies';
|
||||
}
|
||||
$html .= ' <span class="seedetail" data-source="'.$source.'">(See detail per file type...)</span>';
|
||||
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Bytes']).'</td>';
|
||||
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Files']).'</td>';
|
||||
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Lines']).'</td>';
|
||||
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Blanks']).'</td>';
|
||||
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Comments']).'</td>';
|
||||
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Code']).'</td>';
|
||||
$html .= '<td>TODO graph here...</td>';
|
||||
$html .= '</tr>';
|
||||
if (!empty($arrayoflineofcode[$source])) {
|
||||
foreach ($arrayoflineofcode[$source] as $key => $val) {
|
||||
$html .= '<tr class="loc hidden source'.$source.' language'.str_replace(' ', '', $key).'">';
|
||||
$html .= '<td>'.$key.'</td>';
|
||||
$html .= '<td class="right"></td>';
|
||||
$html .= '<td class="right">'.(empty($val['Files']) ? '' : formatNumber($val['Files'])).'</td>';
|
||||
$html .= '<td class="right">'.(empty($val['Lines']) ? '' : formatNumber($val['Lines'])).'</td>';
|
||||
$html .= '<td class="right">'.(empty($val['Blanks']) ? '' : formatNumber($val['Blanks'])).'</td>';
|
||||
$html .= '<td class="right">'.(empty($val['Comments']) ? '' : formatNumber($val['Comments'])).'</td>';
|
||||
$html .= '<td class="right">'.(empty($val['Code']) ? '' : formatNumber($val['Code'])).'</td>';
|
||||
//$html .= '<td class="right">'.(empty($val['Complexity']) ? '' : $val['Complexity']).'</td>';
|
||||
$html .= '<td>TODO graph here...</td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$html .= '<tr class="trgroup">';
|
||||
$html .= '<td class="left">Total</td>';
|
||||
$html .= '<td class="right">'.formatNumber($arrayofmetrics['proj']['Bytes'] + $arrayofmetrics['dep']['Bytes']).'</td>';
|
||||
$html .= '<td class="right">'.formatNumber($arrayofmetrics['proj']['Files'] + $arrayofmetrics['dep']['Files']).'</td>';
|
||||
$html .= '<td class="right">'.formatNumber($arrayofmetrics['proj']['Lines'] + $arrayofmetrics['dep']['Lines']).'</td>';
|
||||
$html .= '<td class="right">'.formatNumber($arrayofmetrics['proj']['Blanks'] + $arrayofmetrics['dep']['Blanks']).'</td>';
|
||||
$html .= '<td class="right">'.formatNumber($arrayofmetrics['proj']['Comments'] + $arrayofmetrics['dep']['Comments']).'</td>';
|
||||
$html .= '<td class="right">'.formatNumber($arrayofmetrics['proj']['Code'] + $arrayofmetrics['dep']['Code']).'</td>';
|
||||
//$html .= '<td>'.$arrayofmetrics['Complexity'].'</td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '</tr>';
|
||||
$html .= '</table>';
|
||||
|
||||
$html .= '</section>';
|
||||
|
||||
$html .= '<section class="chapter">';
|
||||
$html .= '<h2>Project value</h2><br>';
|
||||
$html .= 'COCOMO (Basic organic model) value: $';
|
||||
$html .= formatNumber($arraycocomo['proj']['currency'] + $arraycocomo['dep']['currency'], 2);
|
||||
$html .= '<br>';
|
||||
$html .= 'COCOMO (Basic organic model) effort: ';
|
||||
$html .= formatNumber($arraycocomo['proj']['people'] * $arraycocomo['proj']['effort'] + $arraycocomo['dep']['people'] * $arraycocomo['dep']['effort']);
|
||||
$html .= ' monthes people<br>';
|
||||
$html .= '</section>';
|
||||
|
||||
$html .= '<section class="chapter">';
|
||||
$html .= '<h2>Technical debt ('.count($output_arrtd).')</h2><br>';
|
||||
$html .= join('<br>'."\n", $output_arrtd);
|
||||
$html .= '</section>';
|
||||
|
||||
$html .= '
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$( ".seedetail" ).on( "click", function() {
|
||||
var source = $(this).attr("data-source");
|
||||
console.log("Click on "+source);
|
||||
jQuery(".source"+source).toggle();
|
||||
} );
|
||||
});
|
||||
</script>
|
||||
';
|
||||
$html .= '</boby>';
|
||||
$html .= '</html>';
|
||||
|
||||
$fh = fopen($outputpath, 'w');
|
||||
if ($fh) {
|
||||
fwrite($fh, $html);
|
||||
fclose($fh);
|
||||
|
||||
print 'Generation of output file '.$outputfile.' done.'."\n";
|
||||
} else {
|
||||
print 'Failed to open '.$outputfile.' for ouput.'."\n";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* function to format a number
|
||||
*
|
||||
* @param string|int $number Number to format
|
||||
* @param int $nbdec Number of decimal digits
|
||||
* @return string Formated string
|
||||
*/
|
||||
function formatNumber($number, $nbdec = 0)
|
||||
{
|
||||
return number_format($number, 0, '.', ' ');
|
||||
}
|
||||
|
|
@ -22,8 +22,8 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* \file dev/tools/dolibarr-postgres2mysql.php
|
||||
* \brief Script to migrate a postgresql dump into a mysql dump
|
||||
* \file dev/tools/dolibarr-postgres2mysql.php
|
||||
* \brief Script to migrate a postgresql dump into a mysql dump
|
||||
*/
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
|
|
@ -67,8 +67,8 @@ XHTML;
|
|||
/**
|
||||
* getfieldname
|
||||
*
|
||||
* @param string $l String
|
||||
* @return string|null Field name
|
||||
* @param string $l String
|
||||
* @return string|null Field name
|
||||
*/
|
||||
function getfieldname($l)
|
||||
{
|
||||
|
|
@ -94,8 +94,8 @@ function getfieldname($l)
|
|||
/**
|
||||
* formatsize
|
||||
*
|
||||
* @param string $s Size to format
|
||||
* @return string Formated size
|
||||
* @param string $s Size to format
|
||||
* @return string Formated size
|
||||
*/
|
||||
function formatsize($s)
|
||||
{
|
||||
|
|
@ -113,9 +113,9 @@ function formatsize($s)
|
|||
/**
|
||||
* pg2mysql_large
|
||||
*
|
||||
* @param string $infilename Input filename
|
||||
* @param string $outfilename Output filename
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
* @param string $infilename Input filename
|
||||
* @param string $outfilename Output filename
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function pg2mysql_large($infilename, $outfilename)
|
||||
{
|
||||
|
|
@ -234,10 +234,10 @@ function pg2mysql_large($infilename, $outfilename)
|
|||
/**
|
||||
* pg2mysql
|
||||
*
|
||||
* @param array $input Array of input
|
||||
* @param array $arrayofprimaryalreadyintabledef Array of table already output with a primary key set into definition
|
||||
* @param boolean $header Boolean
|
||||
* @return string[] Array of output
|
||||
* @param array $input Array of input
|
||||
* @param array $arrayofprimaryalreadyintabledef Array of table already output with a primary key set into definition
|
||||
* @param boolean $header Boolean
|
||||
* @return string[] Array of output
|
||||
*/
|
||||
function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,21 +10,21 @@
|
|||
# Syntax
|
||||
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
|
||||
then
|
||||
echo "This script detect or clean files with CR+LF into files with LF only. All source files are included, also files into includes."
|
||||
echo "This script detect or clean files with CR+LF into files with LF only. All source files are included, including files into includes."
|
||||
echo "Usage: fixdosfiles.sh [list|fix]"
|
||||
fi
|
||||
|
||||
# To detec
|
||||
if [ "x$1" = "xlist" ]
|
||||
then
|
||||
find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v "CRLF" | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF
|
||||
find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF
|
||||
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v "CRLF" | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep -v 'htdocs\/includes' | grep CRLF
|
||||
fi
|
||||
|
||||
# To convert
|
||||
if [ "x$1" = "xfix" ]
|
||||
then
|
||||
for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v "CRLF" | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF | awk -F':' '{ print $1 }' `
|
||||
for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF | awk -F':' '{ print $1 }' `
|
||||
do
|
||||
echo "Fix file $fic"
|
||||
dos2unix "$fic"
|
||||
|
|
|
|||
20
dev/tools/fixhasRights.sh
Executable file
20
dev/tools/fixhasRights.sh
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
#/bin/bash
|
||||
#
|
||||
# Example of script to fix code writing of permissions
|
||||
#
|
||||
|
||||
for f in $(grep -l -e 'user->rights' -R); do
|
||||
sed -i -r 's/!empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\) *\? *\$user->rights->\1->\2->\3 *: *0;/$user->hasRight("\1", "\2", "\3");/' $f
|
||||
sed -i -r 's/ empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\) *\? *0 *: *\$user->rights->\1->\2->\3;/ !$user->hasRight("\1", "\2", "\3");/' $f
|
||||
sed -i -r 's/!empty\((DolibarrApiAccess::)\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\)/\1$user->hasRight("\2", "\3", "\4")/g' $f
|
||||
sed -i -r 's/!empty\((DolibarrApiAccess::)\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)\)/\1$user->hasRight("\2", "\3")/g' $f
|
||||
sed -i -r 's/empty\((DolibarrApiAccess::)\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\)/!\1$user->hasRight("\2", "\3", "\4")/g' $f
|
||||
sed -i -r 's/empty\((DolibarrApiAccess::)\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)\)/!\1$user->hasRight("\2", "\3")/g' $f
|
||||
sed -i -r 's/!empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\)/$user->hasRight("\1", "\2", "\3")/g' $f
|
||||
sed -i -r 's/!empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)\)/$user->hasRight("\1", "\2")/g' $f
|
||||
sed -i -r 's/empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)->([_a-z0-9]+)\)/!$user->hasRight("\1", "\2", "\3")/g' $f
|
||||
sed -i -r 's/empty\(\$user->rights->([_a-z0-9]+)->([_a-z0-9]+)\)/!$user->hasRight("\1", "\2")/g' $f
|
||||
sed -i -r 's/\$user->rights\??->([_a-z0-9]+)\??->([_a-z0-9]+)\??->([_a-z0-9]+)/$user->hasRight("\1", "\2", "\3")/g' $f
|
||||
sed -i -r 's/\$user->rights\??->([_a-z0-9]+)\??->([_a-z0-9]+)/$user->hasRight("\1", "\2")/g' $f
|
||||
done
|
||||
|
||||
|
|
@ -3,8 +3,8 @@
|
|||
# Count number of commits per user and per versions (using date for version detection)
|
||||
#
|
||||
|
||||
Releases=("16.0" "develop")
|
||||
Dates=("2022-01-01" "2022-08-31" "2050-01-01")
|
||||
Releases=("17.0" "18.0" "develop")
|
||||
Dates=("2023-02-01" "2023-08-31" "2050-01-01")
|
||||
let "counter = 1"
|
||||
|
||||
for i in "${Releases[@]}"
|
||||
|
|
|
|||
|
|
@ -4,13 +4,17 @@
|
|||
#
|
||||
|
||||
if [ "x$2" = "x" ]; then
|
||||
echo "Usage: $0 tagnamestart|START tagnameend|HEAD"
|
||||
echo "Usage: $0 origin/branchstart|tagnamestart|START origin/branchend|tagnameend|HEAD"
|
||||
exit
|
||||
fi
|
||||
|
||||
START=$1
|
||||
if [ "x$START" = "xSTART" ]; then
|
||||
START=""
|
||||
fi
|
||||
|
||||
echo "git log $1..$2 --shortstat | grep ... | perl ... > /tmp/github_lines_perusers.tmp"
|
||||
git log $1..$2 --shortstat | grep -e 'Author:' -e 'Date:' -e ' changed' -e ' insertion' -e ' deletion' | perl -n -e '/^(.*)$/; $line = $1; if ($line =~ /(changed|insertion|deletion)/) { $line =~ s/[^0-9\s]//g; my @arr=split /\s+/, $line; $tot=0; for (1..@arr) { $tot += $arr[$_]; }; print $tot."\n"; } else { print $line."\n"; };' > /tmp/github_lines_perusers.tmp
|
||||
echo "git log $START..$2 --shortstat | grep ... | perl ... > /tmp/github_lines_perusers.tmp"
|
||||
git log $START..$2 --shortstat | grep -e 'Author:' -e 'Date:' -e ' changed' -e ' insertion' -e ' deletion' | perl -n -e '/^(.*)$/; $line = $1; if ($line =~ /(changed|insertion|deletion)/) { $line =~ s/[^0-9\s]//g; my @arr=split /\s+/, $line; $tot=0; for (1..@arr) { $tot += $arr[$_]; }; print $tot."\n"; } else { print $line."\n"; };' > /tmp/github_lines_perusers.tmp
|
||||
|
||||
cat /tmp/github_lines_perusers.tmp | awk 'BEGIN { FS="\n"; print "user and nb of lines"; lastuser=""; } { if ($1 ~ /Author:/) { lastuser=$1 }; if ($1 ~ /^[0-9]+$/) { aaa[lastuser]+=$1; } } END { for (var in aaa) print var," ",aaa[var]; } '
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* \file dev/tools/spider.php
|
||||
* \brief Script to spider Dolibarr app.
|
||||
* \file dev/tools/spider.php
|
||||
* \brief Script to spider Dolibarr app.
|
||||
*
|
||||
* To use it:
|
||||
* - Disable module "bookmark"
|
||||
|
|
@ -29,9 +29,9 @@ const MAX_DEPTH=2;
|
|||
|
||||
|
||||
/**
|
||||
* @param string $url URL
|
||||
* @param string $depth Depth
|
||||
* @return string String
|
||||
* @param string $url URL
|
||||
* @param string $depth Depth
|
||||
* @return string String
|
||||
*/
|
||||
function followLink($url, $depth = 0)
|
||||
{
|
||||
|
|
@ -68,23 +68,24 @@ function followLink($url, $depth = 0)
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $site Site
|
||||
* @param string $path Path
|
||||
* @return string String
|
||||
* @param string $site Site
|
||||
* @param string $path Path
|
||||
* @return string String
|
||||
*/
|
||||
function convertLink($site, $path)
|
||||
{
|
||||
if (substr_compare($path, "//", 0, 2)==0)
|
||||
return parse_url($site)['scheme'].$path;
|
||||
elseif (substr_compare($path, "http://", 0, 7)==0 or
|
||||
substr_compare($path, "https://", 0, 8)==0 or
|
||||
substr_compare($path, "www.", 0, 4)==0)
|
||||
elseif (substr_compare($path, "http://", 0, 7)==0
|
||||
or substr_compare($path, "https://", 0, 8)==0
|
||||
or substr_compare($path, "www.", 0, 4)==0
|
||||
)
|
||||
return $path;
|
||||
else return $site.'/'.$path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $url URL
|
||||
* @param string $url URL
|
||||
* @return boolean
|
||||
*/
|
||||
function ignoreLink($url)
|
||||
|
|
@ -93,10 +94,10 @@ function ignoreLink($url)
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $link URL
|
||||
* @param string $title Title
|
||||
* @param string $metaData Array
|
||||
* @param int $depth Depth
|
||||
* @param string $link URL
|
||||
* @param string $title Title
|
||||
* @param string $metaData Array
|
||||
* @param int $depth Depth
|
||||
* @return void
|
||||
*/
|
||||
function insertIntoDatabase($link, $title, &$metaData, $depth)
|
||||
|
|
@ -109,9 +110,9 @@ function insertIntoDatabase($link, $title, &$metaData, $depth)
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $doc Doc
|
||||
* @param string $url URL
|
||||
* @return string URL/Title
|
||||
* @param string $doc Doc
|
||||
* @param string $url URL
|
||||
* @return string URL/Title
|
||||
*/
|
||||
function getDocTitle(&$doc, $url)
|
||||
{
|
||||
|
|
@ -123,8 +124,8 @@ function getDocTitle(&$doc, $url)
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $doc Doc
|
||||
* @return array Array
|
||||
* @param string $doc Doc
|
||||
* @return array Array
|
||||
*/
|
||||
function getDocMetaData(&$doc)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ class Aaa
|
|||
|
||||
/**
|
||||
* do
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function do()
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ $globalbbb = 'globalbbb';
|
|||
|
||||
/**
|
||||
* fbbb
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function fbbb()
|
||||
|
|
@ -21,6 +22,7 @@ class Bbb
|
|||
|
||||
/**
|
||||
* do
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function do()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//use \Aaa as Aaa;
|
||||
|
||||
use Dolibarr\Aaa as Aaa;
|
||||
use function Dolibarr\faaa as faaa; // Need php 5.6+
|
||||
use function Dolibarr\faaa as faaa; // Need php 5.6+
|
||||
|
||||
//use const Dolibarr\AAA;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,10 +21,11 @@
|
|||
|
||||
/**
|
||||
* Creates an example PDF TEST document using TCPDF
|
||||
* @package com.tecnick.tcpdf
|
||||
*
|
||||
* @package com.tecnick.tcpdf
|
||||
* @abstract TCPDF - Example: Document Encryption / Security
|
||||
* @author Nicola Asuni
|
||||
* @since 2008-03-04
|
||||
* @author Nicola Asuni
|
||||
* @since 2008-03-04
|
||||
*/
|
||||
|
||||
require_once '../../htdocs/includes/tecnickcom/tcpdf/config/tcpdf_config.php';
|
||||
|
|
|
|||
|
|
@ -38,13 +38,14 @@ print 'Files has been created. Check its name from your explorer'."\n";
|
|||
|
||||
/**
|
||||
* Creates an example PDF TEST document using TCPDF
|
||||
* @package com.tecnick.tcpdf
|
||||
* @abstract TCPDF - Example: CID-0 CJK unembedded font
|
||||
* @author Nicola Asuni
|
||||
*
|
||||
* @package com.tecnick.tcpdf
|
||||
* @abstract TCPDF - Example: CID-0 CJK unembedded font
|
||||
* @author Nicola Asuni
|
||||
* @copyright 2004-2009 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
|
||||
* @link http://tcpdf.org
|
||||
* @license https://www.gnu.org/copyleft/lesser.html LGPL
|
||||
* @since 2008-09-15
|
||||
* @link http://tcpdf.org
|
||||
* @license https://www.gnu.org/copyleft/lesser.html LGPL
|
||||
* @since 2008-09-15
|
||||
*/
|
||||
|
||||
require_once '../../htdocs/includes/tecnickcom/tcpdf/config/tcpdf_config.php';
|
||||
|
|
|
|||
|
|
@ -62,5 +62,5 @@ fi
|
|||
|
||||
echo Think to launch also:
|
||||
echo "> dev/tools/fixaltlanguages.sh fix all"
|
||||
echo "For v11: Replace also regex \(.*(sponge|cornas|eratosthene|cyan).*\) with '' on *.lang files"
|
||||
#echo "For v11: Replace also regex \(.*(sponge|cornas|eratosthene|cyan).*\) with '' on *.lang files"
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ README (english)
|
|||
User guide
|
||||
--------------------------------
|
||||
|
||||
* All Dolibarr guides are available, on line, on the Dolibarr Web site:
|
||||
* All Dolibarr guides are available, online, on the Dolibarr Websites:
|
||||
|
||||
https://www.dolibarr.org
|
||||
https://wiki.dolibarr.org
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
|||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('accountancy', 'admin', 'bills', 'compta', 'salaries'));
|
||||
|
||||
$mesg = '';
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
|
|
@ -95,7 +94,7 @@ $arrayfields = array(
|
|||
'aa.import_key'=>array('label'=>"ImportId", 'checked'=>-1)
|
||||
);
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
|
||||
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
|
||||
unset($arrayfields['categories']);
|
||||
unset($arrayfields['aa.reconcilable']);
|
||||
}
|
||||
|
|
@ -146,7 +145,7 @@ if (empty($reshook)) {
|
|||
$search_array_options = array();
|
||||
}
|
||||
if ((GETPOST('valid_change_chart', 'alpha') && GETPOST('chartofaccounts', 'int') > 0) // explicit click on button 'Change and load' with js on
|
||||
|| (GETPOST('chartofaccounts', 'int') > 0 && GETPOST('chartofaccounts', 'int') != $conf->global->CHARTOFACCOUNTS)) { // a submit of form is done and chartofaccounts combo has been modified
|
||||
|| (GETPOST('chartofaccounts', 'int') > 0 && GETPOST('chartofaccounts', 'int') != getDolGlobalInt('CHARTOFACCOUNTS'))) { // a submit of form is done and chartofaccounts combo has been modified
|
||||
if ($chartofaccounts > 0 && $permissiontoadd) {
|
||||
// Get language code for this $chartofaccounts
|
||||
$sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_country as c, '.MAIN_DB_PREFIX.'accounting_system as a';
|
||||
|
|
@ -154,7 +153,9 @@ if (empty($reshook)) {
|
|||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$country_code = $obj->code;
|
||||
if ($obj) {
|
||||
$country_code = $obj->code;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
|
@ -228,7 +229,7 @@ if ($action == 'delete') {
|
|||
print $formconfirm;
|
||||
}
|
||||
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
$pcgver = getDolGlobalInt('CHARTOFACCOUNTS');
|
||||
|
||||
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.account_number, aa.account_parent, aa.label, aa.labelshort, aa.fk_accounting_category,";
|
||||
$sql .= " aa.reconcilable, aa.active, aa.import_key,";
|
||||
|
|
@ -240,8 +241,8 @@ $sql .= " WHERE asy.rowid = ".((int) $pcgver);
|
|||
//print $sql;
|
||||
if (strlen(trim($search_account))) {
|
||||
$lengthpaddingaccount = 0;
|
||||
if ($conf->global->ACCOUNTING_LENGTH_GACCOUNT || $conf->global->ACCOUNTING_LENGTH_AACCOUNT) {
|
||||
$lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_GACCOUNT, $conf->global->ACCOUNTING_LENGTH_AACCOUNT);
|
||||
if (getDolGlobalInt('ACCOUNTING_LENGTH_GACCOUNT') || getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) {
|
||||
$lengthpaddingaccount = max(getDolGlobalInt('ACCOUNTING_LENGTH_GACCOUNT'), getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT'));
|
||||
}
|
||||
$search_account_tmp = $search_account;
|
||||
$weremovedsomezero = 0;
|
||||
|
|
@ -260,7 +261,7 @@ if (strlen(trim($search_account))) {
|
|||
$search_account_tmp_clean = $search_account_tmp;
|
||||
$search_account_clean = $search_account;
|
||||
$startchar = '%';
|
||||
if (strpos($search_account_tmp, '^') === 0) {
|
||||
if (substr($search_account_tmp, 0, 1) === '^') {
|
||||
$startchar = '';
|
||||
$search_account_tmp_clean = preg_replace('/^\^/', '', $search_account_tmp);
|
||||
$search_account_clean = preg_replace('/^\^/', '', $search_account);
|
||||
|
|
@ -289,7 +290,7 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
@ -391,11 +392,11 @@ if ($resql) {
|
|||
print '<option value="-1"> </option>';
|
||||
while ($i < $numbis) {
|
||||
$obj = $db->fetch_object($resqlchart);
|
||||
|
||||
print '<option value="'.$obj->rowid.'"';
|
||||
print ($pcgver == $obj->rowid) ? ' selected' : '';
|
||||
print '>'.$obj->pcg_version.' - '.$obj->label.' - ('.$obj->country_code.')</option>';
|
||||
|
||||
if ($obj) {
|
||||
print '<option value="'.$obj->rowid.'"';
|
||||
print ($pcgver == $obj->rowid) ? ' selected' : '';
|
||||
print '>'.$obj->pcg_version.' - '.$obj->label.' - ('.$obj->country_code.')</option>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -296,11 +296,6 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
|
|||
setEventMessages($db->error(), null, 'errors');
|
||||
}
|
||||
}
|
||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||
}
|
||||
|
||||
if (GETPOST('actioncancel', 'alpha')) {
|
||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes') { // delete
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ if ($action == 'add' && $user->hasRight('accounting', 'chartofaccount')) {
|
|||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
|
||||
$action = 'create';
|
||||
} else {
|
||||
$sql = "SELECT pcg_version FROM " . MAIN_DB_PREFIX . "accounting_system WHERE rowid = ".((int) $conf->global->CHARTOFACCOUNTS);
|
||||
$sql = "SELECT pcg_version FROM " . MAIN_DB_PREFIX . "accounting_system WHERE rowid = ".((int) getDolGlobalInt('CHARTOFACCOUNTS'));
|
||||
|
||||
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
|
||||
$result = $db->query($sql);
|
||||
|
|
@ -139,7 +139,7 @@ if ($action == 'add' && $user->hasRight('accounting', 'chartofaccount')) {
|
|||
} else {
|
||||
$result = $object->fetch($id);
|
||||
|
||||
$sql = "SELECT pcg_version FROM ".MAIN_DB_PREFIX."accounting_system WHERE rowid=".((int) $conf->global->CHARTOFACCOUNTS);
|
||||
$sql = "SELECT pcg_version FROM ".MAIN_DB_PREFIX."accounting_system WHERE rowid=".((int) getDolGlobalInt('CHARTOFACCOUNTS'));
|
||||
|
||||
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
|
||||
$result2 = $db->query($sql);
|
||||
|
|
@ -211,7 +211,7 @@ $form = new Form($db);
|
|||
$formaccounting = new FormAccounting($db);
|
||||
|
||||
$accountsystem = new AccountancySystem($db);
|
||||
$accountsystem->fetch($conf->global->CHARTOFACCOUNTS);
|
||||
$accountsystem->fetch(getDolGlobalInt('CHARTOFACCOUNTS'));
|
||||
|
||||
$title = $langs->trans('AccountAccounting')." - ".$langs->trans('Card');
|
||||
|
||||
|
|
|
|||
|
|
@ -78,9 +78,16 @@ if ($mysoc->isInEEC()) {
|
|||
$list_account[] = 'ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT';
|
||||
|
||||
$list_account[] = '---Others---';
|
||||
$list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_VAT_SOLD_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT';
|
||||
|
||||
/*if ($mysoc->useRevenueStamp()) {
|
||||
$list_account[] = 'ACCOUNTING_REVENUESTAMP_SOLD_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_REVENUESTAMP_BUY_ACCOUNT';
|
||||
}*/
|
||||
|
||||
$list_account[] = 'ACCOUNTING_VAT_PAY_ACCOUNT';
|
||||
|
||||
if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
|
||||
$list_account[] = 'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT';
|
||||
$list_account[] = 'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT';
|
||||
|
|
@ -110,6 +117,7 @@ if (isModEnabled('societe')) {
|
|||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'update') {
|
||||
$error = 0;
|
||||
// Process $list_account_main
|
||||
|
|
@ -257,6 +265,8 @@ foreach ($list_account as $key) {
|
|||
print img_picto('', 'payment_vat', 'class="pictofixedwidth"');
|
||||
} elseif (preg_match('/^ACCOUNTING_VAT/', $key)) {
|
||||
print img_picto('', 'vat', 'class="pictofixedwidth"');
|
||||
/*} elseif (preg_match('/^ACCOUNTING_REVENUESTAMP/', $key)) {
|
||||
print img_picto('', 'vat', 'class="pictofixedwidth"');*/
|
||||
} elseif (preg_match('/^ACCOUNTING_ACCOUNT_CUSTOMER/', $key)) {
|
||||
print img_picto('', 'bill', 'class="pictofixedwidth"');
|
||||
} elseif (preg_match('/^LOAN_ACCOUNTING_ACCOUNT/', $key)) {
|
||||
|
|
|
|||
|
|
@ -49,6 +49,18 @@ if (!$sortorder) {
|
|||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin", "compta"));
|
||||
|
||||
$error = 0;
|
||||
$errors = array();
|
||||
|
||||
// List of status
|
||||
static $tmpstatut2label = array(
|
||||
'0' => 'OpenFiscalYear',
|
||||
'1' => 'CloseFiscalYear'
|
||||
);
|
||||
|
||||
$object = new Fiscalyear($db);
|
||||
|
||||
|
||||
// Security check
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
|
|
@ -57,24 +69,6 @@ if (!$user->hasRight('accounting', 'fiscalyear', 'write')) { // If
|
|||
accessforbidden();
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
// List of status
|
||||
static $tmpstatut2label = array(
|
||||
'0' => 'OpenFiscalYear',
|
||||
'1' => 'CloseFiscalYear'
|
||||
);
|
||||
$statut2label = array(
|
||||
''
|
||||
);
|
||||
foreach ($tmpstatut2label as $key => $val) {
|
||||
$statut2label[$key] = $langs->trans($val);
|
||||
}
|
||||
|
||||
$errors = array();
|
||||
|
||||
$object = new Fiscalyear($db);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
|
@ -97,14 +91,14 @@ $help_url = "EN:Module_Double_Entry_Accounting";
|
|||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$sql = "SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut, f.entity";
|
||||
$sql = "SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut as status, f.entity";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_fiscalyear as f";
|
||||
$sql .= " WHERE f.entity = ".$conf->entity;
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
@ -137,14 +131,19 @@ if ($result) {
|
|||
print '<td>'.$langs->trans("DateEnd").'</td>';
|
||||
print '<td class="center">'.$langs->trans("NumberOfAccountancyEntries").'</td>';
|
||||
print '<td class="center">'.$langs->trans("NumberOfAccountancyMovements").'</td>';
|
||||
print '<td class="right">'.$langs->trans("Statut").'</td>';
|
||||
print '<td class="right">'.$langs->trans("Status").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
if ($num) {
|
||||
while ($i < $num && $i < $max) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$fiscalyearstatic->ref = $obj->rowid;
|
||||
$fiscalyearstatic->id = $obj->rowid;
|
||||
$fiscalyearstatic->date_start = $obj->date_start;
|
||||
$fiscalyearstatic->date_end = $obj->date_end;
|
||||
$fiscalyearstatic->statut = $obj->status;
|
||||
$fiscalyearstatic->status = $obj->status;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
|
|
@ -155,12 +154,12 @@ if ($result) {
|
|||
print '<td class="left">'.dol_print_date($db->jdate($obj->date_end), 'day').'</td>';
|
||||
print '<td class="center">'.$object->getAccountancyEntriesByFiscalYear($obj->date_start, $obj->date_end).'</td>';
|
||||
print '<td class="center">'.$object->getAccountancyMovementsByFiscalYear($obj->date_start, $obj->date_end).'</td>';
|
||||
print '<td class="right">'.$fiscalyearstatic->LibStatut($obj->statut, 5).'</td>';
|
||||
print '<td class="right">'.$fiscalyearstatic->LibStatut($obj->status, 5).'</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
print '<tr class="oddeven"><td colspan="7" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
print '<tr class="oddeven"><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ print '</tr>';
|
|||
foreach ($list as $key) {
|
||||
print '<tr class="oddeven value">';
|
||||
|
||||
if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) {
|
||||
if (getDolGlobalInt('ACCOUNTING_MANAGE_ZERO') && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -394,10 +394,10 @@ foreach ($list_binding as $key) {
|
|||
// Value
|
||||
print '<td class="right">';
|
||||
if ($key == 'ACCOUNTING_DATE_START_BINDING') {
|
||||
print $form->selectDate((!empty($conf->global->$key) ? $db->idate($conf->global->$key) : -1), $key, 0, 0, 1);
|
||||
print $form->selectDate((getDolGlobalInt($key) ? (int) getDolGlobalInt($key) : -1), $key, 0, 0, 1);
|
||||
} elseif ($key == 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER') {
|
||||
$array = array(0=>$langs->trans("PreviousMonth"), 1=>$langs->trans("CurrentMonth"), 2=>$langs->trans("Fiscalyear"));
|
||||
print $form->selectarray($key, $array, (isset($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER) ? $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER : 0), 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage');
|
||||
print $form->selectarray($key, $array, getDolGlobalInt('ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER', 0), 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage');
|
||||
} else {
|
||||
print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,11 +52,13 @@ if (!$user->hasRight('accounting', 'bind', 'write')) {
|
|||
// search & action GETPOST
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
$codeventil_buy = GETPOST('codeventil_buy', 'array');
|
||||
$codeventil_sell = GETPOST('codeventil_sell', 'array');
|
||||
$chk_prod = GETPOST('chk_prod', 'array');
|
||||
$default_account = GETPOST('default_account', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$account_number_buy = GETPOST('account_number_buy');
|
||||
$account_number_sell = GETPOST('account_number_sell');
|
||||
$changeaccount = GETPOST('changeaccount', 'array');
|
||||
|
|
@ -78,7 +80,6 @@ $search_onpurchase = GETPOST('search_onpurchase', 'alpha');
|
|||
|
||||
$accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
|
||||
$btn_changetype = GETPOST('changetype', 'alpha');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
if (empty($accounting_product_mode)) {
|
||||
$accounting_product_mode = 'ACCOUNTANCY_SELL';
|
||||
|
|
@ -394,7 +395,7 @@ if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
|||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
@ -467,24 +468,24 @@ if ($resql) {
|
|||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Options').'</td><td>'.$langs->trans('Description').'</td>';
|
||||
print "</tr>\n";
|
||||
print '<tr class="oddeven"><td><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL"'.($accounting_product_mode == 'ACCOUNTANCY_SELL' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSell').'</td>';
|
||||
print '<tr class="oddeven"><td><input type="radio" id="accounting_product_mode1" name="accounting_product_mode" value="ACCOUNTANCY_SELL"'.($accounting_product_mode == 'ACCOUNTANCY_SELL' ? ' checked' : '').'> <label for="accounting_product_mode1">'.$langs->trans('OptionModeProductSell').'</label></td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductSellDesc');
|
||||
print "</td></tr>\n";
|
||||
if ($mysoc->isInEEC()) {
|
||||
print '<tr class="oddeven"><td><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_INTRA"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSellIntra').'</td>';
|
||||
print '<tr class="oddeven"><td><input type="radio" id="accounting_product_mode2" name="accounting_product_mode" value="ACCOUNTANCY_SELL_INTRA"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' ? ' checked' : '').'> <label for="accounting_product_mode2">'.$langs->trans('OptionModeProductSellIntra').'</label></td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductSellIntraDesc');
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
print '<tr class="oddeven"><td><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_EXPORT"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSellExport').'</td>';
|
||||
print '<tr class="oddeven"><td><input type="radio" id="accounting_product_mode3" name="accounting_product_mode" value="ACCOUNTANCY_SELL_EXPORT"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT' ? ' checked' : '').'> <label for="accounting_product_mode3">'.$langs->trans('OptionModeProductSellExport').'</label></td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductSellExportDesc');
|
||||
print "</td></tr>\n";
|
||||
print '<tr class="oddeven"><td><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><input type="radio" id="accounting_product_mode4" name="accounting_product_mode" value="ACCOUNTANCY_BUY"'.($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '').'> <label for="accounting_product_mode4">'.$langs->trans('OptionModeProductBuy').'</label></td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
|
||||
if ($mysoc->isInEEC()) {
|
||||
print '<tr class="oddeven"><td><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_INTRA"'.($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuyIntra').'</td>';
|
||||
print '<tr class="oddeven"><td><input type="radio" id="accounting_product_mode5" name="accounting_product_mode" value="ACCOUNTANCY_BUY_INTRA"'.($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' ? ' checked' : '').'> <label for="accounting_product_mode5">'.$langs->trans('OptionModeProductBuyIntra').'</label></td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
|
||||
}
|
||||
print '<tr class="oddeven"><td><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_EXPORT"'.($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuyExport').'</td>';
|
||||
print '<tr class="oddeven"><td><input type="radio" id="accounting_product_mode6" name="accounting_product_mode" value="ACCOUNTANCY_BUY_EXPORT"'.($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT' ? ' checked' : '').'> <label for="accounting_product_mode6">'.$langs->trans('OptionModeProductBuyExport').'</label></td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
|
||||
print "</table>\n";
|
||||
|
||||
|
|
@ -528,11 +529,11 @@ if ($resql) {
|
|||
$categoriesProductArr = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', '', 64, 0, 1);
|
||||
$categoriesProductArr[-2] = '- '.$langs->trans('NotCategorized').' -';
|
||||
$moreforfilter .= Form::multiselectarray('search_category_product_list', $categoriesProductArr, $searchCategoryProductList, 0, 0, 'minwidth300');
|
||||
$moreforfilter .= ' <input type="checkbox" class="valignmiddle" name="search_category_product_operator" value="1"'.($searchCategoryProductOperator == 1 ? ' checked="checked"' : '').'/> <span class="none">'.$langs->trans('UseOrOperatorForCategories').'</span>';
|
||||
$moreforfilter .= ' <input type="checkbox" class="valignmiddle" id="search_category_product_operator" name="search_category_product_operator" value="1"'.($searchCategoryProductOperator == 1 ? ' checked="checked"' : '').'/> <label for="search_category_product_operator"><span class="none">'.$langs->trans('UseOrOperatorForCategories').'</span></label>';
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
|
||||
//Show/hide child products. Hidden by default
|
||||
// Show/hide child products. Hidden by default
|
||||
if (isModEnabled('variants') && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= '<input type="checkbox" id="search_show_childproducts" name="search_show_childproducts"'.($show_childproducts ? 'checked="checked"' : '').'>';
|
||||
|
|
@ -558,9 +559,16 @@ if ($resql) {
|
|||
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="center liste_titre">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="8" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
|
||||
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 right"><input type="text" class="flat maxwidth50 right" size="5" name="search_vat" placeholder="%" value="'.dol_escape_htmltag($search_vat).'"></td>';
|
||||
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_vat" placeholder="%" value="'.dol_escape_htmltag($search_vat).'"></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>';
|
||||
|
|
@ -579,13 +587,21 @@ if ($resql) {
|
|||
print ' '.$langs->trans("or").' '.$form->selectarray('search_current_account_valid', $listofvals, $search_current_account_valid, 1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="center liste_titre">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="center liste_titre">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
$clickpitco = $form->showCheckAddButtons('checkforselect', 1);
|
||||
print_liste_field_titre($clickpitco, '', '', '', '', '', '', '', 'center ');
|
||||
}
|
||||
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);
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) {
|
||||
|
|
@ -600,8 +616,11 @@ if ($resql) {
|
|||
}
|
||||
print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p." : "ppe.") . $accountancy_field_name, "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AssignDedicatedAccountingAccount");
|
||||
$clickpitco = $form->showCheckAddButtons('checkforselect', 1);
|
||||
print_liste_field_titre($clickpitco, '', '', '', '', '', '', '', 'center ');
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
$clickpitco = $form->showCheckAddButtons('checkforselect', 1);
|
||||
print_liste_field_titre($clickpitco, '', '', '', '', '', '', '', 'center ');
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
$product_static = new Product($db);
|
||||
|
|
@ -681,8 +700,22 @@ if ($resql) {
|
|||
}
|
||||
}
|
||||
|
||||
$selected = 0;
|
||||
if (!empty($chk_prod)) {
|
||||
if (in_array($product_static->id, $chk_prod)) {
|
||||
$selected = 1;
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="center">';
|
||||
print '<input type="checkbox" class="checkforselect productforselectcodeventil_'.$product_static->id.'" name="chk_prod[]" '.($selected ? "checked" : "").' value="'.$obj->rowid.'"/>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td>';
|
||||
print $product_static->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
|
@ -830,16 +863,13 @@ if ($resql) {
|
|||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($chk_prod)) {
|
||||
$ischecked = 0;
|
||||
if (in_array($product_static->id, $chk_prod)) {
|
||||
$ischecked=true;
|
||||
}
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="center">';
|
||||
print '<input type="checkbox" class="checkforselect productforselectcodeventil_'.$product_static->id.'" name="chk_prod[]" '.($selected ? "checked" : "").' value="'.$obj->rowid.'"/>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Checkbox select
|
||||
print '<td class="center">';
|
||||
print '<input type="checkbox" class="checkforselect productforselectcodeventil_'.$product_static->id.'" name="chk_prod[]" '.($ischecked ? "checked" : "").' value="'.$obj->rowid.'"/></td>';
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ $id = GETPOST('id', 'int');
|
|||
$rowid = GETPOST('rowid', 'int');
|
||||
$massaction = GETPOST('massaction', 'aZ09');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'accountingsubaccountlist'; // To manage different context of search
|
||||
|
||||
$search_subaccount = GETPOST('search_subaccount', 'alpha');
|
||||
|
|
@ -78,7 +79,7 @@ $arrayfields = array(
|
|||
'reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1)
|
||||
);
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
|
||||
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
|
||||
unset($arrayfields['reconcilable']);
|
||||
}
|
||||
|
||||
|
|
@ -130,15 +131,15 @@ llxHeader('', $title, $help_url);
|
|||
|
||||
|
||||
// Customer
|
||||
$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '1' as type, sa.entity";
|
||||
$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '1' as type, sa.entity, sa.client as nature";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe sa";
|
||||
$sql .= " WHERE sa.entity IN (".getEntity('societe').")";
|
||||
$sql .= " AND sa.code_compta <> ''";
|
||||
//print $sql;
|
||||
if (strlen(trim($search_subaccount))) {
|
||||
$lengthpaddingaccount = 0;
|
||||
if ($conf->global->ACCOUNTING_LENGTH_AACCOUNT) {
|
||||
$lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_AACCOUNT);
|
||||
if (getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) {
|
||||
$lengthpaddingaccount = getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT');
|
||||
}
|
||||
$search_subaccount_tmp = $search_subaccount;
|
||||
$weremovedsomezero = 0;
|
||||
|
|
@ -178,14 +179,14 @@ if (!empty($search_type) && $search_type >= 0) {
|
|||
|
||||
// Supplier
|
||||
$sql .= " UNION ";
|
||||
$sql .= " SELECT sa.rowid, sa.nom as label, sa.code_compta_fournisseur as subaccount, '2' as type, sa.entity FROM ".MAIN_DB_PREFIX."societe sa";
|
||||
$sql .= " SELECT sa.rowid, sa.nom as label, sa.code_compta_fournisseur as subaccount, '2' as type, sa.entity, '0' as nature FROM ".MAIN_DB_PREFIX."societe sa";
|
||||
$sql .= " WHERE sa.entity IN (".getEntity('societe').")";
|
||||
$sql .= " AND sa.code_compta_fournisseur <> ''";
|
||||
//print $sql;
|
||||
if (strlen(trim($search_subaccount))) {
|
||||
$lengthpaddingaccount = 0;
|
||||
if ($conf->global->ACCOUNTING_LENGTH_AACCOUNT) {
|
||||
$lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_AACCOUNT);
|
||||
if (getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) {
|
||||
$lengthpaddingaccount = getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT');
|
||||
}
|
||||
$search_subaccount_tmp = $search_subaccount;
|
||||
$weremovedsomezero = 0;
|
||||
|
|
@ -225,14 +226,14 @@ if (!empty($search_type) && $search_type >= 0) {
|
|||
|
||||
// User - Employee
|
||||
$sql .= " UNION ";
|
||||
$sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '3' as type, u.entity FROM ".MAIN_DB_PREFIX."user u";
|
||||
$sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '3' as type, u.entity, '0' as nature FROM ".MAIN_DB_PREFIX."user u";
|
||||
$sql .= " WHERE u.entity IN (".getEntity('user').")";
|
||||
$sql .= " AND u.accountancy_code <> ''";
|
||||
//print $sql;
|
||||
if (strlen(trim($search_subaccount))) {
|
||||
$lengthpaddingaccount = 0;
|
||||
if ($conf->global->ACCOUNTING_LENGTH_AACCOUNT) {
|
||||
$lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_AACCOUNT);
|
||||
if (getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) {
|
||||
$lengthpaddingaccount = getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT');
|
||||
}
|
||||
$search_subaccount_tmp = $search_subaccount;
|
||||
$weremovedsomezero = 0;
|
||||
|
|
@ -274,7 +275,7 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
@ -308,6 +309,9 @@ if ($resql) {
|
|||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
}
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array();
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
|
|
@ -324,7 +328,8 @@ if ($resql) {
|
|||
print '<div class="info">'.$langs->trans("WarningCreateSubAccounts").'</div>';
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields
|
||||
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||
|
||||
$moreforfilter = '';
|
||||
$massactionbutton = '';
|
||||
|
|
@ -334,6 +339,13 @@ if ($resql) {
|
|||
|
||||
// Line for search fields
|
||||
print '<tr class="liste_titre_filter">';
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre center maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['subaccount']['checked'])) {
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_subaccount" value="'.$search_subaccount.'"></td>';
|
||||
}
|
||||
|
|
@ -348,13 +360,20 @@ if ($resql) {
|
|||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
}
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
}
|
||||
if (!empty($arrayfields['subaccount']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['subaccount']['label'], $_SERVER["PHP_SELF"], "subaccount", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
|
|
@ -369,7 +388,10 @@ if ($resql) {
|
|||
print_liste_field_titre($arrayfields['reconcilable']['label'], $_SERVER["PHP_SELF"], 'reconcilable', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
$totalarray = array();
|
||||
|
|
@ -380,6 +402,28 @@ if ($resql) {
|
|||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="center">';
|
||||
$e = '';
|
||||
|
||||
// Customer
|
||||
if ($obj->type == 1) {
|
||||
$e .= '<a class="editfielda" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&token='.newToken().'&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
|
||||
} elseif ($obj->type == 2) {
|
||||
// Supplier
|
||||
$e .= '<a class="editfielda" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&token='.newToken().'&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
|
||||
} elseif ($obj->type == 3) {
|
||||
// User - Employee
|
||||
$e .= '<a class="editfielda" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?action=edit&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
|
||||
}
|
||||
print $e;
|
||||
print '</td>'."\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Account number
|
||||
if (!empty($arrayfields['subaccount']['checked'])) {
|
||||
print "<td>";
|
||||
|
|
@ -393,7 +437,7 @@ if ($resql) {
|
|||
// Subaccount label
|
||||
if (!empty($arrayfields['label']['checked'])) {
|
||||
print "<td>";
|
||||
print $obj->label;
|
||||
print dol_escape_htmltag($obj->label);
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
|
@ -416,6 +460,9 @@ if ($resql) {
|
|||
$s .= '<a class="user-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->rowid.'">'.$langs->trans("Employee").'</a>';
|
||||
}
|
||||
print $s;
|
||||
if ($obj->nature == 2) {
|
||||
print ' <span class="warning bold">('.$langs->trans("Prospect").')</span>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
|
@ -442,30 +489,43 @@ if ($resql) {
|
|||
}
|
||||
}
|
||||
|
||||
// Action
|
||||
print '<td class="center">';
|
||||
$e = '';
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="center">';
|
||||
$e = '';
|
||||
|
||||
// Customer
|
||||
if ($obj->type == 1) {
|
||||
$e .= '<a class="editfielda" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&token='.newToken().'&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
|
||||
} elseif ($obj->type == 2) {
|
||||
// Supplier
|
||||
$e .= '<a class="editfielda" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&token='.newToken().'&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
|
||||
} elseif ($obj->type == 3) {
|
||||
// User - Employee
|
||||
$e .= '<a class="editfielda" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?action=edit&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
|
||||
}
|
||||
print $e;
|
||||
print '</td>'."\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
// Customer
|
||||
if ($obj->type == 1) {
|
||||
$e .= '<a class="editfielda" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&token='.newToken().'&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
|
||||
} elseif ($obj->type == 2) {
|
||||
// Supplier
|
||||
$e .= '<a class="editfielda" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&token='.newToken().'&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
|
||||
} elseif ($obj->type == 3) {
|
||||
// User - Employee
|
||||
$e .= '<a class="editfielda" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?action=edit&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
|
||||
}
|
||||
print $e;
|
||||
print '</td>'."\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
print '</tr>'."\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
// If no record found
|
||||
if ($num == 0) {
|
||||
$colspan = 1;
|
||||
foreach ($arrayfields as $key => $val) {
|
||||
if (!empty($val['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
|
|
|
|||
|
|
@ -161,11 +161,11 @@ if (empty($reshook)) {
|
|||
|
||||
if (!empty($search_date_start)) {
|
||||
$filter['t.doc_date>='] = $search_date_start;
|
||||
$param .= '&date_startmonth=' . GETPOST('date_startmonth', 'int') . '&date_startday=' . GETPOST('date_startday', 'int') . '&date_startyear=' . GETPOST('date_startyear', 'int');
|
||||
$param .= '&date_startmonth=' . GETPOST('date_startmonth', 'int') . '&date_startday=' . GETPOST('date_startday', 'int') . '&date_startyear=' . GETPOST('date_startyear', 'int');
|
||||
}
|
||||
if (!empty($search_date_end)) {
|
||||
$filter['t.doc_date<='] = $search_date_end;
|
||||
$param .= '&date_endmonth=' . GETPOST('date_endmonth', 'int') . '&date_endday=' . GETPOST('date_endday', 'int') . '&date_endyear=' . GETPOST('date_endyear', 'int');
|
||||
$param .= '&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;
|
||||
|
|
@ -177,7 +177,7 @@ if (empty($reshook)) {
|
|||
} else {
|
||||
$filter['t.numero_compte>='] = $search_accountancy_code_start;
|
||||
}
|
||||
$param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start);
|
||||
$param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start);
|
||||
}
|
||||
if (!empty($search_accountancy_code_end)) {
|
||||
if ($type == 'sub') {
|
||||
|
|
@ -185,7 +185,7 @@ if (empty($reshook)) {
|
|||
} else {
|
||||
$filter['t.numero_compte<='] = $search_accountancy_code_end;
|
||||
}
|
||||
$param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end);
|
||||
$param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end);
|
||||
}
|
||||
if (!empty($search_ledger_code)) {
|
||||
$filter['t.code_journal'] = $search_ledger_code;
|
||||
|
|
@ -254,7 +254,7 @@ llxHeader('', $title_page);
|
|||
if ($action != 'export_csv') {
|
||||
// List
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
if ($type == 'sub') {
|
||||
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter, 'AND', 1);
|
||||
} else {
|
||||
|
|
@ -304,7 +304,7 @@ if ($action != 'export_csv') {
|
|||
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#exportcsvbutton").click(function() {
|
||||
jQuery("#exportcsvbutton").click(function(event) {
|
||||
event.preventDefault();
|
||||
console.log("Set action to export_csv");
|
||||
jQuery("#action").val("export_csv");
|
||||
|
|
@ -375,10 +375,12 @@ if ($action != 'export_csv') {
|
|||
}
|
||||
$moreforfilter .= '</div>';
|
||||
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= '<label for="notreconciled">'.$langs->trans('NotReconciled').'</label>: ';
|
||||
$moreforfilter .= '<input type="checkbox" name="search_not_reconciled" id="notreconciled" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>';
|
||||
$moreforfilter .= '</div>';
|
||||
if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= '<label for="notreconciled">'.$langs->trans('NotReconciled').'</label>: ';
|
||||
$moreforfilter .= '<input type="checkbox" name="search_not_reconciled" id="notreconciled" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>';
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
|
||||
if (!empty($moreforfilter)) {
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
|
|
@ -395,6 +397,14 @@ if ($action != 'export_csv') {
|
|||
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td class="liste_titre" colspan="'.$colspan.'">';
|
||||
print '</td>';
|
||||
|
||||
|
|
@ -404,13 +414,18 @@ if ($action != 'export_csv') {
|
|||
print $hookmanager->resPrint;
|
||||
|
||||
// Action column
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
}
|
||||
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
||||
// TODO : Retrieve the type of third party: Customer / Supplier / Employee
|
||||
//if ($type == 'sub') {
|
||||
|
|
@ -428,7 +443,9 @@ if ($action != 'export_csv') {
|
|||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
|
||||
$total_debit = 0;
|
||||
|
|
@ -532,6 +549,14 @@ if ($action != 'export_csv') {
|
|||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="center">';
|
||||
print $link;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Accounting account
|
||||
if ($type == 'sub') {
|
||||
print '<td>'.$line->subledger_account.' <span class="opacitymedium">('.$line->subledger_label.')</span></td>';
|
||||
|
|
@ -581,9 +606,14 @@ if ($action != 'export_csv') {
|
|||
} else {
|
||||
print '<td class="right nowraponall amount">'.price(price2num($line->debit - $line->credit, 'MT')).'</td>';
|
||||
}
|
||||
print '<td class="center">';
|
||||
print $link;
|
||||
print '</td>';
|
||||
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="center">';
|
||||
print $link;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
// Records the sub-total
|
||||
|
|
@ -593,7 +623,12 @@ if ($action != 'export_csv') {
|
|||
}
|
||||
|
||||
if (!empty($show_subgroup)) {
|
||||
print '<tr class="liste_total"><td class="right">'.$langs->trans("SubTotal").':</td>';
|
||||
print '<tr class="liste_total">';
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print "<td></td>\n";
|
||||
}
|
||||
print '<td class="right">'.$langs->trans("SubTotal").':</td>';
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||
print '<td class="right nowraponall amount">'.price(price2num($sous_total_opening_balance, 'MT')).'</td>';
|
||||
}
|
||||
|
|
@ -604,11 +639,19 @@ if ($action != 'export_csv') {
|
|||
} else {
|
||||
print '<td class="right nowraponall amount">' . price(price2num($sous_total_debit - $sous_total_credit, 'MT')) . '</td>';
|
||||
}
|
||||
print "<td></td>\n";
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print "<td></td>\n";
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td class="right">'.$langs->trans("AccountBalance").':</td>';
|
||||
print '<tr class="liste_total">';
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print "<td></td>\n";
|
||||
}
|
||||
print '<td class="right">'.$langs->trans("AccountBalance").':</td>';
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||
print '<td class="nowrap right">'.price(price2num($total_opening_balance, 'MT')).'</td>';
|
||||
}
|
||||
|
|
@ -619,7 +662,10 @@ if ($action != 'export_csv') {
|
|||
} else {
|
||||
print '<td class="right nowraponall amount">' . price(price2num($total_debit - $total_credit, 'MT')) . '</td>';
|
||||
}
|
||||
print "<td></td>\n";
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print "<td></td>\n";
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
|
|
|
|||
|
|
@ -497,7 +497,7 @@ if ($action == 'create') {
|
|||
|
||||
// Ref document
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print '<table class="nobordernopadding centpercent"><tr><td>';
|
||||
print $langs->trans('Piece');
|
||||
print '</td>';
|
||||
if ($action != 'editdocref') {
|
||||
|
|
|
|||
1404
htdocs/accountancy/bookkeeping/export.php
Normal file
1404
htdocs/accountancy/bookkeeping/export.php
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2022 Lionel Vessiller <lvessiller@open-dsi.fr>
|
||||
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
// Load Dolibarr environment
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
||||
|
|
@ -96,14 +95,6 @@ $search_date_validation_start = dol_mktime(0, 0, 0, $search_date_validation_star
|
|||
$search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear);
|
||||
$search_import_key = GETPOST("search_import_key", 'alpha');
|
||||
|
||||
//var_dump($search_date_start);exit;
|
||||
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
|
||||
$action = 'delbookkeepingyear';
|
||||
}
|
||||
if (GETPOST("button_export_file_x") || GETPOST("button_export_file.x") || GETPOST("button_export_file")) {
|
||||
$action = 'export_file';
|
||||
}
|
||||
|
||||
$search_account_category = GETPOST('search_account_category', 'int');
|
||||
|
||||
$search_accountancy_code = GETPOST("search_accountancy_code", 'alpha');
|
||||
|
|
@ -159,7 +150,7 @@ $hookmanager->initHooks(array('bookkeepinglist'));
|
|||
$formaccounting = new FormAccounting($db);
|
||||
$form = new Form($db);
|
||||
|
||||
if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->hasRight('accounting', 'mouvements', 'export')) {
|
||||
if (!in_array($action, array('delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->hasRight('accounting', 'mouvements', 'export')) {
|
||||
if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values') && !GETPOST('search_accountancy_code_start')) {
|
||||
$query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
||||
$query .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";
|
||||
|
|
@ -201,8 +192,8 @@ $arrayfields = array(
|
|||
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
|
||||
't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
|
||||
't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
|
||||
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
|
||||
't.date_validated'=>array('label'=>$langs->trans("DateValidationAndLock"), 'checked'=>1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
|
||||
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>0),
|
||||
't.date_validated'=>array('label'=>$langs->trans("DateValidationAndLock"), 'checked'=>0, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
|
||||
't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100),
|
||||
);
|
||||
|
||||
|
|
@ -210,13 +201,6 @@ if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
|
|||
unset($arrayfields['t.lettering_code']);
|
||||
}
|
||||
|
||||
$accountancyexport = new AccountancyExport($db);
|
||||
$listofformat = $accountancyexport->getType();
|
||||
$formatexportset = getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV');
|
||||
if (empty($listofformat[$formatexportset])) {
|
||||
$formatexportset = 1;
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
if (!isModEnabled('accounting')) {
|
||||
|
|
@ -457,49 +441,6 @@ if (empty($reshook)) {
|
|||
$param .= '&search_import_key='.urlencode($search_import_key);
|
||||
}
|
||||
|
||||
//if ($action == 'delbookkeepingyearconfirm' && !$user->hasRight('accounting', 'mouvements', 'supprimer_tous')) {
|
||||
// $delmonth = GETPOST('delmonth', 'int');
|
||||
// $delyear = GETPOST('delyear', 'int');
|
||||
// if ($delyear == -1) {
|
||||
// $delyear = 0;
|
||||
// }
|
||||
// $deljournal = GETPOST('deljournal', 'alpha');
|
||||
// if ($deljournal == -1) {
|
||||
// $deljournal = 0;
|
||||
// }
|
||||
//
|
||||
// if (!empty($delmonth) || !empty($delyear) || !empty($deljournal)) {
|
||||
// $result = $object->deleteByYearAndJournal($delyear, $deljournal, '', ($delmonth > 0 ? $delmonth : 0));
|
||||
// if ($result < 0) {
|
||||
// setEventMessages($object->error, $object->errors, 'errors');
|
||||
// } else {
|
||||
// setEventMessages("RecordDeleted", null, 'mesgs');
|
||||
// }
|
||||
//
|
||||
// // Make a redirect to avoid to launch the delete later after a back button
|
||||
// header("Location: list.php".($param ? '?'.$param : ''));
|
||||
// exit;
|
||||
// } else {
|
||||
// setEventMessages("NoRecordDeleted", null, 'warnings');
|
||||
// }
|
||||
//}
|
||||
if ($action == 'setreexport') {
|
||||
$setreexport = GETPOST('value', 'int');
|
||||
if (!dolibarr_set_const($db, "ACCOUNTING_REEXPORT", $setreexport, 'yesno', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
if ($conf->global->ACCOUNTING_REEXPORT == 1) {
|
||||
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'warnings');
|
||||
}
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
$objectclass = 'Bookkeeping';
|
||||
$objectlabel = 'Bookkeeping';
|
||||
|
|
@ -707,103 +648,12 @@ if (count($filter) > 0) {
|
|||
}
|
||||
}
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('accountancy').')';
|
||||
if (empty($conf->global->ACCOUNTING_REEXPORT)) {
|
||||
$sql .= " AND t.date_export IS NULL";
|
||||
}
|
||||
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' AND '.implode(' AND ', $sqlwhere);
|
||||
}
|
||||
//print $sql;
|
||||
|
||||
|
||||
// Export into a file with format defined into setup (FEC, CSV, ...)
|
||||
// Must be after definition of $sql
|
||||
if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements', 'export')) {
|
||||
// TODO Replace the fetchAll to get all ->line followed by call to ->export(). It currently consumes too much memory on large export.
|
||||
// Replace this with the query($sql) and loop on each line to export them.
|
||||
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', (empty($conf->global->ACCOUNTING_REEXPORT) ? 0 : 1));
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
// Export files then exit
|
||||
$accountancyexport = new AccountancyExport($db);
|
||||
|
||||
$formatexport = GETPOST('formatexport', 'int');
|
||||
$notexportlettering = GETPOST('notexportlettering', 'alpha');
|
||||
|
||||
if (!empty($notexportlettering)) {
|
||||
if (is_array($object->lines)) {
|
||||
foreach ($object->lines as $k => $movement) {
|
||||
unset($object->lines[$k]->lettering_code);
|
||||
unset($object->lines[$k]->date_lettering);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$notifiedexportdate = GETPOST('notifiedexportdate', 'alpha');
|
||||
$notifiedvalidationdate = GETPOST('notifiedvalidationdate', 'alpha');
|
||||
$withAttachment = !empty(trim(GETPOST('notifiedexportfull', 'alphanohtml'))) ? 1 : 0;
|
||||
|
||||
// Output data on screen or download
|
||||
$result = $accountancyexport->export($object->lines, $formatexport, $withAttachment);
|
||||
|
||||
$error = 0;
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
} else {
|
||||
if (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) {
|
||||
if (is_array($object->lines)) {
|
||||
dol_syslog("/accountancy/bookkeeping/list.php Function export_file Specify movements as exported", LOG_DEBUG);
|
||||
|
||||
// Specify as export : update field date_export or date_validated
|
||||
$db->begin();
|
||||
|
||||
// TODO Merge update for each line into one gloacl using rowid IN (list of movement ids)
|
||||
foreach ($object->lines as $movement) {
|
||||
$now = dol_now();
|
||||
|
||||
$setfields = '';
|
||||
if (!empty($notifiedexportdate) && empty($movement->date_export)) {
|
||||
$setfields .= ($setfields ? "," : "")." date_export = '".$db->idate($now)."'";
|
||||
}
|
||||
if (!empty($notifiedvalidationdate) && empty($movement->date_validation)) {
|
||||
$setfields .= ($setfields ? "," : "")." date_validated = '".$db->idate($now)."'";
|
||||
}
|
||||
|
||||
if ($setfields) {
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||
$sql .= " SET ".$setfields;
|
||||
$sql .= " WHERE rowid = ".((int) $movement->id);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
} else {
|
||||
$error++;
|
||||
$accountancyexport->errors[] = $langs->trans('NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated');
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
setEventMessages('', $accountancyexport->errors, 'errors');
|
||||
header('Location: '.$_SERVER['PHP_SELF']);
|
||||
}
|
||||
exit(); // download or show errors
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
|
@ -815,7 +665,7 @@ $title_page = $langs->trans("Operations").' - '.$langs->trans("Journals");
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
|
|
@ -857,111 +707,6 @@ llxHeader('', $title_page);
|
|||
|
||||
$formconfirm = '';
|
||||
|
||||
if ($action == 'export_file') {
|
||||
$form_question = array();
|
||||
|
||||
$form_question['formatexport'] = array(
|
||||
'name' => 'formatexport',
|
||||
'type' => 'select',
|
||||
'label' => $langs->trans('Modelcsv'), // TODO Use Selectmodelcsv and show a select combo
|
||||
'values' => $listofformat,
|
||||
'default' => $formatexportset,
|
||||
'morecss' => 'minwidth200 maxwidth200'
|
||||
);
|
||||
|
||||
$form_question['separator0'] = array('name'=>'separator0', 'type'=>'separator');
|
||||
|
||||
if (getDolGlobalInt("ACCOUNTING_ENABLE_LETTERING")) {
|
||||
// If 1, we check by default.
|
||||
$checked = !empty($conf->global->ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING) ? 'true' : 'false';
|
||||
$form_question['notexportlettering'] = array(
|
||||
'name' => 'notexportlettering',
|
||||
'type' => 'checkbox',
|
||||
'label' => $langs->trans('NotExportLettering'),
|
||||
'value' => $checked,
|
||||
);
|
||||
|
||||
$form_question['separator1'] = array('name'=>'separator1', 'type'=>'separator');
|
||||
}
|
||||
|
||||
// If 1 or not set, we check by default.
|
||||
$checked = (!isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) || !empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE));
|
||||
$form_question['notifiedexportdate'] = array(
|
||||
'name' => 'notifiedexportdate',
|
||||
'type' => 'checkbox',
|
||||
'label' => $langs->trans('NotifiedExportDate'),
|
||||
'value' => (!empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) ? 'false' : 'true'),
|
||||
);
|
||||
|
||||
$form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator');
|
||||
|
||||
if (!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) {
|
||||
// If 0 or not set, we NOT check by default.
|
||||
$checked = (isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE) || !empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE));
|
||||
$form_question['notifiedvalidationdate'] = array(
|
||||
'name' => 'notifiedvalidationdate',
|
||||
'type' => 'checkbox',
|
||||
'label' => $langs->trans('NotifiedValidationDate', $langs->transnoentitiesnoconv("MenuAccountancyClosure")),
|
||||
'value' => $checked,
|
||||
);
|
||||
|
||||
$form_question['separator3'] = array('name'=>'separator3', 'type'=>'separator');
|
||||
}
|
||||
|
||||
// add documents in an archive for accountancy export (Quadratus)
|
||||
if (getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV') == AccountancyExport::$EXPORT_TYPE_QUADRATUS) {
|
||||
$form_question['notifiedexportfull'] = array(
|
||||
'name' => 'notifiedexportfull',
|
||||
'type' => 'checkbox',
|
||||
'label' => $langs->trans('NotifiedExportFull'),
|
||||
'value' => 'false',
|
||||
);
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").'...', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 420, 600);
|
||||
}
|
||||
|
||||
//if ($action == 'delbookkeepingyear') {
|
||||
// $form_question = array();
|
||||
// $delyear = GETPOST('delyear', 'int');
|
||||
// $deljournal = GETPOST('deljournal', 'alpha');
|
||||
//
|
||||
// if (empty($delyear)) {
|
||||
// $delyear = dol_print_date(dol_now(), '%Y');
|
||||
// }
|
||||
// $month_array = array();
|
||||
// for ($i = 1; $i <= 12; $i++) {
|
||||
// $month_array[$i] = $langs->trans("Month".sprintf("%02d", $i));
|
||||
// }
|
||||
// $year_array = $formaccounting->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
|
||||
// $journal_array = $formaccounting->select_journal($deljournal, 'deljournal', '', 1, 1, 1, '', 0, 1);
|
||||
//
|
||||
// $form_question['delmonth'] = array(
|
||||
// 'name' => 'delmonth',
|
||||
// 'type' => 'select',
|
||||
// 'label' => $langs->trans('DelMonth'),
|
||||
// 'values' => $month_array,
|
||||
// 'morecss' => 'minwidth150',
|
||||
// 'default' => ''
|
||||
// );
|
||||
// $form_question['delyear'] = array(
|
||||
// 'name' => 'delyear',
|
||||
// 'type' => 'select',
|
||||
// 'label' => $langs->trans('DelYear'),
|
||||
// 'values' => $year_array,
|
||||
// 'default' => $delyear
|
||||
// );
|
||||
// $form_question['deljournal'] = array(
|
||||
// 'name' => 'deljournal',
|
||||
// 'type' => 'other', // We don't use select here, the journal_array is already a select html component
|
||||
// 'label' => $langs->trans('DelJournal'),
|
||||
// 'value' => $journal_array,
|
||||
// 'default' => $deljournal
|
||||
// );
|
||||
//
|
||||
// $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'delbookkeepingyearconfirm', $form_question, '', 1, 320);
|
||||
//}
|
||||
|
||||
// Print form confirm
|
||||
print $formconfirm;
|
||||
|
||||
|
|
@ -975,7 +720,7 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
|
|||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array();
|
||||
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->rights->accounting->mouvements->creer) {
|
||||
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
|
||||
$arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto');
|
||||
$arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringAuto');
|
||||
$arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual');
|
||||
|
|
@ -1015,21 +760,6 @@ if ($reshook < 0) {
|
|||
$newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
|
||||
|
||||
if (empty($reshook)) {
|
||||
// Button re-export
|
||||
if (!empty($conf->global->ACCOUNTING_REEXPORT)) {
|
||||
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'">'.img_picto($langs->trans("ClickToHideAlreadyExportedLines"), 'switch_off', 'class="small size15x valignmiddle"');
|
||||
$newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("ClickToHideAlreadyExportedLines").'</span>';
|
||||
$newcardbutton .= '</a>';
|
||||
} else {
|
||||
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'">'.img_picto($langs->trans("DocsAlreadyExportedAreExcluded"), 'switch_on', 'class="warning size15x valignmiddle"');
|
||||
$newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("DocsAlreadyExportedAreExcluded").'</span>';
|
||||
$newcardbutton .= '</a>';
|
||||
}
|
||||
|
||||
if ($user->hasRight('accounting', 'mouvements', 'export')) {
|
||||
$newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : '').'&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder), $user->hasRight('accounting', 'mouvements', 'export'));
|
||||
}
|
||||
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?type=sub'.$param, '', 1, array('morecss' => 'marginleftonly'));
|
||||
|
|
@ -1608,13 +1338,6 @@ print $hookmanager->resPrint;
|
|||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
// TODO Replace this with mass delete action
|
||||
//if ($user->rights->accounting->mouvements->supprimer_tous) {
|
||||
// print '<div class="tabsAction tabsActionNoBottom">'."\n";
|
||||
// print '<a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear&token='.newToken().($param ? '&'.$param : '').'">'.$langs->trans("DeleteMvt").'</a>';
|
||||
// print '</div>';
|
||||
//}
|
||||
|
||||
print '</form>';
|
||||
|
||||
// End of page
|
||||
|
|
|
|||
|
|
@ -381,7 +381,7 @@ if (empty($reshook)) {
|
|||
$param = '&type='.$type.$param;
|
||||
}
|
||||
|
||||
//if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouvements->supprimer_tous) {
|
||||
//if ($action == 'delbookkeepingyearconfirm' && $user->hasRight('accounting', 'mouvements', 'supprimer')_tous) {
|
||||
// $delmonth = GETPOST('delmonth', 'int');
|
||||
// $delyear = GETPOST('delyear', 'int');
|
||||
// if ($delyear == -1) {
|
||||
|
|
@ -559,7 +559,7 @@ llxHeader('', $title_page);
|
|||
|
||||
// List
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
// TODO Perf Replace this by a count
|
||||
if ($type == 'sub') {
|
||||
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 1, 1);
|
||||
|
|
@ -1297,7 +1297,7 @@ print "</table>";
|
|||
print '</div>';
|
||||
|
||||
// TODO Replace this with mass delete action
|
||||
//if ($user->rights->accounting->mouvements->supprimer_tous) {
|
||||
//if ($user->hasRight('accounting', 'mouvements, 'supprimer_tous')) {
|
||||
// print '<div class="tabsAction tabsActionNoBottom">'."\n";
|
||||
// print '<a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear&token='.newToken().($param ? '&'.$param : '').'">'.$langs->trans("DeleteMvt").'</a>';
|
||||
// print '</div>';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
|
||||
* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -123,11 +123,19 @@ class AccountancyCategory // extends CommonObject
|
|||
public $lines_display;
|
||||
|
||||
/**
|
||||
* @var mixed Sample property 1
|
||||
* @var mixed Sum debit credit
|
||||
*/
|
||||
public $sdc;
|
||||
|
||||
/**
|
||||
* @var array Sum debit credit per month
|
||||
*/
|
||||
public $sdcpermonth;
|
||||
|
||||
/**
|
||||
* @var array Sum debit credit per account
|
||||
*/
|
||||
public $sdcperaccount;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
|
@ -466,7 +474,7 @@ class AccountancyCategory // extends CommonObject
|
|||
$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 .= " WHERE (aa.fk_accounting_category <> ".((int) $id)." OR aa.fk_accounting_category IS NULL)";
|
||||
$sql .= " AND asy.rowid = ".((int) $conf->global->CHARTOFACCOUNTS);
|
||||
$sql .= " AND asy.rowid = ".((int) getDolGlobalInt('CHARTOFACCOUNTS'));
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " AND aa.entity = ".$conf->entity;
|
||||
$sql .= " GROUP BY aa.account_number, aa.label";
|
||||
|
|
@ -512,7 +520,7 @@ class AccountancyCategory // extends CommonObject
|
|||
$sql = "SELECT aa.rowid, aa.account_number";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = ".((int) $conf->global->CHARTOFACCOUNTS);
|
||||
$sql .= " AND asy.rowid = ".((int) getDolGlobalInt('CHARTOFACCOUNTS'));
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " AND aa.entity = ".$conf->entity;
|
||||
$sql .= " ORDER BY LENGTH(aa.account_number) DESC;"; // LENGTH is ok with mysql and postgresql
|
||||
|
|
@ -839,7 +847,7 @@ class AccountancyCategory // extends CommonObject
|
|||
exit();
|
||||
}
|
||||
|
||||
$pcgverid = $conf->global->CHARTOFACCOUNTS;
|
||||
$pcgverid = getDolGlobalInt('CHARTOFACCOUNTS');
|
||||
$pcgvercode = dol_getIdFromCode($this->db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version');
|
||||
if (empty($pcgvercode)) {
|
||||
$pcgvercode = $pcgverid;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -169,7 +169,7 @@ class AccountingAccount extends CommonObject
|
|||
global $conf;
|
||||
|
||||
$this->db = $db;
|
||||
$this->next_prev_filter = "fk_pcg_version IN (SELECT pcg_version FROM ".MAIN_DB_PREFIX."accounting_system WHERE rowid = ".((int) $conf->global->CHARTOFACCOUNTS).")"; // Used to add a filter in Form::showrefnav method
|
||||
$this->next_prev_filter = "fk_pcg_version IN (SELECT pcg_version FROM ".MAIN_DB_PREFIX."accounting_system WHERE rowid = ".((int) getDolGlobalInt('CHARTOFACCOUNTS')).")"; // Used to add a filter in Form::showrefnav method
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -198,7 +198,7 @@ class AccountingAccount extends CommonObject
|
|||
$sql .= " AND a.entity = ".$conf->entity;
|
||||
}
|
||||
if (!empty($limittocurrentchart)) {
|
||||
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid = '.((int) $conf->global->CHARTOFACCOUNTS).')';
|
||||
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid = '.((int) getDolGlobalInt('CHARTOFACCOUNTS')).')';
|
||||
}
|
||||
if (!empty($limittoachartaccount)) {
|
||||
$sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'";
|
||||
|
|
@ -214,8 +214,10 @@ class AccountingAccount extends CommonObject
|
|||
$this->id = $obj->rowid;
|
||||
$this->rowid = $obj->rowid;
|
||||
$this->ref = $obj->account_number;
|
||||
$this->datec = $obj->datec;
|
||||
$this->tms = $obj->tms;
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->tms);
|
||||
//$this->tms = $this->datem;
|
||||
$this->fk_pcg_version = $obj->fk_pcg_version;
|
||||
$this->pcg_type = $obj->pcg_type;
|
||||
$this->account_number = $obj->account_number;
|
||||
|
|
@ -587,7 +589,7 @@ class AccountingAccount extends CommonObject
|
|||
*/
|
||||
public function info($id)
|
||||
{
|
||||
$sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms';
|
||||
$sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms as date_modification';
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as a';
|
||||
$sql .= ' WHERE a.rowid = ' . ((int) $id);
|
||||
|
||||
|
|
@ -602,7 +604,7 @@ class AccountingAccount extends CommonObject
|
|||
$this->user_creation_id = $obj->fk_user_author;
|
||||
$this->user_modification_id = $obj->fk_user_modif;
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->tms);
|
||||
$this->date_modification = $this->db->jdate($obj->date_modification);
|
||||
}
|
||||
$this->db->free($resql);
|
||||
} else {
|
||||
|
|
@ -732,7 +734,7 @@ class AccountingAccount extends CommonObject
|
|||
* @param FactureLigne|SupplierInvoiceLine $factureDet Facture Det
|
||||
* @param array $accountingAccount Array of Accounting account
|
||||
* @param string $type Customer / Supplier
|
||||
* @return array|int Accounting accounts suggested or < 0 if technical error.
|
||||
* @return array|int Array of accounting accounts suggested or < 0 if technical error.
|
||||
* 'suggestedaccountingaccountbydefaultfor'=>Will be used for the label to show on tooltip for account by default on any product
|
||||
* 'suggestedaccountingaccountfor'=>Is the account suggested for this product
|
||||
*/
|
||||
|
|
@ -768,39 +770,39 @@ class AccountingAccount extends CommonObject
|
|||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
if ($factureDet->product_type == 1) {
|
||||
if ($buyer->country_code == $seller->country_code || empty($buyer->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'} : '');
|
||||
$code_l = getDolGlobalString('ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT');
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) { // European intravat sale, but with a VAT
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'} : '');
|
||||
$code_l = getDolGlobalString('ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eecwithvat';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($buyer->tva_intra)) { // European intravat sale, without VAT intra community number
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT'} : '');
|
||||
$code_l = getDolGlobalString('ACCOUNTING_SERVICE_' . $const_name . '_ACCOUNT');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eecwithoutvatnumber';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_INTRA_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_INTRA_ACCOUNT'} : '');
|
||||
$code_l = getDolGlobalString('ACCOUNTING_SERVICE_' . $const_name . '_INTRA_ACCOUNT');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eec';
|
||||
} else { // Foreign sale
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_EXPORT_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_SERVICE_' . $const_name . '_EXPORT_ACCOUNT'} : '');
|
||||
$code_l = getDolGlobalString('ACCOUNTING_SERVICE_' . $const_name . '_EXPORT_ACCOUNT');
|
||||
$suggestedaccountingaccountbydefaultfor = 'export';
|
||||
}
|
||||
}
|
||||
} elseif ($factureDet->product_type == 0) {
|
||||
if ($buyer->country_code == $seller->country_code || empty($buyer->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'} : '');
|
||||
$code_l = getDolGlobalString('ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT');
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC && $factureDet->tva_tx != 0) { // European intravat sale, but with a VAT
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'} : '');
|
||||
$code_l = getDolGlobalString('ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eecwithvat';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($buyer->tva_intra)) { // European intravat sale, without VAT intra community number
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT'} : '');
|
||||
$code_l = getDolGlobalString('ACCOUNTING_PRODUCT_' . $const_name . '_ACCOUNT');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eecwithoutvatnumber';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_INTRA_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_INTRA_ACCOUNT'} : '');
|
||||
$code_l = getDolGlobalString('ACCOUNTING_PRODUCT_' . $const_name . '_INTRA_ACCOUNT');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eec';
|
||||
} else {
|
||||
$code_l = (!empty($conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_EXPORT_ACCOUNT'}) ? $conf->global->{'ACCOUNTING_PRODUCT_' . $const_name . '_EXPORT_ACCOUNT'} : '');
|
||||
$code_l = getDolGlobalString('ACCOUNTING_PRODUCT_' . $const_name . '_EXPORT_ACCOUNT');
|
||||
$suggestedaccountingaccountbydefaultfor = 'export';
|
||||
}
|
||||
}
|
||||
|
|
@ -939,5 +941,7 @@ class AccountingAccount extends CommonObject
|
|||
return $hookmanager->resArray;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Class to manage accounting accounts
|
||||
* Class to manage accounting journals
|
||||
*/
|
||||
class AccountingJournal extends CommonObject
|
||||
{
|
||||
|
|
@ -42,7 +42,7 @@ class AccountingJournal extends CommonObject
|
|||
public $fk_element = '';
|
||||
|
||||
/**
|
||||
* @var int 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
* @var int Does object support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
*/
|
||||
public $ismultientitymanaged = 0;
|
||||
|
||||
|
|
@ -367,6 +367,7 @@ class AccountingJournal extends CommonObject
|
|||
return $langs->trans('AccountingJournalType1');
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
276
htdocs/accountancy/class/api_accountancy.class.php
Normal file
276
htdocs/accountancy/class/api_accountancy.class.php
Normal file
|
|
@ -0,0 +1,276 @@
|
|||
<?php
|
||||
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2019 Cedric Ancelin <icedo.anc@gmail.com>
|
||||
* Copyright (C) 2023 Lionel Vessiller <lvessiller@open-dsi.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* API class for accountancy
|
||||
*
|
||||
* @access protected
|
||||
* @class DolibarrApiAccess {@requires user,external}
|
||||
*
|
||||
*/
|
||||
class Accountancy extends DolibarrApi
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var array $FIELDS Mandatory fields, checked when create and update object
|
||||
*/
|
||||
public static $FIELDS = array();
|
||||
|
||||
/**
|
||||
* @var BookKeeping $bookkeeping {@type BookKeeping}
|
||||
*/
|
||||
public $bookkeeping;
|
||||
|
||||
/**
|
||||
* @var AccountancyExport $accountancy_export {@type AccountancyExport}
|
||||
*/
|
||||
public $accountancyexport;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
global $db, $langs;
|
||||
$this->db = $db;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
|
||||
|
||||
$langs->load('accountancy');
|
||||
|
||||
$this->bookkeeping = new BookKeeping($this->db);
|
||||
$this->accountancyexport = new AccountancyExport($this->db);
|
||||
}
|
||||
|
||||
/**
|
||||
* Accountancy export data
|
||||
*
|
||||
* @param string $period Period : 'lastmonth', 'currentmonth', 'last3months', 'last6months', 'currentyear', 'lastyear', 'fiscalyear', 'lastfiscalyear', 'actualandlastfiscalyear' or 'custom' (see above)
|
||||
* @param string $date_min [=''] Start date of period if 'custom' is set in period parameter
|
||||
* Date format is 'YYYY-MM-DD'
|
||||
* @param string $date_max [=''] End date of period if 'custom' is set in period parameter
|
||||
* Date format is 'YYYY-MM-DD'
|
||||
* @param string $format [=''] by default uses '1' for 'Configurable (CSV)' for format number
|
||||
* or '1000' for FEC
|
||||
* or '1010' for FEC2
|
||||
* (see AccountancyExport class)
|
||||
* @param int $lettering [=0] by default don't export or 1 to export lettering data (columns 'letterring_code' and 'date_lettering' returns empty or not)
|
||||
* @param int $alreadyexport [=0] by default export data only if it's not yet exported or 1 already exported (always export data even if 'date_export" is set)
|
||||
* @param int $notnotifiedasexport [=0] by default notified as exported or 1 not notified as exported (when the export is done, notified or not the column 'date_export')
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @url GET exportdata
|
||||
*
|
||||
* @throws RestException 401 Insufficient rights
|
||||
* @throws RestException 404 Accountancy export period not found
|
||||
* @throws RestException 404 Accountancy export start or end date not defined
|
||||
* @throws RestException 404 Accountancy export format not found
|
||||
* @throws RestException 500 Error on accountancy export
|
||||
*/
|
||||
public function exportData($period, $date_min = '', $date_max = '', $format = '', $lettering = 0, $alreadyexport = 0, $notnotifiedasexport = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
// check rights
|
||||
if (!DolibarrApiAccess::$user->rights->accounting->mouvements->export) {
|
||||
throw new RestException(401, 'No permission to export accounting');
|
||||
}
|
||||
|
||||
// check parameters
|
||||
$period_available_list = array('lastmonth', 'currentmonth', 'last3months', 'last6months', 'currentyear', 'lastyear', 'fiscalyear', 'lastfiscalyear', 'actualandlastfiscalyear', 'custom');
|
||||
if (!in_array($period, $period_available_list)) {
|
||||
throw new RestException(404, 'Accountancy export period not found');
|
||||
}
|
||||
if ($period == 'custom') {
|
||||
if ($date_min == '' && $date_max == '') {
|
||||
throw new RestException(404, 'Accountancy export start and end date for custom period not defined');
|
||||
}
|
||||
}
|
||||
if ($format == '') {
|
||||
$format = AccountancyExport::$EXPORT_TYPE_CONFIGURABLE; // uses default
|
||||
}
|
||||
|
||||
// get objects
|
||||
$bookkeeping = $this->bookkeeping;
|
||||
$accountancyexport = $this->accountancyexport;
|
||||
|
||||
// find export format code from format number
|
||||
$format_number_available_list = $accountancyexport->getType();
|
||||
if (is_numeric($format)) {
|
||||
$format_number = (int) $format;
|
||||
} else {
|
||||
$format_number = 0;
|
||||
$format_label_available_list = array_flip($format_number_available_list);
|
||||
if (isset($format_label_available_list[$format])) {
|
||||
$format_number = $format_label_available_list[$format];
|
||||
}
|
||||
}
|
||||
|
||||
// get all format available and check if exists
|
||||
if (!array_key_exists($format_number, $format_number_available_list)) {
|
||||
throw new RestException(404, 'Accountancy export format not found');
|
||||
}
|
||||
|
||||
$sortorder = 'ASC'; // by default
|
||||
$sortfield = 't.piece_num, t.rowid'; // by default
|
||||
|
||||
// set filter for each period available
|
||||
$filter = array();
|
||||
$doc_date_start = null;
|
||||
$doc_date_end= null;
|
||||
$now = dol_now();
|
||||
$now_arr = dol_getdate($now);
|
||||
$now_month = $now_arr['mon'];
|
||||
$now_year = $now_arr['year'];
|
||||
if ($period == 'custom') {
|
||||
if ($date_min != '') {
|
||||
$time_min = strtotime($date_min);
|
||||
if ($time_min !== false) {
|
||||
$doc_date_start = $time_min;
|
||||
}
|
||||
}
|
||||
if ($date_max != '') {
|
||||
$time_max = strtotime($date_max);
|
||||
if ($time_max !== false) {
|
||||
$doc_date_end = $time_max;
|
||||
}
|
||||
}
|
||||
} elseif ($period == 'lastmonth') {
|
||||
$prev_date_arr = dol_get_prev_month($now_month, $now_year); // get previous month and year if month is january
|
||||
$doc_date_start = dol_mktime(0, 0, 0, $prev_date_arr['month'], 1, $prev_date_arr['year']); // first day of previous month
|
||||
$doc_date_end = dol_get_last_day($prev_date_arr['year'], $prev_date_arr['month']); // last day of previous month
|
||||
} elseif ($period == 'currentmonth') {
|
||||
$doc_date_start = dol_mktime(0, 0, 0, $now_month, 1, $now_year); // first day of current month
|
||||
$doc_date_end = dol_get_last_day($now_year, $now_month); // last day of current month
|
||||
} elseif ($period == 'last3months' || $period == 'last6months') {
|
||||
if ($period == 'last3months') {
|
||||
// last 3 months
|
||||
$nb_prev_month = 3;
|
||||
} else {
|
||||
// last 6 months
|
||||
$nb_prev_month = 6;
|
||||
}
|
||||
$prev_month_date_list = array();
|
||||
$prev_month_date_list[] = dol_get_prev_month($now_month, $now_year); // get previous month for index = 0
|
||||
for ($i = 1; $i < $nb_prev_month; $i++) {
|
||||
$prev_month_date_list[] = dol_get_prev_month($prev_month_date_list[$i-1]['month'], $prev_month_date_list[$i-1]['year']); // get i+1 previous month for index=i
|
||||
}
|
||||
$doc_date_start = dol_mktime(0, 0, 0, $prev_month_date_list[$nb_prev_month-1]['month'], 1, $prev_month_date_list[$nb_prev_month-1]['year']); // first day of n previous month for index=n-1
|
||||
$doc_date_end = dol_get_last_day($prev_month_date_list[0]['year'], $prev_month_date_list[0]['month']); // last day of previous month for index = 0
|
||||
} elseif ($period == 'currentyear' || $period == 'lastyear') {
|
||||
$period_year = $now_year;
|
||||
if ($period == 'lastyear') {
|
||||
$period_year--;
|
||||
}
|
||||
$doc_date_start = dol_mktime(0, 0, 0, 1, 1, $period_year); // first day of year
|
||||
$doc_date_end = dol_mktime(23, 59, 59, 12, 31, $period_year); // last day of year
|
||||
} elseif ($period == 'fiscalyear' || $period == 'lastfiscalyear' || $period == 'actualandlastfiscalyear') {
|
||||
// find actual fiscal year
|
||||
$cur_fiscal_period = getCurrentPeriodOfFiscalYear($this->db, $conf);
|
||||
$cur_fiscal_date_start = $cur_fiscal_period['date_start'];
|
||||
$cur_fiscal_date_end = $cur_fiscal_period['date_end'];
|
||||
|
||||
if ($period == 'fiscalyear') {
|
||||
$doc_date_start = $cur_fiscal_date_start;
|
||||
$doc_date_end = $cur_fiscal_date_end;
|
||||
} else {
|
||||
// get one day before current fiscal date start (to find previous fiscal period)
|
||||
$prev_fiscal_date_search = dol_time_plus_duree($cur_fiscal_date_start, -1, 'd');
|
||||
|
||||
// find previous fiscal year from current fiscal year
|
||||
$prev_fiscal_period = getCurrentPeriodOfFiscalYear($this->db, $conf, $prev_fiscal_date_search);
|
||||
$prev_fiscal_date_start = $prev_fiscal_period['date_start'];
|
||||
$prev_fiscal_date_end = $prev_fiscal_period['date_end'];
|
||||
|
||||
if ($period == 'lastfiscalyear') {
|
||||
$doc_date_start = $prev_fiscal_date_start;
|
||||
$doc_date_end = $prev_fiscal_date_end;
|
||||
} else {
|
||||
// period == 'actualandlastfiscalyear'
|
||||
$doc_date_start = $prev_fiscal_date_start;
|
||||
$doc_date_end = $cur_fiscal_date_end;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_numeric($doc_date_start)) {
|
||||
$filter['t.doc_date>='] = $doc_date_start;
|
||||
}
|
||||
if (is_numeric($doc_date_end)) {
|
||||
$filter['t.doc_date<='] = $doc_date_end;
|
||||
}
|
||||
|
||||
$result = $bookkeeping->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $alreadyexport);
|
||||
|
||||
if ($result < 0) {
|
||||
throw new RestException(500, 'Error bookkeeping fetch all : '.$bookkeeping->errorsToString());
|
||||
} else {
|
||||
// export files then exit
|
||||
if (empty($lettering)) {
|
||||
if (is_array($bookkeeping->lines)) {
|
||||
foreach ($bookkeeping->lines as $k => $movement) {
|
||||
unset($bookkeeping->lines[$k]->lettering_code);
|
||||
unset($bookkeeping->lines[$k]->date_lettering);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
$this->db->begin();
|
||||
|
||||
if (empty($notnotifiedasexport)) {
|
||||
if (is_array($bookkeeping->lines)) {
|
||||
foreach ($bookkeeping->lines as $movement) {
|
||||
$now = dol_now();
|
||||
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping";
|
||||
$sql .= " SET date_export = '" . $this->db->idate($now) . "'";
|
||||
$sql .= " WHERE rowid = " . ((int) $movement->id);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if (!$result) {
|
||||
$accountancyexport->errors[] = $langs->trans('NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// export and only write file without downloading
|
||||
if (!$error) {
|
||||
$result = $accountancyexport->export($bookkeeping->lines, $format_number, 0, 1, 2);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$this->db->rollback();
|
||||
throw new RestException(500, 'Error accountancy export : '.implode(',', $accountancyexport->errors));
|
||||
} else {
|
||||
$this->db->commit();
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -282,7 +282,7 @@ class BookKeeping extends CommonObject
|
|||
$this->errors[] = $langs->trans('ErrorFieldAccountNotDefinedForBankLine', $this->fk_docdet, $this->doc_type);
|
||||
} else {
|
||||
//$this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForInvoiceLine', $this->doc_ref, $this->label_compte);
|
||||
$mesg = $this->doc_ref.', '.$langs->trans("AccountAccounting").': '.$this->numero_compte;
|
||||
$mesg = $this->doc_ref.', '.$langs->trans("AccountAccounting").': '.($this->numero_compte != -1 ? $this->numero_compte : $langs->trans("Unknown"));
|
||||
if ($this->subledger_account && $this->subledger_account != $this->numero_compte) {
|
||||
$mesg .= ', '.$langs->trans("SubledgerAccount").': '.$this->subledger_account;
|
||||
}
|
||||
|
|
@ -716,11 +716,10 @@ class BookKeeping extends CommonObject
|
|||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $ref Ref
|
||||
* @param string $mode Mode
|
||||
*
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
* @param int $id Id object
|
||||
* @param string $ref Ref (Not used. Does not exists on this table, same as rowid)
|
||||
* @param string $mode Mode
|
||||
* @return int Int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $ref = null, $mode = '')
|
||||
{
|
||||
|
|
@ -761,7 +760,7 @@ class BookKeeping extends CommonObject
|
|||
$sql .= ' WHERE 1 = 1';
|
||||
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||
if (null !== $ref) {
|
||||
$sql .= " AND t.ref = '".$this->db->escape($ref)."'";
|
||||
$sql .= " AND t.rowid = ".((int) $ref);
|
||||
} else {
|
||||
$sql .= ' AND t.rowid = '.((int) $id);
|
||||
}
|
||||
|
|
@ -1480,15 +1479,16 @@ class BookKeeping extends CommonObject
|
|||
* Delete bookkeeping by importkey
|
||||
*
|
||||
* @param string $importkey Import key
|
||||
* @param string $mode Mode
|
||||
* @return int Result
|
||||
*/
|
||||
public function deleteByImportkey($importkey)
|
||||
public function deleteByImportkey($importkey, $mode = '')
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
// first check if line not yet in bookkeeping
|
||||
$sql = "DELETE";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
|
||||
$sql .= " WHERE import_key = '".$this->db->escape($importkey)."'";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -1562,9 +1562,10 @@ class BookKeeping extends CommonObject
|
|||
* Delete bookkeeping by piece number
|
||||
*
|
||||
* @param int $piecenum Piecenum to delete
|
||||
* @param string $mode Mode
|
||||
* @return int Result
|
||||
*/
|
||||
public function deleteMvtNum($piecenum)
|
||||
public function deleteMvtNum($piecenum, $mode = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
|
@ -1572,7 +1573,7 @@ class BookKeeping extends CommonObject
|
|||
|
||||
// first check if line not yet in bookkeeping
|
||||
$sql = "DELETE";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
|
||||
$sql .= " WHERE piece_num = ".(int) $piecenum;
|
||||
$sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion
|
||||
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||
|
|
@ -2031,7 +2032,7 @@ class BookKeeping extends CommonObject
|
|||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
$pcgver = getDolGlobalInt('CHARTOFACCOUNTS');
|
||||
|
||||
$sql = "SELECT DISTINCT ab.numero_compte as account_number, aa.label as label, aa.rowid as rowid, aa.fk_pcg_version";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab";
|
||||
|
|
@ -2093,7 +2094,7 @@ class BookKeeping extends CommonObject
|
|||
public function getRootAccount($account = null)
|
||||
{
|
||||
global $conf;
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
$pcgver = getDolGlobalInt('CHARTOFACCOUNTS');
|
||||
|
||||
$sql = "SELECT root.rowid, root.account_number, root.label as label,";
|
||||
$sql .= " parent.rowid as parent_rowid, parent.account_number as parent_account_number, parent.label as parent_label";
|
||||
|
|
@ -2135,7 +2136,7 @@ class BookKeeping extends CommonObject
|
|||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
$pcgver = getDolGlobalInt('CHARTOFACCOUNTS');
|
||||
$sql = "SELECT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version, cat.label as category";
|
||||
$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";
|
||||
|
|
|
|||
|
|
@ -692,6 +692,9 @@ class Lettering extends BookKeeping
|
|||
|
||||
// Clean parameters
|
||||
$document_ids = is_array($document_ids) ? $document_ids : array();
|
||||
//remove empty entries
|
||||
$document_ids = array_filter($document_ids);
|
||||
|
||||
$doc_type = trim($doc_type);
|
||||
|
||||
if (empty($document_ids)) {
|
||||
|
|
@ -742,10 +745,13 @@ class Lettering extends BookKeeping
|
|||
// Clean parameters
|
||||
$document_ids = is_array($document_ids) ? $document_ids : array();
|
||||
$doc_type = trim($doc_type);
|
||||
//remove empty entries
|
||||
$document_ids = array_filter($document_ids);
|
||||
|
||||
if (empty($document_ids)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
if (!is_array(self::$doc_type_infos[$doc_type])) {
|
||||
$langs->load('errors');
|
||||
$this->errors[] = $langs->trans('ErrorBadParameters');
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ $y = $year_current;
|
|||
|
||||
$buttonvalidate = '<a class="butAction" name="button_validate_movements" href="'.$_SERVER["PHP_SELF"].'?action=validate_movements&year='.$year_start.'">'.$langs->trans("ValidateMovements").'</a>';
|
||||
|
||||
print_barre_liste($langs->trans("OverviewOfMovementsNotValidated"), '', '', '', '', '', '', -1, '', '', 0, $buttonvalidate, '', 0, 1, 1);
|
||||
print_barre_liste($langs->trans("OverviewOfMovementsNotValidated"), '', '', '', '', '', '', -1, '', '', 0, $buttonvalidate, '', 0, 1, 0);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ $year_current = $year_start;
|
|||
// Validate History
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
$chartaccountcode = dol_getIdFromCode($db, getDolGlobalInt('CHARTOFACCOUNTS'), 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('accounting')) {
|
||||
|
|
@ -96,15 +96,15 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
|||
if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('accounting', 'bind', 'write')) {
|
||||
// Clean database by removing binding done on non existing or no more existing accounts
|
||||
$db->begin();
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as fd";
|
||||
$sql1 = "UPDATE ".$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='.((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity).')';
|
||||
$sql1 .= ' AND fd.fk_facture IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'facture WHERE entity = '.((int) $conf->entity).')';
|
||||
$sql1 .= ' AND fk_code_ventilation <> 0';
|
||||
$sql1 .= ' FROM '.$db->prefix().'accounting_account as accnt';
|
||||
$sql1 .= ' INNER JOIN '.$db->prefix().'accounting_system as syst';
|
||||
$sql1 .= " ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) getDolGlobalInt('CHARTOFACCOUNTS'))." AND accnt.entity = ".((int) $conf->entity).")";
|
||||
$sql1 .= " AND fd.fk_facture IN (SELECT rowid FROM ".$db->prefix()."facture WHERE entity = ".((int) $conf->entity).")";
|
||||
$sql1 .= " AND fk_code_ventilation <> 0";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
$resql1 = $db->query($sql1);
|
||||
|
|
@ -144,23 +144,23 @@ if ($action == 'validatehistory') {
|
|||
} else {
|
||||
$sql .= " s.accountancy_code_sell as company_code_sell"; // accounting code for product but stored on thirdparty
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
|
||||
$sql .= " FROM ".$db->prefix()."facture as f";
|
||||
$sql .= " INNER JOIN ".$db->prefix()."societe as s ON s.rowid = f.fk_soc";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
|
||||
$sql .= " LEFT JOIN " . $db->prefix() . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facturedet as l ON f.rowid = l.fk_facture"; // the main table
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
|
||||
$sql .= " LEFT JOIN ".$db->prefix()."c_country as co ON co.rowid = s.fk_pays ";
|
||||
$sql .= " INNER JOIN ".$db->prefix()."facturedet as l ON f.rowid = l.fk_facture"; // the main table
|
||||
$sql .= " LEFT JOIN ".$db->prefix()."product as p ON p.rowid = l.fk_product";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
$sql .= " LEFT JOIN " . $db->prefix() . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe";
|
||||
$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_sell = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_sell = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||
$sql .= " AND l.product_type <= 2";
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ $hookmanager->initHooks(array('accountancycustomerlist'));
|
|||
$formaccounting = new FormAccounting($db);
|
||||
$accountingAccount = new AccountingAccount($db);
|
||||
|
||||
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
$chartaccountcode = dol_getIdFromCode($db, getDolGlobalInt('CHARTOFACCOUNTS'), 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('accounting')) {
|
||||
|
|
@ -166,7 +166,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
|
||||
if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
if ($massaction == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) {
|
||||
$msg = '';
|
||||
|
||||
//print '<div><span style="color:red">' . $langs->trans("Processing") . '...</span></div>';
|
||||
|
|
@ -359,7 +359,7 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
@ -446,7 +446,7 @@ if ($result) {
|
|||
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
//if ($user->hasRight('mymodule', 'supprimer')) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
if ($massaction !== 'set_default_account') {
|
||||
$massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ if (!isModEnabled('accounting')) {
|
|||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
|
|||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
if ($action == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) {
|
||||
if (!$cancel) {
|
||||
if ($codeventil < 0) {
|
||||
$codeventil = 0;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ $year_current = $year_start;
|
|||
// Validate History
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
$chartaccountcode = dol_getIdFromCode($db, getDolGlobalInt('CHARTOFACCOUNTS'), 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('accounting')) {
|
||||
|
|
@ -85,7 +85,7 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('acc
|
|||
$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='.((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity).')';
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid='.((int) getDolGlobalInt('CHARTOFACCOUNTS')).' AND accnt.entity = '.((int) $conf->entity).')';
|
||||
$sql1 .= ' AND erd.fk_expensereport IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'expensereport WHERE entity = '.((int) $conf->entity).')';
|
||||
$sql1 .= ' AND fk_code_ventilation <> 0';
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ if (!isModEnabled('accounting')) {
|
|||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|||
$search_date_end = '';
|
||||
}
|
||||
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->accounting->bind->write) {
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0 && $user->hasRight('accounting', 'bind', 'write')) {
|
||||
$error = 0;
|
||||
|
||||
if (!(GETPOST('account_parent', 'int') >= 0)) {
|
||||
|
|
@ -234,7 +234,7 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ $hookmanager->initHooks(array('accountancyexpensereportlist'));
|
|||
$formaccounting = new FormAccounting($db);
|
||||
$accounting = new AccountingAccount($db);
|
||||
|
||||
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
$chartaccountcode = dol_getIdFromCode($db, getDolGlobalInt('CHARTOFACCOUNTS'), 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('accounting')) {
|
||||
|
|
@ -104,7 +104,7 @@ if (!isModEnabled('accounting')) {
|
|||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
|
||||
if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
if ($massaction == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) {
|
||||
$msg = '';
|
||||
|
||||
if (!empty($mesCasesCochees)) {
|
||||
|
|
@ -283,7 +283,7 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
|
|||
|
|
@ -262,11 +262,14 @@ if (isModEnabled('accounting')) {
|
|||
print $boxlist;
|
||||
|
||||
print '</div>';
|
||||
} else {
|
||||
} elseif (isModEnabled('compta')) {
|
||||
print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("Module10Desc")."</span>\n";
|
||||
print "<br>";
|
||||
} else {
|
||||
// This case can happen mode no accounting module is on but module "intracommreport" is on
|
||||
print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@
|
|||
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2022 Open-DSI <support@open-dsi.fr>
|
||||
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2017-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2017-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Eric Seigne <eric.seigne@cap-rel.fr>
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
|
|
@ -89,7 +90,7 @@ if (!isModEnabled('accounting')) {
|
|||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
@ -147,8 +148,8 @@ if ($date_start && $date_end) {
|
|||
$sql .= " AND b.dateo >= '".$db->idate($date_start)."' AND b.dateo <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
// Define begin binding date
|
||||
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
|
||||
$sql .= " AND b.dateo >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
if (getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$sql .= " AND b.dateo >= '".$db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING'))."'";
|
||||
}
|
||||
// Already in bookkeeping or not
|
||||
if ($in_bookkeeping == 'already') {
|
||||
|
|
@ -195,13 +196,13 @@ if ($result) {
|
|||
//print $sql;
|
||||
|
||||
// Variables
|
||||
$account_supplier = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_customer = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "") ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_employee = (!empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_pay_vat = (!empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_pay_donation = (!empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_pay_subscription = (!empty($conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT) ? $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_transfer = (!empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_supplier = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER', 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_customer = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER', 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_employee = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT', 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_pay_vat = getDolGlobalString('ACCOUNTING_VAT_PAY_ACCOUNT', 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_pay_donation = getDolGlobalString('DONATION_ACCOUNTINGACCOUNT', 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_pay_subscription = getDolGlobalString('ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT', 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_transfer = getDolGlobalString('ACCOUNTING_ACCOUNT_TRANSFER_CASH', 'NotDefined'); // NotDefined is a reserved word
|
||||
|
||||
$tabcompany = array();
|
||||
$tabuser = array();
|
||||
|
|
@ -805,12 +806,6 @@ if (!$error && $action == 'writebookkeeping') {
|
|||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
$lettering_static = new Lettering($db);
|
||||
$nb_lettering = $lettering_static->bookkeepingLetteringAll(array($bookkeeping->id));
|
||||
|
||||
if ($nb_lettering < 0) {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($lettering_static->error, $lettering_static->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -866,7 +861,7 @@ if (!$error && $action == 'writebookkeeping') {
|
|||
if (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')) {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages('Try to insert a non balanced transaction in book for '.$ref.'. Canceled. Surely a bug.', null, 'errors');
|
||||
setEventMessages('We tried to insert a non balanced transaction in book for '.$ref.'. Canceled. Surely a bug.', null, 'errors');
|
||||
}
|
||||
|
||||
if (!$errorforline) {
|
||||
|
|
@ -912,7 +907,7 @@ if (!$error && $action == 'writebookkeeping') {
|
|||
|
||||
// Export
|
||||
if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$sep = getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV');
|
||||
|
||||
$filename = 'journal';
|
||||
$type_export = 'journal';
|
||||
|
|
@ -983,13 +978,13 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||
print '"'.$val["type_payment"].'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
if ($tabtype[$key] == 'payment_supplier') {
|
||||
print '"'.$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER.'"'.$sep;
|
||||
print '"'.getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER').'"'.$sep;
|
||||
} elseif ($tabtype[$key] == 'payment') {
|
||||
print '"'.$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER.'"'.$sep;
|
||||
print '"'.getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER').'"'.$sep;
|
||||
} elseif ($tabtype[$key] == 'payment_expensereport') {
|
||||
print '"'.$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT.'"'.$sep;
|
||||
print '"'.getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT').'"'.$sep;
|
||||
} elseif ($tabtype[$key] == 'payment_salary') {
|
||||
print '"'.$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT.'"'.$sep;
|
||||
print '"'.getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT').'"'.$sep;
|
||||
} else {
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
}
|
||||
|
|
@ -1014,9 +1009,9 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["type_payment"].'"'.$sep;
|
||||
print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE).'"'.$sep;
|
||||
print '"'.length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE).'"'.$sep;
|
||||
print "".$sep;
|
||||
print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE')).'"'.$sep;
|
||||
print '"'.length_accounta(getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE')).'"'.$sep;
|
||||
print $sep;
|
||||
print '"'.$reflabel.'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
|
|
@ -1088,9 +1083,9 @@ if (empty($action) || $action == 'view') {
|
|||
|
||||
|
||||
// Button to write into Ledger
|
||||
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|
||||
|| ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
|
||||
|| empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
||||
if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == '-1'
|
||||
|| getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == '-1'
|
||||
|| getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == "" || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1') {
|
||||
print ($desc ? '' : '<br>').'<div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
$desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}');
|
||||
$desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>', $desc);
|
||||
|
|
@ -1105,8 +1100,8 @@ if (empty($action) || $action == 'view') {
|
|||
print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
|
||||
}
|
||||
|
||||
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|
||||
|| ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
||||
if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == '-1'
|
||||
|| getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == '-1') {
|
||||
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
|
||||
} else {
|
||||
if ($in_bookkeeping == 'notyet') {
|
||||
|
|
|
|||
|
|
@ -57,6 +57,9 @@ if ($in_bookkeeping == '') {
|
|||
|
||||
$now = dol_now();
|
||||
|
||||
$hookmanager->initHooks(array('expensereportsjournal'));
|
||||
$parameters = array();
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
|
|
@ -64,7 +67,7 @@ if (!isModEnabled('accounting')) {
|
|||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
@ -102,11 +105,17 @@ $sql = "SELECT er.rowid, er.ref, er.date_debut as de,";
|
|||
$sql .= " erd.rowid as erdid, erd.comments, erd.total_ht, erd.total_tva, erd.total_localtax1, erd.total_localtax2, erd.tva_tx, erd.total_ttc, erd.fk_code_ventilation, erd.vat_src_code, ";
|
||||
$sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_account,";
|
||||
$sql .= " f.accountancy_code, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= " FROM ".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."accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."expensereport as er ON er.rowid = erd.fk_expensereport";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = er.fk_user_author";
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= " WHERE er.fk_statut > 0";
|
||||
$sql .= " AND erd.fk_code_ventilation > 0";
|
||||
$sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy
|
||||
|
|
@ -124,6 +133,9 @@ if ($in_bookkeeping == 'already') {
|
|||
if ($in_bookkeeping == 'notyet') {
|
||||
$sql .= " AND er.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
|
||||
}
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= " ORDER BY er.date_debut";
|
||||
|
||||
dol_syslog('accountancy/journal/expensereportsjournal.php', LOG_DEBUG);
|
||||
|
|
@ -380,7 +392,7 @@ if ($action == 'writebookkeeping') {
|
|||
if (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')) {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages('Try to insert a non balanced transaction in book for '.$val["ref"].'. Canceled. Surely a bug.', null, 'errors');
|
||||
setEventMessages('We tried to insert a non balanced transaction in book for '.$val["ref"].'. Canceled. Surely a bug.', null, 'errors');
|
||||
}
|
||||
|
||||
if (!$errorforline) {
|
||||
|
|
@ -469,6 +481,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// VAT
|
||||
foreach ($tabtva[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ if (!isModEnabled('accounting')) {
|
|||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
@ -109,35 +109,41 @@ $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva
|
|||
$sql .= " p.default_vat_code AS product_buy_default_vat_code, p.tva_tx as product_buy_vat, p.localtax1_tx as product_buy_localvat1, p.localtax2_tx as product_buy_localvat2,";
|
||||
$sql .= " co.code as country_code, co.label as country_label,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.fk_pays,";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
|
||||
$sql .= " spe.accountancy_code_customer as code_compta,";
|
||||
$sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,";
|
||||
} else {
|
||||
$sql .= " s.code_compta as code_compta,";
|
||||
$sql .= " s.code_compta_fournisseur,";
|
||||
}
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
|
||||
$sql .= " ppe.accountancy_code_buy,";
|
||||
} else {
|
||||
$sql .= " p.accountancy_code_buy,";
|
||||
}
|
||||
$sql .= " aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as fd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = fd.fk_facture_fourn";
|
||||
$sql .= " 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 ";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= " WHERE f.fk_statut > 0";
|
||||
$sql .= " AND fd.fk_code_ventilation > 0";
|
||||
$sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
|
||||
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) {
|
||||
$sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_SITUATION.")";
|
||||
} else {
|
||||
$sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_DEPOSIT.",".FactureFournisseur::TYPE_SITUATION.")";
|
||||
|
|
@ -146,8 +152,8 @@ if ($date_start && $date_end) {
|
|||
$sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
// Define begin binding date
|
||||
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
|
||||
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$sql .= " AND f.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'";
|
||||
}
|
||||
// Already in bookkeeping or not
|
||||
if ($in_bookkeeping == 'already') {
|
||||
|
|
@ -156,6 +162,9 @@ if ($in_bookkeeping == 'already') {
|
|||
if ($in_bookkeeping == 'notyet') {
|
||||
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
|
||||
}
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= " ORDER BY f.datef";
|
||||
|
||||
dol_syslog('accountancy/journal/purchasesjournal.php', LOG_DEBUG);
|
||||
|
|
@ -177,10 +186,10 @@ if ($result) {
|
|||
$num = $db->num_rows($result);
|
||||
|
||||
// Variables
|
||||
$cptfour = ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined';
|
||||
$cpttva = (!empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined';
|
||||
$rcctva = (!empty($conf->global->ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT)) ? $conf->global->ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT : 'NotDefined';
|
||||
$rcdtva = (!empty($conf->global->ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT)) ? $conf->global->ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT : 'NotDefined';
|
||||
$cptfour = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER', 'NotDefined');
|
||||
$cpttva = getDolGlobalString('ACCOUNTING_VAT_BUY_ACCOUNT', 'NotDefined');
|
||||
$rcctva = getDolGlobalString('ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT', 'NotDefined');
|
||||
$rcdtva = getDolGlobalString('ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT', 'NotDefined');
|
||||
$country_code_in_EEC = getCountriesInEEC(); // This make a database call but there is a cache done into $conf->cache['country_code_in_EEC']
|
||||
|
||||
$i = 0;
|
||||
|
|
@ -193,9 +202,9 @@ if ($result) {
|
|||
$compta_prod = $obj->compte;
|
||||
if (empty($compta_prod)) {
|
||||
if ($obj->product_type == 0) {
|
||||
$compta_prod = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : 'NotDefined';
|
||||
$compta_prod = getDolGlobalString('ACCOUNTING_PRODUCT_BUY_ACCOUNT', 'NotDefined');
|
||||
} else {
|
||||
$compta_prod = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : 'NotDefined';
|
||||
$compta_prod = getDolGlobalString('ACCOUNTING_SERVICE_BUY_ACCOUNT', 'NotDefined');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -203,7 +212,7 @@ if ($result) {
|
|||
$compta_tva = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
$compta_localtax1 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
$compta_localtax2 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
$compta_counterpart_tva_npr = (!empty($conf->global->ACCOUNTING_COUNTERPART_VAT_NPR)) ? $conf->global->ACCOUNTING_COUNTERPART_VAT_NPR : 'NotDefined';
|
||||
$compta_counterpart_tva_npr = getDolGlobalString('ACCOUNTING_COUNTERPART_VAT_NPR', 'NotDefined');
|
||||
|
||||
// Define array to display all VAT rates that use this accounting account $compta_tva
|
||||
if (price2num($obj->tva_tx) || !empty($obj->vat_src_code)) {
|
||||
|
|
@ -241,7 +250,7 @@ if ($result) {
|
|||
}
|
||||
|
||||
// VAT Reverse charge
|
||||
if (($mysoc->country_code == 'FR' || !empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) && $obj->vat_reverse_charge == 1 && in_array($obj->country_code, $country_code_in_EEC)) {
|
||||
if (($mysoc->country_code == 'FR' || getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) && $obj->vat_reverse_charge == 1 && in_array($obj->country_code, $country_code_in_EEC)) {
|
||||
$rcvatdata = getTaxesFromId($obj->product_buy_vat . ($obj->product_buy_default_vat_code ? ' (' . $obj->product_buy_default_vat_code . ')' : ''), $mysoc, $mysoc, 0);
|
||||
$rcc_compta_tva = (!empty($vatdata['accountancy_code_vat_reverse_charge_credit']) ? $vatdata['accountancy_code_vat_reverse_charge_credit'] : $rcctva);
|
||||
$rcd_compta_tva = (!empty($vatdata['accountancy_code_vat_reverse_charge_debit']) ? $vatdata['accountancy_code_vat_reverse_charge_debit'] : $rcdtva);
|
||||
|
|
@ -340,7 +349,7 @@ if ($action == 'writebookkeeping') {
|
|||
$invoicestatic = new FactureFournisseur($db);
|
||||
$accountingaccountsupplier = new AccountingAccount($db);
|
||||
|
||||
$accountingaccountsupplier->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true);
|
||||
$accountingaccountsupplier->fetch(null, getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'), true);
|
||||
|
||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||
$errorforline = 0;
|
||||
|
|
@ -404,7 +413,7 @@ if ($action == 'writebookkeeping') {
|
|||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||
$bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER');
|
||||
$bookkeeping->label_compte = $accountingaccountsupplier->label;
|
||||
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("SubledgerAccount");
|
||||
|
|
@ -437,13 +446,8 @@ if ($action == 'writebookkeeping') {
|
|||
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
$lettering_static = new Lettering($db);
|
||||
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
|
||||
|
||||
if ($nb_lettering < 0) {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($lettering_static->error, $lettering_static->errors, 'errors');
|
||||
}
|
||||
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -467,7 +471,7 @@ if ($action == 'writebookkeeping') {
|
|||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||
|
||||
if (!empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT)) {
|
||||
if (getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT')) {
|
||||
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT')) {
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
|
|
@ -528,7 +532,7 @@ if ($action == 'writebookkeeping') {
|
|||
}
|
||||
|
||||
// VAT Reverse charge
|
||||
if ($mysoc->country_code == 'FR' || !empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
|
||||
if ($mysoc->country_code == 'FR' || getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) {
|
||||
$has_vat = false;
|
||||
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
|
|
@ -659,7 +663,7 @@ if ($action == 'writebookkeeping') {
|
|||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'amountsnotbalanced';
|
||||
setEventMessages('Try to insert a non balanced transaction in book for '.$invoicestatic->ref.'. Canceled. Surely a bug.', null, 'errors');
|
||||
setEventMessages('We tried to insert a non balanced transaction in book for '.$invoicestatic->ref.'. Canceled. Surely a bug.', null, 'errors');
|
||||
}
|
||||
|
||||
if (!$errorforline) {
|
||||
|
|
@ -709,7 +713,7 @@ $form = new Form($db);
|
|||
|
||||
// Export
|
||||
if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$sep = getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV');
|
||||
|
||||
$filename = 'journal';
|
||||
$type_export = 'journal';
|
||||
|
|
@ -757,7 +761,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||
print '"'.$val["refsologest"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER).'"'.$sep;
|
||||
print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.$langs->trans("Thirdparty").'"'.$sep;
|
||||
|
|
@ -801,7 +805,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||
}
|
||||
|
||||
// VAT Reverse charge
|
||||
if ($mysoc->country_code == 'FR' || !empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
|
||||
if ($mysoc->country_code == 'FR' || getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) {
|
||||
$has_vat = false;
|
||||
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
|
|
@ -876,7 +880,7 @@ if (empty($action) || $action == 'view') {
|
|||
$exportlink = '';
|
||||
$builddate = dol_now();
|
||||
$description = $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) {
|
||||
$description .= $langs->trans("DepositsAreNotIncluded");
|
||||
} else {
|
||||
$description .= $langs->trans("DepositsAreIncluded");
|
||||
|
|
@ -891,7 +895,8 @@ if (empty($action) || $action == 'view') {
|
|||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
// Button to write into Ledger
|
||||
if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
||||
$acctSupplierNotConfigured = in_array(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'), ['','-1']);
|
||||
if ($acctSupplierNotConfigured) {
|
||||
print '<br><div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
$desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}');
|
||||
$desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>', $desc);
|
||||
|
|
@ -899,10 +904,10 @@ if (empty($action) || $action == 'view') {
|
|||
print '</div>';
|
||||
}
|
||||
print '<div class="tabsAction tabsActionNoBottom centerimp">';
|
||||
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') {
|
||||
if (getDolGlobalString('ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL') && $in_bookkeeping == 'notyet') {
|
||||
print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
|
||||
}
|
||||
if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
||||
if ($acctSupplierNotConfigured) {
|
||||
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
|
||||
} else {
|
||||
if ($in_bookkeeping == 'notyet') {
|
||||
|
|
@ -1028,7 +1033,7 @@ if (empty($action) || $action == 'view') {
|
|||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER);
|
||||
$accountoshow = length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'));
|
||||
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||
print '<span class="error">'.$langs->trans("MainAccountForSuppliersNotDefined").'</span>';
|
||||
} else {
|
||||
|
|
@ -1072,7 +1077,7 @@ if (empty($action) || $action == 'view') {
|
|||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
if (!empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT)) {
|
||||
if (getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT')) {
|
||||
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT')) {
|
||||
print length_accounta($tabcompany[$key]['code_compta']);
|
||||
}
|
||||
|
|
@ -1102,7 +1107,7 @@ if (empty($action) || $action == 'view') {
|
|||
}
|
||||
|
||||
// VAT Reverse charge
|
||||
if ($mysoc->country_code == 'FR' || !empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
|
||||
if ($mysoc->country_code == 'FR' || getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) {
|
||||
$has_vat = false;
|
||||
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
|
|
@ -1134,7 +1139,7 @@ if (empty($action) || $action == 'view') {
|
|||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Purchase").')</span>';
|
||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("AccountingJournalType3").')</span>';
|
||||
} else {
|
||||
print $accountoshow;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
|
|
@ -70,7 +70,7 @@ if (!isModEnabled('accounting')) {
|
|||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
@ -100,16 +100,19 @@ if (empty($date_startmonth) || empty($date_endmonth)) {
|
|||
$pastmonthyear = $dates['pastmonthyear'];
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
}
|
||||
if (getDolGlobalString('ACCOUNTANCY_JOURNAL_USE_CURRENT_MONTH')) {
|
||||
$pastmonth+=1;
|
||||
}
|
||||
|
||||
if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) { // We define date_start and date_end, only if we did not submit the form
|
||||
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);
|
||||
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
||||
}
|
||||
|
||||
$sql = "SELECT f.rowid, f.ref, f.type, f.situation_cycle_ref, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code, f.retained_warranty,";
|
||||
$sql = "SELECT f.rowid, f.ref, f.type, f.situation_cycle_ref, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code, f.retained_warranty, f.revenuestamp,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code, fd.info_bits,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur,";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
|
||||
$sql .= " spe.accountancy_code_customer as code_compta,";
|
||||
$sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,";
|
||||
} else {
|
||||
|
|
@ -117,26 +120,32 @@ if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
|||
$sql .= " s.code_compta_fournisseur,";
|
||||
}
|
||||
$sql .= " p.rowid as pid, p.ref as pref, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
|
||||
$sql .= " ppe.accountancy_code_sell";
|
||||
} else {
|
||||
$sql .= " p.accountancy_code_sell";
|
||||
}
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= " WHERE fd.fk_code_ventilation > 0";
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice', 0).')'; // We don't share object for accountancy, we use source object sharing
|
||||
$sql .= " AND f.fk_statut > 0";
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Non common setup
|
||||
if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) { // Non common setup
|
||||
$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.")";
|
||||
|
|
@ -146,8 +155,8 @@ if ($date_start && $date_end) {
|
|||
$sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
// Define begin binding date
|
||||
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
|
||||
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$sql .= " AND f.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'";
|
||||
}
|
||||
// Already in bookkeeping or not
|
||||
if ($in_bookkeeping == 'already') {
|
||||
|
|
@ -158,8 +167,11 @@ if ($in_bookkeeping == 'notyet') {
|
|||
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
|
||||
// $sql .= " AND fd.rowid NOT IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account
|
||||
}
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= " ORDER BY f.datef, f.ref";
|
||||
//print $sql; exit;
|
||||
//print $sql;
|
||||
|
||||
dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
|
|
@ -169,6 +181,7 @@ if ($result) {
|
|||
$tabtva = array();
|
||||
$def_tva = array();
|
||||
$tabwarranty = array();
|
||||
$tabrevenuestamp = array();
|
||||
$tabttc = array();
|
||||
$tablocaltax1 = array();
|
||||
$tablocaltax2 = array();
|
||||
|
|
@ -177,8 +190,8 @@ if ($result) {
|
|||
$num = $db->num_rows($result);
|
||||
|
||||
// Variables
|
||||
$cptcli = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "")) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined';
|
||||
$cpttva = (!empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : 'NotDefined';
|
||||
$cptcli = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER', 'NotDefined');
|
||||
$cpttva = getDolGlobalString('ACCOUNTING_VAT_SOLD_ACCOUNT', 'NotDefined');
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
|
|
@ -190,23 +203,25 @@ if ($result) {
|
|||
$compta_prod = $obj->compte;
|
||||
if (empty($compta_prod)) {
|
||||
if ($obj->product_type == 0) {
|
||||
$compta_prod = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : 'NotDefined';
|
||||
$compta_prod = getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_ACCOUNT', 'NotDefined');
|
||||
} else {
|
||||
$compta_prod = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : 'NotDefined';
|
||||
$compta_prod = getDolGlobalString('ACCOUNTING_SERVICE_SOLD_ACCOUNT', 'NotDefined');
|
||||
}
|
||||
}
|
||||
|
||||
//$compta_revenuestamp = getDolGlobalString('ACCOUNTING_REVENUESTAMP_SOLD_ACCOUNT', 'NotDefined');
|
||||
|
||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), $mysoc, $mysoc, 0);
|
||||
$compta_tva = (!empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
$compta_localtax1 = (!empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
$compta_localtax2 = (!empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
|
||||
// Define array to display all VAT rates that use this accounting account $compta_tva
|
||||
// Define the array to store the detail of each vat rate and code for lines
|
||||
if (price2num($obj->tva_tx) || !empty($obj->vat_src_code)) {
|
||||
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '')] = (vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''));
|
||||
}
|
||||
|
||||
// Create a compensation rate.
|
||||
// Create a compensation rate for situation invoice.
|
||||
$situation_ratio = 1;
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
if ($obj->situation_cycle_ref) {
|
||||
|
|
@ -225,6 +240,8 @@ if ($result) {
|
|||
}
|
||||
}
|
||||
|
||||
$revenuestamp = (double) price2num($obj->revenuestamp, 'MT');
|
||||
|
||||
// Invoice lines
|
||||
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
|
||||
$tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr);
|
||||
|
|
@ -232,6 +249,7 @@ if ($result) {
|
|||
$tabfac[$obj->rowid]["type"] = $obj->type;
|
||||
$tabfac[$obj->rowid]["description"] = $obj->label_compte;
|
||||
$tabfac[$obj->rowid]["close_code"] = $obj->close_code; // close_code = 'replaced' for replacement invoices (not used in most european countries)
|
||||
$tabfac[$obj->rowid]["revenuestamp"] = $revenuestamp;
|
||||
//$tabfac[$obj->rowid]["fk_facturedet"] = $obj->fdid;
|
||||
|
||||
// Avoid warnings
|
||||
|
|
@ -256,12 +274,19 @@ if ($result) {
|
|||
// real data we should have stored and result obtained with a compensation.
|
||||
// It also seems that credit notes on situation invoices are correctly saved (but it depends on the version used in fact).
|
||||
// For credit notes, we hope to have situation_ratio = 1 so the compensation has no effect to avoid introducing troubles with credit notes.
|
||||
$total_ttc = $obj->total_ttc * $situation_ratio;
|
||||
if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY) && $obj->retained_warranty > 0) {
|
||||
$retained_warranty = (double) price2num($total_ttc * $obj->retained_warranty / 100, 'MT');
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
$total_ttc = $obj->total_ttc * $situation_ratio;
|
||||
} else {
|
||||
$total_ttc = $obj->total_ttc;
|
||||
}
|
||||
|
||||
// Move a part of the retained warrenty into the account of warranty
|
||||
if (getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY') && $obj->retained_warranty > 0) {
|
||||
$retained_warranty = (double) price2num($total_ttc * $obj->retained_warranty / 100, 'MT'); // Calculate the amount of warrenty for this line (using the percent value)
|
||||
$tabwarranty[$obj->rowid][$compta_soc] += $retained_warranty;
|
||||
$total_ttc -= $retained_warranty;
|
||||
}
|
||||
|
||||
$tabttc[$obj->rowid][$compta_soc] += $total_ttc;
|
||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
|
||||
$tva_npr = (($obj->info_bits & 1 == 1) ? 1 : 0);
|
||||
|
|
@ -271,6 +296,32 @@ if ($result) {
|
|||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1 * $situation_ratio;
|
||||
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2 * $situation_ratio;
|
||||
|
||||
$compta_revenuestamp = 'NotDefined';
|
||||
if (!empty($revenuestamp)) {
|
||||
$sqlrevenuestamp = "SELECT accountancy_code_sell FROM ".MAIN_DB_PREFIX."c_revenuestamp";
|
||||
$sqlrevenuestamp .= " WHERE fk_pays = ".((int) $mysoc->country_id);
|
||||
$sqlrevenuestamp .= " AND taux = ".((double) $revenuestamp);
|
||||
$sqlrevenuestamp .= " AND active = 1";
|
||||
$resqlrevenuestamp = $db->query($sqlrevenuestamp);
|
||||
|
||||
if ($resqlrevenuestamp) {
|
||||
$num_rows_revenuestamp = $db->num_rows($resqlrevenuestamp);
|
||||
if ($num_rows_revenuestamp > 1) {
|
||||
dol_print_error($db, 'Failed 2 or more lines for the revenue stamp of your country. Check the dictionary of revenue stamp.');
|
||||
} else {
|
||||
$objrevenuestamp = $db->fetch_object($resqlrevenuestamp);
|
||||
if ($objrevenuestamp) {
|
||||
$compta_revenuestamp = $objrevenuestamp->accountancy_code_sell;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($tabrevenuestamp[$obj->rowid][$compta_revenuestamp]) && !empty($revenuestamp)) {
|
||||
// The revenue stamp was never seen for this invoice id=$obj->rowid
|
||||
$tabttc[$obj->rowid][$compta_soc] += $obj->revenuestamp;
|
||||
$tabrevenuestamp[$obj->rowid][$compta_revenuestamp] = $obj->revenuestamp;
|
||||
}
|
||||
|
||||
$tabcompany[$obj->rowid] = array(
|
||||
'id' => $obj->socid,
|
||||
|
|
@ -281,13 +332,15 @@ if ($result) {
|
|||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// After the loop on each line
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$errorforinvoice = array();
|
||||
|
||||
// Loop in invoices to detect lines with not binding lines
|
||||
// Loop on all invoices to detect lines without binded code (fk_code_ventilation <= 0)
|
||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||
$sql = "SELECT COUNT(fd.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||
|
|
@ -315,11 +368,11 @@ if ($action == 'writebookkeeping') {
|
|||
$invoicestatic = new Facture($db);
|
||||
$accountingaccountcustomer = new AccountingAccount($db);
|
||||
|
||||
$accountingaccountcustomer->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
|
||||
$accountingaccountcustomer->fetch(null, getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'), true);
|
||||
|
||||
$accountingaccountcustomerwarranty = new AccountingAccount($db);
|
||||
|
||||
$accountingaccountcustomerwarranty->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY, true);
|
||||
$accountingaccountcustomerwarranty->fetch(null, getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY'), true);
|
||||
|
||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||
$errorforline = 0;
|
||||
|
|
@ -332,6 +385,7 @@ if ($action == 'writebookkeeping') {
|
|||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
|
||||
$companystatic->code_compta_client = $tabcompany[$key]['code_compta'];
|
||||
$companystatic->code_client = $tabcompany[$key]['code_client'];
|
||||
$companystatic->client = 3;
|
||||
|
||||
|
|
@ -381,7 +435,7 @@ if ($action == 'writebookkeeping') {
|
|||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY;
|
||||
$bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY');
|
||||
$bookkeeping->label_compte = $accountingaccountcustomerwarranty->label;
|
||||
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("Retainedwarranty");
|
||||
|
|
@ -430,7 +484,7 @@ if ($action == 'writebookkeeping') {
|
|||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||
$bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER');
|
||||
$bookkeeping->label_compte = $accountingaccountcustomer->label;
|
||||
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("SubledgerAccount");
|
||||
|
|
@ -465,13 +519,6 @@ if ($action == 'writebookkeeping') {
|
|||
$lettering_static = new Lettering($db);
|
||||
|
||||
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
|
||||
|
||||
if ($nb_lettering < 0) {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'other';
|
||||
setEventMessages($lettering_static->error, $lettering_static->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -495,7 +542,7 @@ if ($action == 'writebookkeeping') {
|
|||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||
|
||||
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT)) {
|
||||
if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT')) {
|
||||
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT')) {
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
|
|
@ -607,12 +654,66 @@ if ($action == 'writebookkeeping') {
|
|||
}
|
||||
}
|
||||
|
||||
// Revenue stamp
|
||||
if (!$errorforline) {
|
||||
foreach ($tabrevenuestamp[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
$accountingaccount->fetch(null, $k, true); // TODO Use a cache for label
|
||||
$label_account = $accountingaccount->label;
|
||||
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->date_creation = $now;
|
||||
$bookkeeping->doc_type = 'customer_invoice';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = $label_account;
|
||||
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("RevenueStamp");
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
|
||||
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $langs->transnoentities($journal_label);
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
$bookkeeping->entity = $conf->entity;
|
||||
|
||||
$totaldebit += $bookkeeping->debit;
|
||||
$totalcredit += $bookkeeping->credit;
|
||||
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { // Already exists
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'alreadyjournalized';
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
} else {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'other';
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Protection against a bug on lines before
|
||||
if (!$errorforline && (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT'))) {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'amountsnotbalanced';
|
||||
setEventMessages('Try to insert a non balanced transaction in book for '.$invoicestatic->ref.'. Canceled. Surely a bug.', null, 'errors');
|
||||
setEventMessages('We Tried to insert a non balanced transaction in book for '.$invoicestatic->ref.'. Canceled. Surely a bug.', null, 'errors');
|
||||
}
|
||||
|
||||
if (!$errorforline) {
|
||||
|
|
@ -664,7 +765,8 @@ $form = new Form($db);
|
|||
|
||||
// Export
|
||||
if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
// Note that to have the button to get this feature enabled, you must enable ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL
|
||||
$sep = getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV');
|
||||
|
||||
$filename = 'journal';
|
||||
$type_export = 'journal';
|
||||
|
|
@ -711,7 +813,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||
print '"'.$val["ref"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY).'"'.$sep;
|
||||
print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY')).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("Retainedwarranty").'"'.$sep;
|
||||
|
|
@ -730,7 +832,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||
print '"'.$val["ref"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER).'"'.$sep;
|
||||
print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("Thirdparty").'"'.$sep;
|
||||
|
|
@ -791,6 +893,25 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Revenue stamp
|
||||
foreach ($tabrevenuestamp[$key] as $k => $mt) {
|
||||
//if ($mt) {
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["ref"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '""'.$sep;
|
||||
print '"'.$langs->trans("RevenueStamp").'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("RevenueStamp").'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -807,7 +928,7 @@ if (empty($action) || $action == 'view') {
|
|||
$exportlink = '';
|
||||
$builddate = dol_now();
|
||||
$description = $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) {
|
||||
$description .= $langs->trans("DepositsAreNotIncluded");
|
||||
} else {
|
||||
$description .= $langs->trans("DepositsAreIncluded");
|
||||
|
|
@ -822,7 +943,8 @@ if (empty($action) || $action == 'view') {
|
|||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
// Button to write into Ledger
|
||||
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||
$acctCustomerNotConfigured = in_array(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'), ['','-1']);
|
||||
if ($acctCustomerNotConfigured) {
|
||||
print '<br><div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
$desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}');
|
||||
$desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>', $desc);
|
||||
|
|
@ -830,10 +952,10 @@ if (empty($action) || $action == 'view') {
|
|||
print '</div>';
|
||||
}
|
||||
print '<div class="tabsAction tabsActionNoBottom centerimp">';
|
||||
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') {
|
||||
if (getDolGlobalString('ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL') && $in_bookkeeping == 'notyet') {
|
||||
print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
|
||||
}
|
||||
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||
if ($acctCustomerNotConfigured) {
|
||||
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
|
||||
} else {
|
||||
if ($in_bookkeeping == 'notyet') {
|
||||
|
|
@ -886,6 +1008,7 @@ if (empty($action) || $action == 'view') {
|
|||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
|
||||
$companystatic->code_compta_client = $tabcompany[$key]['code_compta'];
|
||||
$companystatic->code_client = $tabcompany[$key]['code_client'];
|
||||
$companystatic->client = 3;
|
||||
|
||||
|
|
@ -957,9 +1080,9 @@ if (empty($action) || $action == 'view') {
|
|||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY);
|
||||
$accountoshow = length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY'));
|
||||
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
|
||||
print '<span class="error">'.$langs->trans("MainAccountForRetainedWarrantyNotDefined").'</span>';
|
||||
} else {
|
||||
print $accountoshow;
|
||||
}
|
||||
|
|
@ -987,7 +1110,7 @@ if (empty($action) || $action == 'view') {
|
|||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER);
|
||||
$accountoshow = length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'));
|
||||
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
|
||||
} else {
|
||||
|
|
@ -1031,7 +1154,7 @@ if (empty($action) || $action == 'view') {
|
|||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT)) {
|
||||
if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT')) {
|
||||
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT')) {
|
||||
print length_accounta($tabcompany[$key]['code_compta']);
|
||||
}
|
||||
|
|
@ -1070,7 +1193,7 @@ if (empty($action) || $action == 'view') {
|
|||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Sale").')</span>';
|
||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("AccountingJournalType2").')</span>';
|
||||
} else {
|
||||
print $accountoshow;
|
||||
}
|
||||
|
|
@ -1088,6 +1211,30 @@ if (empty($action) || $action == 'view') {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Warranty
|
||||
foreach ($tabrevenuestamp[$key] as $k => $mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<!-- Thirdparty revenuestamp -->";
|
||||
print "<td>".$date."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||
print '<span class="error">'.$langs->trans("MainAccountForRevenueStampSaleNotDefined").'</span>';
|
||||
} else {
|
||||
print $accountoshow;
|
||||
}
|
||||
print '</td>';
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
print "<td>".$companystatic->getNomUrl(0, 'customer', 16).' - '.$invoicestatic->ref.' - '.$langs->trans("RevenueStamp")."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
|
||||
if (!$i) {
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ if (!isModEnabled('accounting')) {
|
|||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ if (!isModEnabled('accounting')) {
|
|||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
|
|||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
if ($action == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) {
|
||||
if (!$cancel) {
|
||||
if ($codeventil < 0) {
|
||||
$codeventil = 0;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ if (!isModEnabled('accounting')) {
|
|||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->bind->write)) {
|
||||
if (!$user->hasRight('accounting', 'bind', 'write')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ $year_current = $year_start;
|
|||
// Validate History
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
$chartaccountcode = dol_getIdFromCode($db, getDolGlobalInt('CHARTOFACCOUNTS'), 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('accounting')) {
|
||||
|
|
@ -82,7 +82,7 @@ if (!isModEnabled('accounting')) {
|
|||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
@ -91,18 +91,18 @@ if (empty($user->rights->accounting->mouvements->lire)) {
|
|||
* Actions
|
||||
*/
|
||||
|
||||
if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accounting->bind->write) {
|
||||
if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('accounting', 'bind', 'write')) {
|
||||
// Clean database
|
||||
$db->begin();
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det as fd";
|
||||
$sql1 = "UPDATE ".$db->prefix()."facture_fourn_det 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.' AND accnt.entity = '.$conf->entity.')';
|
||||
$sql1 .= ' AND fd.fk_facture_fourn IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_fourn WHERE entity = '.$conf->entity.')';
|
||||
$sql1 .= ' AND fk_code_ventilation <> 0';
|
||||
$sql1 .= " FROM ".$db->prefix()."accounting_account as accnt";
|
||||
$sql1 .= " INNER JOIN ".$db->prefix()."accounting_system as syst";
|
||||
$sql1 .= " ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".getDolGlobalInt('CHARTOFACCOUNTS')." AND accnt.entity = ".((int) $conf->entity).")";
|
||||
$sql1 .= " AND fd.fk_facture_fourn IN (SELECT rowid FROM ".$db->prefix()."facture_fourn WHERE entity = ".((int) $conf->entity).")";
|
||||
$sql1 .= " AND fk_code_ventilation <> 0";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
$resql1 = $db->query($sql1);
|
||||
|
|
@ -142,23 +142,23 @@ if ($action == 'validatehistory') {
|
|||
} else {
|
||||
$sql .= " s.accountancy_code_buy as company_code_buy";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
|
||||
$sql .= " FROM ".$db->prefix()."facture_fourn as f";
|
||||
$sql .= " INNER JOIN ".$db->prefix()."societe as s ON s.rowid = f.fk_soc";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
|
||||
$sql .= " LEFT JOIN " . $db->prefix() . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
|
||||
$sql .= " LEFT JOIN ".$db->prefix()."c_country as co ON co.rowid = s.fk_pays ";
|
||||
$sql .= " INNER JOIN ".$db->prefix()."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
||||
$sql .= " LEFT JOIN ".$db->prefix()."product as p ON p.rowid = l.fk_product";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
$sql .= " LEFT JOIN " . $db->prefix() . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe";
|
||||
$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_product_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa4 ON " . $alias_product_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||
$sql .= " AND l.product_type <= 2";
|
||||
$sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
|
||||
|
|
@ -257,7 +257,7 @@ if ($action == 'validatehistory') {
|
|||
}
|
||||
|
||||
if ($suggestedid > 0) {
|
||||
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
|
||||
$sqlupdate = "UPDATE ".$db->prefix()."facture_fourn_det";
|
||||
$sqlupdate .= " SET fk_code_ventilation = ".((int) $suggestedid);
|
||||
$sqlupdate .= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".((int) $facture_static_det->id);
|
||||
|
||||
|
|
@ -357,9 +357,9 @@ for ($i = 1; $i <= 12; $i++) {
|
|||
$sql .= " SUM(".$db->ifsql("MONTH(ff.datef)=".$j, "ffd.total_ht", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
|
||||
}
|
||||
$sql .= " SUM(ffd.total_ht) as total";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as ffd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
|
||||
$sql .= " FROM ".$db->prefix()."facture_fourn_det as ffd";
|
||||
$sql .= " LEFT JOIN ".$db->prefix()."facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
||||
$sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
|
||||
$sql .= " WHERE ff.datef >= '".$db->idate($search_date_start)."'";
|
||||
$sql .= " AND ff.datef <= '".$db->idate($search_date_end)."'";
|
||||
// Define begin binding date
|
||||
|
|
@ -489,9 +489,9 @@ for ($i = 1; $i <= 12; $i++) {
|
|||
$sql .= " SUM(".$db->ifsql("MONTH(ff.datef)=".$j, "ffd.total_ht", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
|
||||
}
|
||||
$sql .= " SUM(ffd.total_ht) as total";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as ffd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
|
||||
$sql .= " FROM ".$db->prefix()."facture_fourn_det as ffd";
|
||||
$sql .= " LEFT JOIN ".$db->prefix()."facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
||||
$sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
|
||||
$sql .= " WHERE ff.datef >= '".$db->idate($search_date_start)."'";
|
||||
$sql .= " AND ff.datef <= '".$db->idate($search_date_end)."'";
|
||||
// Define begin binding date
|
||||
|
|
@ -525,11 +525,11 @@ if ($resql) {
|
|||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td class="left">';
|
||||
print '<td class="tdoverflowmax300"'.(empty($row[1]) ? '' : ' title="'.dol_escape_htmltag($row[1]).'"').'>';
|
||||
if ($row[0] == 'tobind') {
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
|
||||
} else {
|
||||
print $row[1];
|
||||
print dol_escape_htmltag($row[1]);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
|
@ -583,8 +583,8 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
|
|||
$sql .= " SUM(".$db->ifsql("MONTH(ff.datef)=".$j, "ffd.total_ht", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
|
||||
}
|
||||
$sql .= " SUM(ffd.total_ht) as total";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as ffd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
||||
$sql .= " FROM ".$db->prefix()."facture_fourn_det as ffd";
|
||||
$sql .= " LEFT JOIN ".$db->prefix()."facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
||||
$sql .= " WHERE ff.datef >= '".$db->idate($search_date_start)."'";
|
||||
$sql .= " AND ff.datef <= '".$db->idate($search_date_end)."'";
|
||||
// Define begin binding date
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ if (!isModEnabled('accounting')) {
|
|||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|||
$search_tvaintra = '';
|
||||
}
|
||||
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->accounting->bind->write) {
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0 && $user->hasRight('accounting', 'bind', 'write')) {
|
||||
$error = 0;
|
||||
|
||||
if (!(GETPOST('account_parent', 'int') >= 0)) {
|
||||
|
|
@ -308,7 +308,7 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue