Compare commits

..

1 Commits
18.0 ... 17.0

Author SHA1 Message Date
Vincent Penel
e43438cc7b Fix/ticket status (#37129)
* set oldCopy and Status

* Update ticket.class.php

* Question Eldy

* Fix event status change

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-02-10 15:40:05 +01:00
6819 changed files with 178457 additions and 202700 deletions

View File

@@ -1,24 +0,0 @@
name: "CI-RELEASE"
on:
release:
types: [published]
jobs:
trigger-docker:
runs-on: ubuntu-latest
steps:
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.RELEASE_DOCKER_ID }}
private-key: ${{ secrets.RELEASE_DOCKER_SECRET }}
- uses: peter-evans/repository-dispatch@v4
with:
token: ${{ steps.generate-token.outputs.token }}
repository: Dolibarr/dolibarr-docker
event-type: new-release
client-payload: '{"version": "${{ github.event.release.tag_name }}"}'

View File

@@ -1,26 +0,0 @@
name: Qodana
on:
schedule:
- cron: "0 20 * * 1,3,5"
workflow_dispatch:
# push:
# branches:
# - develop
permissions:
contents: read
jobs:
qodana:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
#php-version: '7.1'
- name: 'Qodana Scan'
uses: JetBrains/qodana-action@v2023.1.5
#with:
# php-version: '7.1'
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}

View File

@@ -1,38 +0,0 @@
# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: Doxygen
on:
schedule:
- cron: "0 15 * * *"
workflow_dispatch:
branches:
- develop
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Build
uses: DenverCoder1/doxygen-github-pages-action@v1.2.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: build/html
config_file: build/doxygen/dolibarr-doxygen.doxyfile
# - name: Deploy
# uses: JamesIves/github-pages-deploy-action@v4
# with:
# branch: gh-pages
# folder: build/html # The folder the action should deploy.
# target-folder: docs/html2
#jobs:
# doxygen:
# runs-on: ubuntu-latest
# steps:
# - name: 'Doxygen'
# uses: mattnotmitt/doxygen-action@1.9.5
# with:
# doxyfile-path: build/doxygen

View File

@@ -4,9 +4,6 @@ name: "Exakat analysis"
on:
schedule:
- cron: "0 20 * * *"
workflow_dispatch:
branches:
- develop
permissions:
contents: read
@@ -16,8 +13,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Exakat
uses: docker://exakat/exakat-ga
with:

View File

@@ -116,19 +116,18 @@ jobs:
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"
#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:32574/dolibarr_src postgresql://dolibarrowner:dolibarrownerpass@127.0.0.1/dolibarr_dest
ps fauxww | grep postgres
ls /etc/postgresql/14/main/
sudo chmod -R a+rwx /etc/postgresql/14/main/pg_hba.conf
@@ -144,12 +143,10 @@ jobs:
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
@@ -163,11 +160,11 @@ jobs:
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_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=\'pgsql\'';' >> $CONF_FILE
echo '$'dolibarr_main_db_port=\'5432\'';' >> $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
@@ -178,11 +175,13 @@ jobs:
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_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_databaselogin=\'root\'';' >> $INSTALL_FORCED_FILE
echo '$'force_install_databasepass=\'password\'';' >> $INSTALL_FORCED_FILE
#echo '$'force_install_port=\'32574\'';' >> $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
@@ -261,7 +260,6 @@ jobs:
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
@@ -287,10 +285,6 @@ jobs:
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
@@ -321,9 +315,6 @@ jobs:
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()

View File

@@ -46,8 +46,6 @@ jobs:
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 \
@@ -96,18 +94,14 @@ jobs:
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
@@ -133,12 +127,16 @@ jobs:
set +e
echo '<?php' > $INSTALL_FORCED_FILE
echo '$'force_install_noedit=2';' >> $INSTALL_FORCED_FILE
# For mysql
echo '$'force_install_type=\'mysqli\'';' >> $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=\'root\'';' >> $INSTALL_FORCED_FILE
echo '$'force_install_databasepass=\'password\'';' >> $INSTALL_FORCED_FILE
# For mysql
echo '$'force_install_port=\'32574\'';' >> $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
@@ -271,9 +269,6 @@ jobs:
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()

View File

@@ -1,30 +0,0 @@
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

View File

@@ -1,44 +0,0 @@
name: GitHub CI PHPCS and PHPCBF
on: push
#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:
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

View File

@@ -1,82 +0,0 @@
# Action to prepare the github action
# Go on Dolibarr - Settings - Developer settings - Enter a name + webhook to disable + Permissions (see app test) + Can install by any account
# Click on generate the private keys
# Click on Install application - choose user of the Organization
# Go on Organisation - Secret and variables and create a secret PR18_SECRET_KEY and copy the content of received private key. Choose the repository access to "Repository Dolibarr".
# Go on Organisation - Secret and variables and create a variable PR18_APP_ID and copy the ID of the previously create ID. Choose the repository access to "Repository Dolibarr".
#
name: Set reviewer and label for v18 (test ldr)
on:
pull_request_target:
types: [opened, synchronize, reopened]
branches:
- "18.0"
push:
branches:
- "18.0"
permissions:
pull-requests: write
issues: write
jobs:
assign-and-label-v18:
runs-on: ubuntu-latest
steps:
#- name: Install GitHub CLI
# run: sudo apt-get install gh
- name: Debug GitHub Event
run: cat $GITHUB_EVENT_PATH
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.PR18_APP_ID }}
private-key: ${{ secrets.PR18_SECRET_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
- name: Assign Tag
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
prid: ${{ github.event.pull_request.number }}
prid2: ${{ github.event.pull_request_target.number }}
url: ${{ github.event.pull_request.html_url }}
url2: ${{ github.event.pull_request_target.html_url }}
run: |
echo "env.prid=${{env.prid}}"
echo "env.prid=${{env.prid2}}"
echo "env.url=${{env.url}}"
echo "env.url2=${{env.url2}}"
gh pr edit "${{env.prid}}" --add-label "Issue for v18 maintenance Team"
- name: Set reviewers except PR author
id: set-reviewers
run: |
# Liste des reviewers à ajuster selon équipe
REVIEWERS=("lvessiller-opendsi" "rycks")
AUTHOR="${{ github.event.pull_request.user.login }}"
FINAL_REVIEWERS=()
for reviewer in "${REVIEWERS[@]}"; do
if [ "$reviewer" != "$AUTHOR" ]; then
FINAL_REVIEWERS+=("$reviewer")
fi
done
echo "AUTHOR=$AUTHOR"
echo "reviewers=$(IFS=, ; echo "${FINAL_REVIEWERS[*]}")" >> $GITHUB_OUTPUT
- name: Assign reviewers
if: steps.set-reviewers.outputs.reviewers != ''
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
prid: ${{ github.event.pull_request.number }}
url: ${{ github.event.pull_request.html_url }}
reviewers: ${{ steps.set-reviewers.outputs.reviewers }}
run: |
echo "Assigning reviewers: ${{env.reviewers}}"
gh pr edit "${{env.prid}}" --add-reviewer "${{env.reviewers}}"

View File

@@ -1,158 +0,0 @@
# Action to prepare the GitHub Action
# Prerequisites (create in the organization / repo):
# - Secret: PR18_SECRET_KEY (private key generated for the GitHub App)
# - Variable: PR18_APP_ID (GitHub App ID)
#
# Behavior:
# - On pull_request_target (opened, synchronize, reopened) against branch 18.0:
# - Generate a GitHub App token
# - Add the label "Issue for v18 maintenance Team" to the PR (error-tolerant)
# - Assign the reviewers listed below, excluding the PR author
# -> attempt per reviewer (if a reviewer fails, log and continue)
# -> the step fails only if no reviewer could be added
# - On push to 18.0: workflow runs but PR-specific actions are skipped
#
name: Set reviewer and label for v18
on:
pull_request_target:
types: [opened, synchronize, reopened]
branches:
- "18.0"
push:
branches:
- "18.0"
permissions:
pull-requests: write
issues: write
jobs:
assign-and-label-v18:
runs-on: ubuntu-latest
# Mergeers / reviewers list: edit here as needed (comma-separated)
env:
REVIEWERS: "lvessiller-opendsi,rycks"
# Label name to apply
V18_LABEL: "Issue for v18 maintenance Team"
steps:
# 1) Generate a GitHub App token (via actions/create-github-app-token)
- name: Generate GitHub App token
id: generate-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.PR18_APP_ID }}
private-key: ${{ secrets.PR18_SECRET_KEY }}
# 2) Checkout repository (useful if repo content is needed later)
- name: Checkout repository
uses: actions/checkout@v4
# Debug information (useful for diagnostics)
- name: Debug info
run: |
echo "Event: $GITHUB_EVENT_NAME"
echo "Ref: $GITHUB_REF"
echo "Run id: $GITHUB_RUN_ID"
echo "Reviewers configured: $REVIEWERS"
# 3) Add the label to the PR (PR events only)
# -> tolerant to errors: log on failure but do not fail the job
- name: Add label to PR (pull_request events only)
if: ${{ github.event_name == 'pull_request' }}
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
V18_LABEL: ${{ env.V18_LABEL }}
REPO: ${{ github.repository }}
run: |
set -euo pipefail
echo "Adding label '$V18_LABEL' to PR #${PR_NUMBER}"
response=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
-H "Authorization: Bearer ${GH_TOKEN}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${REPO}/issues/${PR_NUMBER}/labels" \
-d "{\"labels\": [\"${V18_LABEL}\"]}")
if [ "$response" -eq 200 ]; then
echo "Label added successfully."
else
echo "Warning: failed to add label '$V18_LABEL' to PR #${PR_NUMBER} (HTTP $response). Continuing."
fi
# 4) Compute final reviewers list excluding the PR author
- name: Compute reviewers (exclude PR author)
if: ${{ github.event_name == 'pull_request' }}
id: set-reviewers
run: |
set -euo pipefail
IFS=',' read -ra ALL_REVIEWERS <<< "${REVIEWERS}"
AUTHOR="${{ github.event.pull_request.user.login }}"
FINAL=()
for r in "${ALL_REVIEWERS[@]}"; do
r_trimmed="$(echo "$r" | xargs)"
if [ -z "$r_trimmed" ]; then
continue
fi
if [ "$r_trimmed" != "$AUTHOR" ]; then
FINAL+=("$r_trimmed")
fi
done
if [ ${#FINAL[@]} -eq 0 ]; then
echo "reviewers=" >> $GITHUB_OUTPUT
else
reviewers_csv="$(IFS=, ; echo "${FINAL[*]}")"
echo "reviewers=${reviewers_csv}" >> $GITHUB_OUTPUT
fi
echo "author=$AUTHOR" >> $GITHUB_OUTPUT
echo "Computed reviewers: ${reviewers_csv:-<none>}"
# 5) Assign reviewers one-by-one with fine-grained error handling
# - try each reviewer, track successes and failures
# - fail the step only if none could be added
# - succeed if at least one was added (but log failures)
- name: Assign reviewers on PR (per-reviewer, tolerant errors)
if: ${{ github.event_name == 'pull_request' && steps.set-reviewers.outputs.reviewers != '' }}
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REVIEWERS_CSV: ${{ steps.set-reviewers.outputs.reviewers }}
REPO: ${{ github.repository }}
run: |
set -uo pipefail
IFS=',' read -ra TO_ADD <<< "${REVIEWERS_CSV}"
SUCCESS=0
FAILED=()
for r in "${TO_ADD[@]}"; do
r_trimmed="$(echo "$r" | xargs)"
if [ -z "$r_trimmed" ]; then
continue
fi
echo "Attempting to add reviewer: $r_trimmed"
response=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
-H "Authorization: Bearer ${GH_TOKEN}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${REPO}/pulls/${PR_NUMBER}/requested_reviewers" \
-d "{\"reviewers\": [\"${r_trimmed}\"]}")
if [ "$response" -eq 201 ] || [ "$response" -eq 200 ]; then
echo "Added reviewer: $r_trimmed"
SUCCESS=$((SUCCESS+1))
else
echo "Warning: failed to add reviewer: $r_trimmed (HTTP $response)"
FAILED+=("$r_trimmed")
fi
done
if [ $SUCCESS -eq 0 ]; then
echo "Error: none of the configured reviewers could be added: ${FAILED[*]:-<none>}"
exit 1
else
echo "Reviewers added: ${SUCCESS}. Failed to add: ${FAILED[*]:-none}"
fi
# 6) Push event notice (no PR-specific actions performed)
- name: Push event notice
if: ${{ github.event_name == 'push' }}
run: |
echo "Triggered by push on branch 18.0. No PR-specific actions performed."

View File

@@ -6,9 +6,8 @@ on:
- cron: "0 21 * * *"
issue_comment:
types: [created]
workflow_dispatch:
permissions: {} # no restriction by default
permissions: {} # none
jobs:
stale:

12
.gitignore vendored
View File

@@ -14,11 +14,11 @@ default.properties
/.pydevproject
/.vscode
.DS_Store
.idea
*.iml
*.orig
Thumbs.db
/dolibarr_genesis.mp4
.phpunit.result.cache
# Log files
dolibarr_install.log
upgrade.log
@@ -57,13 +57,3 @@ yarn.lock
package-lock.json
doc/install.lock
/.asciidoctorconfig.adoc
# Qodana
.idea/vcs.xml
.idea/modules.xml
.idea/workspace.xml
.idea/inspectionProfiles/Project_Default.xml
.idea/jsLinters/jshint.xml
/composer.json
/composer.lock

View File

@@ -89,9 +89,3 @@ Baffir Abbes <bafbes@users.noreply.github.com> bafbes <bafbes@users.noreply.gith
Kevin Guerrier <guerrier.k@gmail.com> GUERRIER Kevin <guerrier.k@gmail.com>
Remy Younes <ryounes@gmail.com> remy <ryounes@gmail.com>
Estephe Loridan <github@estephe.me> Estephe L. <github@estephe.me>
Anthony Berton <anthony.berton@bb2a.fr> Anthony Berton <anthony.berton@bb2a.fr>
Anthony Berton <anthony.berton@bb2a.fr> Berton Anthony <anthony.berton@bb2a.fr>
Anthony Berton <anthony.berton@bb2a.fr> BB2A-Anthony <anthony.berton@bb2a.fr>
Anthony Berton <anthony.berton@bb2a.fr> Anthony Berton <bertonanthony@gmail.com>
Anthony Berton <anthony.berton@bb2a.fr> Berton Anthony <bertonanthony@gmail.com>
Anthony Berton <anthony.berton@bb2a.fr> BB2A-Anthony <bertonanthony@gmail.com>

View File

@@ -81,8 +81,6 @@ repos:
]
pass_filenames: false # Run on all files
- id: php-lint
exclude:
(?x)^(htdocs/includes/symfony/var-dumper/Tests/.*)$
- id: php-stan
stages: [manual]
files: \.(php)$

View File

@@ -75,6 +75,9 @@ before_install:
- |
echo Install packages for PHP
sudo apt-get install -y pgloader memcached
if [ "$TRAVIS_PHP_VERSION" = '7.0' ]; then
sudo apt install unzip apache2 php7.0 php7.0-cli php7.0-curl php7.0-mysql php7.0-pgsql php7.0-gd php7.0-imap php7.0-intl php7.0-ldap php7.0-xml php7.0-mbstring php7.0-xml php7.0-zip libapache2-mod-php7.0
fi
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
@@ -133,6 +136,14 @@ install:
- |
echo "Update Composer version and Install tools - PHP Unit, Parallel Lint, PHP CodeSniffer, PHP Vardump check - for $TRAVIS_PHP_VERSION"
echo "(composer version 2.5 is bugged and generate phpunit error Exception: Serialization of 'Closure' is not allowed)"
if [ "$TRAVIS_PHP_VERSION" = '7.0' ]; then
sudo composer self-update 2.2.18
composer -n require phpunit/phpunit ^6.0 \
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.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then
sudo composer self-update 2.2.18
composer -n require phpunit/phpunit ^7.5 \
@@ -437,9 +448,6 @@ script:
php upgrade.php 16.0.0 17.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade16001700.log
php upgrade2.php 16.0.0 17.0.0 > $TRAVIS_BUILD_DIR/upgrade16001700-2.log
php step5.php 16.0.0 17.0.0 > $TRAVIS_BUILD_DIR/upgrade16001700-3.log
php upgrade.php 17.0.0 18.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade17001800.log
php upgrade2.php 17.0.0 18.0.0 > $TRAVIS_BUILD_DIR/upgrade17001800-2.log
php step5.php 17.0.0 18.0.0 > $TRAVIS_BUILD_DIR/upgrade17001800-3.log
#show table content and log
#echo '\d llx_adherent' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
@@ -460,7 +468,6 @@ script:
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

View File

@@ -24,36 +24,34 @@ Component Version License GPL Compatible
-------------------------------------------------------------------------------------
PHP libraries:
EvalMath 1.0 BSD Yes Safe math expressions evaluation
Escpos-php 3.0 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
GeoIP2 0.2.0 Apache License 2.0 Yes Lib to make geoip convert
Mobiledetect 2.8.41 MIT License Yes Detect mobile devices browsers
Mobiledetect 2.8.39 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)
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
ParseDown 1.7.4 MIT License Yes Markdown parser
ParseDown 1.6 MIT License Yes Markdown parser
PCLZip 2.8.4 LGPL-3+ Yes Library to zip/unzip files
PHPDebugBar 1.18.2 MIT License Yes Used only by the module "debugbar" for developers
PHPDebugBar 1.15.1 MIT License Yes Used only by the module "debugbar" for developers
PHP-Imap 2.7.2 MIT License Yes Library to use IMAP with OAuth
PHPSpreadSheet 1.12.0 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
PHPSpreadSheet 1.8.2 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
php-iban 4.1.1 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
PSR/Logs 1.0 MIT License Yes Library for logs (used by DebugBar)
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 4.0.2 BSD Yes DAV support
Sabre 3.2.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 10.7.0 MIT Licence Yes Library for Stripe module
Stripe 7.67.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
jQuery 3.6.4 MIT License Yes JS library
jQuery 3.6.0 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
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)

731
ChangeLog
View File

@@ -2,709 +2,6 @@
English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 18.0.8 compared to 18.0.7 *****
35 files changed, 647 insertions(+), 298 deletions(-)
FIX: #34746 - More complete fix for CVE-2024-40137
FIX: Correct the calculation of the amount of the current period between the period provided (#35083)
FIX: Add security test for show terminal selection if no terminal selected when invoice.php is call (#34717)
FIX: Add security test for show terminal selection if no terminal selected when invoice.php is call
FIX: missing quick edit for extrafields (baclport commit 4fc66c6) (#35160)
FIX: Missing sentence part (#35144)
FIX: set global mysoc and load langs in API access (#35041)
FIX: set global mysoc and load langs in API access
FIX: reset mysoc and langs only if entity of API has changed
FIX: accountancy general ledger: bad handling of hook return (#34029)
FIX: accountancy general ledger: bad handling of hook return
FIX: accountancy balance: bad handling of hook return
FIX: - Fix missing token for disable custom group category for compta report (page /htdocs/accountancy/admin/categories_list.php) (#35084)
FIX: The combo of custom groups has disappeared (backport v19) (#35016)
FIX: #34893 (#34897)
FIX: #34893
FIX: change error code to USERNOTALLOWEDTOCHANGEPASS
FIX: asset: could not select invoice in disposal pop-in (#34725)
FIX: 17.0 SQL syntax error and/or constraint error when calling Facture::update() after a clone (e.g. in a trigger) (#34778)
FIX: 17.0: when you clone an invoice that was created from a template invoice, the clone should not be linked to the template invoice (#34777)
FIX: pre-send mail mass action: keep __EMAIL__ substitution (#34522)
FIX: pre-send mail mass action: keep __EMAIL__ substitution
FIX: comment
FIX: massaction email tpl: keep preset
FIX: loop interrupt if an error occurs in sendEmailsRemindersOnInvoiceDueDate (#34657)
FIX: #34654
***** ChangeLog for 18.0.7 compared to 18.0.6 *****
138 files changed, 1622 insertions(+), 530 deletions(-)
FIX: 17.0 API endpoints "PUT": prevent overwriting all extrafields if only some are supplied in the request cf. PR #29237
FIX: 17.0 - collisions in cache for dol_getIdFromCode
FIX: 17.0 - missing error handling for FactureRec::fetch in card-rec.php
FIX: 17.0: warnings due to uninitialized variables + delete code that doesn't apply to recurring invoices (AFAIK, there is no recurring credit note feature)
FIX: #21294 Stock import sql query
FIX: #26250 fatal error on kit
FIX: #32339 Delete a loan settlement is partial
FIX: #33038 drag and drop files are not prefixed with object reference
FIX: #33117 accountancy export Quadratus when doc ref is less than 10 char
FIX: #33145 wrong label status buy on product tooltip
FIX: accountancy export Quadratus when doc ref is less than 10 char
FIX: bad dispatched quantities for batches on shipment card
FIX: bank payment rejection on SEPA (backport commit 100a657) (#33838)
FIX: calculate start date of cloned task from cloned project (#31799)
FIX: can not delete files in task card
FIX: close all services on contract will close all lines (#33466)
FIX: compatibility with multicompany
FIX: constant PAYMENTBYBANKTRANSFER_ADDDAYS was never saved (#33799)
FIX: Count on supplier invoice list does not match count in DB (#33351)
FIX: #CVE-2024-34051
FIX: delete supplier order line when linked to customer order line
FIX: delete supplier order when at least one line linked to customer order line
FIX: display error when loan can't be deleted
FIX: display full tree on shipment card when a kit contains a same component in other sub-kit
FIX: Fix case when the value of a extrafields of the type 'boolean', 'select' or other have an option with a value equal to '0'.
FIX: Fix return value of hook sendMail when hook return -1 who must be return false in sendfile() function
FIX: GETPOST('private_message')
FIX: in projet/element.php total_time is always back to 0
FIX: invoice creation : use dol_include_once instead of require_once to allow external modules
FIX: invoice creation : use dol_include_once instead of require_once to allow external modules.
FIX: issue #28222 Edit date extrafield displayed on all on lines (#31914)
FIX: Many status on invoice linked object block
FIX: Multilangs : PDF lines description
FIX: ODT substitution when many HTML tags in string
FIX: old copy not needed in supplier order create method (#31733)
FIX: PAIEMENT Wrong field displayed for DateChequeReceived (#33390)
FIX: phpcs
FIX: product variants copy: also copy multiprice variations
FIX: qual
FIX: removes traces of <<<HEAD conflicts following the postponement of branch 13 modifications (#32014)
FIX: Replace compromised tj-actions/changed-files (#33481)
FIX: selectcontact is loading all contacts if socid is empty and MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT is not set
FIX: selectcontact is loading all contacts when update event
FIX: select group and severity search fields on ticket list
FIX: send email to assigned user on ticket create
FIX: send mail to BCC when email formatted as Fullname <email> (#31983)
FIX: Show true error when send notify email at validate expense report
FIX: status ticket update for new message
FIX: swiftmailer: correctly set errors-to header (#31826)
FIX: TakePos barcode rule (#31857)
FIX: There were many status indicator in the invoice linked object block (propal card)
FIX(ticket): Notification email without public interface
FIX: Update on a sold line of bank entries set the type to empty, now it's fixed #22539 (#31888)
FIX: update status on create supplier order for trigger (#31642)
FIX: use tax with code on supplier order line give tax code missing in supplier invoice (#32018)
FIX: use vat with code on supplier order result code missing in supplier invoice
FIX: warehouse list: broken status filter (#33667)
FIX: warnings (#33423)
FIX: wrong left margin (v18 to develop ?)
FIX: wrong message on update shipment
FIX: wrong update function parameter
***** ChangeLog for 18.0.6 compared to 18.0.5 *****
FIX: 16.0 - parent company gets emptied when updating a third party from the card in edit mode (#28269)
FIX: 16.0 - the e-mail templates configured in the notification module are not used if the recipient is a fixed e-mail address (#29407)
FIX: 17.0: $num doesn't take trigger-modified newref into account, leading to inconsistencies if BILL_SUPPLIER_VALIDATE changes the invoice's ref (#28684)
FIX: 17.0: fatal when updating recurring supplier invoice line with php8 ($remise_percent is '' instead of 0) (#31713)
FIX: 17.0: supplier invoice template card: buyer and seller swapped in VAT-related function calls (probably a copy-paste from customer invoice templates) (#31446)
FIX: #24265 regression cannot see all product on takepos (#28753)
FIX: #25853 Thirdparty Massaction (#25868)
FIX: #28205
FIX: #28251 Fixing subpermission name on api_multicurrencies.class.php (#28252)
FIX: #28369
FIX: #28518 (#28520)
FIX: #28978 FIX: #28976
FIX: #29029 Impossible to delete an order line
FIX: #29114 Missing contact term in intervention
FIX: #29114 Translate contact term in intervention
FIX: #29439 incomplete API return (#29796)
FIX: #29496 filtering a record should not hide its child not filtered
FIX: #30010 Use conf TICKET_MESSAGE_MAIL_INTRO instead of translation key (#30081)
FIX: #30274 Add the include before executing dolibarr_set_const (#30320)
FIX: #30467
FIX: #30768 allocate the correct invoice_line_id to the element timespent (#30769)
FIX: Accountancy export with file or not
FIX: Accountancy - Generate entries of expense report with localtax (#30411)
FIX: Accountancy - Not trunc id_import
FIX: accounting FEC import (Issue #28306) (#29414)
FIX: Add new hidden conf "DISABLE_QTY_OVERWRITTEN" (#28523)
FIX: Add same security test when uploading files from API than from GUI (#31114)
FIX: Amount of localtaxes in foreign currency was wrong on screen and PDF
FIX: an error in a complex else condition
FIX: ASSET: annual depreciation starting year (Again ;-)) #26084 (#30040)
FIX: avoid error "Column 'entity' in where clause is ambiguous" (#28270)
FIX: avoid from re-initializing array result on nested hook getEntity (#30626)
FIX: avoid php warnings (#29247)
FIX: avoid to delete "lock" and "unlock" files
FIX: avoid Unknown column 'pfp.ref_fourn' (#28145)
FIX: background color for enabled modules (#29378)
FIX: Backport fix fatal error on price with some truncating setup
FIX: Backport page inventory.php from v18 to fix pagination bugs causing data loss (#29688)
FIX: back to page on error in contact card (#29627)
FIX: Bad calculation of $nbtotalofrecord (#30183)
FIX: box_actions.php still uses fk_user_done which no longer exists (#31190)
FIX: can validate shipment without stock movement (#31780)
FIX: Condition on newDateLimReglement
FIX: Conflict with autoload (#30399)
FIX: const WORKFLOW_RECEPTION_CLASSIFY_NEWD_INVOICE (#31601)
FIX: contact/address title is always "New Contact/Address" even if the contact/address already exists (#29581)
FIX: Display the date according to user language on substitutions (#29510)
FIX: Display the real_PMP on inventory when its value is equal to 0 (#22291)
FIX: Don't display column when it's out of date (#28271)
FIX: email templates for expense report not visible
FIX: Error mesg show untranslated extrafield name (#30227)
FIX: Error message overwrote when a error occurs during update of product multilangs (#30841)
FIX: Error When cloning fourn price no default value for tva_tx (#28368)
FIX: executeHooks $object default value (#29647)
FIX: expedition PDF models using units labels (#30358)
FIX: Extrafield following between rec invoice and classic invoice (#31445)
FIX: fatal error on loading pictures in attached documents of an event (#30553)
FIX: fatal error Unsupported operand types when recording load payment
FIX: Fix bug select columns and access to the public ticket list from the public ticket card (case when we have connected to another client before, the track id stocked in session overwrite the new track id from the public ticket card) (#31000)
FIX: Fix create shipping with product who have negative stocks on warehouse but the negative stock transfer is allowed (#26217)
FIX: Fix save directory for invoice ODT and multientities
FIX: group by qty in product margin tab (#29853)
FIX: Hierarchy Employee view do not filter on employee = 1 (#29496)
FIX: if you call fetchLines several times, your $object->lines contains duplicates (#31167)
FIX: If you have no stock of your product, an error is displayed when you delete the reception. (#31504)
FIX: incorrect page numbering in PDF #29458 (#29476)
FIX: inventoryDeletePermission id define twice
FIX: issue on action set condition in particular when you set a deposi… (#31518)
FIX: issue to get the right files exported in Quadratrus export.php (#30004)
FIX: lang output for sales representative on PDF (#30469)
FIX: late order search option (#30692) and propal (#30687)
FIX: lettering (auto) for invoice deposit with company discount (#29633)
FIX: made invalid code shape error more user friendly (#29498)
FIX: Merge of thirdparties must also move uploaded files
FIX: missing entity parameter for ajax_constantonoff
FIX: missing hide "new" button where "product" or "service" module are disable
FIX: mo cloning (#29686)
FIX: modification date from label in accounting bookkeeping list (#30038)
FIX: Move the trigger for delete order line before the SQL request
FIX: multiple problems with multicompany
FIX: mysql error during dump for enable sandbox M999999 (#31116)
FIX: notification: error 500 in fixed emails due to a bad copy/paste (#29580)
FIX: notification module: for supplier orders (any of the 3 triggers), user can choose an e-mail template in conf, but the conf is not used when sending the notification (#28216)
FIX: Not qualified lines for reception (#29473)
FIX: not redirect when error occurs on updating card (#29388)
FIX: Not trancate the multicurrency rate shown on cards (even if the global MAIN_MAX_DECIMALS_SHOWN is set to 0) (#28211)
FIX: on change ref for bank account attachment are lost (#30529)
FIX: Option MAIN_DOC_USE_TIMING can be a string with date format
FIX: orders to bill menu (#30179)
FIX: Payment on customer invoice - Remove accountid in url if empty for apply default value (#28156)
FIX: PDF Fatal error : Backport fix from #23972
FIX: PDF Translations Extrafields
FIX: permission on payment file of a tax
FIX: php8: Fatal when empty $tmpvat is an empty string (no silent conversion to '0' when used in arithmetic operations) (#29451)
FIX: PHP 8 warning on output of successful cronjob (#29922)
FIX: PHP exception on getSpecialCode (#29646)
FIX: php warning global conf (#29478)
FIX: pos: invoice date incorrectly set because of timezome mismatches (reverts #36e91da) (#30184)
FIX: public project form return an error if SOCIETE_EMAIL_UNIQUE (#29942)
FIX: purge files cron: php warnings when rest module enabled (#30919)
FIX: PUT /thirdparties/{id} and PUT /contacts/{id} should throw exception if update returns < 0 (#29596)
FIX: Regression #29340
FIX: Repair the replenishment list (#29336)
FIX: REPLENISH MANY FOURN WHEN ORDER ALREADY CREATE (#29710)
FIX: round capital societe (#29211)
FIX: search and add extrafields to tasks when conf disabled (#29542)
FIX: show preview pdf list expensereport (#31694)
FIX: sometimes a string type instead integer is return, why ?
FIX: Special code is now transmitted by args only in order supplier (#28546) (#28619)
FIX: SQL syntax error in DDLUpdateField
FIX: subscription must be editable when accounting isn't reconciled (#28469)
FIX: substitutions THIRDPARTY_XXX are not available for actioncomm reminders (#31385)
FIX: Supplier Order search on date valid (#30448)
FIX: supplier price duplicate entry on update supplier product ref (#29290)
FIX: syntax error
FIX: TakePOS | Add product / Delete line of existing invoice
FIX: Ticket new message notification sent twice
FIX: transfer in accountancy for expense reports.
FIX: Unsigned propal having signing date (#29825)
FIX: Update asset.class.php
FIX: update date_echeance of supplier invoices when we update invoice date in the past (#29886)
FIX: use $conf->browser->os instead
FIX: use price() to display qty on a product's stats tab to avoid showing too many decimals when rounding errors are possible (#31165)
FIX: User List - Function is show in wrong column when module HRM enabled (#30186)
fix: when invoice is created by WORKFLOW_ORDER_AUTOCREATE_INVOICE on ORDER_NEW, the invoice must have the default bank account of the thirdparty is it's empty on order (#29462)
FIX: when qty is not an integer, apply price() (#31138)
FIX: Wrong currency shown in TakePOS payment page
FIX: wrong shortcut key for macintosh
FIX: wrong sql request with product category filter
FIX: wrong stock permission number
***** ChangeLog for 18.0.5 compared to 18.0.4 *****
FIX: 17.0: deprecated field should only be a fallback
FIX: 17.0 - php8 warnings: test for $field existence before checking if it is null or empty
FIX: #24185: v18: display of the merged pdf lists
FIX: #26416 BOM_SUB_BOM blank page
FIX: #27166
FIX: #27262 Recurrent invoice - user to string conversion
FIX: #27970 #26283 #27970
FIX: Accountancy - Level 3 of binding not working on supplier side (#27462)
FIX: Accounting files export - Use th instead of td on all title columns (#28003)
FIX: add action update_extras to don card
FIX: Adding hooks init
FIX: Adding the $encode parameter to recursive _replaceHtmlWithOdtTag() utilisation
FIX: add new hook context for mo production card (#28037)
FIX: avoid from re-initializing result on nested hook getEntity (#27799)
FIX: avoid sql error (issue #26342)
FIX: bad accountancy code autoselection for supplier ventilation
FIX: Bad visible status of proposal after reopen
FIX: Barcode header cell not well displayed
FIX: BarCode Header not well displayed
FIX: Bar code verification should be done by entity because generation does (#28087)
FIX: can edit reminders on past events
FIX: check parameter socid before cloning a customer proposal (#28085)
FIX: crabe PDF is generating in conf->entity instead of object->entity
FIX: CVE-2024-23817 (#28089)
FIX: disable pointer events on jQuery-UI tooltips to prevent a glitch (fast-blinking tooltip)
FIX: Error on emailreminder not reported
FIX: Fatal error converting object of class User to string (php8)
FIX: filter by entity on contact is missing
FIX: Fix supplier invoice security check
FIX: format of color in manifest is wrong when using a custom color
FIX: #GHSA-7947-48q7-cp5m
FIX: HTML injection vulnerability in Dolibarr Application Home Page
FIX: invoice add line save devise
FIX: Keep a link to enable a 'always_enabled' module to solve pb.
FIX: label
FIX: line special_code never saved (#28051)
FIX: link to print when there is a search on multiselect fields
FIX: Menu Create of project no working on smartphone with no top menu.
FIX: missing $search_sale var (backport from v19)
FIX: Missing begin transaction when updating supplier recurring invoice
FIX: missing entity filter for check if period exists
FIX: more correctly parse the select part to be replaced in sql queries
FIX: MouvementStock::origin is not an object
FIX: notification information on intervention validated confirmation message (v17+)
FIX: not load all contacts by default when creating an event
FIX: port in Docker MailDev
FIX: propal use devise changes
FIX: public user photo not visible if $dolibarr_main_instance_unique_id
FIX: remove DISTINCT (backport from v19)
FIX: remove specific name from v19
FIX: Retours PR
FIX: Return a better error message when token is not valid
FIX: search by ref & rowid in don list
FIX: search by thirdparty in don list
FIX: several names for one const THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT
FIX: SQL concatenation error
FIX: [TAKEPOS] display prices with or without taxes depending on setup (TAKEPOS_CHANGE_PRICE_HT)
FIX: Ternary operator condition is always true/false
FIX: too long output
FIX: Undefined property: Task::$fk_parent
FIX: uniformization to use "intervention"
FIX: Update loan.class.php (#27971)
FIX: update price extrafield on propal card
FIX: user filter in per user view of event list (#28049)
FIX: use the currency for propal signature page
***** ChangeLog for 18.0.4 compared to 18.0.3 *****
FIX: $this->newref already exists and could have been modified by trigger but we still use a local variable for the filesystem-based renaming
FIX: 16.0 only, backport fix for SQL error on global search product
FIX: #25399 (#26694)
FIX: #25458 intervention localizations (backport v17) (#26757)
FIX: #26518
FIX: #26536 Accountancy - Balance - Not divided lines by label & account, only by account (#26547)
FIX: #26553 Supplier invoice - Do not display the delete button for reconciled payment (#26554)
FIX: #26735
FIX: #26994
FIX: Accountancy - Possibility to write in bookkeeping expense report operation with some line not bound (#26545)
FIX: add display of an error when attempting to delete a committed transaction (#26573)
FIX: avoid warning : Cannot use a scalar value as an array (#26437)
FIX: backport SQL error on global search product
FIX: # Bug Estimated Stock at date value in V14 (#26479)
FIX: commande context (#26497)
FIX: delivery note disappear after generation
FIX: double hook and paging search param in product list (#26767)
FIX: Email reminder template must not be visible when option is off
FIX: escape HTML tags in return value of getFullName() (#26735)
FIX: Fix set private note (#26610)
FIX: Fix when options FAC_FORCE_DATE_VALIDATION and INVOICE_CHECK_POSTERIOR_DATE enabled. The date is forced after the test and not before
FIX: menu auguria
FIX: pagination parameters on save and cancel buttons (#26605)
FIX: pdf cornas page head multicell width (backport v17)
FIX: php8 fatal on edit supplier order when multicurrency is activated (#26758)
FIX: possible inconsistency between llx_ecm_files and file system when BILL_SUPPLIER_VALIDATES changes ref
FIX: regression on planned bank entries (#26556)
FIX: Social contribution - Payment list - Wrong information in type column (#26561)
FIX: special_code update line keep old value. (#26819)
FIX: substitute project variables in invoice documents (#26445)
FIX: Test on permission for holiday tooltips
FIX: v17: Param $notrigger in $societe->create() causes method to return true regardless of actual result of database functions (#26499)
FIX: v18 SQL error in llx_c_forme_juridique.sql when installing
FIX: Warehouse Global Amounts not displayed (#26478)
FIX: warning param $lineID getSpecialCode is negatif (#26826)
FIX: warning php8.2 undefined_array_key (#26830)
***** ChangeLog for 18.0.3 compared to 18.0.2 *****
FIX: #25793 Cannot add time spent (#26405)
FIX: #26100 Ticket - On edit, list of closed project must be excluded (#26223)
FIX: #26170
FIX: #26195 Various payment - List of project excluded those assigned to third parties (#26222)
FIX: #26349 add_customer_ref_on_linked_shipment
FIX: avoid warning + CSRF
FIX: avoid warning if module not activated
FIX: Bad name for trigger in HRM module
FIX: check tva_tx before comparing price_min_ttc (#25220)
FIX: Compare the result of the send mail file function
FIX: dol_eval with function starting with !
FIX: Error handling for computed values on import (#24897)
FIX: Error not returned on sales with takepos and batch module enabled
FIX: error of webhook not returned
FIX: firstname and lastname were not saved in attendee subscription
FIX: HTML in ODT templates (#26181)
FIX: Link to list of movement from the inventory code
FIX: Mass import of stock from a file must accept empty source
FIX: Max version of PHP (#26327)
FIX: missing load group members for ldap synchro (#26167)
FIX: missing project entity filter (Issue #26243) (#26247)
FIX: modification of complementary attributes in invoices (#26180)
FIX: On object validation, ecm index are not updated for uploaded files
FIX: Propal's negative quantities
FIX: public subscription page should not display acceptation for public register when it is not enabled (#26354)
FIX: regression on rounding stocks fields on product list
FIX: removed a non expected hidden input field in stockatdate page
FIX: src_object_id and ttype not filed when uploading a file with API.
FIX: suggested end for membership can be before subscription start (#26351)
FIX: Supplier card - VAT Reserve Charge - Undefined function isInEEC() (#26379)
FIX: syntax error
FIX: template invoice list extrafield filters (backport v17) (#26227)
FIX: Tooltip for search syntax must not appear on date fields
FIX: upload of files src_object_type
FIX: use event.key instead event.wich to avoid keyboard difference
FIX: Use of line->insert instead of line->create
FIX: user creation when LDAP is configured (#26332)
FIX: Wrong backtopage given for the stocktransfer button from the stocktransfer list (#26271)
***** ChangeLog for 18.0.2 compared to 18.0.1 *****
FIX: 17.0 PHP8: supplier invoice class
FIX: #24908 #25824
FIX: #25780 Various payment - List - Fatal error on PHP8.x
FIX: #25884
FIX: #25919
FIX: #25934 #25929
FIX: Accountancy - Update Quadra export format
FIX: add field "entity" only in $tabfieldinsert
FIX: add warning in the changelog
FIX: Avoid duplicate popup when popup setup to work as ajax
FIX: avoid excess line breaks
FIX: removed some php8 warning
FIX: avoid wrong backtopage url
FIX: bad check return for sendfile
FIX: Bad choice of filter on product/service
FIX: bad from and to
FIX: Bad length for value
FIX: Bad value of accounting account shown in list. Edit fails.
FIX: batch to update non valid backlink check
FIX: better sql request for all cases
FIX: Can't access to rec supplier invoice card
FIX: Can't delete a fourn commande row if a commande ligne is linked
FIX: could not delete a fourn commande row if a commande ligne is linked
FIX: create intervention from time spend
FIX: customer code search filter on invoice list
FIX: #CVE-2023-4197
FIX: date comparison for user expiration on user list
FIX: Debug the dispatch page to work on corrupted data
FIX: delete useless condition in massaction_pre
FIX: Edition of line on the list of timespent for all projects
FIX: Edition of shipment detail with lot not updating correctly tables
FIX: emailcollector to search existing thirdparty when extract not found
FIX: Error message
FIX: Expense report is created on the wrong entity
FIX: export FEC
FIX: Filter on partnership status
FIX: fix the wrong position of the hook 'printFieldListTitle' and 'printFieldListValue' in the stock at date page
FIX: If PHPIMAP is active, emailcollector "recordjoinpiece" operation will not work
FIX: include
FIX: Kanban view
FIX: link to create purchase order from sale order
FIX: Look and feel search v18
FIX: message order in ticket public view is not coherent with tickets events tab
FIX: missing contact_id for the trigger
FIX: missing entity filter to customize ticket dictionaries by entity
FIX: Missing error message on CommandeFourn creation
FIX: missing fk_account situation invoice
FIX: missing group "members" + multiple broken features for Multicompany
FIX: missing 'overwrite_trans' for $addzero (Multicompany)
FIX: modification of complementary attributes in commercial proposals
FIX: multicompany compatibility
FIX: multiple broken features for Multicompany !!!!
FIX: Navigation to/from a project from page of projects of a thirdparty
FIX: payment : language is not propagated to following pages
FIX: Prices visible on TakePOS KO with multiprices support
FIX: product list accounting length
FIX: Quick search Intervention redirect to wrong page
FIX: Return right content type
FIX: right access on salary card and tabs
FIX: rights paymentsc paiementcharge
FIX: same broken feature as v18 (Multicompany)
FIX: Save user modif id when changing a contact status
FIX: Social Contrib - List - Fatal error on kanban view PHP8.x & Missing colspan
FIX: thirdparty object in proposal card is not loaded
FIX: Total of holidays is doubled
FIX: translation button
FIX: trigger for email sent from partnership
FIX: uniformize getEntity sql request
FIX: use urlencode for origin and originid
FIX: Various payment - List - Fatal error on php8.1
FIX: warning when Workboard Responses display non numeric strings
FIX: wrong place of trigger delete
FIX: wrong test + is_int is better for negative integer
***** ChangeLog for 18.0.1 compared to 18.0.0 *****
FIX: Adding a product in recurring invoice does not use the correct VAT
FIX: API /product/getAttributes
FIX: avoid php8 warnings
FIX: bad balance of TR tag in multicurrency price view
FIX: Bad calculation of localtax when price_base_type not defined.
FIX: Bad link into message
FIX: Bad message on menu to go to setup of accounting custom groups
FIX: Bank receipt was empty
FIX: Billing massaction should be possible on Processed Reception.
FIX: clone when cloning object with ->lines containing not object
FIX: Condition to show column POSModule and POSTerminal in invoice list
FIX: CSS
FIX: date survey : button to add dates would not work. Session would store cells numbers which would stay to 10 for next surveys created.
FIX: dir output path for ODT models on reception card
FIX: Duplicate tooltip on ref of an agenda event
FIX: encrypt sensitive data must not be done for const MAIN_AGENDA_ACTIONAUTO
FIX: Export when old file export_csv.modules.php is still present
FIX: fatal error with bad definition of dictionaries
FIX: fatal error with some parameters
FIX: hook formBuilddocOptions was broken when used by 2 modules
FIX: Line for revenuestamp in accountancy transfer must appear only if it exists
FIX: Navigation between bank receipts
FIX: payment card: misleading message when delete button disabled
FIX: reception odt dir output path
FIX: SQL request parenthesis
FIX: Suppliers addlines never have VAT if buyprice for this supplier not set
FIX: TakePOS receipt preview in admin #25648
FIX: technical error on conciliation of lines
FIX: the account in chart of account to use for revenue stamp is on dict
FIX: url to check keyword not saved on partnership from public form
FIX: when adding new times on a survey, all hours would be erased.
***** ChangeLog for 18.0.0 compared to 17.0.0 *****
For uses:
---------
NEW: PHP 8.2 compatibility (not yet complete).
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: 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 a public virtual card page for each user
NEW: Add a status on supplier price ref (WIP to close a supplier ref)
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 customer code to invoices listing
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 origin info when create a product batch when created from a movement stock
NEW: Add possibility to choose format #21426
NEW: Add SQL contraint on product_stock table to allow only exsting product and warehouse #23543
NEW: Add STRIPE_DEBUG, a way to log Stripe IPN
NEW: An external module can modify the quick search fields
NEW: Auto activate some modules on install (Export/Import/Wysiwyg editor)
NEW: Autofill email form with the email template with status "Default" on
NEW: 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 bin accounting line for a given month
NEW: Can edit account on miscellaneous payment (if not transfered)
NEW: Can edit inline the VAT number from supplier tab
NEW: Can fill date of salary payment with date of start of salary
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: Customers: add date due and labels into customer comm card
NEW: Can select the export format during export of journals
NEW: Can set a checkbox in formconfirm by clicking on the label
NEW: Can set flag default value on email templates
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: constant PROPALE_ADDON_NOTE_PUBLIC_DEFAULT
NEW: create email substitution variable for intervention signature URL
NEW: Debug the custom CSS feature to avoid a directory search/scan at
NEW: dev name
NEW: Disable bad reputation product price
NEW: dolExplodeIntoArray can accept regex
NEW: dol_sort_array can sort on alphabetical order even if val is num
NEW: element time integration code + SQL
NEW: Email: don't have closed contact proposed as receiver for the mails
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: 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: expend/collapse list of social networks
NEW: Filter on amount and qty on list of service's contracts
NEW: formconfirm can support field with format datetime
NEW: getCommonSubstitutionArray to have more substitute keys
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: hook printFieldListFrom in contact list
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: Invoice - show category of operations
NEW: Keep a link between user created from recruitment and application
NEW: List product in orders
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 open contact from liste_contact function, to not have access to closed contact as mail receiver
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 export: allow to export field 'shipment method'
NEW: payment default values when supplier order created from reception
NEW: Payment : manage contracts
NEW: presend mass action in contact list
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: product images on popup are cached
NEW: Products: Add statistics by amount on statistics of products.
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: Provide the oldcopy value when calling setValueFrom() function with a trigger key
NEW: Reception: can receive more than qty ordered on reception
NEW: referential objects of batch
NEW: remove default percentage for event creation url
NEW: remove keys whose table element is the same as element in map list
NEW: repair script skip views
NEW: Security: Save date to invalidate other session into user table
NEW: Security: Invalidate all sessions of a user when password is modified.
NEW: search on time spent duration range
NEW: sepaStripe now creates the payment mode with type pm_ using new API
NEW: set payment default values when supplier order created from reception
NEW: set today start time at beginning
NEW: Show counter of access of website in website list
NEW: Show main currency in company info user tooltip
NEW: Show module into list of emails templates
NEW: Show picto into the combobox of widgets
NEW: Show supplier invoice ref of direct debit transfer tab invoices
NEW: show supplier name in getNomUrl of supplier order
NEW: sort of column of custom group of account
NEW: Supplier Invoices: add ability of ODT support to supplier invoices
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: Support different bank account for several direct debit payments
NEW: Support multiselect in the warehouse selection combo box
NEW: Option: MAIN_SECURITY_MAXFILESIZE_DOWNLOADED #yogosha10660
NEW: Survey: Comment on survey is possible only after vote.
NEW: tables: llx_element_time to store time spent on several elements (mo, ticket...)
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: The upgrade process can be done by creating a file upgrade.unlock
NEW: Tickets: --Send an email when ticket assigned--
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: Use a cache file for external RSS in calendar
NEW: Use by default the domain $dolibarr_main_url_root for SMTP HELO
NEW: use more recent model by default
NEW: VAT can be modified during add of line
NEW: Website Module: Increment website counter on each page access in website module
NEW: write all fields and their properties in asciidoc format
NEW: Can add an array of several links in date selector
NEW: Option PDF_SHOW_PHONE_AFTER_USER_CONTACT to show phone after specific assigned contact on PDF
NEW: Option PDF_SHOW_EMAIL_AFTER_USER_CONTACT to show email after specific assigned contact on PDF
NEW: Widgets: Implement MAIN_ACTIVATE_FILECACHE on birthday widget
NEW: Widgets: Add widget "The next upcoming events"
NEW: Widgets: Add widget of open opportunities
NEW: use an ajax component to switch prospection status on thirdparty list
NEW: Add partial payment reason "withholding tax"
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 listiong objects from directory
NEW: add helplist property to describe fields of objects
NEW: add hook in loadLotStock() in html.formproduct.class.php file, add hook 'llxFooter', Add hook online sign
NEW: Update lib parsedownto 1.7.4, phpspreadsheet lib to v1.12, ESCPOS v3.0, jquery, Stripe.
NEW: Support contact in post() document API
NEW: More APIs (update currency rate, upload of supplier documents, ...)
NEW: ModuleBuilder: updating in modulbuilder on tab Menu when adding object
NEW: ModuleBuilder: add/edit permissions
NEW: ModuleBuilder: better generated documentation
NEW: add sent info in the parameters provided to the hook sendMailAfter
NEW: add setAsSelectUser into factory for generic setup page
NEW: add option keepspace into dol_string_nospecialchar()
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 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.4 compared to 17.0.3 *****
FIX: $this->newref already exists and could have been modified by a trigger but we still use a local variable for the filesystem-based renaming
@@ -1209,20 +506,18 @@ 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.
* 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.
* 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.
* 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 *****
@@ -1278,24 +573,23 @@ FIX: wrong url param name action
FIX: Amount of localtax1 and 2 not correctly save on purchase order (the rate was saved instead)
FIX: #20415
FIX: #21280
FIX: #23008
FIX: #22271
FIX: #22524
FIX: #22837
FIX: #22964
FIX: #23008
FIX: #23012
FIX: #23019 Impossible to add task times to an existing draft invoice
FIX: #23072
FIX: #23075
FIX: #23087
FIX: #23115
FIX: #23115
FIX: #23116
FIX: #23117
FIX: #23281
FIX: #23420 : wrong check on $search_categ value causing FATAL ERROR
FIX: Accountancy - Quadra export
FIX: add border left on image product when conf activated
FIX: Add missing token when deleting template inn order_supplier admin menu
FIX: Amount of localtax1 and 2 not correctly save on purchase order (the
FIX: API access for deactivated users
FIX: bad selection of barcode numbering module
FIX: Can't see all time spent by all user
@@ -1306,6 +600,8 @@ FIX: Empty FormSetup emailTemplate type IF empty fieldvalue
FIX: Errors Handling for CreateFrom Hooks
FIX: error with dol_banner_tab, ref is needed
FIX: ExpenseReport card was not reloaded after addline
FIX: #23075
FIX: #23117
FIX: get multicurrency infos of propal when create order from propal with "WORKFLOW_PROPAL_AUTOCREATE_ORDER" conf
FIX: Give predictable order to inventory lines
FIX: include class multicurrency
@@ -1313,6 +609,7 @@ FIX: methods declaration (backport fix 67b9a7dc07d708231d12b5e58800334d4a01ef98)
FIX: multicurrency_tx and not currency_tx
FIX: on public ticket list, only the page 1 was accessible. Other pages were 404 error.
FIX: PGSQL Integer type does not have a free lenght
FIX: PGSQL Int type does not have a free lenght
FIX: Product list in setup.php in new Module
FIX: propal and order stats broken on Tag+User(retricted customer list)
FIX: saving of numbering module for jobs
@@ -2840,7 +2137,7 @@ NEW: add quick dropdown menu in top right menu (experimental with MAIN_USE_TOP_M
NEW: add region in export companies and contacts
NEW: add rights on margin info on invoice list
NEW: add search param for close date on order list
NEW: add show preview for mail attachment on form mail
NEW: add show preview for mail attachement on form mail
NEW: add State/Province origin for products
NEW: add the workflow interaction close intervention on closing ticket
NEW: add tracking number in list and search_all items
@@ -4225,7 +3522,7 @@ FIX: access to public interface when origin email has an alias.
FIX: Alias name is not into the email recipient label.
FIX: allow standalone credit note even if no invoice
FIX: an admin can not access his own permissions after enabling advanced permissions
FIX: Attachment of linked files on ticket when sending a message
FIX: Attachement of linked files on ticket when sending a message
FIX: avoid non numeric warning
FIX: Bad currency var used in stripe for connect
FIX: Bad list of ticket on public interface for ticket emailcollector
@@ -5021,7 +4318,7 @@ NEW: hidden option to define an invoice template for each invoice type
NEW: Highlight lines on lists when they are checked
NEW: Notification module support expense report+holiday validation and approval
NEW: On customer/supplier card, add simple tooltip to amount boxes
NEW: Page to check if the operations/items created between two dates have attached item(s) and possibility to download all attachments
NEW: Page to check if the operations/items created between two dates have attached item(s) and possibility to download all attachements
NEW: possibility to add all rights of all modules in one time
NEW: redirect if only one result on global search on card
NEW: Permission to ignore price min
@@ -6465,7 +5762,7 @@ NEW: No external check of version without explicit click in about page.
NEW: ODT docs for USER USERGROUP CONTRACT and PRODUCT class
NEW: odt usergroup
NEW: On invoices generated by template, we save if invoice come from a source template.
NEW: option to copy into attachment files of events, files send by mail (with auto event creation)
NEW: option to copy into attachement files of events, files send by mail (with auto event creation)
NEW: PDF with numbertoword
NEW: Permit multiple file upload in linked documents
NEW: PHP 7.1 compatibility

View File

@@ -1,7 +1,8 @@
# DOLIBARR ERP & CRM
![Downloads per day](https://img.shields.io/sourceforge/dw/dolibarr.svg)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.1-8892BF.svg?style=flat-square)](https://php.net/)
![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.0-8892BF.svg?style=flat-square)](https://php.net/)
[![GitHub release](https://img.shields.io/github/v/release/Dolibarr/dolibarr)](https://github.com/Dolibarr/dolibarr)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5521/badge)](https://bestpractices.coreinfrastructure.org/projects/5521)

View File

@@ -4,7 +4,7 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
## Supported Versions for security reports
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).
Security report are valid only on current stable version (see dolibarr.org web site to get current stable version) or on development version (branch "develop" on https://github.com/Dolibarr/dolibarr).
## Reporting a Vulnerability
@@ -48,15 +48,14 @@ Reports are processed around once a month.
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.
* $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). CSRF attacks are accepted but
double check that you have set MAIN_SECURITY_CSRF_WITH_TOKEN to value 3.
* 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)
* 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 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, api calls and all public pages (/public/*) must be installed as recommendend into the section "About - Admin tools - Section Access limits and mitigation".

View File

@@ -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";
$short_options = "c:h";
$long_options = array(
// Load conf file if it is already defined

View File

@@ -1,4 +1,4 @@
FROM php:8.1-apache-bullseye
FROM php:7.3-apache
ENV PHP_INI_DATE_TIMEZONE 'UTC'
ENV PHP_INI_MEMORY_LIMIT 256M
@@ -25,7 +25,7 @@ RUN apt-get update -y \
mailutils \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-install -j$(nproc) calendar intl mysqli pdo_mysql gd soap zip \
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
&& docker-php-ext-install -j$(nproc) ldap && \
@@ -50,7 +50,7 @@ RUN echo 'xdebug.idekey="netbeans-xdebug"' >> ${PHP_INI_DIR}/php.ini
# set up sendmail config, to use maildev
RUN echo "account default" > /etc/msmtprc
RUN echo "auth off" >> /etc/msmtprc
RUN echo "port 1025" >> /etc/msmtprc
RUN echo "port 25" >> /etc/msmtprc
RUN echo "host mail" >> /etc/msmtprc
RUN echo "from local@localdomain.com" >> /etc/msmtprc
RUN echo "domain localhost.localdomain" >> /etc/msmtprc

View File

@@ -1,7 +1,7 @@
# How to use it ?
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.
The docker-compose.yml file is used to build and run Dolibarr in the current workspace.
This docker image 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:
@@ -25,7 +25,7 @@ The URL to go to the Dolibarr is :
The URL to go to PhpMyAdmin is (login/password is root/root) :
http://0.0.0.0:8080
In Dolibarr configuration Email let PHP mail function, To see all mail send by Dolibarr go to maildev
http://0.0.0.0:8081

View File

@@ -10,7 +10,7 @@ services:
mariadb:
image: mariadb:latest
environment:
MYSQL_ROOT_PASSWORD: rootpassfordev
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: dolibarr
ports:
- "3306:3306"
@@ -34,8 +34,6 @@ services:
build: .
environment:
HOST_USER_ID: $HOST_USER_ID
PHP_INI_DATE_TIMEZONE: $PHP_INI_DATE_TIMEZONE
PHP_INI_MEMORY_LIMIT: $PHP_INI_MEMORY_LIMIT
volumes:
- ../../htdocs:/var/www/html/
- ../../documents:/var/documents
@@ -55,8 +53,8 @@ services:
mail:
image: maildev/maildev
ports:
- "8081:1080"
- "25:1025"
- "8081:80"
- "25:25"
networks:
- internal-pod
- external-pod

View File

@@ -10,15 +10,15 @@ 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
echo "[docker-run] => update ${PHP_INI_DIR}/conf.d/dolibarr-php.ini"
cat <<EOF > ${PHP_INI_DIR}/conf.d/dolibarr-php.ini
date.timezone = ${PHP_INI_DATE_TIMEZONE:-UTC}
memory_limit = ${PHP_INI_MEMORY_LIMIT:-256M}
if [ ! -f /usr/local/etc/php/php.ini ]; then
cat <<EOF > /usr/local/etc/php/php.ini
date.timezone = $PHP_INI_DATE_TIMEZONE
EOF
fi
exec apache2-foreground

View File

@@ -220,8 +220,7 @@ 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 = example=PHP
EXTENSION_MAPPING =
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
@@ -603,7 +602,6 @@ 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

View File

@@ -11,38 +11,38 @@ LaunchProgram=Launch %1
AssocFileExtension=&Associate %1 with the %2 file extension
AssocingFileExtension=Associating %1 with the %2 file extension...
YouWillInstallDoliWamp=You will install DoliWamp (so Dolibarr plus all required third-party software like Apache, MySQL and PHP) on your computer.
ThisAssistantInstallOrUpgrade=WARNING: Using an ERP CRM installed on a local computer can be dangerous: if your computer breaks down, you can lose all your data. Do this if you are ready to manage backups yourself seriously. If not, use an installation in SaaS instead (see https://saas.dolibarr.org).
IfYouHaveTechnicalKnowledge=Moreover, if you have technical knowledge and want to manage Apache, MySQL and PHP yourself, you should not use this assistant and instead make a manual installation of Dolibarr on your existing server with Apache, MySQL and PHP.
ButIfYouLook=But if you are looking for an automatic setup on your local computer, you're on the right path...
DoYouWantToStart=Do you want to start the installation process?
YouWillInstallDoliWamp=You will install DoliWamp (so Dolibarr + all required third party software like Apache, Mysql and PHP) on your computer.
ThisAssistantInstallOrUpgrade=WARNING: Using an ERP CRM installed on a local computer can be dangerous: if your computer break down, you can lose all your data. Do this if you are ready to manage backup yourself seriously. If not, use an installation in Saas instead (see https://saas.dolibarr.org).
IfYouHaveTechnicalKnowledge=Moreover, if you have technical knowledges and want to manage your Apache, Mysql and PHP yourself, you should not use this assistant and make a manual installation of Dolibarr on your existing server with Apache, Mysql and PHP.
ButIfYouLook=But if you look for an automatic setup on your local computer, you''re on the good way...
DoYouWantToStart=Do you want to start installation process ?
TechnicalParameters=Technical parameters
IfFirstInstall=If this is the first install, please specify some technical parameters. If you don't understand, are not sure, or are doing an upgrade, just keep the default values.
IfFirstInstall=If first install, please specify some technical parameters. If you don't understand, are not sure, or are doing an upgrade, just leave the default values.
; WARNING !!! STRINGS HERE MUST BE LOWER THAN 60 CHARACTERS
SMTPServer=SMTP server (your own or ISP SMTP server, first install only):
ApachePort=Apache port (first install only, common choice is 80):
MySqlPort=MySQL port (first install only, common choice is 3306):
MySqlPassword=MySQL server and database password you want for root (first install only):
SMTPServer=SMTP server (your own or ISP SMTP server, first install only) :
ApachePort=Apache port (first install only, common choice is 80) :
MySqlPort=MySql port (first install only, common choice is 3306) :
MySqlPassword=MySql server and database password you want for root (first install only):
FailedToDeleteLock=Failed to delete the file %1/www/dolibarr/install.lock. You can ignore this warning but you may have to remove the file manually later when asked. Click OK to continue...
FailedToDeleteLock=Failed to delete the file %1/www/dolibarr/install.lock. You can ignore warning but you may have to remove it manually later when asked. Click OK to continue...
PortAlreadyInUse=Port %1 seems to already be in use. You should cancel to go back and choose another value for %2 port. Cancel choice and choose another value?
PortAlreadyInUse=Port %1 seems to be already in use. You should cancel to go back and choose another value for %2 port. Cancel choice and choose another value ?
FirefoxDetected=Firefox has been detected on your computer. Would you like to use it as the default browser for Dolibarr?
ChromeDetected=Chrome has been detected on your computer. Would you like to use it as the default browser for Dolibarr?
MicrosoftEdgeDetected=Microsoft Edge has been detected on your computer. Would you like to use it as the default browser for Dolibarr?
ChooseDefaultBrowser=Please choose your default browser (iexplore.exe, firefox.exe, chrome.exe, MicrosoftEdge.exe...). If you are not sure, just click Open:
FirefoxDetected=Firefox has been detected on your computer. Would you like to use it as the default browser for Dolibarr ?
ChromeDetected=Chrome has been detected on your computer. Would you like to use it as the default browser for Dolibarr ?
MicrosoftEdgeDetected=Microsoft Edge has been detected on your computer. Would you like to use it as the default browser for Dolibarr ?
ChooseDefaultBrowser=Please choose your default browser (iexplore.exe, firefox.exe, chrome.exe, MicrosoftEdge.exe...). If you are not sure, just click Open :
LaunchNow=Launch Dolibarr now
ProgramHasBeenRemoved=Dolibarr's program files have been removed. However, all your data files are still in directory %1. You must remove this directory manually for a complete uninstall.
ProgramHasBeenRemoved=Dolibarr program files have been removed. However, all your data files are still in directory %1. You must remove this directory manually for a complete uninstall.
DoliWampWillStartApacheMysql=DoliWamp installer will now start or restart Apache and MySQL. This may take from several seconds to one minute. Start to install or upgrade the web and database server required by Dolibarr?
DoliWampWillStartApacheMysql=DoliWamp installer will now start or restart Apache and Mysql, this may last from several seconds to one minute after this confirmation. Start to install or upgrade the web and database server required by Dolibarr ?
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
OldVersionFoundAndMoveInNew=An old database version has been found and moved to be used by new Dolibarr version
OldVersionFoundButFailedToMoveInNew=An old database version has been found but could not be moved to be used with new Dolibarr version
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)
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=Continue anyway (install process may fails without this prerequisite)

View File

@@ -304,15 +304,22 @@ if (isset($_GET['img']))
// Definition of language and texts
// Definition de la langue et des textes
if (isset ($_GET['lang'])) {
$langue = preg_replace('/[^a-z_]/i', '', $_GET['lang']);
} elseif (preg_match("/^fr/", $_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
if (isset ($_GET['lang']))
{
$langue = $_GET['lang'];
}
elseif (preg_match("/^fr/", $_SERVER['HTTP_ACCEPT_LANGUAGE']))
{
$langue = 'fr';
} elseif (preg_match("/^es/", $_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
}
elseif (preg_match("/^es/", $_SERVER['HTTP_ACCEPT_LANGUAGE']))
{
$langue = 'es';
} else {
}
else
{
$langue = 'en';
}
@@ -320,25 +327,29 @@ if (isset ($_GET['lang'])) {
// Read PHP extensions
$loaded_extensions = get_loaded_extensions();
$phpExtContents='';
foreach ($loaded_extensions as $extension) {
foreach ($loaded_extensions as $extension)
$phpExtContents .= "<li>${extension}</li>";
}
// Read alias directory
$listoffile=array();
$aliasarray=array();
$aliasContents='';
if (is_dir($aliasDir)) {
if (is_dir($aliasDir))
{
$handle=opendir($aliasDir);
if (is_resource($handle)) {
while ($file = readdir($handle)) {
if (is_resource($handle))
{
while ($file = readdir($handle))
{
$listoffiles[]=$file;
}
}
sort($listoffiles);
foreach($listoffiles as $file) {
foreach($listoffiles as $file)
{
if (is_file($aliasDir.$file) && preg_match('/\.conf/',$file))
{
$msg = '';
@@ -363,7 +374,8 @@ if (!isset($aliasContents))
// Read projects in www dir
$listoffiles=array();
$handle=opendir(".");
if (is_resource($handle)) {
if (is_resource($handle))
{
while ($file = readdir($handle))
{
$listoffiles[]=$file;
@@ -371,7 +383,8 @@ if (is_resource($handle)) {
closedir($handle);
}
foreach($listoffiles as $file) {
foreach($listoffiles as $file)
{
if (is_dir($file) && !in_array($file,$projectsListIgnore) && !in_array($file,$aliasarray))
{
$projectContents .= '<tr><td><ul class="projects">';
@@ -384,9 +397,9 @@ foreach($listoffiles as $file) {
}
}
if (!isset($projectContents)) {
if (!isset($projectContents))
$projectContents = '<tr><td colspan="3">'.$langues[$langue]['txtNoProjet'].'</td></tr>';
}
$nameServer=getenv("COMPUTERNAME");

View File

@@ -172,7 +172,7 @@ $files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom
*/
// Define qualified files (must be same than into generate_filelist_xml.php and in api_setup.class.php)
$regextoinclude = '\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|bak|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$';
$regextoexclude = '('.($includecustom?'':'custom|').'documents|escpos-php\/doc|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
$regextoexclude = '('.($includecustom?'':'custom|').'documents|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
$files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
$dir='';

View File

@@ -4,7 +4,7 @@
# \brief Dolibarr package builder (tgz, zip, rpm, deb, exe, aps)
# \author (c)2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
#
# This is list of constant you can set to have generated packages moved into a specific dir:
# This is list of constant you can set to have generated packages moved into a specific dir:
#DESTIBETARC='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/lastbuild'
#DESTISTABLE='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/stable'
#DESTIMODULES='/media/HDDATA1_LD/Mes Sites/Web/Admin1/wwwroot/files/modules'
@@ -18,12 +18,10 @@ use Term::ANSIColor;
# Change this to defined target for option 98 and 99
$PROJECT="dolibarr";
$PUBLISHBETARC="$ENV{'DESTIASSOLOGIN'}\@vmprod1.dolibarr.org:/home/dolibarr/asso.dolibarr.org/dolibarr_documents/website/www.dolibarr.org/files";
$PUBLISHSTABLE="$ENV{'DESTISFLOGIN'}\@frs.sourceforge.net:/home/frs/project/dolibarr";
$PUBLISHSTABLE="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr";
$PUBLISHBETARC="dolibarr\@vmprod1.dolibarr.org:/home/dolibarr/asso.dolibarr.org/dolibarr_documents/website/www.dolibarr.org/files";
# due to implicit origin on git commands, example
# implicit origin, lionel upstream, eric dolibarr
$GITREMOTENAME="$ENV{'GITREMOTENAME'}";
#@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","EXEDOLIWAMP","SNAPSHOT"); # Possible packages
@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","EXEDOLIWAMP","SNAPSHOT"); # Possible packages
%REQUIREMENTPUBLISH=(
@@ -38,7 +36,7 @@ $GITREMOTENAME="$ENV{'GITREMOTENAME'}";
"RPM_FEDORA"=>"rpmbuild",
"RPM_MANDRIVA"=>"rpmbuild",
"RPM_OPENSUSE"=>"rpmbuild",
"DEB"=>"dpkg",
"DEB"=>"dpkg dpatch",
"FLATPACK"=>"flatpack",
"EXEDOLIWAMP"=>"ISCC.exe",
"SNAPSHOT"=>"tar"
@@ -100,13 +98,6 @@ if (! -d $ENV{"DESTIBETARC"} || ! -d $ENV{"DESTISTABLE"})
exit 1;
}
if (! $ENV{"GITREMOTENAME"})
{
print "Error: environment variable GITREMOTENAME does not exist. You can set it to 'origin' or any other git remote name.\n";
print "$PROG.$Extension aborted.\n";
sleep 2;
exit 1;
}
# Detect OS type
# --------------
if ("$^O" =~ /linux/i || (-d "/etc" && -d "/var" && "$^O" !~ /cygwin/i)) { $OS='linux'; $CR=''; }
@@ -138,7 +129,7 @@ if (! $TEMP || ! -d $TEMP) {
print "$PROG.$Extension aborted.\n";
sleep 2;
exit 2;
}
}
$BUILDROOT="$TEMP/buildroot";
@@ -181,7 +172,7 @@ $newbuild = $BUILD;
$newbuild =~ s/(dev|alpha)/1/gi; # dev
$newbuild =~ s/beta(.?)/2/gi; # beta (we want beta1, beta2, betax to be same package name)
$newbuild =~ s/rc(.?)/3/gi; # rc (we want rc1, rc2, rcx to be same package name)
if ($newbuild !~ /-/) { $newbuild.='-4'; } # finale is same than rc.
if ($newbuild !~ /-/) { $newbuild.='-4'; } # finale is same than rc.
# now newbuild is 0-1 or 0-4 for example. Note that for native package (see debian/source/format), we should not use a dash part but to get a better version management
$build = $newbuild;
$build =~ s/-.*$//g;
@@ -199,8 +190,8 @@ for (0..@ARGV-1) {
if ($ARGV[$_] =~ /^-*target=(\w+)/i) { $target=$1; $batch=1; }
if ($ARGV[$_] =~ /^-*desti=(.+)/i) { $DESTI=$1; }
if ($ARGV[$_] =~ /^-*prefix=(.+)/i) {
$PREFIX=$1;
$FILENAMESNAPSHOT.="-".$PREFIX;
$PREFIX=$1;
$FILENAMESNAPSHOT.="-".$PREFIX;
}
}
if ($ENV{"DESTIBETARC"} && $BUILD =~ /[a-z]/i) { $DESTI = $ENV{"DESTIBETARC"}; } # Force output dir if env DESTIBETARC is defined
@@ -219,7 +210,7 @@ print "Target directory (DESTI) : $DESTI\n";
# Choose package targets
#-----------------------
if ($target) {
if ($target eq "ALL") {
if ($target eq "ALL") {
foreach my $key (@LISTETARGET) {
if ($key ne 'SNAPSHOT' && $key ne 'SF' && $key ne 'ASSO') { $CHOOSEDTARGET{$key}=1; }
}
@@ -245,10 +236,10 @@ else {
printf(" %2d - %-14s (%s)\n",$cpt,"ASSO (publish)","Need ".$REQUIREMENTPUBLISH{"ASSO"});
$cpt=99;
printf(" %2d - %-14s (%s)\n",$cpt,"SF (publish)","Need ".$REQUIREMENTPUBLISH{"SF"});
# Ask which target to build
print "Choose one target number or several separated with space (0 - ".$cpt."): ";
$NUM_SCRIPT=<STDIN>;
$NUM_SCRIPT=<STDIN>;
chomp($NUM_SCRIPT);
if ($NUM_SCRIPT !~ /^[0-9\s]+$/)
{
@@ -295,11 +286,11 @@ foreach my $target (sort keys %CHOOSEDTARGET) {
print "Error: You asked creation of several rpms. Because all rpm have same name, you must defined an environment variable DESTI to tell packager where it can create subdirs for each generated package.\n";
exit;
}
$atleastonerpm=1;
}
foreach my $req (split(/[,\s]/,$REQUIREMENTTARGET{$target}))
$atleastonerpm=1;
}
foreach my $req (split(/[,\s]/,$REQUIREMENTTARGET{$target}))
{
# Test
# Test
print "Test requirement for target $target: Search '$req'... ";
$newreq=$req; $newparam='';
if ($newreq eq 'zip') { $newparam.='-h'; }
@@ -308,12 +299,12 @@ foreach my $target (sort keys %CHOOSEDTARGET) {
print "Test command ".$cmd."... ";
$ret=`$cmd`;
$coderetour=$?; $coderetour2=$coderetour>>8;
if ($coderetour != 0 && (($coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i) || ($coderetour2 == 127 && $OS !~ /windows/)) && $PROGPATH) {
if ($coderetour != 0 && (($coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i) || ($coderetour2 == 127 && $OS !~ /windows/)) && $PROGPATH) {
# Not found error, we try in PROGPATH
$ret=`"$PROGPATH/$ALTERNATEPATH{$req}/$req\" 2>&1`;
$coderetour=$?; $coderetour2=$coderetour>>8;
$REQUIREMENTTARGET{$target}="$PROGPATH/$ALTERNATEPATH{$req}/$req";
}
}
if ($coderetour != 0 && (($coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i) || ($coderetour2 == 127 && $OS !~ /windows/))) {
# Not found error
@@ -342,7 +333,7 @@ $nbofpublishneedchangelog=0;
foreach my $target (sort keys %CHOOSEDTARGET) {
if ($target eq '-CHKSUM') { $nbofpublishneedchangelog++; }
if ($CHOOSEDTARGET{$target} < 0) { next; }
if ($target ne 'EXE' && $target ne 'EXEDOLIWAMP' && $target ne '-CHKSUM')
if ($target ne 'EXE' && $target ne 'EXEDOLIWAMP' && $target ne '-CHKSUM')
{
$nboftargetneedbuildroot++;
}
@@ -406,10 +397,10 @@ if ($nboftargetok) {
print "Go to directory $SOURCE\n";
$olddir=getcwd();
chdir("$SOURCE");
print "Clean $SOURCE/htdocs/includes/autoload.php\n";
$ret=`rm -f $SOURCE/htdocs/includes/autoload.php`;
$ret=`git ls-files . --exclude-standard --others`;
if ($ret)
{
@@ -418,16 +409,12 @@ if ($nboftargetok) {
print "Canceled.\n";
exit;
}
print 'Create xml check file with md5 checksum with command php '.$SOURCE.'/build/generate_filelist_xml.php release='.$MAJOR.'.'.$MINOR.'.'.$BUILD."\n";
$ret=`php $SOURCE/build/generate_filelist_xml.php release=$MAJOR.$MINOR.$BUILD`;
print $ret."\n";
# Copy to final dir
$NEWDESTI=$DESTI;
if ( !-d "$NEWDESTI/signatures" ) {
use File::Path qw( make_path );
make_path "$NEWDESTI/signatures" or die "Failed to create path: $NEWDESTI/signatures";
}
print "Copy \"$SOURCE/htdocs/install/filelist-$MAJOR.$MINOR.$BUILD.xml\" to $NEWDESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml\n";
use File::Copy qw(copy);
copy "$SOURCE/htdocs/install/filelist-$MAJOR.$MINOR.$BUILD.xml", "$NEWDESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml";
@@ -440,32 +427,32 @@ if ($nboftargetok) {
print "Go to directory $SOURCE\n";
$olddir=getcwd();
chdir("$SOURCE");
print 'Run git tag -a -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n";
$ret=`git tag -a -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD" 2>&1`;
if ($ret =~ /(already exists|existe déjà)/)
{
print "WARNING: Tag ".$MAJOR.'.'.$MINOR.'.'.$BUILD." already exists. Overwrite (y/N) ? ";
$QUESTIONOVERWRITETAG=<STDIN>;
$QUESTIONOVERWRITETAG=<STDIN>;
chomp($QUESTIONOVERWRITETAG);
if ($QUESTIONOVERWRITETAG =~ /(o|y)/)
{
print 'Run git tag -a -f -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n";
$ret=`git tag -a -f -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD"`;
print 'Run git push $GITREMOTENAME -f --tags'."\n";
$ret=`git push $GITREMOTENAME -f --tags`;
print 'Run git push -f --tags'."\n";
$ret=`git push -f --tags`;
#$ret=`git push -f origin "$MAJOR.$MINOR.$BUILD"`;
}
}
else
{
print 'Run git push $GITREMOTENAME --tags'."\n";
$ret=`git push $GITREMOTENAME --tags`;
print 'Run git push --tags'."\n";
$ret=`git push --tags`;
#$ret=`git push origin "$MAJOR.$MINOR.$BUILD"`;
}
chdir("$olddir");
}
# Update buildroot if required
#-----------------------------
if ($nboftargetneedbuildroot)
@@ -475,7 +462,7 @@ if ($nboftargetok) {
print "Delete directory $BUILDROOT\n";
$ret=`rm -fr "$BUILDROOT"`;
mkdir "$BUILDROOT";
mkdir "$BUILDROOT/$PROJECT";
print "Copy $SOURCE into $BUILDROOT/$PROJECT\n";
@@ -501,7 +488,7 @@ if ($nboftargetok) {
$ret=`rm -f $BUILDROOT/$PROJECT/phpstan.neon`;
$ret=`rm -f $BUILDROOT/$PROJECT/pom.xml`;
$ret=`rm -f $BUILDROOT/$PROJECT/README-*.md`;
$ret=`rm -fr $BUILDROOT/$PROJECT/build/html`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/Doli*-*`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.deb`;
@@ -568,20 +555,20 @@ if ($nboftargetok) {
$ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot11.png`;
$ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot12.png`;
# Security to avoid to package data files
# Security to avoid to package data files
print "Remove documents dir\n";
$ret=`rm -fr $BUILDROOT/$PROJECT/document`;
$ret=`rm -fr $BUILDROOT/$PROJECT/documents`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/document`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`;
print "Remove subdir of custom dir\n";
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\;\n";
$ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs but not files
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\;\n";
$ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs, even symbolic links, but not files
# Removed known external modules to avoid any error when packaging from env where external modules are tested
# Removed known external modules to avoid any error when packaging from env where external modules are tested
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/abricot*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/accountingexport*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/allscreens*`;
@@ -606,15 +593,15 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/timesheet*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/webmail*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/theme/common/fontawesome-5/svgs`;
# Removed other test files
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`;
$ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`;
$ret=`rm -f $BUILDROOT/$PROJECT/.gitignore $BUILDROOT/$PROJECT/*/.gitignore $BUILDROOT/$PROJECT/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.gitignore`;
# Removed files installed by the awful composer
# Removed files installed by the awful composer
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/geoip/sample*.*`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/bin`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/adapters`; # Keep this removal in case we embed libraries
@@ -653,14 +640,14 @@ if ($nboftargetok) {
# Build package for each target
#------------------------------
foreach my $target (sort keys %CHOOSEDTARGET)
foreach my $target (sort keys %CHOOSEDTARGET)
{
if ($CHOOSEDTARGET{$target} < 0) { next; }
if ($target eq '-CHKSUM') { next; }
print "\nBuild package for target $target\n";
if ($target eq 'SNAPSHOT')
if ($target eq 'SNAPSHOT')
{
$NEWDESTI=$DESTI;
@@ -684,13 +671,13 @@ if ($nboftargetok) {
next;
}
if ($target eq 'TGZ')
if ($target eq 'TGZ')
{
$NEWDESTI=$DESTI;
if ($NEWDESTI =~ /stable/)
{
mkdir($DESTI.'/standard');
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
}
print "Remove target $FILENAMETGZ.tgz...\n";
@@ -704,7 +691,7 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$FILENAMETGZ/build/exe`;
$ret=`rm -fr $BUILDROOT/$FILENAMETGZ/htdocs/includes/ckeditor/_source`; # We can't remove it with exclude file, we need it for some tarball packages
print "Compress $FILENAMETGZ into $FILENAMETGZ.tgz...\n";
$cmd="tar --exclude-vcs --exclude-from \"$BUILDROOT/$PROJECT/build/tgz/tar_exclude.txt\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$BUILDROOT/$FILENAMETGZ.tgz\" $FILENAMETGZ";
print "$cmd\n";
@@ -716,14 +703,14 @@ if ($nboftargetok) {
next;
}
if ($target eq 'XZ')
if ($target eq 'XZ')
{
$NEWDESTI=$DESTI;
if ($NEWDESTI =~ /stable/)
{
mkdir($DESTI.'/standard');
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
}
}
print "Remove target $FILENAMEXZ.xz...\n";
unlink("$NEWDESTI/$FILENAMEXZ.xz");
@@ -736,7 +723,7 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$FILENAMEXZ/build/exe`;
$ret=`rm -fr $BUILDROOT/$FILENAMEXZ/htdocs/includes/ckeditor/_source`; # We can't remove it with exclude file, we need it for some tarball packages
print "Compress $FILENAMEXZ into $FILENAMEXZ.xz...\n";
print "Go to directory $BUILDROOT\n";
@@ -752,15 +739,15 @@ if ($nboftargetok) {
$ret=`mv "$BUILDROOT/$FILENAMEXZ.xz" "$NEWDESTI/$FILENAMEXZ.xz"`;
next;
}
if ($target eq 'ZIP')
if ($target eq 'ZIP')
{
$NEWDESTI=$DESTI;
if ($NEWDESTI =~ /stable/)
{
mkdir($DESTI.'/standard');
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
}
}
print "Remove target $FILENAMEZIP.zip...\n";
unlink("$NEWDESTI/$FILENAMEZIP.zip");
@@ -783,14 +770,14 @@ if ($nboftargetok) {
print $cmd."\n";
$ret= `$cmd`;
chdir("$olddir");
# Move to final dir
print "Move $FILENAMEZIP.zip to $NEWDESTI/$FILENAMEZIP.zip\n";
$ret=`mv "$BUILDROOT/$FILENAMEZIP.zip" "$NEWDESTI/$FILENAMEZIP.zip"`;
next;
}
if ($target =~ /RPM/) # Linux only
if ($target =~ /RPM/) # Linux only
{
$NEWDESTI=$DESTI;
$subdir="package_rpm_generic";
@@ -801,7 +788,7 @@ if ($nboftargetok) {
{
mkdir($DESTI.'/'.$subdir);
if (-d $DESTI.'/'.$subdir) { $NEWDESTI=$DESTI.'/'.$subdir; }
}
}
if ($RPMDIR eq "") { $RPMDIR=$ENV{'HOME'}."/rpmbuild"; }
@@ -814,7 +801,7 @@ if ($nboftargetok) {
print "Create directory $BUILDROOT/$FILENAMETGZ2\n";
$ret=`rm -fr $BUILDROOT/$FILENAMETGZ2`;
print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMETGZ2\n";
$cmd="cp -pr '$BUILDROOT/$PROJECT' '$BUILDROOT/$FILENAMETGZ2'";
$ret=`$cmd`;
@@ -831,7 +818,6 @@ if ($nboftargetok) {
print "Compress $FILENAMETGZ2 into $FILENAMETGZ2.tgz...\n";
$ret=`tar --exclude-from "$SOURCE/build/tgz/tar_exclude.txt" --directory "$BUILDROOT" -czvf "$BUILDROOT/$FILENAMETGZ2.tgz" $FILENAMETGZ2`;
if (! -d $RPMDIR . '/SOURCES') { mkdir($RPMDIR . '/SOURCES'); }
print "Move $BUILDROOT/$FILENAMETGZ2.tgz to $RPMDIR/SOURCES/$FILENAMETGZ2.tgz\n";
$cmd="mv $BUILDROOT/$FILENAMETGZ2.tgz $RPMDIR/SOURCES/$FILENAMETGZ2.tgz";
$ret=`$cmd`;
@@ -841,7 +827,7 @@ if ($nboftargetok) {
if ($target =~ /FEDO/i) { $BUILDFICSRC="${FILENAME}_fedora.spec"; }
if ($target =~ /MAND/i) { $BUILDFICSRC="${FILENAME}_mandriva.spec"; }
if ($target =~ /OPEN/i) { $BUILDFICSRC="${FILENAME}_opensuse.spec"; }
use Date::Language;
$lang=Date::Language->new('English');
$datestring = $lang->time2str("%a %b %e %Y", time);
@@ -859,7 +845,7 @@ if ($nboftargetok) {
}
close SPECFROM;
close SPECTO;
print "Copy patch file to $RPMDIR/SOURCES\n";
$ret=`cp "$SOURCE/build/rpm/dolibarr-forrpm.patch" "$RPMDIR/SOURCES"`;
$ret=`chmod 644 $RPMDIR/SOURCES/dolibarr-forrpm.patch`;
@@ -881,14 +867,14 @@ if ($nboftargetok) {
next;
}
if ($target eq 'DEB')
if ($target eq 'DEB')
{
$NEWDESTI=$DESTI;
if ($NEWDESTI =~ /stable/)
{
mkdir($DESTI.'/package_debian-ubuntu');
if (-d $DESTI.'/package_debian-ubuntu') { $NEWDESTI=$DESTI.'/package_debian-ubuntu'; }
}
}
$olddir=getcwd();
@@ -969,18 +955,13 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/jquery/plugins/select2/LICENSE`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/mike42/escpos-php/LICENSE.md`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/mobiledetect/mobiledetectlib/LICENSE.txt`;
# Removed files we don't need (already removed)
#$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/ckeditor/_source`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/.codeclimate.yml`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/.pre-commit-config.yaml`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/.vscode`;
$ret=`find $BUILDROOT/$PROJECT.tmp/ -type f -name '.editorconfig' -exec rm {} \\;`;
$ret=`find $BUILDROOT/$PROJECT.tmp/ -type f -name '.travis.yml' -exec rm {} \\;`;
# Rename upstream changelog to match debian rules
$ret=`mv $BUILDROOT/$PROJECT.tmp/ChangeLog $BUILDROOT/$PROJECT.tmp/changelog`;
# Prepare source package (init debian dir)
print "Create directory $BUILDROOT/$PROJECT.tmp/debian\n";
$ret=`mkdir "$BUILDROOT/$PROJECT.tmp/debian"`;
@@ -1018,7 +999,7 @@ if ($nboftargetok) {
$ret=`cp -f "$SOURCE/build/debian/dolibarr.postrm" "$BUILDROOT/$PROJECT.tmp/debian"`;
$ret=`cp -f "$SOURCE/build/debian/dolibarr.templates" "$BUILDROOT/$PROJECT.tmp/debian"`;
$ret=`cp -f "$SOURCE/build/debian/install.forced.php.install" "$BUILDROOT/$PROJECT.tmp/debian"`;
# Set owners and permissions
#print "Set owners on files/dir\n";
#$ret=`chown -R root.root $BUILDROOT/$PROJECT.tmp`;
@@ -1049,8 +1030,8 @@ if ($nboftargetok) {
$ret=`$cmd`;
$cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.sh' -type f -exec chmod 755 {} \\; ";
$ret=`$cmd`;
print "Rename directory $BUILDROOT/$PROJECT.tmp into $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n";
$cmd="mv $BUILDROOT/$PROJECT.tmp $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build";
$ret=`$cmd`;
@@ -1058,14 +1039,14 @@ if ($nboftargetok) {
print "Go into directory $BUILDROOT\n";
chdir("$BUILDROOT");
# We need a tarball to be able to build "quilt" debian package (not required for native but we need patch so it is not a native)
print "Compress $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build into $BUILDROOT/$FILENAMEDEBNATIVE.orig.tar.gz...\n";
$cmd="tar --exclude-vcs --exclude-from \"$BUILDROOT/$PROJECT/build/tgz/tar_exclude.txt\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$BUILDROOT/$FILENAMEDEBNATIVE.orig.tar.gz\" $PROJECT-$MAJOR.$MINOR.$build";
print $cmd."\n";
$ret=`$cmd`;
# Creation of source package
# Creation of source package
print "Go into directory $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n";
chdir("$BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build");
#$cmd="dpkg-source -b $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build";
@@ -1084,12 +1065,12 @@ if ($nboftargetok) {
$ret=`mv $BUILDROOT/*_all.deb "$NEWDESTI/"`;
$ret=`mv $BUILDROOT/*.dsc "$NEWDESTI/"`;
$ret=`mv $BUILDROOT/*.orig.tar.gz "$NEWDESTI/"`;
#$ret=`mv $BUILDROOT/*.debian.tar.xz "$NEWDESTI/"`; # xz file is generated when build/debian/sources/option
#$ret=`mv $BUILDROOT/*.debian.tar.xz "$NEWDESTI/"`; # xz file is generated when build/debian/sources/option
$ret=`mv $BUILDROOT/*.debian.tar.gz "$NEWDESTI/"`;
$ret=`mv $BUILDROOT/*.changes "$NEWDESTI/"`;
next;
}
if ($target eq 'EXEDOLIWAMP')
{
$NEWDESTI=$DESTI;
@@ -1097,22 +1078,22 @@ if ($nboftargetok) {
{
mkdir($DESTI.'/package_windows');
if (-d $DESTI.'/package_windows') { $NEWDESTI=$DESTI.'/package_windows'; }
}
}
print "Remove target $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe...\n";
unlink "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe";
if ($OS eq 'windows') {
print "Check that ISCC.exe is in your PATH.\n";
} else {
print "Check that in your Wine setup, you have created a Z: drive that point to your / directory.\n";
}
$SOURCEBACK=$SOURCE;
$SOURCEBACK =~ s/\//\\/g;
print "Prepare file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\" from \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.iss\"\n";
#$ret=`cat "$SOURCE/build/exe/doliwamp/doliwamp.iss" | sed -e 's/__FILENAMEEXEDOLIWAMP__/$FILENAMEEXEDOLIWAMP/g' > "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`;
open(IN, '<' . $SOURCE."/build/exe/doliwamp/doliwamp.iss") or die $!;
open(OUT, '>' . "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss") or die $!;
@@ -1125,7 +1106,7 @@ if ($nboftargetok) {
close(OUT);
print "Compil exe $FILENAMEEXEDOLIWAMP.exe file from iss file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\" on OS $OS\n";
if ($OS eq 'windows') {
$cmd= "ISCC.exe \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\"";
} else {
@@ -1139,26 +1120,26 @@ if ($nboftargetok) {
print "Move \"$SOURCE\\build\\$FILENAMEEXEDOLIWAMP.exe\" to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n";
rename("$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe","$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe");
print "Move $SOURCE/build/$FILENAMEEXEDOLIWAMP.exe to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n";
use File::Copy;
#$ret=`mv "$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe" "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"`;
$ret=move("$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe", "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe");
print "Remove tmp file $SOURCE/build/exe/doliwamp/doliwamp.tmp.iss\n";
#$ret=`rm "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`;
$ret=unlink("$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss");
next;
}
}
# Publish package for each target
#--------------------------------
foreach my $target (sort keys %CHOOSEDPUBLISH)
foreach my $target (sort keys %CHOOSEDPUBLISH)
{
if ($CHOOSEDPUBLISH{$target} < 0) { next; }
print "\nList of files to publish (BUILD=$BUILD)\n";
%filestoscansf=(
"$DESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml"=>'none', # none means it won't be published on SF
@@ -1181,8 +1162,7 @@ if ($nboftargetok) {
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'package_debian-ubuntu',
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_amd64.changes"=>'package_debian-ubuntu',
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.dsc"=>'package_debian-ubuntu',
#"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.xz"=>'package_debian-ubuntu',
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.gz"=>'package_debian-ubuntu',
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.xz"=>'package_debian-ubuntu',
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'package_debian-ubuntu',
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'package_windows',
"$DESTI/standard/$FILENAMETGZ.tgz"=>'standard',
@@ -1217,26 +1197,26 @@ if ($nboftargetok) {
print "\n";
}
if ($target eq 'SF' || $target eq 'ASSO')
if ($target eq 'SF' || $target eq 'ASSO')
{
print "\n";
if ($target eq 'SF') { $PUBLISH = $PUBLISHSTABLE; }
if ($target eq 'ASSO' && $BUILD =~ /[a-z]/i) { $PUBLISH = $PUBLISHBETARC.'/lastbuild'; }
if ($target eq 'ASSO' && $BUILD =~ /^[0-9]+$/) { $PUBLISH = $PUBLISHBETARC.'/stable'; }
$NEWPUBLISH=$PUBLISH;
print "Publish to target $NEWPUBLISH. Click enter or CTRL+C...\n";
# Ask which target to build
$NUM_SCRIPT=<STDIN>;
$NUM_SCRIPT=<STDIN>;
chomp($NUM_SCRIPT);
print "Create empty dir /tmp/emptydir. We need it to create target dir using rsync.\n";
$ret=`mkdir -p "/tmp/emptydir/"`;
%filestoscan=%filestoscansf;
foreach my $file (sort keys %filestoscan)
{
$found=0;
@@ -1246,30 +1226,30 @@ if ($nboftargetok) {
if ($target eq 'SF') {
if ($filestoscan{$file} eq 'none') {
next;
}
}
$destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD;
}
elsif ($target eq 'ASSO' and $NEWPUBLISH =~ /stable/) {
$destFolder="$NEWPUBLISH/$filestoscanstableasso{$file}";
}
}
elsif ($target eq 'ASSO' and $NEWPUBLISH !~ /stable/) {
$destFolder="$NEWPUBLISH";
}
}
else # No more used
{
$dirnameonly=$file;
$dirnameonly =~ s/.*\/([^\/]+)\/[^\/]+$/$1/;
$dirnameonly =~ s/.*\/([^\/]+)\/[^\/]+$/$1/;
$filenameonly=$file;
$filenameonly =~ s/.*\/[^\/]+\/([^\/])+$/$1/;
$filenameonly =~ s/.*\/[^\/]+\/([^\/])+$/$1/;
$destFolder="$NEWPUBLISH/$dirnameonly";
}
print "\n";
print "Publish file ".$file." to ".$destFolder."\n";
# mkdir
# mkdir
#my $ssh = Net::SSH::Perl->new("frs.sourceforge.net");
#$ssh->login("$user","$pass");
#$ssh->login("$user","$pass");
#use String::ShellQuote qw( shell_quote );
#$ssh->cmd('mkdir '.shell_quote($destFolder).' && exit');
@@ -1278,20 +1258,20 @@ if ($nboftargetok) {
#$sftp->mkdir($destFolder)
#$command="ssh eldy,dolibarr\@frs.sourceforge.net mkdir -p \"$destFolder\"";
#print "$command\n";
#print "$command\n";
#my $ret=`$command 2>&1`;
$command="rsync -s -e 'ssh' --recursive /tmp/emptydir/ \"".$destFolder."\"";
print "$command\n";
print "$command\n";
my $ret=`$command 2>&1`;
$command="rsync -s -e 'ssh' \"$file\" \"".$destFolder."\"";
print "$command\n";
print "$command\n";
my $ret2=`$command 2>&1`;
print "$ret2\n";
}
}
}
}
}
print "\n----- Summary -----\n";

View File

@@ -6,7 +6,7 @@ of Dolibarr. There is a chapter for BETA version and a chapter for RELEASE versi
***** Prerequisites For Linux *****
Prerequisites to build tgz, debian and rpm packages:
> apt-get install perl tar dpkg p7zip-full rpm zip php-cli debhelper po-debconf
> apt-get install perl tar dpkg dpatch p7zip-full rpm zip php-cli
Prerequisites to build autoexe DoliWamp package from Linux (solution seems broken since Ubuntu 20.04):
> apt-get install wine q4wine
@@ -14,11 +14,11 @@ Prerequisites to build autoexe DoliWamp package from Linux (solution seems broke
> Install InnoSetup
For example by running isetup-5.5.8.exe (https://www.jrsoftware.org) https://files.jrsoftware.org/is/5/
> Install WampServer into "C:\wamp64" to have Apache, PHP and MariaDB
For example by running wampserver3.2.6_x64.exe (https://www.wampserver.com).
For example by running wampserver3.2.6_x64.exe (https://www.wampserver.com).
See file build/exe/doliwamp.iss to know the doliwamp version currently setup.
> Add path to ISCC into PATH windows var:
Launch wine cmd, then regedit and add entry int HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment\PATH
> To build manually the .exe from Windows (running from makepack-dolibarr.pl script is however recommanded),
> To build manually the .exe from Windows (running from makepack-dolibarr.pl script is however recommanded),
open file build/exe/doliwamp.iss and click on button "Compile".
The .exe file will be build into directory build.
@@ -31,8 +31,8 @@ Prerequisites to build autoexe DoliWamp package from Windows:
> 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 current version:
git clone https://github.com/dolibarr/dolibarr or git clone --branch X.Y 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.
@@ -43,11 +43,11 @@ Prerequisites to build autoexe DoliWamp package from Windows:
***** Actions to do a BETA *****
This files describe steps made by Dolibarr packaging team to make a
This files describe steps made by Dolibarr packaging team to make a
beta version of Dolibarr, step by step.
- Check all files are commited.
- Update version/info in ChangeLog, for this you can:
- Update version/info in ChangeLog, for this you can:
To generate a changelog of a major new version x.y.0 (from a repo on branch develop), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
To generate a changelog of a major new version x.y.0 (from a repo on branch x.y repo), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
@@ -67,7 +67,7 @@ Recopy the content of the output file into the file ChangeLog.
***** Actions to do a RELEASE *****
This files describe steps made by Dolibarr packaging team to make a
This files describe steps made by Dolibarr packaging team to make a
complete release of Dolibarr, step by step.
- Check all files are commited.
@@ -84,9 +84,9 @@ Recopy the content of the output file into the file ChangeLog.
- Check content of built packages.
- Run makepack-dolibarr.pl again with option to publish files on
- Run makepack-dolibarr.pl again with option to publish files on
dolibarr foundation server (Dir /home/dolibarr/wwwroot/files/stable on www.dolibarr.org).
- Run makepack-dolibarr.pl again with option to publish files on
- Run makepack-dolibarr.pl again with option to publish files on
sourceforge. This will also add official tag.
- Edit symbolic links in directory "/home/dolibarr/wwwroot/files/stable/xxx"
on server to point to new files (used by some web sites).

View File

@@ -6,6 +6,5 @@
// 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';

View File

@@ -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";
$short_options = "c:h";
$long_options = array(
// Load conf file if it is already defined

View File

@@ -3,13 +3,6 @@
.git
.gitignore
.scrutinizer.yml
.travis.yml
.vscode
.idea
.editorconfig
.codeclimate.yml
.pre-commit-config.yaml
.mailmap
Thumbs.db
build/exe
build/html

View File

@@ -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>

View File

@@ -22,9 +22,3 @@ dolibarr*.deb
dolibarr*.zip
cvschangelogbuilder_dolibarr*
dolibarr_install.log
.travis.yml
.vscode
.idea
.editorconfig
.codeclimate.yml
.pre-commit-config.yaml

View File

@@ -24,30 +24,32 @@
"vendor-dir" : "htdocs/includes"
},
"require" : {
"php" : ">=7.1.0",
"php" : ">=5.6.0",
"ext-curl" : "*",
"ckeditor/ckeditor" : "4.12.1",
"mike42/escpos-php" : "3.0",
"mobiledetect/mobiledetectlib" : "2.8.41",
"phpoffice/phpspreadsheet" : ">=1.12",
"mike42/escpos-php" : "2.2",
"mobiledetect/mobiledetectlib" : "2.8.39",
"phpoffice/phpexcel" : "1.8.2",
"restler/framework" : "3.0.0-RC6",
"tecnickcom/tcpdf" : "6.3.2",
"nnnick/chartjs" : "^3.7.1",
"stripe/stripe-php" : "10.7.0",
"maximebf/debugbar" : "1.18.2",
"symfony/var-dumper" : ">=3.2"
"nnnick/chartjs" : "^2.9",
"stripe/stripe-php" : "6.43.1",
"maximebf/debugbar" : "1.15.1",
"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",
"rector/rector" : "^0.16.0"
"phpunit/phpunit-selenium" : "^2"
},
"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)",

View File

@@ -211,7 +211,7 @@ with
* Fix by replacing
if ($res[0] == PDF_TYPE_OBJECT)
with
if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT)
if ($res && $res[0] == PDF_TYPE_OBJECT)

View File

@@ -15,7 +15,7 @@
"npm": ">=5.6.0"
},
"dependencies": {
"zapier-platform-core": "15.0.1"
"zapier-platform-core": "11.3.1"
},
"devDependencies": {
"mocha": "^5.2.0",

View File

@@ -148,8 +148,8 @@ $sqls=array(
"DELETE FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__'",
),
'project'=>array(
// TODO set fk_project to null on all objects/tables that refer to project
"DELETE FROM ".MAIN_DB_PREFIX."element_time WHERE elementtype = 'task' AND fk_element IN (select rowid FROM ".MAIN_DB_PREFIX."projet_task WHERE fk_projet IN (select rowid FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__'))",
// TODO set fk_project to null on object that refer to project
"DELETE FROM ".MAIN_DB_PREFIX."projet_task_time WHERE fk_task IN (select rowid FROM ".MAIN_DB_PREFIX."projet_task WHERE fk_projet IN (select rowid FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__'))",
"DELETE FROM ".MAIN_DB_PREFIX."projet_task WHERE fk_projet IN (select rowid FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__'",
),

28
dev/initdemo/README Normal file
View File

@@ -0,0 +1,28 @@
README
------
Scripts in this directory can be used to reload or save a demo database.
Install of package "dialog" is required.
*** Init demo
The script initdemo.sh will erase current database with data into mysqldump_dolibarr_x.y.z.sql and copy files into documents_demo into officiel document directory.
Do a chmod 700 initdemo.sh
then run ./initdemo.sh to launch Graphic User Interface.
After loading the demo files, admin login may be:
- admin / admin
or
- admin / adminadmin
*** Save demo
The script savedemo.sh will save current database into a database dump file.
*** Update demo
The goal of script updatedemo.php is to update dates into the demo data so samples are up to date.

View File

@@ -1,32 +0,0 @@
README
======
Scripts in this directory can be used to reload or save a demo database.
Install of package "dialog" is required.
Init demo
-------------
The script initdemo.sh will erase current database with data intodev/initdemo/mysqldump_dolibarr_x.y.z.sql and copy files into documents_demo into officiel document directory.
Do a chmod 700 initdemo.sh
then run ./initdemo.sh to launch Graphic User Interface.
After loading the demo files, admin login may be:
- admin / admin
or
- admin / adminadmin
Update demo
-------------
The goal of script dev/initdemo/updatedemo.php is to update dates into the demo data so samples are up to date.
Save demo
-------------
The script dev/initdemo.savedemo.sh will save current database into a database dump file.

View File

@@ -154,11 +154,12 @@ if [ "x${demopasshash}" != "xpassword_hash" ]
then
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
@@ -171,7 +172,6 @@ fi
if [ -s "$mydir/initdemopostsql.sql" ]; then
echo A file initdemopostsql.sql was found, we execute it.
echo "mysql -P$port $base < \"$mydir/initdemopostsql.sql\""
mysql -P$port $base < "$mydir/initdemopostsql.sql"
else
echo No file initdemopostsql.sql found, so no extra sql action done.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -22,7 +22,8 @@ https://www.tecklenborgh.com/post/ksa-zatca-publishes-guide-on-how-to-develop-a-
Method to encode/decode ZATCA string is available in test/phpunit/BarcodeTest.php
* FOR QR-Bill in switzerland - Facture-QR
* FOR QR-Bill in switzerland
----------------------------
Syntax of QR Code - See file ig-qr-bill-v2.2-fr.pdf (more doc on https://www.swiss-qr-invoice.org/downloads/)
Syntax of complentary field named "structured information of invoice S1": https://www.swiss-qr-invoice.org/downloads/qr-bill-s1-syntax-fr.pdf
To test/validate: https://www.swiss-qr-invoice.org/validator/

View File

@@ -10,7 +10,8 @@ Signification des chiffres.
- 1 chiffre pour la somme de controle
Cette regle subit de nombreuses entorses pour ameliorer l'usage des chiffres disponibles.
Voici la liste des codes pays ou systeme, les préfixes qui ne sont pas explicitement mentionnés sont réservés par GS1 :
Voici la liste des codes pays ou systeme :
EN
@@ -24,139 +25,105 @@ Meaning of the numbers:
This rule has been twisted many times to improve the use of the available numbers.
Here is the list of country codes or system, prefixes not explicitly listed are reserved by GS1:
Here is the list of country codes or system:
List (https://www.gs1.org/prefixes)
===================================
List
====
0000000 Flag for internal numbering / Codification interne en magasin
0000101999 GS1 US (U.S.A / États-Unis & Canada)
020-029 Restricted / Restreint
030-039 GS1 US (U.S.A / États-Unis & Canada)
040-049 Flag for internal numbering / Codification interne en magasin
050-059 GS1 US (U.S.A / États-Unis & Canada)
060-139 GS1 US (U.S.A / États-Unis & Canada)
300-379 GS1 France
380 GS1 Bulgaria
383 GS1 Slovenija
385 GS1 Croatia
387 GS1 BIH (Bosnia-Herzegovina)
389 GS1 Montenegro
400-440 GS1 Germany
450-459 GS1 Japan
460-469 GS1 Russia
470 GS1 Kyrgyzstan
471 GS1 Chinese Taipei
474 GS1 Estonia
475 GS1 Latvia
476 GS1 Azerbaijan
477 GS1 Lithuania
478 GS1 Uzbekistan
479 GS1 Sri Lanka
480 GS1 Philippines
481 GS1 Belarus
482 GS1 Ukraine
483 GS1 Turkmenistan
484 GS1 Moldova
485 GS1 Armenia
486 GS1 Georgia
487 GS1 Kazakstan
488 GS1 Tajikistan
489 GS1 Hong Kong, China
490-499 GS1 Japan
500-509 GS1 UK
520-521 GS1 Association Greece
528 GS1 Lebanon
529 GS1 Cyprus
530 GS1 Albania
531 GS1 Macedonia
535 GS1 Malta
539 GS1 Ireland
540-549 GS1 Belgium & Luxembourg
560 GS1 Portugal
569 GS1 Iceland
570-579 GS1 Denmark
590 GS1 Poland
594 GS1 Romania
599 GS1 Hungary
600-601 GS1 South Africa
603 GS1 Ghana
604 GS1 Senegal
607 GS1 Oman
608 GS1 Bahrain
609 GS1 Mauritius
611 GS1 Morocco
613 GS1 Algeria
615 GS1 Nigeria
616 GS1 Kenya
617 GS1 Cameroon
618 GS1 Côte d'Ivoire
619 GS1 Tunisia
620 GS1 Tanzania
621 GS1 Syria
622 GS1 Egypt
624 GS1 Libya
625 GS1 Jordan
626 GS1 Iran
627 GS1 Kuwait
628 GS1 Saudi Arabia
629 GS1 Emirates
630 GS1 Qatar
631 GS1 Namibia
640-649 GS1 Finland
690-699 GS1 China
700-709 GS1 Norway
729 GS1 Israel
730-739 GS1 Sweden
740 GS1 Guatemala
741 GS1 El Salvador
742 GS1 Honduras
743 GS1 Nicaragua
744 GS1 Costa Rica
745 GS1 Panama
746 GS1 Republica Dominicana
750 GS1 Mexico
754-755 GS1 Canada
759 GS1 Venezuela
760-769 GS1 Schweiz, Suisse, Svizzera
770-771 GS1 Colombia
773 GS1 Uruguay
775 GS1 Peru
777 GS1 Bolivia
778-779 GS1 Argentina
780 GS1 Chile
784 GS1 Paraguay
786 GS1 Ecuador
789-790 GS1 Brasil
800-839 GS1 Italy
840-849 GS1 Spain
850 GS1 Cuba
858 GS1 Slovakia
859 GS1 Czech
860 GS1 Serbia
865 GS1 Mongolia
867 GS1 North Korea
868-869 GS1 Türkiye
870-879 GS1 Netherlands
880 GS1 South Korea
883 GS1 Myanmar
884 GS1 Cambodia
885 GS1 Thailand
888 GS1 Singapore
890 GS1 India
893 GS1 Vietnam
896 GS1 Pakistan
899 GS1 Indonesia
900-919 GS1 Austria
930-939 GS1 Australia
940-949 GS1 New Zealand
950 GS1 Global Office
955 GS1 Malaysia
958 GS1 Macao, China
960-969 Global Office - GTIN-8
977 Serial publications / Publications en série (ISSN)
978-979 Bookland / Livres (ISBN)
980 Refund receipts / Remboursements
981-983 GS1 Coupons
99 GS1 Coupons
00 - 13 UCC (U.S.A / États-Unis & Canada)
20 - 29 Flag for internal numbering / Codification interne en magasin
30 - 37 GENCOD-EAN France
380 BCCI (Bulgaria)
383 SANA (Slovenia)
385 CRO-EAN (Croatia)
387 EAN-BIH (Bosnia-Herzegovina)
400-440 CCG (DE/Germany/Allemagne)
45 + 49 Distribution Code Center - DCC (Japan)
460-469 UNISCAN - EAN Russia (Federation de Russie)
471 CAN Taiwan
474 EAN Estonia
475 EAN Latvia
476 EAN Azerbaijan
477 EAN Lithuania
478 EAN Uzbekistan
479 EAN Sri Lanka
480 PANC Philippines
481 EAN Belarus
482 EAN Ukraine
484 EAN Moldova
485 EAN Armenia
486 EAN Georgia
487 EAN Kazakhstan
489 HKANA Hong Kong
50 E Centre UK - United Kingdom
520 HELLCAN-EAN HELLAS - Greece
528 EAN Lebanon
529 EAN Cyprus
531 EAN-MAC (FYR Macedonia)
535 EAN Malta
539 EAN Ireland
54 ICODIF/EAN Belgium & Luxembourg
560 CODIPOR (Portugal)
569 EAN Iceland/Islande
57 EAN Denmark
590 EAN Poland
594 EAN Romania
599 H.A.P.M.H. (Hungary)
600-601 EAN South Africa
609 EAN Mauritius Island
611 EAN Morocco
613 EAN Algeria
619 Tunicode (Tunisia)
621 EAN Syria
622 EAN Egypt
625 EAN Jordan/Jordanie
626 EAN Iran
628 EAN Saudi Arabia
64 EAN Finland
690-693 ANCC - Article Numbering Centre of China
70 EAN Norge (Norvege)
729 Israeli Bar Code Association - EAN Israel
73 EAN Suede
740 EAN Guatemala
741 EAN El Salvador
742 ICCC (Honduras)
743 EAN Nicaragua
744 EAN Costa Rica Panama
746 746 EAN Republique Dominicaine
750 AMECE (Mexique)
759 EAN Venezuela
76 EAN (Schweiz, Suisse, Svizzera)
770 IAC (Colombie)
773 EAN Uruguay
775 APC - EAN Peru (Perou)
777 EAN Bolivie
779 CODIGO - EAN Argentine
780 EAN Chili
784 EAN Paraguay
786 ECOP (Equateur)
789 EAN Bresil
80 - 83 INDICOD (Italy)
84 AECOC (Espagne)
850 Camera de Comercio de la Republica de Cuba (Cuba)
858 EAN Slovaquie
859 EAN Republique Tcheque
860 EAN YU (Yougoslavie)
867 EAN DPR Korea (Coree du Nord)
869 Union of Chambers of Commerce of Turkey (Turquie)
87 EAN Nederland (Hollande)
880 EAN Korea (Coree du Sud)
885 EAN Thailande
888 SANC (Singapour)
890 EAN Inde
893 EAN Vietnam
899 EAN Indonesie
90 - 91 EAN Autriche
93 EAN Australie
94 EAN Nouvelle Zelande
955 Malaysian Article Numbering Council (MANC) - Malaisie
977 Publications sirielles (ISSN)
978 - 979 Livres (ISBN)
980 Refus de remboursement
981 - 982 Coupons (monnaie courante)
99 Coupons

View File

@@ -1,18 +1,16 @@
<VirtualHost *:80>
#php_admin_value sendmail_path "/usr/sbin/sendmail -t -i"
#php_admin_value mail.force_extra_parameters "-f postmaster@mydomain.com"
#php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com"
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com"
php_admin_value open_basedir /tmp/:/home/.../htdocs:/home/.../dolibarr_documents:
# Add this to use a custom apparmor profile when using apache php handler
<IfModule mod_apparmor.c>
AADefaultHatName sellyoursaas-instances
</IfModule>
<IfModule mod_apparmor.c>
AADefaultHatName sellyoursaas-instances
</IfModule>
# The URLs of the web site
ServerName myvirtualalias
ServerAlias myvirtualalias
@@ -24,13 +22,8 @@
AddDefaultCharset UTF-8
# Detect if we are using DoliDroid
#SetEnvIf User-Agent DoliDroid dolidroid
# The directory and permissions for the web site
DocumentRoot "/home/.../htdocs"
<Directory /home/.../htdocs/>
AllowOverride None
Options -Indexes -MultiViews +FollowSymLinks -ExecCGI
@@ -42,47 +35,43 @@
#AuthUserFile /etc/apache2/.htpasswd
#require valid-user
</Directory>
# Leaving /public and /api, /dav, .well_known but also wrappers for document, viewimage and public json/img accessible to everyone
# Leaving /public and /api, /dav, .well_known but also wrappers for document and viewimage accessible to everyone
<Directory /home/admin/wwwroot/dolibarr/htdocs/public/>
AuthType None
Satisfy any
Require all granted
Satisfy any
</Directory>
<Directory /home/admin/wwwroot/dolibarr/htdocs/api/>
AuthType None
Satisfy any
Require all granted
Satisfy any
</Directory>
<Directory /home/admin/wwwroot/dolibarr/htdocs/dav/>
AuthType None
Satisfy any
Require all granted
Satisfy any
</Directory>
<Directory /home/admin/wwwroot/dolibarr/htdocs/.well-known/>
AuthType None
Satisfy any
Require all granted
Satisfy any
</Directory>
<Files ~ "(document\.php|viewimage\.php|\.js\.php|\.json\.php|\.js|\.css\.php|\.css|\.gif|\.png|\.svg|\.woff2|favicon\.ico)$">
AuthType None
Satisfy any
Require all granted
Satisfy any
</Files>
# Log directoves
ErrorLog /var/log/apache2/myvirtualalias_error_log
TransferLog /var/log/apache2/myvirtualalias_access_log
# Compress is done on resources of type php pages, text file export, css and javascript
# Compress returned resources of type php pages, text file export, css and javascript
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
AddType text/javascript .jgz
AddEncoding gzip .jgz
# Add cach performance directives
ExpiresActive On
ExpiresByType image/x-icon A2592000
ExpiresByType image/gif A2592000
@@ -93,20 +82,19 @@
ExpiresByType application/x-javascript A2592000
ExpiresByType application/javascript A2592000
SSLEngine On
# To enable the SSL if the certificate file exists
<IfFile "/etc/letsencrypt/live/www.mydomain.com/cert.pem">
SSLEngine On
# If both key and certificate are stored in the same file, only the
# SSLCertificateFile directive is needed.
SSLCertificateFile /etc/letsencrypt/live/www.mydomain.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.mydomain.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/www.mydomain.com/chain.pem
#RewriteEngine on
#RewriteCond %{SERVER_PORT} ^80$
#RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]
</IfFile>
# A self-signed (snakeoil) certificate can be created by installing
# the ssl-cert package. See
# /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
# If both key and certificate are stored in the same file, only the
# SSLCertificateFile directive is needed.
#SSLCertificateFile /etc/letsencrypt/live/www.mydomain.com/cert.pem
#SSLCertificateKeyFile /etc/letsencrypt/live/www.mydomain.com/privkey.pem
#SSLCertificateChainFile /etc/letsencrypt/live/www.mydomain.com/chain.pem
#RewriteEngine on
#RewriteCond %{SERVER_PORT} ^80$
#RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]
</VirtualHost>

View File

@@ -15,5 +15,5 @@
# To test rule file on a existing log file
# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-rulesbruteforce.conf
failregex = ^ [A-Z\s]+ <HOST>\s+functions_.*::check_user_.* Authentication KO
failregex = ^ [A-Z\s]+ <HOST>\s+functions_dolibarr::check_user_password_.* Authentication KO
ignoreregex =

View File

@@ -2,35 +2,6 @@
# 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
@@ -44,10 +15,22 @@ 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, ...
enabled = true
port = http,https
filter = web-dolibarr-limitpublic
@@ -55,5 +38,5 @@ logpath = /mypath/documents/documents/dolibarr.log
action = %(action_mw)s
bantime = 86400 ; 1 day
findtime = 86400 ; 1 day
maxretry = 1000
maxretry = 500

View File

@@ -45,11 +45,12 @@ 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 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
# 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
result2=$?
@@ -59,9 +60,7 @@ 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

View File

@@ -1,14 +0,0 @@
QODANA TUTO
-----------
This README explains how to use qodana to generate static analytics reports on the code
Install docker
Install qodana
To run inspection on CLI
cd ~/git/dirtoscan
sudo qodana scan --show-report

View File

@@ -1,18 +1,13 @@
'capture' => true, // Charge immediatly
// Save a stripe payment was done in realy life so later we will be able to force a commit on recorded payments
$pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
// Conversion du PDF en image png si fichier png non existant
// Save a stripe payment was done in realy life so later we will be able to force a commit on recorded payments
// To make a Stripe SEPA payment request, we must have the payment mode source already saved into societe_rib and retreived with ->sepaStripe
//break; // No break for sortfield and sortorder so we can cumulate fields (is it realy usefull ?)
$errmsg = 'Failed to retreive paymentintent or charge from id';
$minifile = getImageFileNameForSize($fileinfo['basename'], '_mini'); // For new thumbs using same ext (in lower case howerver) than original
$more .= '<div clas="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '">&nbsp;</div>';
$more .= '<div clas="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'">&nbsp;</div>';
$this->errors[] = "Error on updateing fk_prelevement_bons to ".$bon->id;
// Defaut
// Table of entities for export / Tableau des entites a exporter (cle=champ, valeur=entite)
// Table of entities requiring DISTINCT abandonment / Tableau des entites qui requiert abandon du DISTINCT (cle=entite, valeur=champ id child records)
// Table of fields to be filtered / Tableau des champs a filtrer (cle=champ, valeur1=type de donnees) on verifie que le module a des filtres
// Tableau des entites qui requiert abandon du DISTINCT (cle=entite, valeur=champ id child records)
console.log("We hide childs tickets of '.$groupcodefather.' group ticket")
@@ -34,7 +29,6 @@
// On retire les espaces autour des = et parenthèses
// remove invalid value, as it didnt match anything
// we dont use the rank from orderline because we may have lines from several orders
dol_syslog("makeStripeSepaRequest get stripe connet account", LOG_DEBUG);
print '<input type="hidden" class="amount" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">'; // class is requied to be used by javascript callForResult();
print 'jQuery("select[name=\''.$paramkey.'\']").focus();'."\n"; // Not really usefull, but we keep it in case of.
$filles[$obj->fk_categorie_fille] = 1; // Set record for this child
@@ -55,7 +49,6 @@
'type'=>$fille->type,
/* Force to recompute the width of a select2 field when it was hidden and then shown programatically */
// Batch number managment
// Detailed virtual stock, looks bugged, uncomplete and need heavy load.
// Example for remplacement
// If error is more than 10 times the accurancy of rounding. This should not happen.
// If margin is calculated on Cost price, we set it by defaut (but only if value is not 0)
@@ -105,7 +98,6 @@
// Information if theres a rule restriction
// Jump on next occurence
// Label mouvement
// Login is successfull with this method
// Lot/serie
// Message-ID=A, In-Reply-To=B, References=B and message can BE an answer or NOT (a transfer rewriten)
// Not a recongized record
@@ -130,7 +122,6 @@
console.log("objectline_create.tpl Load desciption into text area : "+proddesc);
continue; // The field was not submited to be saved
dol_syslog("Entity was not set on http header with HTTP_DOLAPIENTITY (recommanded for performance purpose), so we switch now on entity of user (".$conf->entity.") and we have to reload configuration.", LOG_WARNING);
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ok - found old pass in database", LOG_WARNING);
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ok - found pass in database");
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ok - hash ".$cryptType." of pass is ok");
dol_syslog('We found unconsistent data into detailed line (diff_on_current_total = '.$diff_on_current_total.') for line rowid = '.$obj->rowid." (ht=".$obj->total_ht." vat=".$obj->total_tva." tax1=".$obj->total_localtax1." tax2=".$obj->total_localtax2." ttc=".$obj->total_ttc."). We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix, LOG_WARNING);
@@ -143,7 +134,6 @@
setEventMessage("actions.lib::show_actions_messaging Error fetch ressource", 'errors');
setEventMessage("company.lib::show_actions_done Error fetch ressource", 'errors');
} else { // We decrease agressiveness of reference color for color 3, 5, 7, ..
$_SESSION["dol_loginmesg"] = "Failed to login using Google. OAuth callback URL retreives a token with non valid data";
$alreadygrabbed[$urltograbbis] = 1; // Track that file was alreay grabbed.
$childrens = $this->getChildrenOfLine($row[0]);
$cluser = new User($this->db);
@@ -153,7 +143,6 @@
$heigth = $tmp[3];
$info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte
$optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"';
$optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"';
$outprice_ht = price($objp->price); // formated for langage user because is inserted into input field
$outprice_ttc = price($objp->price_ttc); // formated for langage user because is inserted into input field
@@ -198,7 +187,6 @@
// Strip off the beggining '<'
// TODO If not defined, use $objectobj->model_pdf (or defaut invoice config) to know what is template to use to regenerate doc.
// TODO Replace this with a checkbox for each payment mode: "Send request to PaymentModeManager immediatly..."
// TODO Replace this with a checkbox for each payment mode: "Send request to XXX immediatly..."
// TODO Show vat amout per tax level
// The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object
// This member is linked with a thirdparty, so we also update thirdparty informations
@@ -221,8 +209,6 @@
//No diff => mean everythings is shipped
<p class="content">Nam elementum nisl et mi a commodo porttitor. Morbi sit amet nisl eu arcu faucibus hendrerit vel a risus. Nam a orci mi, elementum ac arcu sit amet, fermentum pellentesque et purus. Integer maximus varius lorem, sed convallis diam accumsan sed. Etiam porttitor placerat sapien, sed eleifend a enim pulvinar faucibus semper quis ut arcu. Ut non nisl a mollis est efficitur vestibulum. Integer eget purus nec nulla mattis et accumsan ut magna libero. Morbi auctor iaculis porttitor. Sed ut magna ac risus et hendrerit scelerisque. Praesent eleifend lacus in lectus aliquam porta. Cras eu ornare dui curabitur lacinia.</p>
GETPOST("mouvement", 'int'),
console.log("Clik on #topmenulogincompanyinfo-btn");
console.log("Clik on #topmenuloginmoreinfo-btn");
console.log("Clik on topmenulogincompanyinfo-btn");
console.log("Clik on topmenuloginmoreinfo-btn");
console.log("chartofaccounts seleted = "+$("#chartofaccounts").val());
@@ -237,7 +223,6 @@
if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) { // Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close ?
if (count($diff_array) == 0 && count($keysinwishednotindelivered) == 0 && count($keysindeliverednotinwished) == 0) { //No diff => mean everythings is received
if (empty($conf->global->PROJECT_DISABLE_UNLINK_FROM_OVERVIEW) || $user->admin) { // PROJECT_DISABLE_UNLINK_FROM_OVERVIEW is empty by defaut, so this test true
if (isModEnabled("supplier_order") && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) { // Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close ?
if (isModEnabled('facture') && !empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) { // Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close ?
if (isNaN(pbq)) { console.log("We use experimental option PRODUIT_CUSTOMER_PRICES_BY_QTY or PRODUIT_CUSTOMER_PRICES_BY_QTY but we could not get the id of pbq from product combo list, so load of price may be 0 if product has differet prices"); }
jQuery("#mouvement option").removeAttr("selected").change();
@@ -263,9 +248,7 @@
$newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $showmode, '', 'project', 'list');
$newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : '').'&search_status=99', $langs->trans("List"), 1, $showmode, '', 'project', 'list');
$object->actionmsg = dol_concatdesc($object->actionmsg, "\n".$langs->transnoentities("AttachedFiles").': '.$attachs);
$paramfortooltipimg .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribut to put on img tag to store tooltip
$paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribut to put on img tag to store tooltip
$paramfortooltiptd .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribut to put on td tag to store tooltip
$paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribut to put on td tag to store tooltip
$showfield = 1; // Par defaut
$tagdatabase = true; // We don't know what it was before, so now we consider we are version choosed.
@@ -291,7 +274,6 @@
// Add field of attribut
// Ajout de l'utilisateur dans le groupe
// Batch number managment
// By default, electronic transfert from bank to bank
// Calculcate number of days consumed
// Complete object by loading several other informations
// Default and recommended: New method using ajax without submiting a page making a javascript history.go(-1) back
@@ -306,7 +288,6 @@
// Fix Get multicurrency param for transmited
// Fonctions de conversion non presente dans ce PHP
// Get lines of sources alread delivered
// Get next free nuber for the ref of bon
// If create form is coming from same page, it means that post was sent but an error occured
// If not abandonned
// If option "one bill per third" is set, and an invoice for this thirdparty was already created, we re-use it.
@@ -367,8 +348,6 @@
GETPOST("mouvement", 'int'),
console.log("Capture paymentIntent successfull "+paymentIntentId);
continue; // The field was not submited to be saved
dol_syslog("The user login has a validity between [".$user->datestartvalidity." and ".$user->dateendvalidity."], curren date is ".dol_now());
dol_syslog("functions_isallowed::check_user_api_key Authentication KO for '".$login."': The user login has a validity between [".$fuser->datestartvalidity." and ".$fuser->dateendvalidity."], curren date is ".dol_now());
dol_syslog('Bad password, connexion refused', LOG_DEBUG);
dol_syslog('Bad value for code, connexion refused');
dol_syslog('Call fetch_barcode with barcode_type not defined and cant be guessed', LOG_WARNING);
@@ -376,7 +355,6 @@
foreach ($legends as $val) { // Loop on each serie
fwrite($handle, "\n-- WARNING: Show create table ".$table." return empy string when it should not.\n");
if ($ex) { // are we expecting an operator but have a number/variable/function/opening parethesis?
if ($forcedroundingmode == '1') { // Check if we need adjustement onto line for vat. TODO This works on the company currency but not on foreign currency
if ($forcedroundingmode == '1') { // Check if we need adjustement onto line for vat. TODO This works on the company currency but not on multicurrency
if (isModEnabled('facture') && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) { // Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close ?
if (isModEnabled('facture') && !empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) { // Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close ?
@@ -416,12 +394,9 @@
$jsListType .= (!empty($jsListType) ? ',' : '').'"'.$type.'":"'.$curent.'"';
$level = 0; // if $level = -1, we dont' use sublevel recursion, we show all lines
$line->pa_ht = $line->pa_ht; // we choosed to have buy/cost price always positive, so no revert of sign here
$msgishtml = -1; // Unknow = autodetect by default
$msgishtml = -1; // Unknow by default
$paht_ret = $paht;
$paramfortooltipimg = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribut to put on td text tag
$paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribut to put on td text tag
$paramfortooltiptd = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribut to put on td text tag
$paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribut to put on td text tag
$pdf->MultiCell($this->posxdiscount - $this->posxunit, 2, $outputlangs->transnoentities("Label Mouvement"), '', 'C');
$pdf->SetXY($this->getColumnContentXStart($colKey), $curY); // Set curent position
@@ -469,10 +444,8 @@
// 2 - Suppression des utilisateurs du groupe Dolibarr qui ne sont plus dans le groupe LDAP
// A redirect is added if API call successfull
// Action according to choosed sending method
// Add entry into bank accoun
// Add personnal information
// Adding <b> may convert the original string into a HTML string. Sowe have to first
// Adding a RSS feed into a sitemap should nto be required. The RSS contains pages that are already included into
// Amount payed
// Atom support many links per containging element.
// Aucun model par defaut.
@@ -500,7 +473,6 @@
// Gestion des utilisateurs associés au groupe
// Groupes
// If a bank account is prodived and we ask to use it as creditor, we use the bank address
// If googleoauth_login has been set (by google_oauthcallback after a successfull OAUTH2 request on openid scope
// If not abandonned
// If stock decrease is on invoice validation, the theorical stock continue to
// If there is a nown BOM, we force the type of MO to the type of BOM
@@ -515,7 +487,6 @@
// Note: We accept disabled account as parent account so we can build a hierarchy and use only childs
// Note: We are here only if $conf->global->MAIN_AGENDA_ACTIONAUTO_action is on (tested at begining of this function).
// Nouveau système du comon object renvoi des rowid et non un id linéaire de 1 à n
// On create mode, force separator group to not be collapsable
// On nettoie le header pour qu'il ne se termine pas par un retour chariot.
// On parcourt donc une liste d'objets en tant qu'objet unique
// On selectionne les users qui ne sont pas deja dans le groupe
@@ -541,8 +512,6 @@
// Succes
// TODO : revoir la gestion des groupes (ou script de sync groupes)
// TODO A virer quand sera gere par l'appelant
// TODO Add a link "Show more..." for all ohter informations.
// TODO Use a cahe on user
// TODO We can't, we dont' have full path of file, only last_main_doc and ->element, so we must first rebuild full path $destfull
// TODO We show localtax from $object, but this properties may not be correct. Only value $object->default_vat_code is guaranted.
// TODO mettre dans une classe propre au pays
@@ -557,7 +526,6 @@
// We must filter on assignement table
// We need to keep the 10 lastest number of invoice doc_ref not the beginning part that is the unusefull almost same part
// We use invoice date $data->doc_date not $date_ecriture which is the transfert date
// We use invoice date $line->doc_date not $date_ecriture which is the transfert date
// add substition variable for ticket
// add variables subtitutions ticket
// count the orders to ship in theorical stock when some are already removed by invoice validation.
@@ -581,9 +549,7 @@
//Origin project strat date
//Stock mouvement
//We use invoice date $data->doc_date not $date_ecriture which is the transfert date
//We use invoice date $line->doc_date not $date_ecriture which is the transfert date
//XXX: Should be done just befor commit no ?
//but the note is saved, so just add a notification will be enought
//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
//print "connexion de type=".$conf->db->type." sur host=".$conf->db->host." port=".$conf->db->port." user=".$conf->db->user." name=".$conf->db->name;
//si le sujet n'est pas celui qui a été effacé alors on concatene
@@ -595,7 +561,6 @@
dol_syslog("Failed to read image using Imagick (Try to install package 'apt-get install php-imagick ghostscript' and check there is no policy to disable ".$ext." convertion in /etc/ImageMagick*/policy.xml): ".$e->getMessage(), LOG_WARNING);
dol_syslog("Fichier invalide",LOG_WARNING);
dol_syslog("RejetPrelevement::_send_email Userid invalide");
dol_syslog('User not found or not valid, connexion refused');
dol_syslog('User not found, connexion refused');
dol_syslog(get_class($this) . "::validate action abandonned: already validated", LOG_WARNING);
dol_syslog(get_class($this). '::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined', LOG_ERR);
@@ -620,7 +585,6 @@
dol_syslog(get_class($this)."::setNextDate was called on objet with property table_element not defined", LOG_ERR);
dol_syslog(get_class($this)."::setProject was called on objet with property table_element not defined", LOG_ERR);
dol_syslog(get_class($this)."::setShippingMethod was called on objet with property table_element not defined", LOG_ERR);
dol_syslog(get_class($this)."::setVATReverseCharge was called on objet with property table_element not defined", LOG_ERR);
dol_syslog(get_class($this)."::setWarehouse was called on objet with property table_element not defined", LOG_ERR);
dol_syslog(get_class($this)."::updateAttribute successfull", LOG_DEBUG);
dol_syslog(get_class($this)."::update_note was called on objet with property table_element not defined", LOG_ERR);
@@ -655,8 +619,6 @@
return -1; // Alternate souce not found
return false; // Sould be 6
return false; // Sould be 6 but can be 123-456
setEventMessage('The element '.$element.' is not supported for uploading file. dir_output is unknow.', 'errors');
throw new Exception('The element '.$element.' is not supported for uploading file. dir_output is unknow.');
throw new RestException(403, 'Forbidden. This parameter cant be read with APIs');
while ($i < $nblot) { // Loop on each serie
|| empty($fk_price_level) // if fetch an unique level dont erase all already fetched
@@ -718,7 +680,6 @@
$rouge = hexdec(substr($color, 0, 2)); //conversion du canal rouge
$serie = array();
$showfield = 1; // By defaut
$sql .= " AND (p.last_check_backlink IS NULL OR p.last_check_backlink <= '".$this->db->idate($now - 24 * 3600)."')"; // Never more than 1 check every day to check that website contains a referal link.
$sql .= " AND ff.fk_statut IS NULL"; // Renvoi vrai si pas facture de remplacement
$sql .= " AND ff.type IS NULL"; // Renvoi vrai si pas facture de remplacement
$sql .= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes
@@ -744,8 +705,6 @@
$this->assertEquals('a : b " c \' d \' e é', $decodedstring, 'Function did not sanitize correclty');
$this->assertEquals('afile', $result);
$this->assertEquals('e&eacute;e', $decodedstring, 'Function did not sanitize correclty with test 1');
$this->assertEquals('text text', $decodedstring, 'Function did not sanitize correclty with test 4a');
$this->assertEquals('text <link href="aaa"> text', $decodedstring, 'Function did not sanitize correclty with test 4b');
$this->assertTrue($result, 'move of directory with directory whitout rename needed in directory');
$this->assertTrue($result, 'move of directory with file whitout rename needed in directory');
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/stocks/mouvements";
@@ -768,7 +727,6 @@
$this->rights[4][3] = 0; // La permission est-elle une permission par defaut
$this->signature_line = dol_hash($keyforsignature, '5'); // Not really usefull
$this->tva_intra = empty($conf->global->MAIN_INFO_TVAINTRA) ? '' : $conf->global->MAIN_INFO_TVAINTRA; // VAT number, not necessarly INTRA.
$this->tva_intra = getDolGlobalString('MAIN_INFO_TVAINTRA'); // VAT number, not necessarly INTRA.
$valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
'filles' => array('name'=>'filles', 'type'=>'tns:FillesArray')
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Paid', 3=>'Abandonned')),
@@ -786,7 +744,6 @@
// 'member' to add a tab in fundation member view
// - If not set, we accept ot have amount defined as parameter (for backward compatibility).
// Action according to choosed sending method
// Add a where here keeping only the citeria on $tabletouse
// Add code to open url using the popup. Add also hidden field to retreive the returned variables
// Add infor from $object->xxx where xxx has been loaded by fetch_origin() of shipment
// Add the count of record only for the main/first level object. Parents are necessarly unique for each record.
@@ -800,10 +757,8 @@
// Chargement librairie pour acces fonction controle RIB
// Check if field was submited to be edited
// Check paramaters
// Check that the redirect_uri that wil be used is same than url of current domain
// Classif "paid partialy"
// Clean paramater $typeofdata
// Clear all fields out of interrest
// Concatenation des differents codes.
// Confirm cancelation
// Confirm deleteion
@@ -812,7 +767,6 @@
// Create with status validated immediatly
// Creation de la classe d'import du model Import_XXX
// Creation objet
// Date delivery planed
// Delivery date planed
// Dependancies
// Don't log Luracast Restler Explorer recources calls
@@ -842,7 +796,6 @@
// Keep the orginal
// Limite acces si droits non corrects
// Links beetween objects are stored in this table
// Load extrafields if not allready done
// Load extrafiels if not allready does
// Log the init of hook but only for hooks thare are declared to be managed
// Loop on each line keword was found into file.
@@ -890,7 +843,6 @@
// Syntaxe ko
// Syntaxe ok
// TODO Check the lineid $lineid is a line of ojbect
// TODO Remove hooks with type 'output' (exemple createFrom). All hooks must be converted into 'addreplace' hooks.
// TODO Remove hooks with type 'output' (exemple getNomUrl). All hooks must be converted into 'addreplace' hooks.
// Tableau des parametres complementaires du post
// Test with restricthtml + MAIN_RESTRICTHTML_ONLY_VALID_HTML to test disabling of bad atrributes
@@ -909,11 +861,9 @@
// We start scan from the not before so if two tabs were opend at differents seconds and we close one (so the js timer),
// Wrapping pour les projets
// accomodate both SMTP AND ESMTP capable servers
// add menu manualy
// additionnal list with adherents of company
// admin login no exectued.
// attemp to create without mandatory fields :
// delete menu manuelly
// for js desabled compatibility set $url as call to confirm action and $params['confirm']['url'] to confirmed action
// groupe
// if "frequency" is empty or = 0, the reccurence is disabled
@@ -922,7 +872,6 @@
// l'adherent n'est pas public par defaut
// need to be ignored from scrutinizer setTypeFromTypeString was created as deprecated to incite developper to use object oriented usage
// on verifie si l'objet est en numerotation provisoire
// parcourir les objets
// personnal stocks are not tagged into table llx_entrepot
// reload page to retrieve customer informations
// reload page to retrieve supplier informations
@@ -935,7 +884,6 @@
//Add hook to filter on user (for exemple on usergroup define in custom modules)
//If dispach process running we add the number of item to dispatch into the head
//If invoice has been converted and the conversion has been used, we dont have remain to pay on invoice
//If no task avaiblable, redirec to to add confirm
//In some case $object is not instanciate (for paiement on custom object) We need to deal with payment
//Iterate over each expression splitted by $separator_chr
//Label mouvement
@@ -943,18 +891,14 @@
//We should use dol_now function not time however this is wrong date to transfert in accounting
//check if tag type submited exists into Tag Map categorie class
//decoding the respose
//fetch informations needs on this mode
//http_response_code(500); // If we use 500, message is not ouput with some command line tools
//postion of Key
//prevents agains infinite loop when we can't create root folder
//print "L'EAN se compose de 8 caracteres, 7 chiffres plus une cle de controle.<br>";
//print $rouge.$vert.$bleu;
//sinon on remplace les choix de l'utilisateur par une ligne de checkbox pour recuperer de nouvelles valeurs
//sinon on remplace les choix de l'utilisateur par une ligne de checkbox pour saisie
//var_dump($serie);
console.log("Cancel check_events() with dolnotif_nb_test_for_page="+dolnotif_nb_test_for_page+". Check is useless because javascript Notification.permission is "+Notification.permission+" (blocked manualy or web site is not https).");
console.log("Change montly amount echeance="+echeance+" idcap="+idcap+" capital="+capital);
dol_syslog("The user login has a validity between [".$user->datestartvalidity." and ".$user->dateendvalidity."], curren date is ".dol_now());
dol_syslog("Warning: Function form_constantes is calle with parameter strictw3c = 0, this is deprecated. Value must be 2 now.", LOG_DEBUG);
dol_syslog(get_class($this)."::getCustomerAccount Try to find the first system customer id for ".$site." of thirdparty id=".$id." (exemple: cus_.... for stripe)", LOG_DEBUG);
dol_syslog(get_class($this)."::setCategoriesCommon Oject Id:".$this->id.' type_categ:'.$type_categ.' nb tag add:'.count($categories), LOG_DEBUG);
@@ -962,12 +906,10 @@
foreach ($arrayofcriterias as $criterias) {
foreach ($parent as $key => $value) { // key=label, value is array of childs
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id); // To avoid pb whith back
http_response_code(202); // If we use 202, this is not really an error message, but this allow to ouput message on command line tools
if (!$login || (in_array('ldap', $authmode) && empty($passwordtotest))) { // With LDAP we refused empty password because some LDAP are "opened" for anonymous access so connexion is a success.
if (!empty($this->phone)) { // If a phone of thirdparty is defined, we add it ot mobile of contacts
if (!is_array($this->userassigned) && !empty($this->userassigned)) { // For backward compatibility when userassigned was an int instead fo array
if ($lines[$i]->fk_parent == $parent || $level < 0) { // if $level = -1, we dont' use sublevel recursion, we show all lines
if ($lines[$i]->fk_task_parent == $parent || $level < 0) { // if $level = -1, we dont' use sublevel recursion, we show all lines
if ($user->hasRight('stock', 'mouvement', 'creer')) {
if (GETPOST('import_name')) { // If we have submited a form, we take value used fot the update try
if (dol_strlen($phone) == 10) {// fixe 6 chiffres +352_AA_BB_CC
@@ -998,7 +940,6 @@
} else // We decrease agressiveness
} else { // If thirdparty unkown, output the waiting account
} else { // old method. deprecated because ot can't retrieve type
} elseif (!empty($this->childtables)) { // If object has childs linked with a foreign key field, we check all child tables.
} elseif (!empty($this->fk_element) && !empty($this->childtables)) { // If object has childs linked with a foreign key field, we check all child tables.
} elseif (dol_strlen($phone) == 11) {// fixe 7 chiffres +352_AA_BB_CC_D
} elseif (dol_strlen($phone) == 12) {// fixe 8 chiffres +352_AA_BB_CC_DD
@@ -1044,7 +985,6 @@
* @param int $id Id du paiement dont il faut afficher les infos
* @param mixed $gm 'gmt'=Input informations are GMT values, 'tzserver'=Local to server TZ
* @param string $method method of transmision to bank
* @param string $method method of transmision to bank (0=Internet, 1=Api...)
* @param string $dolibarr_main_db_pass Mot de passe user a creer
* @param string $field_desc Tableau associatif de description du champ a inserer[nom du parametre][valeur du parametre]
* @param string $resko resultat si test non egal
@@ -1108,7 +1048,6 @@
* @return resource|int 1 if cancelation is ok or transaction not open, 0 if error
* Charge les informations d'ordre info dans l'objet entrepot
* Class line Contructor
* Load the array of extrafields defintion $this->attributes
* Renvoi la description par defaut du modele de numerotation
* Return list of all child users id in herarchy (all sublevels).
* Total of the VAT payed
@@ -1120,12 +1059,7 @@
* Sinon la TVA proposee par defaut=0. Fin de regle.
* Si vendeur non assujeti a TVA, TVA par defaut=0. Fin de regle.
* - string (categories ids seprated by comma)
* - string (categories ids seprated by comma)
* All types can also return some values into an array ->results that will be finaly merged into this->resArray for caller.
* Si (vendeur et acheteur dans Communaute europeenne) et bien vendu = moyen de transports neuf (auto, bateau, avion), TVA par defaut=0 (La TVA doit etre paye par l'acheteur au centre d'impots de son pays et non au vendeur). Fin de regle.
* Si le (pays vendeur = pays acheteur) alors la TVA par defaut=TVA du produit vendu. Fin de regle.
* Si vendeur non assujeti a TVA, TVA par defaut=0. Fin de regle.
* Sinon la TVA proposee par defaut=0. Fin de regle.
* fulllabel = nom avec chemin complet de la categorie
* fullpath = chemin complet compose des id
* @param User $user Objet user
@@ -1134,7 +1068,6 @@
* @param User $user Objet user
* @param User $user Objet user making change
* @param User $user Objet user
* @param User $user Objet user
* @param string $vatrate VAT rate (may contain the vat code too). Exemple: '1.23', '1.23 (ABC)', ...
* Build the conditionnal string from filter the query
* Charge indicateurs this->nb de tableau de bord
@@ -1157,7 +1090,6 @@
* Renvoi si un compte peut etre supprimer ou non (sans mouvements)
* Retourne la liste deroulante des differents etats d'une note de frais.
* Retourne la liste deroulante des formes juridiques tous pays confondus ou pour un pays donne.
* Return HTML to show the search and clear seach button
* Return combo list of differents status of a proposal
* Return incoterms informations
* Return incoterms informations for pdf display
@@ -1177,7 +1109,6 @@
* @param string $criteria Use %% as magic caracters. For exemple to find all item like <b>jean, joe, jim</b>, you can input <b>j%%</b>, you can also use ; as separator for value,
* @param string $filter SQL filter on users. This parameter must not come from user intput.
* @param string $pass Mot de passe
* @param int $disablecrop Disable crop feature on images (-1 = auto, prefer to set it explicitely to 0 or 1)
* @param int $disablecrop Disable crop feature on images (-1 = auto, prefer to set it explicitely to 0 or 1)
* @param DoliDB $db Handler acces base
* @param Product $product Objet product
@@ -1193,7 +1124,6 @@
* @param array $restrictlinksto Restrict links to some elements, for exemple array('order') or array('supplier_order'). null or array() if no restriction.
* @param array $arrayofrecords Array of record informations (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>)
* @param bool $multiple add [] in the name of element and add 'multiple' attribut
* @param float $curY curent Y position
* @param float $curY curent Y position
* @param int $fk_product_stock id product_stock for objet
* @param int $fk_product_stock id product_stock for objet
@@ -1218,7 +1148,6 @@
* @param User $user Objet utilisateur qui met a jour le don
* @param User $user Objet du user qui cree
* @param User $user Objet user
* @param array $params array of additionals parameters
* @param int $info_bits Miscellaneous informations on line
* @param int $socid Id third pary
* @param Translate $outputlangs objet lang a utiliser pour traduction
@@ -1260,14 +1189,12 @@
* Fonction qui dit si cet utilisateur est un redacteur existant dans spip
* Function to build PDF on disk, then output on HTTP strem.
* Les parametres sont deja cense etre juste et avec valeurs finales a l'appel
* Mise a jour de l'objet ligne de commande en base
* Mise a jour en base de la date de derniere connexion d'un utilisateur
* On compare juste manuellement si la database choisie est bien celle activee par la connexion
* Renvoi la description par defaut du modele de numerotation
* Renvoi si un code est pris ou non (par autre tiers)
* Renvoi si un code respecte la syntaxe
* Retourne la version traduite du texte passe en parametre complete du code pays
* Retrieve informations about internal contacts
* Return a HTML link to the user card (with optionaly the picto)
* Return a link (with optionaly the picto)
* Return a link to the a lot card (with optionaly the picto)
@@ -1321,19 +1248,13 @@
* @param Object $objecttmp Object to knwo the table to scan for combo.
* @param User $user User wich display
* @param array $type Array with type for each serie. Example: array('type1', 'type2', ...) where type can be:
* @param array $excludelinksto Do not show links of this type, for exemple array('order') or array('supplier_order'). null or array() if no exclusion.
* @param array $restrictlinksto Restrict links to some elements, for exemple array('order') or array('supplier_order'). null or array() if no restriction.
* @param array $arrayofcriterias Array of available search criterias. Example: array($object->element => $object->fields, 'otherfamily' => otherarrayoffields, ...)
* @param array $search_component_params Array of selected search criterias
* @param int $no_email 1=Do not send mailing, 0=Ok to recieve mailling
* @param object $line_ext Objet with full information of line. $line_ext->detail_batch must be an array of ExpeditionLineBatch
* @param string $uploaded_file Uploade file
* @param string $label Label (Example: 'Leave', 'Manual update', 'Leave request cancelation'...)
* @param string $uploaded_file Uploade file
* @param string $head Optionnal head lines
* @param string $elemtype Type of element we show ('category', ...). Will execute a formating function on it. To use in readonly mode if js component support HTML formatting.
* @param string $type_categ Category type ('customer', 'supplier', 'website_page', ...) definied into const class Categorie type
* @param string $search_component_params_hidden String with $search_component_params criterias
* @param User $user Objet User who close contract
* @param int $rowid Id of third party to load (Use 0 to get a specimen record, use null to use other search criterias)
* @param string $dolibarr_main_db_pass Mot de passe user a creer
@@ -1345,9 +1266,7 @@
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @param int $fk_socpeople Id of thirdparty contact (if source = 'external') or id of user (if souce = 'internal') to link
* @param int $default_font_size default siez of font
* @param int $id id du paiement dont il faut afficher les infos
* @param string $alias String of alias of table for fields. For example 't'. It is recommended to use '' and set alias into fields defintion.
* @param string $alias String of alias of table for fields. For example 't'. It is recommended to use '' and set alias into fields defintion.
* @param string $ref Reference of object (This will define subdir automatically and store submited file into it)
* @param string $resko resultat si test non egal
* @param string $resok resultat si test egal
@@ -1358,30 +1277,19 @@
* @param string $extrafieldsobjectkey The key to use to store retreived data (for example $object->table_element)
* @param string $moreparam To add more parametes on html input tag
* @param string $moreparam To add more parametes on html input tag
* @param Object $objecttmp Object to knwo the table to scan for combo.
* @param Translate $outputlangs objet lang a utiliser pour traduction
* @param array $dict Array of dictionnary for translation
* @param array $array_receiver Array of receiver. exemple array('name' => 'John Doe', 'email' => 'john@doe.com', etc...)
* @param bool $multiple add [] in the name of element and add 'multiple' attribut
* @param bool $multiple add [] in the name of element and add 'multiple' attribut
* @param bool $multiple add [] in the name of element and add 'multiple' attribut (not working with ajax_autocompleter)
* @param bool $multiple add [] in the name of element and add 'multiple' attribut
* @param bool $multiple add [] in the name of element and add 'multiple' attribut (not working with ajax_autocompleter)
* @param int $mode O for create, R for regenerate (Look always 0 ment toujours 0 within the framework of XML exchanges according to documentation)
* @param int $socid Id ot third party or 0 for all or -1 for empty list
* @param int $socid Id ot third party or 0 for all
* @param int $i Rank from which we want to create skilldets (level $i to HRM_MAXRANK wil be created)
* @param int $month Specifig month - Can be empty
* @param int $year Specifig year - Can be empty
* @param int $_type Interger value representing Mail Transport Type
* @param string $str Original string to encode and optionaly truncate
* @param string $page Url of page to call if confirmation is OK. Can contains parameters (param 'action' and 'confirm' will be reformated)
* @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of numeric value, or a select combo). Use '' to use same than $value
* @param string $output_format (html/opton (for option html only)/array (to return options arrays
* @param string $page Page name (website id must also be filled if this parameter is used). Exemple 'myaliaspage' or 'fr/myaliaspage'
* @param string $_path Path to the sendmail execuable
* @param string $key Authentification key
* @param string $selected Id remise fixe pre-selectionnee
* @return string Id connexion
* @return int 1 if transaction successfuly opened or already opened, 0 if error
* @return string Formated value
@@ -1405,7 +1313,6 @@
* @var array Contents informations. Usually created at runtime by loadBox().
* @var array Custom family informations
* @var array Header informations. Usually created at runtime by loadBox().
* @var array box dependancies
* @var int Date for cancelation
* @var int ID for cancelation
* @var int -1=Unkown duration
@@ -1444,7 +1351,6 @@
* Method was used to test module builder convertion to this form usage.
* Mot de passe de l'administrateur
* Multi-diminsional array containg addresses the message will
* Note: To complete search with a particular filter on select, you can set $object->next_prev_filter set to define SQL criterias.
* Optionaly with $selected_warehouse_id parameter user can get stock of specific warehouse
* Parse criteria to return a SQL qury formated
* Path to the sendmail execuable
@@ -1457,7 +1363,6 @@
* Retrieve number of equipments for a product lot/serial
* Return Unix time from ical date time fomrat (YYYYMMDD[T]HHMMSS[Z] or YYYYMMDD[T]HHMMSS)
* Return an array with Agenda Events informations
* Return an array with Currency informations
* Return an array with Expense Report informations
* Return an array with MO informations
* Return an array with bom informations
@@ -1497,10 +1402,8 @@
* Return the addtional SQL SELECT query for filtering a list by a category
* Return verion of data file
* Returns the partial diff for the specificed sequences, in reverse order.
* Serivce expiration unit
* The string return is not formated (translated with transnoentitiesnoconv).
* This can be changed for 2byte characers sets
* This method takes a list of given addresses, via an array or a COMMA delimted string, and inserts them into a highly
* Udpate the percent value of a event with the given id
* Unsuscribe all : 1 = contact has globaly unsubscribe of all mass emailings
* and restore it into another database with different id wihtout comprimising checksums
@@ -1515,9 +1418,6 @@
* to define the UNIX file system path to the sendmail execuable
If an error occured, show the resulting errors
# ---------------------------- mot de passe admin mysql
# Add cach performance directives
# Log directoves
# Log directoves
$IBS_RETOUR = "montant:M;ref:R;auto:A;trans:T"; // Format des parametres du get de validation en reponse (url a definir sous paybox)
$alwaysuncheckedmodules = array('dav', 'dynamicprices', 'incoterm', 'loan', 'multicurrency', 'paybox', 'paypal', 'stripe', 'google', 'printing', 'scanner', 'skype', 'website'); // Module we dont want by default
$amount = (is_numeric($amount) ? $amount : 0); // Check if amount is numeric, for example, an error occured when amount value = o (letter) instead 0 (number)
@@ -1531,8 +1431,6 @@
$ldaprecords = $ldap->getRecords('*', $conf->global->LDAP_MEMBER_DN, $conf->global->LDAP_KEY_MEMBERS, $required_fields, 'member'); // Fiter on 'member' filter param
$ldaprecords = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 'user'); // Fiter on 'user' filter param
$mege = imap_fetchbody($mbox, $jk, $fpos);
$mege = imap_fetchbody($mbox, $jk, $fpos, FT_UID);
$object->status = $object->fk_statut; // for backwad compatibility
$opensurveysondage->mail_admin = $_SESSION['adresse'];
$pdf->SetXY($savx, $savy);
$savy = $pdf->getY();
@@ -1576,7 +1474,6 @@
// Definition des parametres vente produit pour paybox
// Definition, nettoyage parametres
// Delivery date planed
// Donwload file
// Edition des varibales globales
// FIX for compatibity habitual tabs
// Fixe les dimensions de la vignette
@@ -1591,15 +1488,12 @@
// Initialize array of search criterias
// Link for delivery fields ref and date. Does not duplicate the line because we should always have ony 1 link or 0 per shipment
// List of fiels for action=list
// None. Beeing connected is enough.
// Nunber of files
// On remet cette lecture de permission ici car nécessaire d'avoir le nouveau statut de l'objet après toute action exécutée dessus (après incrémentation par exemple, le bouton supprimer doit disparaître)
// Parameteres execution
// Payment informations
// Payments not linked to an invoice. Should not happend. For debug only.
// Peut valoir un nombre ou liste de nombre separes par virgules
// Properties to store project informations
// Replace HTML coments
// Replace protected special codes with matching number of _ as wild card caracter
// Search parent to set task_parent_alternate_id (requird by ganttchart)
// Set also dependencies between use taks and bill time
@@ -1620,25 +1514,20 @@
// We keep it with value ForceBuyingPriceIfNull = 2 for retroactive effect but results are unpredicable.
// We open a list of transaction of a dedicated account and no page was set by defaut
// When a dictionnary is commented
// add properties and declare them in consturctor
// but in some situations that is required (update legal informations for example)
// for gravatar use get_avatar_from_service('gravatar', md5 hash email@adress, size-in-px )
// on transfert les données de l'un vers l'autre
// si le filtrage est parametre pour l'export ou pas
// start and end date that change with time andd that may be different that the period of reference for price.
// verify informations entred
//' If an error occured, show the resulting errors
//' If the API call succeded, then redirect the buyer to PayPal to begin to authorize payment.
//' of the authorization, incuding any shipping information of the
//'__PERSONALIZED__' => 'TESTPersonalized' // Hiden because not used yet
//'options_attr2'=>'Attr2 balbal' //Extra field exemple where field code is attr2
//,'options_attr1'=>'Attr1 balbal', //Extra field exemple where field code is attr1
//If invoice has been converted and the conversion has been used, we dont have remain to pay on invoice
//If no task avaiblable, redirec to to add confirm
//TODO : Note and docuement
//console.log("amount before="+amount+" rouding="+rounding)
//if ($val['notnull'] > 0) $rightpart .= ' fieldrequired'; // No fieldrequired inthe view output
//search and get all permssion in stirng
<dt>pRes</dt><dd>(optional) resource name</dd>
<strong>TaskItem(<em>pID, pName, pStart, pEnd, pColor, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption, pNotes, pGantt</em>)</strong></p>
<td colspan="3"><textarea name="adress" cols="40" rows="3"><?php echo $this->control->tpl['address']; ?></textarea></td>
@@ -1710,7 +1599,6 @@
SOCIETE_USEPREFIX can restore old feature.
miscelaneous contries.
* the tagret is useful with hooks : that allow externals modules to add setup items on good place
- htdocs/modulebuilder/template/test/phpunit/functionnal
<!-- Looking for our sevices -->
description: Screenshots, screencasts, dolibarr.log, debugging informations
| dolibar | |
@@ -1850,13 +1738,7 @@
* Return a string with full address formated for output on documents
* @param string $extName Extension to differenciate thumb file name ('_small', '_mini')
* @return string Formated text of duration
* This Ajax service is oftenly called when option MAIN_DIRECT_STATUS_UPDATE is set.
* 'contract' to add a tabl in contract view
* 'action-btn-label' => '', // Overide label of action button, if empty default label use "Confirm" lang key
* 'cancel-btn-label' => '', // Overide label of cancel button, if empty default label use "CloseDialog" lang key
* 'content' => '', // Overide text of content, if empty default content use "ConfirmBtnCommonContent" lang key
* 'title' => '', // Overide title of modal, if empty default title use "ConfirmBtnCommonTitle" lang key
* 'url' => 'http://', // Overide Url to go when user click on action btn, if empty default url is $url.?confirm=yes, for no js compatibility use $url for fallback confirm.
* 'action-btn-label' => '', // Overide label of action button, if empty default label use "Confirm" lang key
* 'cancel-btn-label' => '', // Overide label of cancel button, if empty default label use "CloseDialog" lang key
* 'content' => '', // Overide text of content, if empty default content use "ConfirmBtnCommonContent" lang key
@@ -1891,7 +1773,6 @@
* \brief Fichier de la classe des fonctions predefinie de composants html cron
* \brief Page des informations dolistore
* Classe du modele de numerotation de reference de projet Universal
* \brief Page list of invoice paied by direct debit or credit transfer
* Also modified to handle attachements.
* \brief Fichier contenant la classe du modele de numerotation de reference de projet Universal
* - corrected the defualt value for 'setPriority()'
@@ -1908,7 +1789,6 @@
* - modifed 'getFrom()' to handle "striping" the email address
* - modified getHeader() to ustilize new Message Sensitivity and Priorty properties
* - removed leading dashes from message boundry
* @param int $onlysqltoimportwebsite Only sql resquests used to import a website template are allowed
* @param int $onlysqltoimportwebsite Only sql resquests used to import a website template are allowed
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
@@ -1967,12 +1847,9 @@
* @param array $replaceambiguouschars Discard ambigous characters. For example array('I').
* @param array $arrayofmesures Array of mesures already filled
* @param mixed $position key of postion to insert to
* @param string $phpfullcodestring PHP new string. For exemple "<?php echo 'a' ?><php echo 'c' ?>"
* @param string $phpfullcodestringold PHP old string. For exemple "<?php echo 'a' ?><php echo 'b' ?>"
* @param string $modulepart Module of document ('module', 'module_user_temp', 'module_user' or 'module_temp'). Exemple: 'medias', 'invoice', 'logs', 'tax-vat', ...
* @param string intput Array of complementary actions to do if success
* @param string $param Parameters of URL (x=value1&y=value2) or may be a formated content with $postorget='PUTALREADYFORMATED'
* @param {string} intput Array of complementary actions to do if success
* @param float $paht Buying price without tax
* @param int $fk_pa Id of buying price (prefer set this to 0 and provide $paht instead. With id, buying price may have change)
* @param string $urltograb URL to grab (exemple: http://www.nltechno.com/ or http://www.nltechno.com/dir1/ or http://www.nltechno.com/dir1/mapage1)
@@ -1991,10 +1868,7 @@
* @param string $extName Extension to differenciate thumb file name ('', '_small', '_mini')
* @param string $resourceType ressource type
* @param boolean $extraRightColumn (optional) Add a addtional column after the summary word and total number
* @param int $action 0 for delete, 1 for add, 2 for update, -1 when delete object completly, -2 for generate rights after add
* @param string $noneWord (optional) The word that is shown when the table has no entires ($num === 0)
* @param string $objectname name of object whant to remove
* @retun boolean
* @return array returns an associtive array containing the response from the server.
* @return string A HTML table that conatins a list with open (unpaid) supplier invoices
* @return string Formated value
@@ -2003,7 +1877,6 @@
* @return array Array with time spent for $fuser for each day of week on tasks in $lines and substasks
* @return string Formated value
* @return string Array of id of orders wit all dispathing already done or not required
* @return string Formated size
* Abort invoice creationg with a given error message
* Check whether given extension is in html etensions list
* Classe permettant la gestion des stats des deplacements et notes de frais
@@ -2012,7 +1885,6 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2005-2019 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2005-2021 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2005-2023 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2016 Laurent Destailleur <eldy@uers.sourceforge.net>
* Correspondance des expeditions et des commandes clients dans la table llx_co_exp
* Correspondance des livraisons et des commandes clients dans la table llx_co_liv
@@ -2090,13 +1962,10 @@ $usercanread = (($user->rights->stock->mouvement->lire));
* TODO: use color definition vars above for define badges color status X -> exemple $badgeStatusValidate, $badgeStatusClosed, $badgeStatusActive ....
* ALL EXTERNAL MODULES THAT WERE NOT CORRECTLY DEVELOPPED WILL NOT WORK ON V15 (All modules that forgot to manage the security token field
* All functions fetch_all() have been set to deprecated for naming consitency, use fetchAll() instead.
* 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
* 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).
* Optionnaly, made freemono the default monotype font if we removed courier
* Optionnaly, removed all fonts except
* Removed the method 4 of GETPOST (to get $_COOKIE). It was not used and not recommanded to use in Dolibarr.
* 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
* 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
* The deprecated subsitution key __SIGNATURE__ has been removed. Replace it with __USER_SIGNATURE__ if you used the old syntax in your email templates.
* The substition key __SIGNATURE__ was renamed into __USER_SIGNATURE__ to follow naming conventions.
* You can test patching of serie with "quilt push" (autant de fois que de patch). Avec "quilt pop -a", on revient a l'état du upstream sans les patch.
@@ -2143,7 +2012,6 @@ $usercanread = (($user->rights->stock->mouvement->lire));
/* Warning: setting this may make screen not beeing refreshed after a combo selection */
/* default color for status : After a quick check, somme status can have oposite function according to objects
/** @var bool Hide PHP informations */
/** @var boolean $force_install_nophpinfo Hide PHP informations */
// and printing in millimiter by setting unit to 'mm' in constructor.
// font-size : defaut char size (can be changed by calling Set_Char_Size(xx);
// "commitment engagment" method and "cash accounting" method
@@ -2160,7 +2028,6 @@ $usercanread = (($user->rights->stock->mouvement->lire));
// Creation de la classe d'export du model ExportXXX
// Customer Default Langauge
// DN pour les groupes
// Date appoval
// Defaut sortorder
// Defini objet langs
// Defini si peux lire/modifier permisssions
@@ -2182,15 +2049,11 @@ $usercanread = (($user->rights->stock->mouvement->lire));
// No cahce on PHP
// No check is done on company permission because readability is managed by public status of project and assignement.
// Nomber of try
// None. Beeing connected is enough.
// Now database connexion is known, so we can forget password
// Personal informations
// Personalized search criterias. Example: $conf->global->PRODUCT_QUICKSEARCH_ON_FIELDS = 'p.ref=ProductRef;p.label=ProductLabel;p.description=Description;p.note=Note;'
// Personalized search criterias. Example: $conf->global->THIRDPARTY_QUICKSEARCH_ON_FIELDS = 's.nom=ThirdPartyName;s.name_alias=AliasNameShort;s.code_client=CustomerCode'
// Place customer adress to the ISO location
// Repair llx_commande_fournisseur to eleminate duplicate reference
// SQL Aliase adherent
// SQL Aliase adherent_type
// Sauvegardes parametres
// Search Criterias
// Securite acces client
@@ -2205,7 +2068,6 @@ $usercanread = (($user->rights->stock->mouvement->lire));
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
// TODO ajouter regle pour restreindre acces paiement
// Table to store complete informations (will replace all other table). Key is table name.
// Test to check image can be publically viewed is done inside the viewimage.php wrapper.
// This 2 lines are usefull only if we want to exclude some Urls from the explorer
// This refresh list of dirs, not list of files (for preformance reason). List of files is refresh only if dir was not synchronized.
// To disable a constant whithout javascript
@@ -2340,7 +2202,6 @@ FIX: supplier invoice payment total dont care about deposit or credit
FIX: tag object_total_vat_x need x to be a string with unknown decimal lenght. Now use for x the real vat real with no more decimal (x = 20 or x = 8.5 or x = 5.99, ...)
FIX: the time spent on project was not visible in its overwiew
FIX: typo on ckeck method
FIX: use event.key instead event.wich to avoid keyboard difference
FIX: when fetch_optionnal_by_label in Extrafields with $this->db cannot work because this->db is never instanciated
FIX: wrong occurence number of contract on contact card, we must only count externals
FIX: wrong path sociales/index.php doesnt exist anymore
@@ -2359,7 +2220,6 @@ NEW: #18401 Add __NEWREF__ subtitute to get new object reference.
NEW: A new function getImageFileNameForSize was also introduced to choose image best size according to usage to save bandwith.
NEW: Accounting - Add default accounting account for member subcriptions.
NEW: Add "depends on" and "required by" into module informations
NEW: Add SQL contraint on product_stock table to allow only exsting product and warehouse #23543
NEW: Add email in event history, for reminder email of expired subsription
NEW: Add exemple of setup for multitail to render dolibarr log files
NEW: Add hidden option MAIN_EMAIL_SUPPORT_ACK to restore Email ack checkbox (feature abandonned by mailers)
@@ -2373,9 +2233,7 @@ NEW: Add tooltip in payment term edition in dictionnary.
NEW: Add workflow to classifed propal bill on invoice validation.
NEW: All language tranlsations (except source en_US) is now managed on https://www.transifex.com/projects/p/dolibarr/.
NEW: Architecture to manage search criteria persistance (using save_lastsearch_values=1 on exit links and restore_lastsearch_values=1 in entry links)
NEW: Authentication: add experimental support for Google OAuth2 connexion
NEW: Better reponsive design
NEW: Can edit account on miscellaneous payment (if not transfered)
NEW: Can edit list of prospect status for customers/prospects. Add a new entry into dictionary table to manage list fo status.
NEW: Can edit list of prospect status for customers/prospects. Add a new entry into dictionary table to manage list fo status. Removed deprecated files.
NEW: Can filter on code in dictionnaries
@@ -2408,18 +2266,14 @@ NEW: add API shipment mode dictionnary
NEW: add a prospect status for the contact with managment of custom icon
NEW: add constant MAIN_COMPANY_PERENTITY_SHARED to manage some informations (Accounting account) when company is shared on several entities
NEW: add constant MAIN_PRODUCT_PERENTITY_SHARED to manage some informations (Accounting account) when product is shared on several entities
NEW: add convertion of images to webp for a single image in website media editor
NEW: add price in burger menu on mouvement list
NEW: add show preview for mail attachement on form mail
NEW: batch referential objets
NEW: can substitue project title in mail template
NEW: comment in api_mymodule for seperate methods
NEW: conditionnal add member button by statut
NEW: contacts type dictionnary in api_setup.class.php
NEW: get state dictionnary by REST API
NEW: get user connected informations in REST API
NEW: hook getnomurltooltip is replaced with hook getNomUrl more powerfull
NEW: only get openned contact from liste_contact function, to not have acces to closed contact as mail receiver
NEW: option to copy into attachement files of events, files send by mail (with auto event creation)
NEW: possibilty to group payments by mode and show their subtotal
NEW: show place from events on import calender
@@ -2433,13 +2287,11 @@ The output patch file can then be submited on Dolibarr
This directory contains ruleset files to use to develop Dolibarr EPR & CRM.
This directory contains several subdirectories with entries for informations on Dolibarr.<br>
This docker image intended for developpement usage.
This docker image is intended for developpement usage.
This module provides a sheduled job that scan regularly one or several IMAP email boxes, with filtering rules, to automatically record data in your application, like
Upgrading to any other version or database system is abolutely required BEFORE trying to
We recommand to install Dolibarr ERP CRM on your own server (as most Open Source software, download and use is free: [https://www.dolibarr.org/download](https://www.dolibarr.org/download)) to get access on every side of application.
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.
class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" boxes
class ModeleExports extends CommonDocGenerator // This class can't be abstract as there is instance propreties loaded by listOfAvailableExportFormat
class ModeleExports extends CommonDocGenerator // This class can't be abstract as there is instance propreties loaded by liste_modeles
define('DOL_CLASS_PATH', 'class/'); // Filsystem path to class dir
echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
@@ -2451,8 +2303,6 @@ if (!empty($conf->variants->eabled) && empty($conf->global->VARIANT_ALLOW_STOCK_
if (!empty($contactname)) { // acces a partir du module de recherche
if ($action == "transfert") {
if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payment mode
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
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
print $form->multiselectarray('BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY', $countryArray, $seledted);
print $langs->trans("Size").': '.ini_get('xcache.size').' &nbsp; &nbsp; &nbsp; '.$langs->trans("Recommanded").': 16*Split<br>'."\n";
print $langs->trans("Split").': '.ini_get('xcache.count').' &nbsp; &nbsp; &nbsp; '.$langs->trans("Recommanded").': (cat /proc/cpuinfo | grep -c processor) + 1<br>'."\n";

View File

@@ -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)
{

View File

@@ -1,20 +0,0 @@
#/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

View File

@@ -3,8 +3,8 @@
# Count number of commits per user and per versions (using date for version detection)
#
Releases=("17.0" "18.0" "develop")
Dates=("2023-02-01" "2023-08-31" "2050-01-01")
Releases=("16.0" "develop")
Dates=("2022-01-01" "2022-08-31" "2050-01-01")
let "counter = 1"
for i in "${Releases[@]}"

View File

@@ -4,17 +4,13 @@
#
if [ "x$2" = "x" ]; then
echo "Usage: $0 origin/branchstart|tagnamestart|START origin/branchend|tagnameend|HEAD"
echo "Usage: $0 tagnamestart|START tagnameend|HEAD"
exit
fi
START=$1
if [ "x$START" = "xSTART" ]; then
START=""
fi
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
echo "git log $1..$2 --shortstat | grep ... | perl ... > /tmp/github_lines_perusers.tmp"
git log $1..$2 --shortstat | grep -e 'Author:' -e 'Date:' -e ' changed' -e ' insertion' -e ' deletion' | perl -n -e '/^(.*)$/; $line = $1; if ($line =~ /(changed|insertion|deletion)/) { $line =~ s/[^0-9\s]//g; my @arr=split /\s+/, $line; $tot=0; for (1..@arr) { $tot += $arr[$_]; }; print $tot."\n"; } else { print $line."\n"; };' > /tmp/github_lines_perusers.tmp
cat /tmp/github_lines_perusers.tmp | awk 'BEGIN { FS="\n"; print "user and nb of lines"; lastuser=""; } { if ($1 ~ /Author:/) { lastuser=$1 }; if ($1 ~ /^[0-9]+$/) { aaa[lastuser]+=$1; } } END { for (var in aaa) print var," ",aaa[var]; } '

View File

@@ -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,24 +68,23 @@ 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)
@@ -94,10 +93,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)
@@ -110,9 +109,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)
{
@@ -124,8 +123,8 @@ function getDocTitle(&$doc, $url)
}
/**
* @param string $doc Doc
* @return array Array
* @param string $doc Doc
* @return array Array
*/
function getDocMetaData(&$doc)
{

View File

@@ -24,7 +24,6 @@ class Aaa
/**
* do
*
* @return void
*/
public function do()

View File

@@ -5,7 +5,6 @@ $globalbbb = 'globalbbb';
/**
* fbbb
*
* @return string
*/
function fbbb()
@@ -22,7 +21,6 @@ class Bbb
/**
* do
*
* @return void
*/
public function do()

View File

@@ -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;

View File

@@ -21,11 +21,10 @@
/**
* 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';

View File

@@ -38,14 +38,13 @@ 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';

View File

@@ -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"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 KiB

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 KiB

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 KiB

After

Width:  |  Height:  |  Size: 132 KiB

View File

@@ -3,7 +3,6 @@ README (english)
User guide
--------------------------------
* All Dolibarr guides are available, online, on the Dolibarr Websites:
* All Dolibarr guides are available, on line, on the Dolibarr Web site:
https://www.dolibarr.org
https://wiki.dolibarr.org

View File

@@ -33,6 +33,7 @@ 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');
@@ -40,7 +41,6 @@ $rowid = GETPOST('rowid', 'int');
$massaction = GETPOST('massaction', 'aZ09');
$optioncss = GETPOST('optioncss', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'accountingaccountlist'; // To manage different context of search
$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
$search_account = GETPOST('search_account', 'alpha');
$search_label = GETPOST('search_label', 'alpha');
@@ -91,11 +91,11 @@ $arrayfields = array(
'aa.pcg_type'=>array('label'=>"Pcgtype", 'checked'=>1, 'help'=>'PcgtypeDesc'),
'categories'=>array('label'=>"AccountingCategories", 'checked'=>-1, 'help'=>'AccountingCategoriesDesc'),
'aa.reconcilable'=>array('label'=>"Reconcilable", 'checked'=>1),
'aa.import_key'=>array('label'=>"ImportId", 'checked'=>-1, 'help'=>''),
'aa.active'=>array('label'=>"Activated", 'checked'=>1)
'aa.active'=>array('label'=>"Activated", 'checked'=>1),
'aa.import_key'=>array('label'=>"ImportId", 'checked'=>-1)
);
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
unset($arrayfields['categories']);
unset($arrayfields['aa.reconcilable']);
}
@@ -146,7 +146,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') != getDolGlobalInt('CHARTOFACCOUNTS'))) { // a submit of form is done and chartofaccounts combo has been modified
|| (GETPOST('chartofaccounts', 'int') > 0 && GETPOST('chartofaccounts', 'int') != $conf->global->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';
@@ -228,7 +228,7 @@ if ($action == 'delete') {
print $formconfirm;
}
$pcgver = getDolGlobalInt('CHARTOFACCOUNTS');
$pcgver = $conf->global->CHARTOFACCOUNTS;
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.account_number, aa.account_parent, aa.label, aa.labelshort, aa.fk_accounting_category,";
$sql .= " aa.reconcilable, aa.active, aa.import_key,";
@@ -240,8 +240,8 @@ $sql .= " WHERE asy.rowid = ".((int) $pcgver);
//print $sql;
if (strlen(trim($search_account))) {
$lengthpaddingaccount = 0;
if (getDolGlobalInt('ACCOUNTING_LENGTH_GACCOUNT') || getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) {
$lengthpaddingaccount = max(getDolGlobalInt('ACCOUNTING_LENGTH_GACCOUNT'), getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT'));
if ($conf->global->ACCOUNTING_LENGTH_GACCOUNT || $conf->global->ACCOUNTING_LENGTH_AACCOUNT) {
$lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_GACCOUNT, $conf->global->ACCOUNTING_LENGTH_AACCOUNT);
}
$search_account_tmp = $search_account;
$weremovedsomezero = 0;
@@ -289,7 +289,7 @@ $sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
if (empty($conf->global->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
@@ -321,7 +321,7 @@ if ($resql) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit);
$param .= '&limit='.urlencode($limit);
}
if ($search_account) {
$param .= '&search_account='.urlencode($search_account);
@@ -414,7 +414,7 @@ if ($resql) {
print '<br>';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
$moreforfilter = '';
@@ -429,13 +429,6 @@ 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 maxwidthsearch">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
}
if (!empty($arrayfields['aa.account_number']['checked'])) {
print '<td class="liste_titre"><input type="text" class="flat width100" name="search_account" value="'.$search_account.'"></td>';
}
@@ -470,19 +463,12 @@ if ($resql) {
if (!empty($arrayfields['aa.active']['checked'])) {
print '<td class="liste_titre">&nbsp;</td>';
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
}
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterButtons();
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['aa.account_number']['checked'])) {
print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
}
@@ -512,10 +498,7 @@ if ($resql) {
if (!empty($arrayfields['aa.active']['checked'])) {
print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder);
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "</tr>\n";
$i = 0;
@@ -528,32 +511,6 @@ if ($resql) {
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center nowraponall">';
if ($user->hasRight('accounting', 'chartofaccount')) {
print '<a class="editfielda" href="./card.php?action=update&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?'.$param).'">';
print img_edit();
print '</a>';
print '&nbsp;';
print '<a class="marginleftonly" href="./card.php?action=delete&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?'.$param).'">';
print img_delete();
print '</a>';
print '&nbsp;';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
}
print '</td>'."\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Account number
if (!empty($arrayfields['aa.account_number']['checked'])) {
print "<td>";
@@ -566,7 +523,7 @@ if ($resql) {
// Account label
if (!empty($arrayfields['aa.label']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->label).'">';
print "<td>";
print dol_escape_htmltag($obj->label);
print "</td>\n";
if (!$i) {
@@ -679,30 +636,28 @@ if ($resql) {
}
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center nowraponall">';
if ($user->hasRight('accounting', 'chartofaccount')) {
print '<a class="editfielda" href="./card.php?action=update&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?'.$param).'">';
print img_edit();
print '</a>';
print '&nbsp;';
print '<a class="marginleftonly" href="./card.php?action=delete&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?'.$param).'">';
print img_delete();
print '</a>';
print '&nbsp;';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
// Action
print '<td class="center nowraponall">';
if ($user->hasRight('accounting', 'chartofaccount')) {
print '<a class="editfielda" href="./card.php?action=update&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?'.$param).'">';
print img_edit();
print '</a>';
print '&nbsp;';
print '<a class="marginleftonly" href="./card.php?action=delete&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?'.$param).'">';
print img_delete();
print '</a>';
print '&nbsp;';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>'."\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
print '</td>'."\n";
if (!$i) {
$totalarray['nbfield']++;
}
print "</tr>\n";

View File

@@ -504,8 +504,8 @@ if ($id) {
print '<td>';
print '<input type="hidden" name="id" value="'.$id.'">';
print '</td>';
print '<td></td>';
print '<td></td>';
print '<td style="min-width: 26px;"></td>';
print '<td style="min-width: 26px;"></td>';
print '</tr>';
// Line to enter new values
@@ -640,8 +640,7 @@ if ($id) {
foreach ($fieldlist as $field => $value) {
$showfield = 1;
$class = "left";
$tmpvar = $fieldlist[$field];
$valuetoshow = $obj->$tmpvar;
$valuetoshow = $obj->{$fieldlist[$field]};
if ($value == 'type_template') {
$valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
}

View File

@@ -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) getDolGlobalInt('CHARTOFACCOUNTS'));
$sql = "SELECT pcg_version FROM " . MAIN_DB_PREFIX . "accounting_system WHERE rowid = ".((int) $conf->global->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) getDolGlobalInt('CHARTOFACCOUNTS'));
$sql = "SELECT pcg_version FROM ".MAIN_DB_PREFIX."accounting_system WHERE rowid=".((int) $conf->global->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(getDolGlobalInt('CHARTOFACCOUNTS'));
$accountsystem->fetch($conf->global->CHARTOFACCOUNTS);
$title = $langs->trans('AccountAccounting')." - ".$langs->trans('Card');
@@ -282,7 +282,7 @@ if ($action == 'create') {
print $form->textwithpicto($langs->trans("AccountingCategory"), $langs->transnoentitiesnoconv("AccountingAccountGroupsDesc"));
print '</td>';
print '<td>';
print $formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1);
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1);
print '</td></tr>';
print '</table>';
@@ -359,7 +359,7 @@ if ($action == 'create') {
print $form->textwithpicto($langs->trans("AccountingCategory"), $langs->transnoentitiesnoconv("AccountingAccountGroupsDesc"));
print '</td>';
print '<td>';
print $formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
print '</td></tr>';
print '</table>';
@@ -381,7 +381,7 @@ if ($action == 'create') {
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
print '<table class="border centpercent">';
// Label
print '<tr><td class="titlefield">'.$langs->trans("Label").'</td>';

View File

@@ -45,26 +45,6 @@ if ($cat_id == 0) {
$cat_id = null;
}
// Load variable for pagination
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
}
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (empty($sortfield)) {
$sortfield = 'account_number';
}
if (empty($sortorder)) {
$sortorder = 'ASC';
}
// Security check
if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden();
@@ -131,13 +111,8 @@ print '<table class="border centpercent">';
// Select the category
print '<tr><td class="titlefield">'.$langs->trans("AccountingCategory").'</td>';
print '<td>';
$s = $formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 0);
if ($formaccounting->nbaccounts_category <= 0) {
print '<span class="opacitymedium">'.$s.'</span>';
} else {
print $s;
print '<input type="submit" class="button small" value="'.$langs->trans("Select").'">';
}
$formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 0);
print '<input type="submit" class="button small" value="'.$langs->trans("Select").'">';
print '</td></tr>';
print '</table>';
@@ -162,6 +137,14 @@ if (!empty($cat_id)) {
if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) {
print img_picto($langs->trans("AccountingAccount"), 'accounting_account', 'class="pictofixedwith"');
print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, '', 0, "80%", '', '', $langs->transnoentitiesnoconv("AddAccountFromBookKeepingWithNoCategories"));
//print '<br>';
/*print '<select class="flat minwidth200" size="8" name="cpt_bk[]" multiple>';
foreach ( $accountingcategory->lines_cptbk as $cpt ) {
print '<option value="' . length_accountg($cpt->numero_compte) . '">' . length_accountg($cpt->numero_compte) . ' (' . $cpt->label_compte . ' ' . $cpt->doc_ref . ')</option>';
}
print '</select><br>';
print ajax_combobox('cpt_bk');
*/
print '<input type="submit" class="button button-add small" id="" class="action-delete" value="'.$langs->trans("Add").'"> ';
}
}
@@ -169,16 +152,13 @@ if (!empty($cat_id)) {
print '</form>';
if ((empty($action) || $action == 'display' || $action == 'delete') && $cat_id > 0) {
$param = 'account_category='.((int) $cat_id);
if ($action == 'display' || $action == 'delete') {
print '<br>';
print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre">';
print getTitleFieldOfList('AccountAccounting', 0, $_SERVER['PHP_SELF'], 'account_number', '', $param, '', $sortfield, $sortorder, '')."\n";
print getTitleFieldOfList('Label', 0, $_SERVER['PHP_SELF'], 'label', '', $param, '', $sortfield, $sortorder, '')."\n";
print getTitleFieldOfList('', 0, $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, '')."\n";
print '</tr>'."\n";
print '<td class="liste_titre">'.$langs->trans("AccountAccounting")."</td>";
print '<td class="liste_titre" colspan="2">'.$langs->trans("Label")."</td>";
print "</tr>\n";
if (!empty($cat_id)) {
$return = $accountingcategory->display($cat_id); // This load ->lines_display
@@ -187,8 +167,6 @@ if ((empty($action) || $action == 'display' || $action == 'delete') && $cat_id >
}
if (is_array($accountingcategory->lines_display) && count($accountingcategory->lines_display) > 0) {
$accountingcategory->lines_display = dol_sort_array($accountingcategory->lines_display, $sortfield, $sortorder, -1, 0, 1);
foreach ($accountingcategory->lines_display as $cpt) {
print '<tr class="oddeven">';
print '<td>'.length_accountg($cpt->account_number).'</td>';

View File

@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2004-2023 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* This program is free software; you can redistribute it and/or modify
@@ -58,10 +58,9 @@ $listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000
$sortfield = GETPOST("sortfield", 'aZ09comma');
$sortorder = GETPOST("sortorder", 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters
if (empty($page) || $page == -1) {
$page = 0;
}
} // If $page is not defined, or '' or -1
$offset = $listlimit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
@@ -445,41 +444,17 @@ if ($search_country_id > 0) {
if ($sortfield == 'country') {
$sortfield = 'country_code';
}
if (empty($sortfield)) {
$sortfield = 'position';
}
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($listlimit + 1, $offset);
//print $sql;
$fieldlist = explode(',', $tabfield[$id]);
$param = '&id='.$id;
if ($search_country_id > 0) {
$param .= '&search_country_id='.urlencode($search_country_id);
}
$paramwithsearch = $param;
if ($sortorder) {
$paramwithsearch .= '&sortorder='.urlencode($sortorder);
}
if ($sortfield) {
$paramwithsearch .= '&sortfield='.urlencode($sortfield);
}
if (GETPOST('from', 'alpha')) {
$paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha'));
}
if ($listlimit) {
$paramwithsearch .= '&listlimit='.urlencode(GETPOST('listlimit', 'int'));
}
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
print '<input type="hidden" name="sortfield" value="'.dol_escape_htmltag($sortfield).'">';
print '<input type="hidden" name="sortorder" value="'.dol_escape_htmltag($sortorder).'">';
print '<div class="div-table-responsive-no-min">';
print '<div class="div-table-responsive">';
print '<table class="noborder centpercent">';
// Form to add a new line
@@ -488,10 +463,6 @@ if ($tabname[$id]) {
// Line for title
print '<tr class="liste_titre">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}
foreach ($fieldlist as $field => $value) {
// Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees
@@ -531,7 +502,6 @@ if ($tabname[$id]) {
}
if ($fieldlist[$field] == 'range_account') {
$valuetoshow = $langs->trans("Comment");
$class = 'width75';
}
if ($fieldlist[$field] == 'category_type') {
$valuetoshow = $langs->trans("Calculated");
@@ -553,21 +523,14 @@ if ($tabname[$id]) {
print '<td>';
print '<input type="hidden" name="id" value="'.$id.'">';
print '</td>';
print '<td></td>';
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}
print '<td style="min-width: 26px;"></td>';
print '<td style="min-width: 26px;"></td>';
print '<td style="min-width: 26px;"></td>';
print '</tr>';
// Line to enter new values
print '<tr class="oddeven nodrag nodrop nohover">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}
$obj = new stdClass();
// If data was already input, we define them in obj to populate input fields.
if (GETPOST('actionadd', 'alpha')) {
@@ -587,29 +550,19 @@ if ($tabname[$id]) {
fieldListAccountingCategories($fieldlist, $obj, $tabname[$id], 'add');
}
print '<td colspan="2" class="right">';
print '<td colspan="4" class="right">';
print '<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans("Add").'">';
print '</td>';
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}
print "</tr>";
$colspan = count($fieldlist) + 3;
if ($id == 32) {
$colspan++;
}
print '<tr><td colspan="'.$colspan.'">&nbsp;</td></tr>'; // Keep &nbsp; to have a line with enough height
}
print '</table>';
print '</div>';
print '<div class="div-table-responsive">';
print '<table class="noborder centpercent">';
// List of available record in database
dol_syslog("htdocs/accountancy/admin/categories_list.php", LOG_DEBUG);
@@ -618,39 +571,29 @@ if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$param = '&id='.$id;
if ($search_country_id > 0) {
$param .= '&search_country_id='.urlencode($search_country_id);
}
$paramwithsearch = $param;
if ($sortorder) {
$paramwithsearch .= '&sortorder='.$sortorder;
}
if ($sortfield) {
$paramwithsearch .= '&sortfield='.$sortfield;
}
if (GETPOST('from', 'alpha')) {
$paramwithsearch .= '&from='.GETPOST('from', 'alpha');
}
// There is several pages
if ($num > $listlimit) {
print '<tr class="none"><td class="right" colspan="'.(2 + count($fieldlist)).'">';
print '<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).'">';
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>');
print '</td></tr>';
}
$filterfound = 0;
foreach ($fieldlist as $field => $value) {
$showfield = 1; // By defaut
if ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') {
$showfield = 0;
}
if ($showfield) {
if ($value == 'country') {
$filterfound++;
}
}
}
// Title line with search boxes
print '<tr class="liste_titre liste_titre_add liste_titre_filter">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre center">';
if ($filterfound) {
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
}
print '</td>';
}
$filterfound = 0;
foreach ($fieldlist as $field => $value) {
$showfield = 1; // By defaut
@@ -672,23 +615,17 @@ if ($resql) {
}
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre center">';
if ($filterfound) {
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
}
print '</td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre center">';
if ($filterfound) {
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
}
print '</td>';
print '</tr>';
// Title of lines
print '<tr class="liste_titre">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print getTitleFieldOfList('');
}
foreach ($fieldlist as $field => $value) {
// Determines the name of the field in relation to the possible names
// in data dictionaries
@@ -762,22 +699,16 @@ if ($resql) {
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "", $sortfield, $sortorder, $class.' ');
}
}
print getTitleFieldOfList($langs->trans("ListOfAccounts"), 0, $_SERVER["PHP_SELF"], "", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, '');
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center ');
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print getTitleFieldOfList('');
}
print getTitleFieldOfList('');
print getTitleFieldOfList('');
print getTitleFieldOfList('');
print '</tr>';
if ($num) {
$imaxinloop = ($listlimit ? min($num, $listlimit) : $num);
// Lines with values
while ($i < $imaxinloop) {
while ($i < $num) {
$obj = $db->fetch_object($resql);
//print_r($obj);
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
@@ -786,16 +717,12 @@ if ($resql) {
$reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors;
// Actions
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}
// Show fields
if (empty($reshook)) {
fieldListAccountingCategories($fieldlist, $obj, $tabname[$id], 'edit');
}
print '<td></td>';
print '<td></td>';
print '<td class="center">';
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
@@ -804,54 +731,19 @@ if ($resql) {
print '<input type="submit" class="button button-edit smallpaddingimp" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<input type="submit" class="button button-cancel smallpaddingimp" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
// Actions
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}
print '<td></td>';
} else {
// Can an entry be erased or disabled ?
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
if (isset($obj->code)) {
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
$iserasable = 0; $canbedisabled = 0;
}
}
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
if ($param) {
$url .= '&'.$param;
}
$url .= '&';
$canbemodified = $iserasable;
$tmpaction = 'view';
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors;
// Actions
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">';
if ($canbemodified) {
print '<a class="reposition editfielda marginleftonly marginrightonly" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a>';
}
if ($iserasable) {
if ($user->admin) {
print '<a class="marginleftonly marginrightonly" href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a>';
}
}
print '</td>';
}
if (empty($reshook)) {
foreach ($fieldlist as $field => $value) {
$showfield = 1;
$title = '';
$class = 'tddict';
$tmpvar = $fieldlist[$field];
$valuetoshow = $obj->$tmpvar;
$class = "left";
$valuetoshow = $obj->{$fieldlist[$field]};
if ($value == 'category_type') {
$valuetoshow = yn($valuetoshow);
} elseif ($valuetoshow == 'all') {
@@ -863,65 +755,94 @@ if ($resql) {
$key = $langs->trans("Country".strtoupper($obj->country_code));
$valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country);
}
} elseif (in_array($fieldlist[$field], array('label', 'range_account', 'formula'))) {
$class = "tdoverflowmax250";
$title = $valuetoshow;
} elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_country') {
$key = $langs->trans("Country".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_availability') {
$langs->loadLangs(array("propal"));
$key = $langs->trans("AvailabilityType".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "AvailabilityType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_actioncomm') {
$key = $langs->trans("Action".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "Action".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} elseif ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') {
$showfield = 0;
}
$class = 'tddict';
// Show value for field
if ($showfield) {
print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'"'.($title ? ' title="'.dol_escape_htmltag($title).'"': '').'>'.dol_escape_htmltag($valuetoshow).'</td>';
print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'">'.dol_escape_htmltag($valuetoshow).'</td>';
}
}
}
// Link to setup the group
print '<td>';
if (empty($obj->formula)) {
// Count number of accounts into group
$nbofaccountintogroup = 0;
$listofaccountintogroup = $accountingcategory->getCptsCat($obj->rowid);
$nbofaccountintogroup = count($listofaccountintogroup);
print '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories.php?action=display&save_lastsearch_values=1&account_category='.$obj->rowid.'">';
print $langs->trans("NAccounts", $nbofaccountintogroup);
print '</a>';
} else {
print '<span class="opacitymedium">'.$langs->trans("Formula").'</span>';
// Can an entry be erased or disabled ?
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
if (isset($obj->code)) {
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
$iserasable = 0; $canbedisabled = 0;
}
}
print '</td>';
$canbemodified = $iserasable;
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
if ($param) {
$url .= '&'.$param;
}
$url .= '&';
// Active
print '<td class="center" class="nowrap">';
if ($canbedisabled) {
print '<a href="'.$url.'action='.$acts[$obj->active].'&token='.newToken().'">'.$actl[$obj->active].'</a>';
print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
} else {
print $langs->trans("AlwaysActive");
}
print "</td>";
// Actions
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">';
if ($canbemodified) {
print '<a class="reposition editfielda paddingleft marginleftonly marginrightonly paddingright" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a>';
}
if ($iserasable) {
if ($user->admin) {
print '<a class="paddingleft marginleftonly marginrightonly paddingright" href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a>';
}
}
print '</td>';
// Modify link
if ($canbemodified) {
print '<td class="center"><a class="reposition editfielda" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a></td>';
} else {
print '<td>&nbsp;</td>';
}
// Delete link
if ($iserasable) {
print '<td class="center">';
if ($user->admin) {
print '<a href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a>';
}
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
print '</td>';
} else {
print '<td>&nbsp;</td>';
}
// Link to setup the group
print '<td class="center">';
if (empty($obj->formula)) {
print '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories.php?action=display&save_lastsearch_values=1&account_category='.$obj->rowid.'">';
print $langs->trans("ListOfAccounts");
print '</a>';
// Count number of accounts into group
$nbofaccountintogroup = 0;
$listofaccountintogroup = $accountingcategory->getCptsCat($obj->rowid);
$nbofaccountintogroup = count($listofaccountintogroup);
//if ($nbofaccountintogroup > 0) {
print ' <span class="opacitymedium">('.$langs->trans("NAccounts", $nbofaccountintogroup).')</span>';
//} else {
// print ' <span class="opacitymedium">(0)</span>';
//}
}
print '</td>';
}
print "</tr>\n";
$i++;
}
} else {
$colspan = 10;
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
} else {
dol_print_error($db);
@@ -987,14 +908,20 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co
print '<td><input type="text" class="flat minwidth100" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
} else {
print '<td>';
$class = '';
if (in_array($fieldlist[$field], array('code', 'range_account', 'label', 'formula'))) {
$size = ''; $class = '';
if ($fieldlist[$field] == 'code') {
$class = 'maxwidth100';
}
if ($fieldlist[$field] == 'position') {
$class = 'maxwidth50';
}
print '<input type="text" class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
if ($fieldlist[$field] == 'libelle') {
$class = 'quatrevingtpercent';
}
if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'category_type') {
$size = 'size="2" ';
}
print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
print '</td>';
}
}

View File

@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@@ -78,26 +78,12 @@ if ($mysoc->isInEEC()) {
$list_account[] = 'ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT';
$list_account[] = '---Others---';
$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_SOLD_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';
}
if (isModEnabled('banque')) {
$list_account[] = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
}
if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
$list_account[] = 'ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY';
}
if (isModEnabled('don')) {
$list_account[] = 'DONATION_ACCOUNTINGACCOUNT';
}
@@ -117,7 +103,6 @@ if (isModEnabled('societe')) {
/*
* Actions
*/
if ($action == 'update') {
$error = 0;
// Process $list_account_main
@@ -265,8 +250,6 @@ 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)) {

View File

@@ -49,18 +49,6 @@ 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();
@@ -69,6 +57,24 @@ 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
@@ -98,7 +104,7 @@ $sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
if (empty($conf->global->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
@@ -131,7 +137,7 @@ 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("Status").'</td>';
print '<td class="right">'.$langs->trans("Statut").'</td>';
print '</tr>';
if ($num) {
@@ -140,8 +146,6 @@ if ($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;
@@ -154,12 +158,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->status, 5).'</td>';
print '<td class="right">'.$fiscalyearstatic->LibStatut($obj->statut, 5).'</td>';
print '</tr>';
$i++;
}
} else {
print '<tr class="oddeven"><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
print '<tr class="oddeven"><td colspan="7" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
print '</table>';
print '</div>';

View File

@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@@ -66,7 +66,12 @@ $error = 0;
* Actions
*/
if (in_array($action, array('setBANK_DISABLE_DIRECT_INPUT', 'setACCOUNTANCY_COMBO_FOR_AUX', 'setACCOUNTING_MANAGE_ZERO'))) {
if (in_array($action, array(
'setBANK_DISABLE_DIRECT_INPUT',
'setACCOUNTANCY_COMBO_FOR_AUX',
'setACCOUNTING_MANAGE_ZERO',
'setACCOUNTING_LIST_SORT_VENTILATION_TODO',
'setACCOUNTING_LIST_SORT_VENTILATION_DONE'))) {
$constname = preg_replace('/^set/', '', $action);
$constvalue = GETPOST('value', 'int');
$res = dolibarr_set_const($db, $constname, $constvalue, 'yesno', 0, '', $conf->entity);
@@ -116,6 +121,34 @@ if ($action == 'update') {
}
}
if ($action == 'setlistsorttodo') {
$setlistsorttodo = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
if ($action == 'setlistsortdone') {
$setlistsortdone = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
if ($action == 'setmanagezero') {
$setmanagezero = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity);
@@ -242,19 +275,6 @@ if ($action == 'setenableautolettering') {
}
}
if ($action == 'setenablevatreversecharge') {
$setenablevatreversecharge = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE", $setenablevatreversecharge, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
/*
* View
@@ -361,7 +381,7 @@ print '</tr>';
foreach ($list as $key) {
print '<tr class="oddeven value">';
if (getDolGlobalInt('ACCOUNTING_MANAGE_ZERO') && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) {
if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) {
continue;
}
@@ -384,6 +404,33 @@ print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans('BindingOptions').'</td>';
print "</tr>\n";
// TO DO Mutualize code for yes/no constants
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO").'</td>';
if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_TODO&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_TODO&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE").'</td>';
if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_DONE&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_DONE&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
// Param a user $user->rights->accounting->chartofaccount can access
foreach ($list_binding as $key) {
print '<tr class="oddeven value">';
@@ -394,10 +441,10 @@ foreach ($list_binding as $key) {
// Value
print '<td class="right">';
if ($key == 'ACCOUNTING_DATE_START_BINDING') {
print $form->selectDate((getDolGlobalInt($key) ? (int) getDolGlobalInt($key) : -1), $key, 0, 0, 1);
print $form->selectDate((!empty($conf->global->$key) ? $db->idate($conf->global->$key) : -1), $key, 0, 0, 1);
} elseif ($key == 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER') {
$array = array(0=>$langs->trans("PreviousMonth"), 1=>$langs->trans("CurrentMonth"), 2=>$langs->trans("Fiscalyear"));
print $form->selectarray($key, $array, getDolGlobalInt('ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER', 0), 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage');
print $form->selectarray($key, $array, (isset($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER) ? $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER : 0), 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage');
} else {
print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
}
@@ -448,20 +495,14 @@ print '</tr>';
print '</table>';
print '<br>';
// Show advanced options
print '<br>';
// Advanced params
// Lettering params
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td colspan="2">' . $langs->trans('OptionsAdvanced') . '</td>';
print '<td colspan="2">'.$langs->trans('Options').' '.$langs->trans('Lettering').'</td>';
print "</tr>\n";
print '<tr class="oddeven">';
print '<td>';
print $form->textwithpicto($langs->trans("ACCOUNTING_ENABLE_LETTERING"), $langs->trans("ACCOUNTING_ENABLE_LETTERING_DESC", $langs->transnoentitiesnoconv("NumMvts")).'<br>'.$langs->trans("EnablingThisFeatureIsNotNecessary")).'</td>';
print '<td>'.$langs->trans("ACCOUNTING_ENABLE_LETTERING").'</td>';
if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
@@ -475,8 +516,7 @@ print '</tr>';
if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
print '<tr class="oddeven">';
print '<td>';
print $form->textwithpicto($langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING"), $langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING_DESC")) . '</td>';
print '<td>' . $langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING") . '</td>';
if (!empty($conf->global->ACCOUNTING_ENABLE_AUTOLETTERING)) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenableautolettering&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
@@ -489,23 +529,8 @@ if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
print '</tr>';
}
print '<tr class="oddeven">';
print '<td>';
print $form->textwithpicto($langs->trans("ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE"), $langs->trans("ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE_DESC", $langs->transnoentities("MenuDefaultAccounts"))).'</td>';
if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenablevatreversecharge&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenablevatreversecharge&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
print '</table>';
print '<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans('Modify').'"></div>';
print '</form>';

View File

@@ -431,9 +431,9 @@ if ($id) {
print '<td>';
print '<input type="hidden" name="id" value="'.$id.'">';
print '</td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
print '<td style="min-width: 26px;"></td>';
print '<td style="min-width: 26px;"></td>';
print '<td style="min-width: 26px;"></td>';
print '</tr>';
// Line to enter new values
@@ -587,8 +587,7 @@ if ($id) {
foreach ($fieldlist as $field => $value) {
$showfield = 1;
$class = "left";
$tmpvar = $fieldlist[$field];
$valuetoshow = $obj->$tmpvar;
$valuetoshow = $obj->{$fieldlist[$field]};
if ($valuetoshow == 'all') {
$valuetoshow = $langs->trans('All');
} elseif ($fieldlist[$field] == 'nature' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') {

View File

@@ -52,13 +52,11 @@ 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');
@@ -80,6 +78,7 @@ $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';
@@ -195,7 +194,7 @@ if ($action == 'update') {
}
if ($result <= 0) {
// setEventMessages(null, $accounting->errors, 'errors');
$msg .= '<div><span class="error">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br> <pre>'.$sql.'</pre></span></div>';
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br> <pre>'.$sql.'</pre></span></div>';
$ko++;
} else {
$sql = '';
@@ -204,7 +203,7 @@ if ($action == 'update') {
$sql_exists .= " WHERE fk_product = " . ((int) $productid) . " AND entity = " . ((int) $conf->entity);
$resql_exists = $db->query($sql_exists);
if (!$resql_exists) {
$msg .= '<div><span class="error">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br> <pre>'.$resql_exists.'</pre></span></div>';
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br> <pre>'.$resql_exists.'</pre></span></div>';
$ko++;
} else {
$nb_exists = $db->num_rows($resql_exists);
@@ -395,7 +394,7 @@ if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
if (empty($conf->global->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
@@ -417,7 +416,7 @@ if ($resql) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit);
$param .= '&limit='.urlencode($limit);
}
if ($searchCategoryProductOperator == 1) {
$param .= "&search_category_product_operator=".urlencode($searchCategoryProductOperator);
@@ -468,24 +467,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" 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 '<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 '<td>'.$langs->trans('OptionModeProductSellDesc');
print "</td></tr>\n";
if ($mysoc->isInEEC()) {
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 '<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 '<td>'.$langs->trans('OptionModeProductSellIntraDesc');
print "</td></tr>\n";
}
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 '<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 '<td>'.$langs->trans('OptionModeProductSellExportDesc');
print "</td></tr>\n";
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 '<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 '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
if ($mysoc->isInEEC()) {
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 '<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 '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
}
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 '<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 '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
print "</table>\n";
@@ -529,11 +528,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" 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 .= ' <input type="checkbox" class="valignmiddle" name="search_category_product_operator" value="1"'.($searchCategoryProductOperator == 1 ? ' checked="checked"' : '').'/> <span class="none">'.$langs->trans('UseOrOperatorForCategories').'</span>';
$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"' : '').'>';
@@ -559,16 +558,9 @@ 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" name="search_vat" placeholder="%" value="'.dol_escape_htmltag($search_vat).'"></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>';
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>';
@@ -587,21 +579,13 @@ 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">&nbsp;</td>';
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center liste_titre">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
}
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)) {
@@ -616,11 +600,8 @@ 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");
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
$clickpitco = $form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($clickpitco, '', '', '', '', '', '', '', 'center ');
}
$clickpitco = $form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($clickpitco, '', '', '', '', '', '', '', 'center ');
print '</tr>';
$product_static = new Product($db);
@@ -700,22 +681,8 @@ 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>';
@@ -863,13 +830,16 @@ if ($resql) {
print '</td>';
}
// 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>';
if (!empty($chk_prod)) {
$ischecked = 0;
if (in_array($product_static->id, $chk_prod)) {
$ischecked=true;
}
}
// 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++;
}

View File

@@ -19,18 +19,17 @@
/**
* \file htdocs/accountancy/admin/subaccount.php
* \ingroup Accountancy (Double entries)
* \brief List of accounting sub-account (auxiliary accounts)
* \ingroup Accountancy (Double entries)
* \brief List of accounting sub-account (auxiliary accounts)
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("accountancy", "admin", "bills", "compta", "errors", "hrm", "salaries"));
$langs->loadLangs(array("compta", "bills", "admin", "accountancy", "salaries", "hrm", "errors"));
$mesg = '';
$action = GETPOST('action', 'aZ09');
@@ -39,7 +38,6 @@ $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');
@@ -79,11 +77,10 @@ $arrayfields = array(
'reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1)
);
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
unset($arrayfields['reconcilable']);
}
/*
* Actions
*/
@@ -123,23 +120,21 @@ if (empty($reshook)) {
$form = new Form($db);
// Page Header
$help_url = 'EN:Module_Double_Entry_Accounting#Setup';
$help_url = '';
$title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger');
llxHeader('', $title, $help_url);
// Customer
$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '1' as type, sa.entity, sa.client as nature";
$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '1' as type, sa.entity";
$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 (getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) {
$lengthpaddingaccount = getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT');
if ($conf->global->ACCOUNTING_LENGTH_AACCOUNT) {
$lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_AACCOUNT);
}
$search_subaccount_tmp = $search_subaccount;
$weremovedsomezero = 0;
@@ -179,14 +174,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, '0' as nature 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 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 (getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) {
$lengthpaddingaccount = getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT');
if ($conf->global->ACCOUNTING_LENGTH_AACCOUNT) {
$lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_AACCOUNT);
}
$search_subaccount_tmp = $search_subaccount;
$weremovedsomezero = 0;
@@ -224,16 +219,16 @@ if (!empty($search_type) && $search_type >= 0) {
$sql .= " HAVING type LIKE '".$db->escape($search_type)."'";
}
// User - Employee
// User
$sql .= " UNION ";
$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 .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '3' as type, u.entity 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 (getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) {
$lengthpaddingaccount = getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT');
if ($conf->global->ACCOUNTING_LENGTH_AACCOUNT) {
$lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_AACCOUNT);
}
$search_subaccount_tmp = $search_subaccount;
$weremovedsomezero = 0;
@@ -275,7 +270,7 @@ $sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
if (empty($conf->global->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
@@ -297,7 +292,7 @@ if ($resql) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit);
$param .= '&limit='.urlencode($limit);
}
if ($search_subaccount) {
$param .= '&search_subaccount='.urlencode($search_subaccount);
@@ -309,9 +304,6 @@ 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.'">';
@@ -328,8 +320,7 @@ if ($resql) {
print '<div class="info">'.$langs->trans("WarningCreateSubAccounts").'</div>';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$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) : '');
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$moreforfilter = '';
$massactionbutton = '';
@@ -339,13 +330,6 @@ 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>';
}
@@ -360,20 +344,13 @@ if ($resql) {
print '<td class="liste_titre">&nbsp;</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 '<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);
}
@@ -388,10 +365,7 @@ if ($resql) {
print_liste_field_titre($arrayfields['reconcilable']['label'], $_SERVER["PHP_SELF"], 'reconcilable', '', $param, '', $sortfield, $sortorder, 'center ');
}
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "</tr>\n";
$totalarray = array();
@@ -402,28 +376,6 @@ 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>";
@@ -437,7 +389,7 @@ if ($resql) {
// Subaccount label
if (!empty($arrayfields['label']['checked'])) {
print "<td>";
print dol_escape_htmltag($obj->label);
print $obj->label;
print "</td>\n";
if (!$i) {
$totalarray['nbfield']++;
@@ -448,7 +400,6 @@ if ($resql) {
if (!empty($arrayfields['type']['checked'])) {
print '<td class="center">';
$s = '';
// Customer
if ($obj->type == 1) {
$s .= '<a class="customer-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->rowid.'">'.$langs->trans("Customer").'</a>';
@@ -456,13 +407,10 @@ if ($resql) {
// Supplier
$s .= '<a class="vendor-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->rowid.'">'.$langs->trans("Supplier").'</a>';
} elseif ($obj->type == 3) {
// User - Employee
// User
$s .= '<a class="user-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->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']++;
@@ -489,43 +437,29 @@ if ($resql) {
}
}
// 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']++;
}
// Action
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
$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);

View File

@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
@@ -42,26 +42,7 @@ $langs->loadLangs(array("accountancy", "compta"));
$action = GETPOST('action', 'aZ09');
$optioncss = GETPOST('optioncss', 'alpha');
$type = GETPOST('type', 'alpha');
if ($type == 'sub') {
$context_default = 'balancesubaccountlist';
} else {
$context_default = 'balancelist';
}
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : $context_default;
$show_subgroup = GETPOST('show_subgroup', 'alpha');
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
$search_date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
$search_ledger_code = GETPOST('search_ledger_code', 'array');
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
if ($search_accountancy_code_start == - 1) {
$search_accountancy_code_start = '';
}
$search_accountancy_code_end = GETPOST('search_accountancy_code_end', 'alpha');
if ($search_accountancy_code_end == - 1) {
$search_accountancy_code_end = '';
}
$search_not_reconciled = GETPOST('search_not_reconciled', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ09');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
@@ -74,16 +55,25 @@ if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST(
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if ($sortorder == "") {
$sortorder = "ASC";
//if (! $sortfield) $sortfield="p.date_fin";
//if (! $sortorder) $sortorder="DESC";
$show_subgroup = GETPOST('show_subgroup', 'alpha');
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
$search_date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
$search_ledger_code = GETPOST('search_ledger_code', 'array');
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
if ($search_accountancy_code_start == - 1) {
$search_accountancy_code_start = '';
}
if ($sortfield == "") {
$sortfield = "t.numero_compte";
$search_accountancy_code_end = GETPOST('search_accountancy_code_end', 'alpha');
if ($search_accountancy_code_end == - 1) {
$search_accountancy_code_end = '';
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new BookKeeping($db);
$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('balancelist')); // Note that conf->hooks_modules contains array
$formaccounting = new FormAccounting($db);
$formother = new FormOther($db);
@@ -94,7 +84,6 @@ if (empty($search_date_start) && !GETPOSTISSET('formfilteraction')) {
$sql .= " WHERE date_start < '".$db->idate(dol_now())."' AND date_end > '".$db->idate(dol_now())."'";
$sql .= $db->plimit(1);
$res = $db->query($sql);
if ($res->num_rows > 0) {
$fiscalYear = $db->fetch_object($res);
$search_date_start = strtotime($fiscalYear->date_start);
@@ -115,6 +104,45 @@ if (empty($search_date_start) && !GETPOSTISSET('formfilteraction')) {
$search_date_end = dol_get_last_day($year_end, $month_end);
}
}
if ($sortorder == "") {
$sortorder = "ASC";
}
if ($sortfield == "") {
$sortfield = "t.numero_compte";
}
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
$filter = array();
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');
}
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');
}
if (!empty($search_accountancy_code_start)) {
$filter['t.numero_compte>='] = $search_accountancy_code_start;
$param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
}
if (!empty($search_accountancy_code_end)) {
$filter['t.numero_compte<='] = $search_accountancy_code_end;
$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
}
if (!empty($search_ledger_code)) {
$filter['t.code_journal'] = $search_ledger_code;
foreach ($search_ledger_code as $code) {
$param .= '&search_ledger_code[]='.urlencode($code);
}
}
if (!isModEnabled('accounting')) {
accessforbidden();
@@ -126,13 +154,14 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
accessforbidden();
}
/*
* Action
*/
$param = '';
$parameters = array('socid'=>$socid);
$parameters = array();
$arrayfields = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@@ -143,71 +172,17 @@ if (empty($reshook)) {
$show_subgroup = '';
$search_date_start = '';
$search_date_end = '';
$search_date_startyear = '';
$search_date_startmonth = '';
$search_date_startday = '';
$search_date_endyear = '';
$search_date_endmonth = '';
$search_date_endday = '';
$search_accountancy_code_start = '';
$search_accountancy_code_end = '';
$search_not_reconciled = '';
$search_ledger_code = array();
$filter = array();
}
// Must be after the remove filter action, before the export.
$filter = array();
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');
}
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');
}
if (!empty($search_doc_date)) {
$filter['t.doc_date'] = $search_doc_date;
$param .= '&doc_datemonth=' . GETPOST('doc_datemonth', 'int') . '&doc_dateday=' . GETPOST('doc_dateday', 'int') . '&doc_dateyear=' . GETPOST('doc_dateyear', 'int');
}
if (!empty($search_accountancy_code_start)) {
if ($type == 'sub') {
$filter['t.subledger_account>='] = $search_accountancy_code_start;
} else {
$filter['t.numero_compte>='] = $search_accountancy_code_start;
}
$param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start);
}
if (!empty($search_accountancy_code_end)) {
if ($type == 'sub') {
$filter['t.subledger_account<='] = $search_accountancy_code_end;
} else {
$filter['t.numero_compte<='] = $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;
foreach ($search_ledger_code as $code) {
$param .= '&search_ledger_code[]=' . urlencode($code);
}
}
if (!empty($search_not_reconciled)) {
$filter['t.reconciled_option'] = $search_not_reconciled;
$param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
}
if (!empty($show_subgroup)) {
$param .= '&show_subgroup='.urlencode($show_subgroup);
}
// param with type of list
$url_param = substr($param, 1); // remove first "&"
if (!empty($type)) {
$param = '&type=' . $type . $param;
}
}
/*
* View
*/
if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
@@ -215,23 +190,14 @@ if ($action == 'export_csv') {
$type_export = 'balance';
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
if ($type == 'sub') {
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter, 'AND', 1);
} else {
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter);
}
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
foreach ($object->lines as $line) {
if ($type == 'sub') {
print '"' . length_accounta($line->subledger_account) . '"' . $sep;
print '"' . $line->subledger_label . '"' . $sep;
} else {
print '"' . length_accountg($line->numero_compte) . '"' . $sep;
print '"' . $object->get_compte_desc($line->numero_compte) . '"' . $sep;
}
print '"'.length_accountg($line->numero_compte).'"'.$sep;
print '"'.$object->get_compte_desc($line->numero_compte).'"'.$sep;
print '"'.price($line->debit).'"'.$sep;
print '"'.price($line->credit).'"'.$sep;
print '"'.price($line->debit - $line->credit).'"'.$sep;
@@ -241,15 +207,8 @@ if ($action == 'export_csv') {
exit;
}
/*
* View
*/
if ($type == 'sub') {
$title_page = $langs->trans("AccountBalanceSubAccount");
} else {
$title_page = $langs->trans("AccountBalance");
}
$title_page = $langs->trans("AccountBalance");
llxHeader('', $title_page);
@@ -257,57 +216,44 @@ llxHeader('', $title_page);
if ($action != 'export_csv') {
// List
$nbtotalofrecords = '';
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
if ($type == 'sub') {
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter, 'AND', 1);
} else {
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
}
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
if ($nbtotalofrecords < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
if ($type == 'sub') {
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 1);
} else {
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter);
}
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" id="action" value="list">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="type" value="'.$type.'">';
print '<input type="hidden" name="action" id="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
$newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
$button = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
if (empty($reshook)) {
$newcardbutton .= '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
$button .= '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
print '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#exportcsvbutton").click(function(event) {
jQuery("#exportcsvbutton").click(function() {
event.preventDefault();
console.log("Set action to export_csv");
jQuery("#action").val("export_csv");
@@ -316,32 +262,12 @@ if ($action != 'export_csv') {
});
});
</script>';
if ($type == 'sub') {
$newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
$newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
} else {
$newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
}
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit);
}
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
$selectedfields = '';
// Warning to explain why list of record is not consistent with the other list view (missing a lot of lines)
if ($type == 'sub') {
print info_admin($langs->trans("WarningRecordWithoutSubledgerAreExcluded"));
}
$moreforfilter = '';
$moreforfilter .= '<div class="divsearchfield">';
@@ -349,42 +275,20 @@ if ($action != 'export_csv') {
$moreforfilter .= $form->selectDate($search_date_start ? $search_date_start : -1, 'date_start', 0, 0, 1, '', 1, 0);
$moreforfilter .= $langs->trans('DateEnd').': ';
$moreforfilter .= $form->selectDate($search_date_end ? $search_date_end : -1, 'date_end', 0, 0, 1, '', 1, 0);
$moreforfilter .= '</div>';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= ' - ';
$moreforfilter .= '<label for="show_subgroup">'.$langs->trans('ShowSubtotalByGroup').'</label>: ';
$moreforfilter .= '<input type="checkbox" name="show_subgroup" id="show_subgroup" value="show_subgroup"'.($show_subgroup == 'show_subgroup' ? ' checked' : '').'>';
$moreforfilter .= '</div>';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans("Journals").': ';
$moreforfilter .= $langs->trans("Journal");
$moreforfilter .= $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1);
$moreforfilter .= '</div>';
$moreforfilter .= '</br>';
$moreforfilter .= '<div class="divsearchfield">';
// Accountancy account
$moreforfilter .= $langs->trans('AccountAccounting').': ';
if ($type == 'sub') {
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), 'maxwidth200');
} else {
$moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, 'maxwidth200', 'accounts');
}
$moreforfilter .= ' ';
if ($type == 'sub') {
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), 'maxwidth200');
} else {
$moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, 'maxwidth200', 'accounts');
}
$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">';
print $moreforfilter;
@@ -400,15 +304,10 @@ 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 $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, '', 'accounts');
print ' ';
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, '', 'accounts');
print '</td>';
// Fields from hook
@@ -417,28 +316,19 @@ if ($action != 'export_csv') {
print $hookmanager->resPrint;
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
}
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') {
// print_liste_field_titre("Type", $_SERVER['PHP_SELF'], "t.type", "", $param, "", $sortfield, $sortorder);
//}
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
print_liste_field_titre("OpeningBalance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder);
}
print_liste_field_titre("AccountingDebit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("AccountingCredit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder);
// Hook fields
@@ -446,9 +336,7 @@ 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
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
}
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
print '</tr>'."\n";
$total_debit = 0;
@@ -471,7 +359,7 @@ if ($action != 'export_csv') {
$sql .= " GROUP BY t.numero_compte";
$resql = $db->query($sql);
$nrows = $resql->num_rows;
$nrows = $db->num_rows($resql);
$opening_balances = array();
for ($i = 0; $i < $nrows; $i++) {
$arr = $resql->fetch_array();
@@ -484,13 +372,11 @@ if ($action != 'export_csv') {
$accountingaccountstatic->id = 0;
$accountingaccountstatic->account_number = '';
if ($type != 'sub') {
$accountingaccountstatic->fetch(null, $line->numero_compte, true);
if (!empty($accountingaccountstatic->account_number)) {
$accounting_account = $accountingaccountstatic->getNomUrl(0, 1, 1);
} else {
$accounting_account = length_accountg($line->numero_compte);
}
$accountingaccountstatic->fetch(null, $line->numero_compte, true);
if (!empty($accountingaccountstatic->account_number)) {
$accounting_account = $accountingaccountstatic->getNomUrl(0, 1, 0, '', 0, -1, 0, 'accountcard');
} else {
$accounting_account = length_accountg($line->numero_compte);
}
$link = '';
@@ -552,51 +438,19 @@ 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>';
} else {
print '<td>'.$accounting_account.'</td>';
}
// Type
// TODO Retrieve the type of third party: Customer / Supplier / Employee
//if ($type == 'sub') {
// print '<td></td>';
//}
print '<td>'.$accounting_account.'</td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
print '<td class="right nowraponall amount">'.price(price2num($opening_balance, 'MT')).'</td>';
}
$urlzoom = '';
if ($type == 'sub') {
if ($line->subledger_account) {
$urlzoom = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?type=sub&search_accountancy_code_start=' . urlencode($line->subledger_account) . '&search_accountancy_code_end=' . urlencode($line->subledger_account);
if (GETPOSTISSET('date_startmonth')) {
$urlzoom .= '&search_date_startmonth=' . GETPOST('date_startmonth', 'int') . '&search_date_startday=' . GETPOST('date_startday', 'int') . '&search_date_startyear=' . GETPOST('date_startyear', 'int');
}
if (GETPOSTISSET('date_endmonth')) {
$urlzoom .= '&search_date_endmonth=' . GETPOST('date_endmonth', 'int') . '&search_date_endday=' . GETPOST('date_endday', 'int') . '&search_date_endyear=' . GETPOST('date_endyear', 'int');
}
if ($line->numero_compte) {
$urlzoom = DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start='.urlencode($line->numero_compte).'&search_accountancy_code_end='.urlencode($line->numero_compte);
if (GETPOSTISSET('date_startmonth')) {
$urlzoom .= '&search_date_startmonth='.GETPOST('date_startmonth', 'int').'&search_date_startday='.GETPOST('date_startday', 'int').'&search_date_startyear='.GETPOST('date_startyear', 'int');
}
} else {
if ($line->numero_compte) {
$urlzoom = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start=' . urlencode($line->numero_compte) . '&search_accountancy_code_end=' . urlencode($line->numero_compte);
if (GETPOSTISSET('date_startmonth')) {
$urlzoom .= '&search_date_startmonth=' . GETPOST('date_startmonth', 'int') . '&search_date_startday=' . GETPOST('date_startday', 'int') . '&search_date_startyear=' . GETPOST('date_startyear', 'int');
}
if (GETPOSTISSET('date_endmonth')) {
$urlzoom .= '&search_date_endmonth=' . GETPOST('date_endmonth', 'int') . '&search_date_endday=' . GETPOST('date_endday', 'int') . '&search_date_endyear=' . GETPOST('date_endyear', 'int');
}
if (GETPOSTISSET('date_endmonth')) {
$urlzoom .= '&search_date_endmonth='.GETPOST('date_endmonth', 'int').'&search_date_endday='.GETPOST('date_endday', 'int').'&search_date_endyear='.GETPOST('date_endyear', 'int');
}
}
// Debit
@@ -609,14 +463,9 @@ if ($action != 'export_csv') {
} else {
print '<td class="right nowraponall amount">'.price(price2num($line->debit - $line->credit, 'MT')).'</td>';
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">';
print $link;
print '</td>';
}
print '<td class="center">';
print $link;
print '</td>';
print "</tr>\n";
// Records the sub-total
@@ -626,12 +475,7 @@ if ($action != 'export_csv') {
}
if (!empty($show_subgroup)) {
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>';
print '<tr class="liste_total"><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>';
}
@@ -642,19 +486,11 @@ if ($action != 'export_csv') {
} else {
print '<td class="right nowraponall amount">' . price(price2num($sous_total_debit - $sous_total_credit, 'MT')) . '</td>';
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print "<td></td>\n";
}
print "<td></td>\n";
print '</tr>';
}
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>';
print '<tr class="liste_total"><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>';
}
@@ -665,10 +501,7 @@ if ($action != 'export_csv') {
} else {
print '<td class="right nowraponall amount">' . price(price2num($total_debit - $total_credit, 'MT')) . '</td>';
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print "<td></td>\n";
}
print "<td></td>\n";
print '</tr>';
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);

View File

@@ -497,7 +497,7 @@ if ($action == 'create') {
// Ref document
print '<tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Piece');
print '</td>';
if ($action != 'editdocref') {
@@ -612,7 +612,7 @@ if ($action == 'create') {
print dol_get_fiche_end();
print '<div class="clearboth"></div>';
print '<div style="clear:both"></div>';
print '<br>';

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,9 @@
<?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2022 Lionel Vessiller <lvessiller@open-dsi.fr>
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022 Progiseize <a.bisotti@progiseize.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,6 +27,7 @@
// 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';
@@ -95,9 +94,15 @@ $search_date_validation_start = dol_mktime(0, 0, 0, $search_date_validation_star
$search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear);
$search_import_key = GETPOST("search_import_key", 'alpha');
$search_account_category = GETPOST('search_account_category', 'int');
//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_accountancy_code = GETPOST("search_accountancy_code", 'alpha');
$search_accountancy_code = GETPOST("search_accountancy_code");
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
if ($search_accountancy_code_start == - 1) {
$search_accountancy_code_start = '';
@@ -150,7 +155,7 @@ $hookmanager->initHooks(array('bookkeepinglist'));
$formaccounting = new FormAccounting($db);
$form = new Form($db);
if (!in_array($action, array('delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->hasRight('accounting', 'mouvements', 'export')) {
if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->hasRight('accounting', 'mouvements', 'export')) {
if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values') && !GETPOST('search_accountancy_code_start')) {
$query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$query .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";
@@ -192,8 +197,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'=>0),
't.date_validated'=>array('label'=>$langs->trans("DateValidationAndLock"), 'checked'=>0, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
'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.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100),
);
@@ -201,6 +206,13 @@ 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')) {
@@ -241,7 +253,6 @@ if (empty($reshook)) {
$search_doc_type = '';
$search_doc_ref = '';
$search_doc_date = '';
$search_account_category = '';
$search_accountancy_code = '';
$search_accountancy_code_start = '';
$search_accountancy_code_end = '';
@@ -324,20 +335,6 @@ if (empty($reshook)) {
$filter['t.doc_ref'] = $search_doc_ref;
$param .= '&search_doc_ref='.urlencode($search_doc_ref);
}
if ($search_account_category != '-1' && !empty($search_account_category)) {
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php';
$accountingcategory = new AccountancyCategory($db);
$listofaccountsforgroup = $accountingcategory->getCptsCat(0, 'fk_accounting_category = '.((int) $search_account_category));
$listofaccountsforgroup2 = array();
if (is_array($listofaccountsforgroup)) {
foreach ($listofaccountsforgroup as $tmpval) {
$listofaccountsforgroup2[] = "'".$db->escape($tmpval['account_number'])."'";
}
}
$filter['t.search_accounting_code_in'] = join(',', $listofaccountsforgroup2);
$param .= '&search_account_category='.urlencode($search_account_category);
}
if (!empty($search_accountancy_code)) {
$filter['t.numero_compte'] = $search_accountancy_code;
$param .= '&search_accountancy_code='.urlencode($search_accountancy_code);
@@ -441,12 +438,55 @@ 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';
$permissiontoread = $user->hasRight('societe', 'lire');
$permissiontodelete = $user->hasRight('societe', 'supprimer');
$permissiontoadd = $user->hasRight('societe', 'creer');
$permissiontoadd = $user->rights->societe->creer;
$uploaddir = $conf->societe->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
@@ -606,9 +646,6 @@ $sql .= " t.tms as date_modification,";
$sql .= " t.date_export,";
$sql .= " t.date_validated as date_validation,";
$sql .= " t.import_key";
$sqlfields = $sql; // $sql fields to remove for count total
$sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t';
// Manage filter
$sqlwhere = array();
@@ -639,25 +676,105 @@ if (count($filter) > 0) {
} elseif ($key == 't.reconciled_option') {
$sqlwhere[] = 't.lettering_code IS NULL';
} elseif ($key == 't.code_journal' && !empty($value)) {
if (is_array($value)) {
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
} else {
$sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
}
} elseif ($key == 't.search_accounting_code_in' && !empty($value)) {
$sqlwhere[] = 't.numero_compte IN ('.$db->sanitize($value, 1).')';
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 4, 1);
} else {
$sqlwhere[] = natural_search($key, $value, 0, 1);
}
}
}
$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);
}
if (!empty($sortfield)) {
$sql .= $db->order($sortfield, $sortorder);
}
//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);
$notexportlettering = GETPOST('notexportlettering', 'alpha');
if (!empty($notexportlettering)) {
if (is_array($object->lines)) {
foreach ($object->lines as $k => $movement) {
unset($object->lines[$k]->lettering_code);
unset($object->lines[$k]->date_lettering);
}
}
}
$mimetype = $accountancyexport->getMimeType($formatexportset);
top_httphead($mimetype, 1);
// Output data on screen
$accountancyexport->export($object->lines, $formatexportset);
$notifiedexportdate = GETPOST('notifiedexportdate', 'alpha');
$notifiedvalidationdate = GETPOST('notifiedvalidationdate', 'alpha');
if (!empty($accountancyexport->errors)) {
dol_print_error('', '', $accountancyexport->errors);
} elseif (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) {
// Specify as export : update field date_export or date_validated
$error = 0;
$db->begin();
if (is_array($object->lines)) {
foreach ($object->lines as $movement) {
$now = dol_now();
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
$sql .= " SET";
if (!empty($notifiedexportdate) && !empty($notifiedvalidationdate)) {
$sql .= " date_export = '".$db->idate($now)."'";
$sql .= ", date_validated = '".$db->idate($now)."'";
} elseif (!empty($notifiedexportdate)) {
$sql .= " date_export = '".$db->idate($now)."'";
} elseif (!empty($notifiedvalidationdate)) {
$sql .= " date_validated = '".$db->idate($now)."'";
}
$sql .= " WHERE rowid = ".((int) $movement->id);
dol_syslog("/accountancy/bookkeeping/list.php Function export_file Specify movements as exported", LOG_DEBUG);
$result = $db->query($sql);
if (!$result) {
$error++;
break;
}
}
}
if (!$error) {
$db->commit();
} else {
$error++;
$db->rollback();
dol_print_error('', $langs->trans("NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated"));
}
}
exit;
}
}
/*
* View
*/
@@ -669,38 +786,28 @@ $title_page = $langs->trans("Operations").' - '.$langs->trans("Journals");
// Count total nb of records
$nbtotalofrecords = '';
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);
$resql = $db->query($sqlforcount);
if ($resql) {
$objforcount = $db->fetch_object($resql);
$nbtotalofrecords = $objforcount->nbtotalofrecords;
} else {
dol_print_error($db);
}
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
$page = 0;
$offset = 0;
}
$db->free($resql);
}
// Complete request and execute it with limit
$sql .= $db->order($sortfield, $sortorder);
if ($limit) {
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) {
$num = $nbtotalofrecords;
} else {
$sql .= $db->plimit($limit + 1, $offset);
}
$resql = $db->query($sql);
if (!$resql) {
dol_print_error($db);
exit;
}
$resql = $db->query($sql);
if (!$resql) {
dol_print_error($db);
exit;
}
$num = $db->num_rows($resql);
$num = $db->num_rows($resql);
}
$arrayofselected = is_array($toselect) ? $toselect : array();
@@ -711,6 +818,99 @@ llxHeader('', $title_page);
$formconfirm = '';
if ($action == 'export_file') {
$form_question = array();
$form_question['notexportlettering'] = array(
'name' => 'notexportlettering',
'type' => 'other',
'label' => '', // TODO Use Selectmodelcsv and show a select combo
'value' => $langs->trans('Modelcsv').' : <b>'.$listofformat[$formatexportset].'</b>'
);
$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');
}
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").'...', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 350, 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;
@@ -719,12 +919,12 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit);
$param .= '&limit='.urlencode($limit);
}
// List of mass actions available
$arrayofmassactions = array();
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->rights->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');
@@ -764,6 +964,21 @@ 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 : '').'">'.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 : '').'">'.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 : ''), $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'));
@@ -798,25 +1013,15 @@ if ($massactionbutton && $contextpage != 'poslist') {
}
$moreforfilter = '';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('AccountingCategory').': ';
$moreforfilter .= '<div class="nowrap inline-block">';
$moreforfilter .= $formaccounting->select_accounting_category($search_account_category, 'search_account_category', 1, 0, 0, 0);
$moreforfilter .= '</div>';
$moreforfilter .= '</div>';
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$moreforfilter .= $hookmanager->resPrint;
} else {
$moreforfilter = $hookmanager->resPrint;
}
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
print '</div>';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">';
@@ -1092,9 +1297,6 @@ while ($i < min($num, $limit)) {
print '<input id="cb'.$line->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.'"'.($selected ? ' checked="checked"' : '').' />';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Piece number
@@ -1293,7 +1495,7 @@ while ($i < min($num, $limit)) {
}
if (!empty($arrayfields['t.import_key']['checked'])) {
print '<td class="center">'.$obj->import_key."</td>\n";
print '<td class="tdoverflowmax100">'.$obj->import_key."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
@@ -1310,11 +1512,11 @@ while ($i < min($num, $limit)) {
print '<input id="cb'.$line->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.'"'.($selected ? ' checked="checked"' : '').' />';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!$i) {
$totalarray['nbfield']++;
}
print "</tr>\n";
@@ -1342,6 +1544,13 @@ 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

View File

@@ -2,7 +2,7 @@
/* Copyright (C) 2016 Neil Orley <neil.orley@oeris.fr>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2020 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
@@ -79,8 +79,7 @@ $search_date_validation_start = dol_mktime(0, 0, 0, $search_date_validation_star
$search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear);
$search_import_key = GETPOST("search_import_key", 'alpha');
$search_account_category = GETPOST('search_account_category', 'int');
$search_accountancy_code = GETPOST("search_accountancy_code");
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
if ($search_accountancy_code_start == - 1) {
$search_accountancy_code_start = '';
@@ -227,7 +226,7 @@ if (empty($reshook)) {
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$search_doc_date = '';
$search_account_category = '';
$search_accountancy_code = '';
$search_accountancy_code_start = '';
$search_accountancy_code_end = '';
$search_label_account = '';
@@ -283,20 +282,6 @@ if (empty($reshook)) {
$filter['t.doc_date'] = $search_doc_date;
$param .= '&doc_datemonth='.GETPOST('doc_datemonth', 'int').'&doc_dateday='.GETPOST('doc_dateday', 'int').'&doc_dateyear='.GETPOST('doc_dateyear', 'int');
}
if ($search_account_category != '-1' && !empty($search_account_category)) {
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php';
$accountingcategory = new AccountancyCategory($db);
$listofaccountsforgroup = $accountingcategory->getCptsCat(0, 'fk_accounting_category = '.((int) $search_account_category));
$listofaccountsforgroup2 = array();
if (is_array($listofaccountsforgroup)) {
foreach ($listofaccountsforgroup as $tmpval) {
$listofaccountsforgroup2[] = "'".$db->escape($tmpval['account_number'])."'";
}
}
$filter['t.search_accounting_code_in'] = join(',', $listofaccountsforgroup2);
$param .= '&search_account_category='.urlencode($search_account_category);
}
if (!empty($search_accountancy_code_start)) {
if ($type == 'sub') {
$filter['t.subledger_account>='] = $search_accountancy_code_start;
@@ -375,13 +360,14 @@ if (empty($reshook)) {
$filter['t.import_key'] = $search_import_key;
$param .= '&search_import_key='.urlencode($search_import_key);
}
// param with type of list
$url_param = substr($param, 1); // remove first "&"
if (!empty($type)) {
$param = '&type='.$type.$param;
}
//if ($action == 'delbookkeepingyearconfirm' && $user->hasRight('accounting', 'mouvements', 'supprimer')_tous) {
//if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouvements->supprimer_tous) {
// $delmonth = GETPOST('delmonth', 'int');
// $delyear = GETPOST('delyear', 'int');
// if ($delyear == -1) {
@@ -413,7 +399,7 @@ if (empty($reshook)) {
$objectlabel = 'Bookkeeping';
$permissiontoread = $user->hasRight('societe', 'lire');
$permissiontodelete = $user->hasRight('societe', 'supprimer');
$permissiontoadd = $user->hasRight('societe', 'creer');
$permissiontoadd = $user->rights->societe->creer;
$uploaddir = $conf->societe->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
@@ -563,30 +549,26 @@ llxHeader('', $title_page);
// List
$nbtotalofrecords = '';
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
// TODO Perf Replace this by a count
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
if ($type == 'sub') {
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 1, 1);
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 1);
} else {
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 0, 1);
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter);
}
if ($nbtotalofrecords < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
if (!$error) {
if ($type == 'sub') {
$result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 1);
} else {
$result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 0);
}
if ($type == 'sub') {
$result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 1);
} else {
$result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter);
}
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
$arrayofselected = is_array($toselect) ? $toselect : array();
@@ -675,7 +657,7 @@ if ($reshook < 0) {
$newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
if (empty($reshook)) {
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
$newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
if ($type == 'sub') {
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?' . $url_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&' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
@@ -690,7 +672,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit);
$param .= '&limit='.urlencode($limit);
}
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
@@ -735,7 +717,7 @@ if ($type == 'sub') {
$moreforfilter = '';
// Search on accountancy custom groups or account
// Accountancy account
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('AccountAccounting').': ';
$moreforfilter .= '<div class="nowrap inline-block">';
@@ -753,13 +735,6 @@ if ($type == 'sub') {
$moreforfilter .= '</div>';
$moreforfilter .= '</div>';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('AccountingCategory').': ';
$moreforfilter .= '<div class="nowrap inline-block">';
$moreforfilter .= $formaccounting->select_accounting_category($search_account_category, 'search_account_category', 1, 0, 0, 0);
$moreforfilter .= '</div>';
$moreforfilter .= '</div>';
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
@@ -932,21 +907,6 @@ $sous_total_credit = 0;
$totalarray['val']['totaldebit'] = 0;
$totalarray['val']['totalcredit'] = 0;
$colspan = 0; // colspan before field 'label of operation'
$colspanend = 3; // colspan after debit/credit
if (!empty($arrayfields['t.piece_num']['checked'])) { $colspan++; }
if (!empty($arrayfields['t.code_journal']['checked'])) { $colspan++; }
if (!empty($arrayfields['t.doc_date']['checked'])) { $colspan++; }
if (!empty($arrayfields['t.doc_ref']['checked'])) { $colspan++; }
if (!empty($arrayfields['t.label_operation']['checked'])) { $colspan++; }
if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; }
if (!empty($arrayfields['t.date_validated']['checked'])) { $colspanend++; }
if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspanend++; }
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
$colspan++;
$colspanend--;
}
while ($i < min($num, $limit)) {
$line = $object->lines[$i];
@@ -960,6 +920,17 @@ while ($i < min($num, $limit)) {
}
//if (empty($accountg)) $accountg = '-';
$colspan = 0; // colspan before field 'label of operation'
$colspanend = 3; // colspan after debit/credit
if (!empty($arrayfields['t.piece_num']['checked'])) { $colspan++; }
if (!empty($arrayfields['t.code_journal']['checked'])) { $colspan++; }
if (!empty($arrayfields['t.doc_date']['checked'])) { $colspan++; }
if (!empty($arrayfields['t.doc_ref']['checked'])) { $colspan++; }
if (!empty($arrayfields['t.label_operation']['checked'])) { $colspan++; }
if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; }
if (!empty($arrayfields['t.date_validating']['checked'])) { $colspanend++; }
if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspanend++; }
// Is it a break ?
if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
// Show a subtotal by accounting account
@@ -970,8 +941,8 @@ while ($i < min($num, $limit)) {
} else {
print '<td class="right" colspan="' . $colspan . '">' . $langs->trans("TotalForAccount") . ' ' . length_accountg($displayed_account_number) . ':</td>';
}
print '<td class="nowrap right">'.price(price2num($sous_total_debit, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($sous_total_credit, 'MT')).'</td>';
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
print '<td colspan="'.$colspanend.'"></td>';
print '</tr>';
// Show balance of last shown account
@@ -980,13 +951,13 @@ while ($i < min($num, $limit)) {
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
if ($balance > 0) {
print '<td class="nowraponall right">';
print price(price2num($sous_total_debit - $sous_total_credit, 'MT'));
print price($sous_total_debit - $sous_total_credit);
print '</td>';
print '<td></td>';
} else {
print '<td></td>';
print '<td class="nowraponall right">';
print price(price2num($sous_total_credit - $sous_total_debit, 'MT'));
print price($sous_total_credit - $sous_total_debit);
print '</td>';
}
print '<td colspan="'.$colspanend.'"></td>';
@@ -998,9 +969,7 @@ while ($i < min($num, $limit)) {
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : count($arrayfields)+1).'" class="tdforbreak">';
if ($type == 'sub') {
if ($line->subledger_account != "" && $line->subledger_account != '-1') {
print empty($line->subledger_label) ? '<span class="error">'.$langs->trans("Unknown").'</span>' : $line->subledger_label;
print ' : ';
print length_accounta($line->subledger_account);
print $line->subledger_label . ' : ' . length_accounta($line->subledger_account);
} else {
// Should not happen: subledger account must be null or a non empty value
print '<span class="error">' . $langs->trans("Unknown");
@@ -1027,6 +996,8 @@ while ($i < min($num, $limit)) {
//if (empty($displayed_account_number)) $displayed_account_number='-';
$sous_total_debit = 0;
$sous_total_credit = 0;
$colspan = 0;
}
print '<tr class="oddeven">';
@@ -1041,9 +1012,6 @@ while ($i < min($num, $limit)) {
print '<input id="cb' . $line->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $line->id . '"' . ($selected ? ' checked="checked"' : '') . ' />';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Piece number
if (!empty($arrayfields['t.piece_num']['checked'])) {
@@ -1205,7 +1173,7 @@ while ($i < min($num, $limit)) {
}
if (!empty($arrayfields['t.import_key']['checked'])) {
print '<td class="center">'.$line->import_key."</td>\n";
print '<td class="tdoverflowmax100">'.$line->import_key."</td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
@@ -1227,9 +1195,9 @@ while ($i < min($num, $limit)) {
print '<input id="cb' . $line->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $line->id . '"' . ($selected ? ' checked="checked"' : '') . ' />';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!$i) {
$totalarray['nbfield']++;
}
// Comptabilise le sous-total
@@ -1244,8 +1212,8 @@ while ($i < min($num, $limit)) {
if ($num > 0 && $colspan > 0) {
print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>';
print '<td class="nowrap right">'.price(price2num($sous_total_debit, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($sous_total_credit, 'MT')).'</td>';
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
print '<td colspan="'.$colspanend.'"></td>';
print '</tr>';
// Show balance of last shown account
@@ -1254,29 +1222,19 @@ if ($num > 0 && $colspan > 0) {
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
if ($balance > 0) {
print '<td class="nowraponall right">';
print price(price2num($sous_total_debit - $sous_total_credit, 'MT'));
print price($sous_total_debit - $sous_total_credit);
print '</td>';
print '<td></td>';
} else {
print '<td></td>';
print '<td class="nowraponall right">';
print price(price2num($sous_total_credit - $sous_total_debit, 'MT'));
print price($sous_total_credit - $sous_total_debit);
print '</td>';
}
print '<td colspan="'.$colspanend.'"></td>';
print '</tr>';
}
// Clean total values to round them
if (!empty($totalarray['val']['totaldebit'])) {
$totalarray['val']['totaldebit'] = price2num($totalarray['val']['totaldebit'], 'MT');
}
if (!empty($totalarray['val']['totalcredit'])) {
$totalarray['val']['totalcredit'] = price2num($totalarray['val']['totalcredit'], 'MT');
}
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
@@ -1299,7 +1257,7 @@ print "</table>";
print '</div>';
// TODO Replace this with mass delete action
//if ($user->hasRight('accounting', 'mouvements, 'supprimer_tous')) {
//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>';

View File

@@ -353,7 +353,7 @@ class AccountancyCategory // extends CommonObject
$sql .= " formula=".(isset($this->formula) ? "'".$this->db->escape($this->formula)."'" : "null").",";
$sql .= " position=".(isset($this->position) ? $this->position : "null").",";
$sql .= " fk_country=".(isset($this->fk_country) ? $this->fk_country : "null").",";
$sql .= " active=".(isset($this->active) ? $this->active : "null");
$sql .= " active=".(isset($this->active) ? $this->active : "null")."";
$sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
@@ -466,7 +466,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) getDolGlobalInt('CHARTOFACCOUNTS'));
$sql .= " AND asy.rowid = ".((int) $conf->global->CHARTOFACCOUNTS);
$sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = ".$conf->entity;
$sql .= " GROUP BY aa.account_number, aa.label";
@@ -512,7 +512,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) getDolGlobalInt('CHARTOFACCOUNTS'));
$sql .= " AND asy.rowid = ".((int) $conf->global->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
@@ -605,6 +605,60 @@ class AccountancyCategory // extends CommonObject
}
}
/**
* Function to know all custom groupd from an accounting account
*
* @return array|integer Result in table (array), -1 if KO
*/
public function getCatsCpts()
{
global $mysoc, $conf;
if (empty($mysoc->country_id)) {
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
exit();
}
$sql = "SELECT t.rowid, t.account_number, t.label as account_label, cat.code, cat.position, cat.label as name_cat, cat.sens ";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t, ".MAIN_DB_PREFIX."c_accounting_category as cat";
$sql .= " WHERE t.fk_accounting_category IN ( SELECT c.rowid ";
$sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
$sql .= " WHERE c.active = 1";
$sql .= " AND c.entity = ".$conf->entity;
$sql .= " AND (c.fk_country = ".((int) $mysoc->country_id)." OR c.fk_country = 0)";
$sql .= " AND cat.rowid = t.fk_accounting_category";
$sql .= " AND t.entity = ".$conf->entity;
$sql .= " ORDER BY cat.position ASC";
$resql = $this->db->query($sql);
if ($resql) {
$i = 0;
$obj = '';
$num = $this->db->num_rows($resql);
$data = array();
if ($num) {
while ($obj = $this->db->fetch_object($resql)) {
$name_cat = $obj->name_cat;
$data[$name_cat][$i] = array(
'id' => $obj->rowid,
'code' => $obj->code,
'position' => $obj->position,
'account_number' => $obj->account_number,
'account_label' => $obj->account_label,
'sens' => $obj->sens
);
$i++;
}
}
return $data;
} else {
$this->error = "Error ".$this->db->lasterror();
dol_syslog(__METHOD__." ".$this->error, LOG_ERR);
return -1;
}
}
/**
* Function to show result of an accounting account from the ledger with a direction and a period
*
@@ -695,75 +749,12 @@ class AccountancyCategory // extends CommonObject
}
}
/**
* Function to get an array of all active custom groups (llx_c_accunting_categories) with their accounts from the chart of account (ll_accounting_acount)
*
* @param int $catid Custom group ID
* @return array|integer Result in table (array), -1 if KO
* @see getCats(), getCptsCat()
*/
public function getCatsCpts($catid = 0)
{
global $mysoc, $conf;
if (empty($mysoc->country_id)) {
$this->error = "Error ".$this->db->lasterror();
dol_syslog(__METHOD__." ".$this->error, LOG_ERR);
return -1;
}
$sql = "SELECT t.rowid, t.account_number, t.label as account_label,";
$sql .= " cat.code, cat.position, cat.label as name_cat, cat.sens, cat.category_type, cat.formula";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t, ".MAIN_DB_PREFIX."c_accounting_category as cat";
$sql .= " WHERE t.fk_accounting_category IN (SELECT c.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
$sql .= " WHERE c.active = 1";
$sql .= " AND c.entity = ".$conf->entity;
$sql .= " AND (c.fk_country = ".((int) $mysoc->country_id)." OR c.fk_country = 0)";
$sql .= " AND cat.rowid = t.fk_accounting_category";
$sql .= " AND t.entity = ".$conf->entity;
if ($catid > 0) {
$sql .= " AND cat.rowid = ".((int) $catid);
}
$sql .= " ORDER BY cat.position ASC";
$resql = $this->db->query($sql);
if ($resql) {
$obj = '';
$num = $this->db->num_rows($resql);
$data = array();
if ($num) {
while ($obj = $this->db->fetch_object($resql)) {
$name_cat = $obj->name_cat;
$data[$name_cat][$obj->rowid] = array(
'id' => $obj->rowid,
'code' => $obj->code,
'label' => $obj->label,
'position' => $obj->position,
'category_type' => $obj->category_type,
'formula' => $obj->formula,
'sens' => $obj->sens,
'account_number' => $obj->account_number,
'account_label' => $obj->account_label
);
}
}
return $data;
} else {
$this->error = "Error ".$this->db->lasterror();
dol_syslog(__METHOD__." ".$this->error, LOG_ERR);
return -1;
}
}
/**
* Return list of custom groups.
* For list + detail of accounting account, see getCatsCpt()
*
* @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups
* @param int $active 1= active, 0=not active
* @return array|int Array of groups or -1 if error
* @see getCatsCpts(), getCptsCat()
*/
public function getCats($categorytype = -1, $active = 1)
{
@@ -798,10 +789,9 @@ class AccountancyCategory // extends CommonObject
'rowid' => $obj->rowid,
'code' => $obj->code,
'label' => $obj->label,
'formula' => $obj->formula,
'position' => $obj->position,
'category_type' => $obj->category_type,
'formula' => $obj->formula,
'sens' => $obj->sens,
'bc' => $obj->sens
);
$i++;
@@ -819,15 +809,12 @@ class AccountancyCategory // extends CommonObject
/**
* Get all accounting account of a given custom group (or a list of custom groups).
* Get all accounting account of a custom group (or a list of custom groups).
* You must choose between first parameter (personalized group) or the second (free criteria filter)
*
* @param int $cat_id Id if personalized accounting group/category
* @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts. This value must be sanitized and not come from an input of a user.
* Example: "pcg_type = 'EXPENSE' AND fk_pcg_version = 'xx'"
* Example: "fk_accounting_category = 99"
* @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts. This value must not come from an input of a user.
* @return array|int Array of accounting accounts or -1 if error
* @see getCats(), getCatsCpts()
*/
public function getCptsCat($cat_id, $predefinedgroupwhere = '')
{
@@ -839,7 +826,7 @@ class AccountancyCategory // extends CommonObject
exit();
}
$pcgverid = getDolGlobalInt('CHARTOFACCOUNTS');
$pcgverid = $conf->global->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

View File

@@ -93,9 +93,10 @@ class AccountancyImport
public function computeAmount(&$arrayrecord, $listfields, $record_key)
{
// get fields indexes
if (isset($listfields['b.debit']) && isset($listfields['b.credit'])) {
$debit_index = $listfields['b.debit'];
$credit_index = $listfields['b.credit'];
$field_index_list = array_flip($listfields);
if (isset($field_index_list['debit']) && isset($field_index_list['credit'])) {
$debit_index = $field_index_list['debit'];
$credit_index = $field_index_list['credit'];
$debit = floatval($arrayrecord[$debit_index]['val']);
$credit = floatval($arrayrecord[$credit_index]['val']);
@@ -122,8 +123,9 @@ class AccountancyImport
*/
public function computeDirection(&$arrayrecord, $listfields, $record_key)
{
if (isset($listfields['b.debit'])) {
$debit_index = $listfields['b.debit'];
$field_index_list = array_flip($listfields);
if (isset($field_index_list['debit'])) {
$debit_index = $field_index_list['debit'];
$debit = floatval($arrayrecord[$debit_index]['val']);
if (!empty($debit)) {

View File

@@ -38,11 +38,6 @@ class AccountancySystem
*/
public $error = '';
/**
* @var string[] Array of Errors code (or messages)
*/
public $errors = array();
/**
* @var int ID
*/

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
@@ -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) getDolGlobalInt('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) $conf->global->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) getDolGlobalInt('CHARTOFACCOUNTS')).')';
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid = '.((int) $conf->global->CHARTOFACCOUNTS).')';
}
if (!empty($limittoachartaccount)) {
$sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'";
@@ -214,10 +214,8 @@ class AccountingAccount extends CommonObject
$this->id = $obj->rowid;
$this->rowid = $obj->rowid;
$this->ref = $obj->account_number;
$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->datec = $obj->datec;
$this->tms = $obj->tms;
$this->fk_pcg_version = $obj->fk_pcg_version;
$this->pcg_type = $obj->pcg_type;
$this->account_number = $obj->account_number;
@@ -401,7 +399,6 @@ class AccountingAccount extends CommonObject
{
global $langs;
// TODO Looks a stupid check
$sql = "(SELECT fk_code_ventilation FROM ".MAIN_DB_PREFIX."facturedet";
$sql .= " WHERE fk_code_ventilation=".((int) $this->id).")";
$sql .= "UNION";
@@ -590,7 +587,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 as date_modification';
$sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as a';
$sql .= ' WHERE a.rowid = ' . ((int) $id);
@@ -605,7 +602,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->date_modification);
$this->date_modification = $this->db->jdate($obj->tms);
}
$this->db->free($resql);
} else {
@@ -687,10 +684,10 @@ class AccountingAccount extends CommonObject
}
/**
* Return the label of the status
* Retourne le libelle du statut d'un user (actif, inactif)
*
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@@ -699,11 +696,11 @@ class AccountingAccount extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return the label of a given status
* Renvoi le libelle d'un statut donne
*
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
* @param int $status Id status
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{
@@ -865,14 +862,10 @@ class AccountingAccount extends CommonObject
// Level 3 (define $code_t): Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
if ($type == 'customer' && !empty($buyer->code_compta_product)) {
if (!empty($buyer->code_compta_product)) {
$code_t = $buyer->code_compta_product;
$suggestedid = $accountingAccount['thirdparty'];
$suggestedaccountingaccountfor = 'thirdparty';
} elseif ($type == 'supplier' && !empty($seller->code_compta_product)) {
$code_t = $seller->code_compta_product;
$suggestedid = $accountingAccount['thirdparty'];
$suggestedaccountingaccountfor = 'thirdparty';
}
}

View File

@@ -312,10 +312,10 @@ class AccountingJournal extends CommonObject
}
/**
* Return the label of the status
* Retourne le libelle du statut d'un user (actif, inactif)
*
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
* @param int $mode 0=libelle long, 1=libelle court
* @return string Label of type
*/
public function getLibType($mode = 0)
{
@@ -327,7 +327,7 @@ class AccountingJournal extends CommonObject
* Return type of an accounting journal
*
* @param int $nature Id type
* @param int $mode 0=label long, 1=label short
* @param int $mode 0=libelle long, 1=libelle court
* @return string Label of type
*/
public function LibType($nature, $mode = 0)
@@ -367,7 +367,6 @@ class AccountingJournal extends CommonObject
return $langs->trans('AccountingJournalType1');
}
}
return "";
}
@@ -389,6 +388,12 @@ class AccountingJournal extends CommonObject
if (empty($type)) $type = 'view';
if (empty($in_bookkeeping)) $in_bookkeeping = 'notyet';
// Hook
if (!is_object($hookmanager)) {
include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
$hookmanager = new HookManager($this->db);
}
$data = array();
$hookmanager->initHooks(array('accountingjournaldao'));
@@ -449,12 +454,27 @@ class AccountingJournal extends CommonObject
}
$sql = "";
// FIXME sql error with Mysql 5.7
/*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
$sql .= "WITH in_accounting_bookkeeping(fk_docdet) AS (";
$sql .= " SELECT DISTINCT fk_docdet";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
$sql .= " WHERE doc_type = 'asset'";
$sql .= ") ";
}*/
$sql .= "SELECT ad.fk_asset AS rowid, a.ref AS asset_ref, a.label AS asset_label, a.acquisition_value_ht AS asset_acquisition_value_ht";
$sql .= ", a.disposal_date AS asset_disposal_date, a.disposal_amount_ht AS asset_disposal_amount_ht, a.disposal_subject_to_vat AS asset_disposal_subject_to_vat";
$sql .= ", ad.rowid AS depreciation_id, ad.depreciation_mode, ad.ref AS depreciation_ref, ad.depreciation_date, ad.depreciation_ht, ad.accountancy_code_debit, ad.accountancy_code_credit";
$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation as ad";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "asset as a ON a.rowid = ad.fk_asset";
// FIXME sql error with Mysql 5.7
/*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
$sql .= " LEFT JOIN in_accounting_bookkeeping as iab ON iab.fk_docdet = ad.rowid";
}*/
$sql .= " WHERE a.entity IN (" . getEntity('asset', 0) . ')'; // We don't share object for accountancy, we use source object sharing
// Compatibility with Mysql 5.7
if ($in_bookkeeping == 'already') {
$sql .= " AND EXISTS (SELECT iab.fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')";
} elseif ($in_bookkeeping == 'notyet') {
@@ -468,6 +488,11 @@ class AccountingJournal extends CommonObject
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
$sql .= " AND ad.depreciation_date >= '" . $this->db->idate($conf->global->ACCOUNTING_DATE_START_BINDING) . "'";
}
// Already in bookkeeping or not
// FIXME sql error with Mysql 5.7
/*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
$sql .= " AND iab.fk_docdet IS" . ($in_bookkeeping == 'already' ? " NOT" : "") . " NULL";
}*/
$sql .= " ORDER BY ad.depreciation_date";
dol_syslog(__METHOD__, LOG_DEBUG);
@@ -730,7 +755,7 @@ class AccountingJournal extends CommonObject
}
}
$journal_data[(int) $pre_data_id] = $element;
$journal_data[$pre_data_id] = $element;
}
unset($pre_data);
@@ -785,6 +810,12 @@ class AccountingJournal extends CommonObject
global $conf, $langs, $hookmanager;
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
// Hook
if (!is_object($hookmanager)) {
include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
$hookmanager = new HookManager($this->db);
}
$error = 0;
$hookmanager->initHooks(array('accountingjournaldao'));
@@ -929,6 +960,11 @@ class AccountingJournal extends CommonObject
$out = '';
// Hook
if (!is_object($hookmanager)) {
include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
$hookmanager = new HookManager($this->db);
}
$hookmanager->initHooks(array('accountingjournaldao'));
$parameters = array('journal_data' => &$journal_data, 'search_date_end' => &$search_date_end, 'sep' => &$sep, 'out' => &$out);
$reshook = $hookmanager->executeHooks('exportCsv', $parameters, $this); // Note that $action and $object may have been

View File

@@ -1,276 +0,0 @@
<?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();
}
}
}
}

View File

@@ -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 != -1 ? $this->numero_compte : $langs->trans("Unknown"));
$mesg = $this->doc_ref.', '.$langs->trans("AccountAccounting").': '.$this->numero_compte;
if ($this->subledger_account && $this->subledger_account != $this->numero_compte) {
$mesg .= ', '.$langs->trans("SubledgerAccount").': '.$this->subledger_account;
}
@@ -817,61 +817,56 @@ class BookKeeping extends CommonObject
/**
* Load object in memory from the database in ->lines. Or just make a simple count if $countonly=1.
* Load object in memory from the database
*
* @param string $sortorder Sort Order
* @param string $sortfield Sort field
* @param int $limit offset limit
* @param int $offset offset limit
* @param array $filter filter array
* @param string $filtermode filter mode (AND or OR)
* @param int $option option (0: general account or 1: subaccount)
* @param int $countonly Do not fill the $object->lines, return only the count.
* @return int <0 if KO, Number of lines if OK
* @param string $sortorder Sort Order
* @param string $sortfield Sort field
* @param int $limit offset limit
* @param int $offset offset limit
* @param array $filter filter array
* @param string $filtermode filter mode (AND or OR)
* @param int $option option (0: general account or 1: subaccount)
*
* @return int <0 if KO, >=0 if OK
*/
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $option = 0, $countonly = 0)
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $option = 0)
{
global $conf;
dol_syslog(__METHOD__, LOG_DEBUG);
$this->lines = array();
$num = 0;
$sql = 'SELECT';
if ($countonly) {
$sql .= ' COUNT(t.rowid) as nb';
} else {
$sql .= ' t.rowid,';
$sql .= " t.doc_date,";
$sql .= " t.doc_type,";
$sql .= " t.doc_ref,";
$sql .= " t.fk_doc,";
$sql .= " t.fk_docdet,";
$sql .= " t.thirdparty_code,";
$sql .= " t.subledger_account,";
$sql .= " t.subledger_label,";
$sql .= " t.numero_compte,";
$sql .= " t.label_compte,";
$sql .= " t.label_operation,";
$sql .= " t.debit,";
$sql .= " t.credit,";
$sql .= " t.montant as amount,";
$sql .= " t.sens,";
$sql .= " t.multicurrency_amount,";
$sql .= " t.multicurrency_code,";
$sql .= " t.lettering_code,";
$sql .= " t.date_lettering,";
$sql .= " t.fk_user_author,";
$sql .= " t.import_key,";
$sql .= " t.code_journal,";
$sql .= " t.journal_label,";
$sql .= " t.piece_num,";
$sql .= " t.date_creation,";
$sql .= " t.date_export,";
$sql .= " t.date_validated as date_validation,";
$sql .= " t.import_key";
}
$sql .= ' t.rowid,';
$sql .= " t.doc_date,";
$sql .= " t.doc_type,";
$sql .= " t.doc_ref,";
$sql .= " t.fk_doc,";
$sql .= " t.fk_docdet,";
$sql .= " t.thirdparty_code,";
$sql .= " t.subledger_account,";
$sql .= " t.subledger_label,";
$sql .= " t.numero_compte,";
$sql .= " t.label_compte,";
$sql .= " t.label_operation,";
$sql .= " t.debit,";
$sql .= " t.credit,";
$sql .= " t.montant as amount,";
$sql .= " t.sens,";
$sql .= " t.multicurrency_amount,";
$sql .= " t.multicurrency_code,";
$sql .= " t.lettering_code,";
$sql .= " t.date_lettering,";
$sql .= " t.fk_user_author,";
$sql .= " t.import_key,";
$sql .= " t.code_journal,";
$sql .= " t.journal_label,";
$sql .= " t.piece_num,";
$sql .= " t.date_creation,";
$sql .= " t.date_export,";
$sql .= " t.date_validated as date_validation,";
$sql .= " t.import_key";
// Manage filter
$sqlwhere = array();
if (count($filter) > 0) {
@@ -885,7 +880,7 @@ class BookKeeping extends CommonObject
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
$sqlwhere[] = $key.'='.$value;
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
$sqlwhere[] = $key.' LIKE \''.$this->db->escapeforlike($this->db->escape($value)).'%\'';
$sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\'';
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
@@ -902,19 +897,18 @@ class BookKeeping extends CommonObject
} else {
$sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
}
} elseif ($key == 't.search_accounting_code_in' && !empty($value)) {
$sqlwhere[] = 't.numero_compte IN ('.$this->db->sanitize($value, 1).')';
} else {
$sqlwhere[] = natural_search($key, $value, 0, 1);
}
}
}
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
$sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
$sql .= ' WHERE 1 = 1';
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
if (count($sqlwhere) > 0) {
$sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere);
}
// Filter by ledger account or subledger account
// Affichage par compte comptable
if (!empty($option)) {
$sql .= " AND t.subledger_account IS NOT NULL";
$sql .= " AND t.subledger_account <> ''";
@@ -925,63 +919,54 @@ class BookKeeping extends CommonObject
$sortorder = 'ASC'.($sortorder ? ','.$sortorder : '');
}
if (!$countonly) {
$sql .= $this->db->order($sortfield, $sortorder);
if (!empty($limit)) {
$sql .= $this->db->plimit($limit + 1, $offset);
}
$sql .= $this->db->order($sortfield, $sortorder);
if (!empty($limit)) {
$sql .= $this->db->plimit($limit + 1, $offset);
}
$resql = $this->db->query($sql);
if ($resql) {
if ($countonly) {
$obj = $this->db->fetch_object($resql);
if ($obj) {
$num = $obj->nb;
}
} else {
$num = $this->db->num_rows($resql);
$num = $this->db->num_rows($resql);
$i = 0;
while (($obj = $this->db->fetch_object($resql)) && (empty($limit) || $i < min($limit, $num))) {
$line = new BookKeepingLine();
$i = 0;
while (($obj = $this->db->fetch_object($resql)) && (empty($limit) || $i < min($limit, $num))) {
$line = new BookKeepingLine();
$line->id = $obj->rowid;
$line->id = $obj->rowid;
$line->doc_date = $this->db->jdate($obj->doc_date);
$line->doc_type = $obj->doc_type;
$line->doc_ref = $obj->doc_ref;
$line->fk_doc = $obj->fk_doc;
$line->fk_docdet = $obj->fk_docdet;
$line->thirdparty_code = $obj->thirdparty_code;
$line->subledger_account = $obj->subledger_account;
$line->subledger_label = $obj->subledger_label;
$line->numero_compte = $obj->numero_compte;
$line->label_compte = $obj->label_compte;
$line->label_operation = $obj->label_operation;
$line->debit = $obj->debit;
$line->credit = $obj->credit;
$line->montant = $obj->amount; // deprecated
$line->amount = $obj->amount;
$line->sens = $obj->sens;
$line->multicurrency_amount = $obj->multicurrency_amount;
$line->multicurrency_code = $obj->multicurrency_code;
$line->lettering_code = $obj->lettering_code;
$line->date_lettering = $this->db->jdate($obj->date_lettering);
$line->fk_user_author = $obj->fk_user_author;
$line->import_key = $obj->import_key;
$line->code_journal = $obj->code_journal;
$line->journal_label = $obj->journal_label;
$line->piece_num = $obj->piece_num;
$line->date_creation = $this->db->jdate($obj->date_creation);
$line->date_export = $this->db->jdate($obj->date_export);
$line->date_validation = $this->db->jdate($obj->date_validation);
$line->import_key = $obj->import_key;
$line->doc_date = $this->db->jdate($obj->doc_date);
$line->doc_type = $obj->doc_type;
$line->doc_ref = $obj->doc_ref;
$line->fk_doc = $obj->fk_doc;
$line->fk_docdet = $obj->fk_docdet;
$line->thirdparty_code = $obj->thirdparty_code;
$line->subledger_account = $obj->subledger_account;
$line->subledger_label = $obj->subledger_label;
$line->numero_compte = $obj->numero_compte;
$line->label_compte = $obj->label_compte;
$line->label_operation = $obj->label_operation;
$line->debit = $obj->debit;
$line->credit = $obj->credit;
$line->montant = $obj->amount; // deprecated
$line->amount = $obj->amount;
$line->sens = $obj->sens;
$line->multicurrency_amount = $obj->multicurrency_amount;
$line->multicurrency_code = $obj->multicurrency_code;
$line->lettering_code = $obj->lettering_code;
$line->date_lettering = $obj->date_lettering;
$line->fk_user_author = $obj->fk_user_author;
$line->import_key = $obj->import_key;
$line->code_journal = $obj->code_journal;
$line->journal_label = $obj->journal_label;
$line->piece_num = $obj->piece_num;
$line->date_creation = $this->db->jdate($obj->date_creation);
$line->date_export = $this->db->jdate($obj->date_export);
$line->date_validation = $this->db->jdate($obj->date_validation);
$line->import_key = $obj->import_key;
$this->lines[] = $line;
$this->lines[] = $line;
$i++;
}
$i++;
}
$this->db->free($resql);
@@ -1068,7 +1053,7 @@ class BookKeeping extends CommonObject
$sqlwhere[] = natural_search($key, $value, 1, 1);
} elseif ($key == 't.code_journal' && !empty($value)) {
if (is_array($value)) {
$sqlwhere[] = natural_search("t.code_journal", (string) join(',', $value), 3, 1);
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 4, 1);
} else {
$sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
}
@@ -1119,7 +1104,7 @@ class BookKeeping extends CommonObject
$line->amount = $obj->amount;
$line->sens = $obj->sens;
$line->lettering_code = $obj->lettering_code;
$line->date_lettering = $this->db->jdate($obj->date_lettering);
$line->date_lettering = $obj->date_lettering;
$line->fk_user_author = $obj->fk_user_author;
$line->import_key = $obj->import_key;
$line->code_journal = $obj->code_journal;
@@ -1154,10 +1139,9 @@ class BookKeeping extends CommonObject
* @param int $offset offset limit
* @param array $filter filter array
* @param string $filtermode filter mode (AND or OR)
* @param int $option option (0: general account or 1: subaccount)
* @return int <0 if KO, >0 if OK
*/
public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $option = 0)
public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
{
global $conf;
@@ -1167,10 +1151,6 @@ class BookKeeping extends CommonObject
$sql = 'SELECT';
$sql .= " t.numero_compte,";
if (!empty($option)) {
$sql .= " t.subledger_account,";
$sql .= " t.subledger_label,";
}
$sql .= " SUM(t.debit) as debit,";
$sql .= " SUM(t.credit) as credit";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
@@ -1196,8 +1176,6 @@ class BookKeeping extends CommonObject
} else {
$sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
}
} elseif ($key == 't.reconciled_option') {
$sqlwhere[] = 't.lettering_code IS NULL';
} else {
$sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
}
@@ -1208,17 +1186,7 @@ class BookKeeping extends CommonObject
$sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere);
}
if (!empty($option)) {
$sql .= ' AND t.subledger_account IS NOT NULL';
$sql .= ' AND t.subledger_account != ""';
$sql .= ' GROUP BY t.numero_compte, t.subledger_account, t.subledger_label';
$sortfield = 't.subledger_account'.($sortfield ? ','.$sortfield : '');
$sortorder = 'ASC'.($sortfield ? ','.$sortfield : '');
} else {
$sql .= ' GROUP BY t.numero_compte';
$sortfield = 't.numero_compte'.($sortfield ? ','.$sortfield : '');
$sortorder = 'ASC'.($sortorder ? ','.$sortorder : '');
}
$sql .= ' GROUP BY t.numero_compte';
if (!empty($sortfield)) {
$sql .= $this->db->order($sortfield, $sortorder);
@@ -1236,9 +1204,6 @@ class BookKeeping extends CommonObject
$line = new BookKeepingLine();
$line->numero_compte = $obj->numero_compte;
$line->label_compte = $obj->label_compte;
$line->subledger_account = $obj->subledger_account;
$line->subledger_label = $obj->subledger_label;
$line->debit = $obj->debit;
$line->credit = $obj->credit;
@@ -1399,7 +1364,6 @@ class BookKeeping extends CommonObject
*/
public function updateByMvt($piece_num = '', $field = '', $value = '', $mode = '')
{
global $conf;
$error = 0;
$this->db->begin();
@@ -1407,7 +1371,6 @@ class BookKeeping extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element.$mode;
$sql .= " SET ".$field." = ".(is_numeric($value) ? ((float) $value) : "'".$this->db->escape($value)."'");
$sql .= " WHERE piece_num = ".((int) $piece_num);
$sql .= " AND entity = " . ((int) $conf->entity);
$resql = $this->db->query($sql);
@@ -2032,7 +1995,7 @@ class BookKeeping extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$pcgver = getDolGlobalInt('CHARTOFACCOUNTS');
$pcgver = $conf->global->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";
@@ -2089,12 +2052,12 @@ class BookKeeping extends CommonObject
* FIXME: This function takes the parent of parent to get the root account !
*
* @param string $account Accounting account
* @return array|int Array with root account information (max 2 upper level), <0 if KO
* @return array Array with root account information (max 2 upper level)
*/
public function getRootAccount($account = null)
{
global $conf;
$pcgver = getDolGlobalInt('CHARTOFACCOUNTS');
$pcgver = $conf->global->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";
@@ -2136,7 +2099,7 @@ class BookKeeping extends CommonObject
// phpcs:enable
global $conf;
$pcgver = getDolGlobalInt('CHARTOFACCOUNTS');
$pcgver = $conf->global->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";
@@ -2149,7 +2112,7 @@ class BookKeeping extends CommonObject
dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$obj = (object) array('label' => '');
$obj = '';
if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql);
}

View File

@@ -51,10 +51,6 @@ class Lettering extends BookKeeping
'table' => 'societe_remise_except',
'fk_doc' => 'fk_facture_source',
'fk_link' => 'fk_facture',
'fk_line_link' => 'fk_facture_line',
'table_link_line' => 'facturedet',
'fk_table_link_line' => 'rowid',
'fk_table_link_line_parent' => 'fk_facture',
'prefix' => 'a',
'is_fk_link_is_also_fk_doc' => true,
),
@@ -77,10 +73,6 @@ class Lettering extends BookKeeping
'table' => 'societe_remise_except',
'fk_doc' => 'fk_invoice_supplier_source',
'fk_link' => 'fk_invoice_supplier',
'fk_line_link' => 'fk_invoice_supplier_line',
'table_link_line' => 'facture_fourn_det',
'fk_table_link_line' => 'rowid',
'fk_table_link_line_parent' => 'fk_facture_fourn',
'prefix' => 'a',
'is_fk_link_is_also_fk_doc' => true,
),
@@ -574,7 +566,7 @@ class Lettering extends BookKeeping
$grouped_lines = array();
foreach (self::$doc_type_infos as $doc_type => $doc_type_info) {
if (empty($bookkeeping_lines_by_type[$doc_type]) || !is_array($bookkeeping_lines_by_type[$doc_type])) {
if (!is_array($bookkeeping_lines_by_type[$doc_type])) {
continue;
}
@@ -773,26 +765,10 @@ class Lettering extends BookKeeping
$link_by_element = array();
$element_by_link = array();
foreach ($doc_type_info['linked_info'] as $linked_info) {
if (empty($linked_info['fk_line_link'])) {
$sql = "SELECT DISTINCT tl2.".$linked_info['fk_link']." AS fk_link, tl2.".$linked_info['fk_doc']." AS fk_doc";
$sql .= " FROM ".MAIN_DB_PREFIX.$linked_info['table']." AS tl";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$linked_info['table']." AS tl2 ON tl2.".$linked_info['fk_link']." = tl.".$linked_info['fk_link'];
$sql .= " WHERE tl.".$linked_info['fk_doc']." IN (".$this->db->sanitize(implode(',', $document_ids)).")";
} else {
$sql = "SELECT DISTINCT tl2.fk_link, tl2.fk_doc";
$sql .= " FROM (";
$sql .= " SELECT DISTINCT " . $this->db->ifsql("tll." . $linked_info['fk_table_link_line_parent'], "tll." . $linked_info['fk_table_link_line_parent'], "tl." . $linked_info['fk_link']) . " AS fk_link, tl." . $linked_info['fk_doc'] . " AS fk_doc";
$sql .= " FROM " . MAIN_DB_PREFIX . $linked_info['table'] . " AS tl";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $linked_info['table_link_line'] . " AS tll ON tll." . $linked_info['fk_table_link_line'] . " = tl." . $linked_info['fk_line_link'];
$sql .= ") AS tl";
$sql .= " LEFT JOIN (";
$sql .= " SELECT DISTINCT " . $this->db->ifsql("tll." . $linked_info['fk_table_link_line_parent'], "tll." . $linked_info['fk_table_link_line_parent'], "tl." . $linked_info['fk_link']) . " AS fk_link, tl." . $linked_info['fk_doc'] . " AS fk_doc";
$sql .= " FROM " . MAIN_DB_PREFIX . $linked_info['table'] . " AS tl";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $linked_info['table_link_line'] . " AS tll ON tll." . $linked_info['fk_table_link_line'] . " = tl." . $linked_info['fk_line_link'];
$sql .= ") AS tl2 ON tl2.fk_link = tl.fk_link";
$sql .= " WHERE tl.fk_doc IN (" . $this->db->sanitize(implode(',', $document_ids)) . ")";
$sql .= " AND tl2.fk_doc IS NOT NULL";
}
$sql = "SELECT DISTINCT tl2." . $linked_info['fk_link'] . " AS fk_link, tl2." . $linked_info['fk_doc'] . " AS fk_doc";
$sql .= " FROM " . MAIN_DB_PREFIX . $linked_info['table'] . " AS tl";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $linked_info['table'] . " AS tl2 ON tl2." . $linked_info['fk_link'] . " = tl." . $linked_info['fk_link'];
$sql .= " WHERE tl." . $linked_info['fk_doc'] . " IN (" . $this->db->sanitize(implode(',', $document_ids)) . ")";
dol_syslog(__METHOD__ . " - Get document lines", LOG_DEBUG);
$resql = $this->db->query($sql);

View File

@@ -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, 0);
print_barre_liste($langs->trans("OverviewOfMovementsNotValidated"), '', '', '', '', '', '', -1, '', '', 0, $buttonvalidate, '', 0, 1, 1);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';

View File

@@ -75,7 +75,7 @@ $year_current = $year_start;
// Validate History
$action = GETPOST('action', 'aZ09');
$chartaccountcode = dol_getIdFromCode($db, getDolGlobalInt('CHARTOFACCOUNTS'), 'accounting_system', 'rowid', 'pcg_version');
$chartaccountcode = dol_getIdFromCode($db, $conf->global->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 ".$db->prefix()."facturedet as fd";
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as fd";
$sql1 .= " SET fk_code_ventilation = 0";
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN';
$sql1 .= ' (SELECT accnt.rowid ';
$sql1 .= ' FROM '.$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";
$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';
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
$resql1 = $db->query($sql1);
@@ -121,12 +121,26 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('acc
if ($action == 'validatehistory') {
$error = 0;
$nbbinddone = 0;
$nbbindfailed = 0;
$notpossible = 0;
$db->begin();
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
/*if ($db->type == 'pgsql') {
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
$sql1 .= " WHERE " . MAIN_DB_PREFIX . "facturedet.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity);
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
$sql1 .= " AND " . MAIN_DB_PREFIX . "facturedet.fk_code_ventilation = 0";
} else {
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity);
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
$sql1 .= " AND fd.fk_code_ventilation = 0";
}*/
// Customer Invoice lines (must be same request than into page list.php for manual binding)
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype, f.situation_cycle_ref, f.fk_facture_source,";
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.situation_percent, l.tva_tx as tva_tx_line, l.vat_src_code,";
@@ -144,23 +158,23 @@ if ($action == 'validatehistory') {
} else {
$sql .= " s.accountancy_code_sell as company_code_sell"; // accounting code for product but stored on thirdparty
}
$sql .= " FROM ".$db->prefix()."facture as f";
$sql .= " INNER JOIN ".$db->prefix()."societe as s ON s.rowid = f.fk_soc";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$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 . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
}
$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";
$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";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . $db->prefix() . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
$sql .= " LEFT JOIN " . MAIN_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 ".$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 .= " 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 .= " 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
@@ -267,14 +281,12 @@ if ($action == 'validatehistory') {
if (!$resqlupdate) {
$error++;
setEventMessages($db->lasterror(), null, 'errors');
$nbbindfailed++;
break;
} else {
$nbbinddone++;
}
} else {
$notpossible++;
$nbbindfailed++;
}
$i++;
@@ -288,10 +300,7 @@ if ($action == 'validatehistory') {
$db->rollback();
} else {
$db->commit();
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
if ($nbbindfailed) {
setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings');
}
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs');
}
}
@@ -319,9 +328,9 @@ if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
$y = $year_current;
$buttonbind = '<a class="butAction smallpaddingimp" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.img_picto($langs->trans("ValidateHistory"), 'link', 'class="pictofixedwidth fa-color-unset"').$langs->trans("ValidateHistory").'</a>';
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.$langs->trans("ValidateHistory").'</a>';
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1, 0, $buttonbind);
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
print '<div class="div-table-responsive-no-min">';
@@ -405,17 +414,7 @@ if ($resql) {
print '</td>';
print '<td>';
if ($row[0] == 'tobind') {
$startmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1);
if ($startmonth > 12) {
$startmonth -= 12;
}
$startyear = ($startmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
$endmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + 11;
if ($endmonth > 12) {
$endmonth -= 12;
}
$endyear = ($endmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_date_startday=1&search_date_startmonth='.((int) $startmonth).'&search_date_startyear='.((int) $startyear).'&search_date_endday=&search_date_endmonth='.((int) $endmonth).'&search_date_endyear='.((int) $endyear), $langs->transnoentitiesnoconv("ToBind"));
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
} else {
print $row[1];
}
@@ -430,12 +429,6 @@ if ($resql) {
print '<td class="right nowraponall amount">';
print price($row[$i]);
// Add link to make binding
if (!empty(price2num($row[$i]))) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&year='.$y.'&validatemonth='.((int) $cursormonth).'&validateyear='.((int) $cursoryear).'&token='.newToken().'">';
print img_picto($langs->trans("ValidateHistory").' ('.$langs->trans('Month'.str_pad($cursormonth, 2, '0', STR_PAD_LEFT)).' '.$cursoryear.')', 'link', 'class="marginleft2"');
print '</a>';
}
print '</td>';
}
print '<td class="right nowraponall amount"><b>'.price($row[14]).'</b></td>';
@@ -579,7 +572,7 @@ print "</table>\n";
print '</div>';
if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This part of code looks strange. Why showing a report that should rely on result of this step ?
if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange. Why showing a report that should rely on result of this step ?
print '<br>';
print '<br>';

View File

@@ -65,10 +65,10 @@ $search_country = GETPOST('search_country', 'alpha');
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$page = GETPOSTISSET('pageplusonPour le détail de la facture ref…e') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) {
$page = 0;
}
@@ -81,8 +81,6 @@ if (!$sortfield) {
if (!$sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
$sortorder = "DESC";
} else {
$sortorder = "ASC";
}
}
@@ -161,12 +159,6 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->hasRight('ac
}
}
if (GETPOST('sortfield') == 'f.datef, f.ref, fd.rowid') {
$value = (GETPOST('sortorder') == 'asc,asc,asc' ? 0 : 1);
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $value, 'yesno', 0, '', $conf->entity);
}
/*
* View
@@ -303,7 +295,7 @@ $sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
if (empty($conf->global->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
@@ -325,7 +317,7 @@ if ($result) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit);
$param .= '&limit='.urlencode($limit);
}
if ($search_societe) {
$param .= "&search_societe=".urlencode($search_societe);

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