Merge branch 'develop' into develop_of_consumption_selectbatch
25
.github/workflows/code_quality.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
name: Qodana
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 20 * * *"
|
||||
workflow_dispatch:
|
||||
branches:
|
||||
- develop
|
||||
# push:
|
||||
# branches:
|
||||
# - develop
|
||||
|
||||
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@v2022.3.4
|
||||
#with:
|
||||
# php-version: '7.1'
|
||||
env:
|
||||
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
|
||||
38
.github/workflows/doxygen-gh-pages.yml.disabled
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
# 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
|
||||
@ -4,6 +4,9 @@ name: "Exakat analysis"
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 20 * * *"
|
||||
workflow_dispatch:
|
||||
branches:
|
||||
- develop
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@ -13,6 +16,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: Exakat
|
||||
uses: docker://exakat/exakat-ga
|
||||
with:
|
||||
3
.github/workflows/stale-issues-safe.yml
vendored
@ -6,7 +6,8 @@ on:
|
||||
- cron: "0 21 * * *"
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {} # none
|
||||
|
||||
jobs:
|
||||
|
||||
3
.gitignore
vendored
@ -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,3 +57,4 @@ yarn.lock
|
||||
package-lock.json
|
||||
|
||||
doc/install.lock
|
||||
/.asciidoctorconfig.adoc
|
||||
|
||||
5
.idea/php.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="7.1">
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="7.1" />
|
||||
</project>
|
||||
|
||||
167
.scrutinizer.yml
@ -8,21 +8,24 @@ build:
|
||||
override:
|
||||
- command: php-scrutinizer-run
|
||||
idle_timeout: 8000
|
||||
#- php-scrutinizer-run --sub-project-dir=htdocs/admin
|
||||
|
||||
imports:
|
||||
- javascript
|
||||
- php
|
||||
|
||||
filter:
|
||||
excluded_paths:
|
||||
- build/*
|
||||
- dev/*
|
||||
- doc/*
|
||||
- documents/*
|
||||
- node_modules/*
|
||||
- test/*
|
||||
dependency_paths:
|
||||
- htdocs/includes/*
|
||||
- build/
|
||||
- dev/
|
||||
- doc/
|
||||
- documents/
|
||||
- node_modules/
|
||||
- test/
|
||||
- htdocs/custom/
|
||||
- htdocs/includes/
|
||||
- htdocs/install/doctemplates/
|
||||
#dependency_paths:
|
||||
# - htdocs/includes/
|
||||
paths:
|
||||
- htdocs/*
|
||||
- scripts/*
|
||||
@ -33,21 +36,23 @@ tools:
|
||||
enabled: true
|
||||
extensions:
|
||||
- php
|
||||
dependency_paths:
|
||||
- htdocs/includes/
|
||||
#dependency_paths:
|
||||
# - htdocs/includes/
|
||||
filter:
|
||||
excluded_paths:
|
||||
- build/*
|
||||
- dev/*
|
||||
- doc/*
|
||||
- documents/*
|
||||
- htdocs/includes/*
|
||||
- build/
|
||||
- dev/
|
||||
- doc/
|
||||
- documents/
|
||||
- htdocs/custom/
|
||||
- htdocs/includes/
|
||||
- htdocs/install/doctemplates/
|
||||
- htdocs/core/class/lessc.class.php
|
||||
- node_modules/*
|
||||
- test/*
|
||||
- node_modules/
|
||||
- test/
|
||||
paths:
|
||||
- htdocs/
|
||||
- scripts/
|
||||
- htdocs/*
|
||||
- scripts/*
|
||||
config:
|
||||
parameter_reference_check:
|
||||
enabled: true
|
||||
@ -156,73 +161,73 @@ tools:
|
||||
# To use specific config for a specific path, use path_configs: (see example on page https://scrutinizer-ci.com/docs/configuration/tool_config_structure)
|
||||
|
||||
# php_depend
|
||||
php_pdepend:
|
||||
enabled: false
|
||||
configuration_file: null
|
||||
suffixes:
|
||||
- php
|
||||
excluded_dirs: { }
|
||||
filter:
|
||||
excluded_paths:
|
||||
- 'build/*'
|
||||
- 'dev/*'
|
||||
- 'doc/*'
|
||||
- 'test/*'
|
||||
- 'htdocs/includes/*'
|
||||
paths: { }
|
||||
#php_pdepend:
|
||||
# enabled: false
|
||||
# configuration_file: null
|
||||
# suffixes:
|
||||
# - php
|
||||
# excluded_dirs: { }
|
||||
# filter:
|
||||
# excluded_paths:
|
||||
# - 'build/*'
|
||||
# - 'dev/*'
|
||||
# - 'doc/*'
|
||||
# - 'test/*'
|
||||
# - 'htdocs/includes/*'
|
||||
# paths: { }
|
||||
|
||||
# change tracking
|
||||
php_changetracking:
|
||||
enabled: false
|
||||
bug_patterns:
|
||||
- '\bfix(?:es|ed)?\b'
|
||||
feature_patterns:
|
||||
- '\badd(?:s|ed)?\b'
|
||||
- '\bimplement(?:s|ed)?\b'
|
||||
filter:
|
||||
excluded_paths:
|
||||
- 'build/*'
|
||||
- 'dev/*'
|
||||
- 'doc/*'
|
||||
- 'documents/*'
|
||||
- 'htdocs/includes/*'
|
||||
- 'node_modules/*'
|
||||
- 'test/*'
|
||||
paths: { }
|
||||
#php_changetracking:
|
||||
# enabled: false
|
||||
# bug_patterns:
|
||||
# - '\bfix(?:es|ed)?\b'
|
||||
# feature_patterns:
|
||||
# - '\badd(?:s|ed)?\b'
|
||||
# - '\bimplement(?:s|ed)?\b'
|
||||
# filter:
|
||||
# excluded_paths:
|
||||
# - 'build/*'
|
||||
# - 'dev/*'
|
||||
# - 'doc/*'
|
||||
# - 'documents/*'
|
||||
# - 'htdocs/includes/*'
|
||||
# - 'node_modules/*'
|
||||
# - 'test/*'
|
||||
# paths: { }
|
||||
|
||||
# Similar code detection
|
||||
php_sim:
|
||||
enabled: false
|
||||
min_mass: 30
|
||||
filter:
|
||||
excluded_paths:
|
||||
- 'build/*'
|
||||
- 'dev/*'
|
||||
- 'doc/*'
|
||||
- 'documents/*'
|
||||
- 'htdocs/includes/*'
|
||||
- 'node_modules/*'
|
||||
- 'test/*'
|
||||
paths: { }
|
||||
#php_sim:
|
||||
# enabled: false
|
||||
# min_mass: 30
|
||||
# filter:
|
||||
# excluded_paths:
|
||||
# - 'build/*'
|
||||
# - 'dev/*'
|
||||
# - 'doc/*'
|
||||
# - 'documents/*'
|
||||
# - 'htdocs/includes/*'
|
||||
# - 'node_modules/*'
|
||||
# - 'test/*'
|
||||
# paths: { }
|
||||
|
||||
# Coding-Style / Bug Detection
|
||||
js_hint:
|
||||
enabled: false
|
||||
use_native_config: true
|
||||
extensions:
|
||||
- js
|
||||
filter:
|
||||
excluded_paths:
|
||||
- 'build/*'
|
||||
- 'dev/*'
|
||||
- 'doc/*'
|
||||
- 'documents/*'
|
||||
- 'htdocs/includes/*'
|
||||
- 'node_modules/*'
|
||||
- 'test/*'
|
||||
paths: { }
|
||||
config: { }
|
||||
path_configs: { }
|
||||
#js_hint:
|
||||
# enabled: false
|
||||
# use_native_config: true
|
||||
# extensions:
|
||||
# - js
|
||||
# filter:
|
||||
# excluded_paths:
|
||||
# - 'build/*'
|
||||
# - 'dev/*'
|
||||
# - 'doc/*'
|
||||
# - 'documents/*'
|
||||
# - 'htdocs/includes/*'
|
||||
# - 'node_modules/*'
|
||||
# - 'test/*'
|
||||
# paths: { }
|
||||
# config: { }
|
||||
# path_configs: { }
|
||||
|
||||
|
||||
before_commands: { }
|
||||
|
||||
30
.travis.yml
@ -72,10 +72,6 @@ jobs:
|
||||
if: type = pull_request OR type = push
|
||||
php: '8.1'
|
||||
env: DB=mysql
|
||||
- stage: PHP Dev
|
||||
if: type = push AND branch = develop
|
||||
php: nightly
|
||||
env: DB=mysql
|
||||
- stage: PHP Dev
|
||||
if: type = push AND branch = 17.0
|
||||
php: nightly
|
||||
@ -95,19 +91,20 @@ notifications:
|
||||
|
||||
install:
|
||||
- |
|
||||
echo "Updating Composer"
|
||||
rm $TRAVIS_BUILD_DIR/composer.json
|
||||
rm $TRAVIS_BUILD_DIR/composer.lock
|
||||
echo "Updating Composer config"
|
||||
composer -V
|
||||
composer self-update
|
||||
composer -n init
|
||||
composer -n config vendor-dir htdocs/includes
|
||||
#rm $TRAVIS_BUILD_DIR/composer.json
|
||||
#rm $TRAVIS_BUILD_DIR/composer.lock
|
||||
#composer -n init
|
||||
#composer -n config vendor-dir htdocs/includes
|
||||
composer -n config -g vendor-dir htdocs/includes
|
||||
echo
|
||||
|
||||
- |
|
||||
echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer, PHP Vardump check - for $TRAVIS_PHP_VERSION"
|
||||
echo "Update Composer version and Install tools - PHP Unit, Parallel Lint, PHP CodeSniffer, PHP Vardump check - for $TRAVIS_PHP_VERSION"
|
||||
echo "(version 2.5 is bugged and generate phpunit error Exception: Serialization of 'Closure' is not allowed)"
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then
|
||||
composer self-update 2.2.18
|
||||
composer -n require phpunit/phpunit ^6 \
|
||||
php-parallel-lint/php-parallel-lint ^1 \
|
||||
php-parallel-lint/php-console-highlighter ^0 \
|
||||
@ -115,6 +112,7 @@ install:
|
||||
squizlabs/php_codesniffer ^3
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ]; then
|
||||
composer self-update 2.2.18
|
||||
composer -n require phpunit/phpunit ^7 \
|
||||
php-parallel-lint/php-parallel-lint ^1.2 \
|
||||
php-parallel-lint/php-console-highlighter ^0 \
|
||||
@ -123,12 +121,15 @@ install:
|
||||
fi
|
||||
# phpunit 9 is required for php 8
|
||||
if [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
||||
composer self-update 2.4.4
|
||||
composer -n require --ignore-platform-reqs phpunit/phpunit ^8 \
|
||||
php-parallel-lint/php-parallel-lint ^1.2 \
|
||||
php-parallel-lint/php-console-highlighter ^0 \
|
||||
php-parallel-lint/php-var-dump-check ~0.4 \
|
||||
squizlabs/php_codesniffer ^3
|
||||
fi
|
||||
# Remove non expected files
|
||||
rm -fr /home/travis/build/Dolibarr/dolibarr/htdocs/includes/phpunit/php-code-coverage/src/Report/Html/Renderer/Template/js
|
||||
echo
|
||||
|
||||
- |
|
||||
@ -450,6 +451,9 @@ 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
|
||||
ls -alrt $TRAVIS_BUILD_DIR/
|
||||
|
||||
- |
|
||||
@ -469,7 +473,7 @@ script:
|
||||
|
||||
- |
|
||||
echo "Unit testing"
|
||||
# Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file.
|
||||
# Ensure we catch errors. Set this to +e instead of -e if you want to go to the end to see dolibarr.log file.
|
||||
set -e
|
||||
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||
phpunitresult=$?
|
||||
@ -497,7 +501,7 @@ after_failure:
|
||||
# Show upgrade log files
|
||||
for ficlog in `ls $TRAVIS_BUILD_DIR/*.log`
|
||||
do
|
||||
echo "Debugging informations for file $ficlog"
|
||||
#echo "Debugging informations for file $ficlog"
|
||||
#cat $ficlog
|
||||
done
|
||||
# Show Apache log file
|
||||
|
||||
294
.tx/config
@ -1,442 +1,442 @@
|
||||
[main]
|
||||
host = https://www.transifex.com
|
||||
host = https://www.transifex.com
|
||||
lang_map = uz: uz_UZ, sw: sw_SW, sr@latin: sr_RS
|
||||
|
||||
[dolibarr.accountancy]
|
||||
[o:dolibarr-association:p:dolibarr:r:accountancy]
|
||||
file_filter = htdocs/langs/<lang>/accountancy.lang
|
||||
source_file = htdocs/langs/en_US/accountancy.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.admin]
|
||||
[o:dolibarr-association:p:dolibarr:r:admin]
|
||||
file_filter = htdocs/langs/<lang>/admin.lang
|
||||
source_file = htdocs/langs/en_US/admin.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.agenda]
|
||||
[o:dolibarr-association:p:dolibarr:r:agenda]
|
||||
file_filter = htdocs/langs/<lang>/agenda.lang
|
||||
source_file = htdocs/langs/en_US/agenda.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.assets]
|
||||
[o:dolibarr-association:p:dolibarr:r:assets]
|
||||
file_filter = htdocs/langs/<lang>/assets.lang
|
||||
source_file = htdocs/langs/en_US/assets.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.banks]
|
||||
[o:dolibarr-association:p:dolibarr:r:banks]
|
||||
file_filter = htdocs/langs/<lang>/banks.lang
|
||||
source_file = htdocs/langs/en_US/banks.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.bills]
|
||||
[o:dolibarr-association:p:dolibarr:r:bills]
|
||||
file_filter = htdocs/langs/<lang>/bills.lang
|
||||
source_file = htdocs/langs/en_US/bills.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.blockedlog]
|
||||
[o:dolibarr-association:p:dolibarr:r:blockedlog]
|
||||
file_filter = htdocs/langs/<lang>/blockedlog.lang
|
||||
source_file = htdocs/langs/en_US/blockedlog.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.bookmarks]
|
||||
[o:dolibarr-association:p:dolibarr:r:bookmarks]
|
||||
file_filter = htdocs/langs/<lang>/bookmarks.lang
|
||||
source_file = htdocs/langs/en_US/bookmarks.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.boxes]
|
||||
[o:dolibarr-association:p:dolibarr:r:boxes]
|
||||
file_filter = htdocs/langs/<lang>/boxes.lang
|
||||
source_file = htdocs/langs/en_US/boxes.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.cashdesk]
|
||||
[o:dolibarr-association:p:dolibarr:r:cashdesk]
|
||||
file_filter = htdocs/langs/<lang>/cashdesk.lang
|
||||
source_file = htdocs/langs/en_US/cashdesk.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.categories]
|
||||
[o:dolibarr-association:p:dolibarr:r:categories]
|
||||
file_filter = htdocs/langs/<lang>/categories.lang
|
||||
source_file = htdocs/langs/en_US/categories.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.commercial]
|
||||
[o:dolibarr-association:p:dolibarr:r:commercial]
|
||||
file_filter = htdocs/langs/<lang>/commercial.lang
|
||||
source_file = htdocs/langs/en_US/commercial.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.companies]
|
||||
[o:dolibarr-association:p:dolibarr:r:companies]
|
||||
file_filter = htdocs/langs/<lang>/companies.lang
|
||||
source_file = htdocs/langs/en_US/companies.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.compta]
|
||||
[o:dolibarr-association:p:dolibarr:r:compta]
|
||||
file_filter = htdocs/langs/<lang>/compta.lang
|
||||
source_file = htdocs/langs/en_US/compta.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.contracts]
|
||||
[o:dolibarr-association:p:dolibarr:r:contracts]
|
||||
file_filter = htdocs/langs/<lang>/contracts.lang
|
||||
source_file = htdocs/langs/en_US/contracts.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.cron]
|
||||
[o:dolibarr-association:p:dolibarr:r:cron]
|
||||
file_filter = htdocs/langs/<lang>/cron.lang
|
||||
source_file = htdocs/langs/en_US/cron.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.datapolicy]
|
||||
[o:dolibarr-association:p:dolibarr:r:datapolicy]
|
||||
file_filter = htdocs/langs/<lang>/datapolicy.lang
|
||||
source_file = htdocs/langs/en_US/datapolicy.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.deliveries]
|
||||
[o:dolibarr-association:p:dolibarr:r:deliveries]
|
||||
file_filter = htdocs/langs/<lang>/deliveries.lang
|
||||
source_file = htdocs/langs/en_US/deliveries.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.dict]
|
||||
[o:dolibarr-association:p:dolibarr:r:dict]
|
||||
file_filter = htdocs/langs/<lang>/dict.lang
|
||||
source_file = htdocs/langs/en_US/dict.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.donations]
|
||||
[o:dolibarr-association:p:dolibarr:r:donations]
|
||||
file_filter = htdocs/langs/<lang>/donations.lang
|
||||
source_file = htdocs/langs/en_US/donations.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.ecm]
|
||||
[o:dolibarr-association:p:dolibarr:r:ecm]
|
||||
file_filter = htdocs/langs/<lang>/ecm.lang
|
||||
source_file = htdocs/langs/en_US/ecm.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.errors]
|
||||
[o:dolibarr-association:p:dolibarr:r:errors]
|
||||
file_filter = htdocs/langs/<lang>/errors.lang
|
||||
source_file = htdocs/langs/en_US/errors.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.eventorganization]
|
||||
[o:dolibarr-association:p:dolibarr:r:eventorganization]
|
||||
file_filter = htdocs/langs/<lang>/eventorganization.lang
|
||||
source_file = htdocs/langs/en_US/eventorganization.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.exports]
|
||||
[o:dolibarr-association:p:dolibarr:r:exports]
|
||||
file_filter = htdocs/langs/<lang>/exports.lang
|
||||
source_file = htdocs/langs/en_US/exports.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.help]
|
||||
[o:dolibarr-association:p:dolibarr:r:help]
|
||||
file_filter = htdocs/langs/<lang>/help.lang
|
||||
source_file = htdocs/langs/en_US/help.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.holiday]
|
||||
[o:dolibarr-association:p:dolibarr:r:holiday]
|
||||
file_filter = htdocs/langs/<lang>/holiday.lang
|
||||
source_file = htdocs/langs/en_US/holiday.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.hrm]
|
||||
[o:dolibarr-association:p:dolibarr:r:hrm]
|
||||
file_filter = htdocs/langs/<lang>/hrm.lang
|
||||
source_file = htdocs/langs/en_US/hrm.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.install]
|
||||
[o:dolibarr-association:p:dolibarr:r:install]
|
||||
file_filter = htdocs/langs/<lang>/install.lang
|
||||
source_file = htdocs/langs/en_US/install.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.interventions]
|
||||
[o:dolibarr-association:p:dolibarr:r:interventions]
|
||||
file_filter = htdocs/langs/<lang>/interventions.lang
|
||||
source_file = htdocs/langs/en_US/interventions.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.intracommreport]
|
||||
[o:dolibarr-association:p:dolibarr:r:intracommreport]
|
||||
file_filter = htdocs/langs/<lang>/intracommreport.lang
|
||||
source_file = htdocs/langs/en_US/intracommreport.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.knowledgemanagement]
|
||||
[o:dolibarr-association:p:dolibarr:r:knowledgemanagement]
|
||||
file_filter = htdocs/langs/<lang>/knowledgemanagement.lang
|
||||
source_file = htdocs/langs/en_US/knowledgemanagement.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.languages-not-res]
|
||||
[o:dolibarr-association:p:dolibarr:r:languages-not-res]
|
||||
file_filter = htdocs/langs/<lang>/languages.lang
|
||||
source_file = htdocs/langs/en_US/languages.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.ldap]
|
||||
[o:dolibarr-association:p:dolibarr:r:ldap]
|
||||
file_filter = htdocs/langs/<lang>/ldap.lang
|
||||
source_file = htdocs/langs/en_US/ldap.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.link]
|
||||
[o:dolibarr-association:p:dolibarr:r:link]
|
||||
file_filter = htdocs/langs/<lang>/link.lang
|
||||
source_file = htdocs/langs/en_US/link.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.loan]
|
||||
[o:dolibarr-association:p:dolibarr:r:loan]
|
||||
file_filter = htdocs/langs/<lang>/loan.lang
|
||||
source_file = htdocs/langs/en_US/loan.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.mailmanspip]
|
||||
[o:dolibarr-association:p:dolibarr:r:mailmanspip]
|
||||
file_filter = htdocs/langs/<lang>/mailmanspip.lang
|
||||
source_file = htdocs/langs/en_US/mailmanspip.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.mails]
|
||||
[o:dolibarr-association:p:dolibarr:r:mails]
|
||||
file_filter = htdocs/langs/<lang>/mails.lang
|
||||
source_file = htdocs/langs/en_US/mails.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.main]
|
||||
[o:dolibarr-association:p:dolibarr:r:main]
|
||||
file_filter = htdocs/langs/<lang>/main.lang
|
||||
source_file = htdocs/langs/en_US/main.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.margins]
|
||||
[o:dolibarr-association:p:dolibarr:r:margins]
|
||||
file_filter = htdocs/langs/<lang>/margins.lang
|
||||
source_file = htdocs/langs/en_US/margins.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.members]
|
||||
[o:dolibarr-association:p:dolibarr:r:members]
|
||||
file_filter = htdocs/langs/<lang>/members.lang
|
||||
source_file = htdocs/langs/en_US/members.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.modulebuilder]
|
||||
[o:dolibarr-association:p:dolibarr:r:modulebuilder]
|
||||
file_filter = htdocs/langs/<lang>/modulebuilder.lang
|
||||
source_file = htdocs/langs/en_US/modulebuilder.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.mrp]
|
||||
[o:dolibarr-association:p:dolibarr:r:mrp]
|
||||
file_filter = htdocs/langs/<lang>/mrp.lang
|
||||
source_file = htdocs/langs/en_US/mrp.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.multicurrency]
|
||||
[o:dolibarr-association:p:dolibarr:r:multicurrency]
|
||||
file_filter = htdocs/langs/<lang>/multicurrency.lang
|
||||
source_file = htdocs/langs/en_US/multicurrency.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.oauth]
|
||||
[o:dolibarr-association:p:dolibarr:r:oauth]
|
||||
file_filter = htdocs/langs/<lang>/oauth.lang
|
||||
source_file = htdocs/langs/en_US/oauth.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.opensurvey]
|
||||
[o:dolibarr-association:p:dolibarr:r:opensurvey]
|
||||
file_filter = htdocs/langs/<lang>/opensurvey.lang
|
||||
source_file = htdocs/langs/en_US/opensurvey.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.orders]
|
||||
[o:dolibarr-association:p:dolibarr:r:orders]
|
||||
file_filter = htdocs/langs/<lang>/orders.lang
|
||||
source_file = htdocs/langs/en_US/orders.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.other]
|
||||
[o:dolibarr-association:p:dolibarr:r:other]
|
||||
file_filter = htdocs/langs/<lang>/other.lang
|
||||
source_file = htdocs/langs/en_US/other.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.partnership]
|
||||
[o:dolibarr-association:p:dolibarr:r:partnership]
|
||||
file_filter = htdocs/langs/<lang>/partnership.lang
|
||||
source_file = htdocs/langs/en_US/partnership.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.paybox]
|
||||
[o:dolibarr-association:p:dolibarr:r:paybox]
|
||||
file_filter = htdocs/langs/<lang>/paybox.lang
|
||||
source_file = htdocs/langs/en_US/paybox.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.paypal]
|
||||
[o:dolibarr-association:p:dolibarr:r:paypal]
|
||||
file_filter = htdocs/langs/<lang>/paypal.lang
|
||||
source_file = htdocs/langs/en_US/paypal.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.printing]
|
||||
[o:dolibarr-association:p:dolibarr:r:printing]
|
||||
file_filter = htdocs/langs/<lang>/printing.lang
|
||||
source_file = htdocs/langs/en_US/printing.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.productbatch]
|
||||
[o:dolibarr-association:p:dolibarr:r:productbatch]
|
||||
file_filter = htdocs/langs/<lang>/productbatch.lang
|
||||
source_file = htdocs/langs/en_US/productbatch.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.products]
|
||||
[o:dolibarr-association:p:dolibarr:r:products]
|
||||
file_filter = htdocs/langs/<lang>/products.lang
|
||||
source_file = htdocs/langs/en_US/products.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.projects]
|
||||
[o:dolibarr-association:p:dolibarr:r:projects]
|
||||
file_filter = htdocs/langs/<lang>/projects.lang
|
||||
source_file = htdocs/langs/en_US/projects.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.propal]
|
||||
[o:dolibarr-association:p:dolibarr:r:propal]
|
||||
file_filter = htdocs/langs/<lang>/propal.lang
|
||||
source_file = htdocs/langs/en_US/propal.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.receiptprinter]
|
||||
[o:dolibarr-association:p:dolibarr:r:receiptprinter]
|
||||
file_filter = htdocs/langs/<lang>/receiptprinter.lang
|
||||
source_file = htdocs/langs/en_US/receiptprinter.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.receptions]
|
||||
[o:dolibarr-association:p:dolibarr:r:receptions]
|
||||
file_filter = htdocs/langs/<lang>/receptions.lang
|
||||
source_file = htdocs/langs/en_US/receptions.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.recruitment]
|
||||
[o:dolibarr-association:p:dolibarr:r:recruitment]
|
||||
file_filter = htdocs/langs/<lang>/recruitment.lang
|
||||
source_file = htdocs/langs/en_US/recruitment.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.resource]
|
||||
[o:dolibarr-association:p:dolibarr:r:resource]
|
||||
file_filter = htdocs/langs/<lang>/resource.lang
|
||||
source_file = htdocs/langs/en_US/resource.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.salaries]
|
||||
[o:dolibarr-association:p:dolibarr:r:salaries]
|
||||
file_filter = htdocs/langs/<lang>/salaries.lang
|
||||
source_file = htdocs/langs/en_US/salaries.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.sendings]
|
||||
[o:dolibarr-association:p:dolibarr:r:sendings]
|
||||
file_filter = htdocs/langs/<lang>/sendings.lang
|
||||
source_file = htdocs/langs/en_US/sendings.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.sms]
|
||||
[o:dolibarr-association:p:dolibarr:r:sms]
|
||||
file_filter = htdocs/langs/<lang>/sms.lang
|
||||
source_file = htdocs/langs/en_US/sms.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.stocks]
|
||||
[o:dolibarr-association:p:dolibarr:r:stocks]
|
||||
file_filter = htdocs/langs/<lang>/stocks.lang
|
||||
source_file = htdocs/langs/en_US/stocks.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.stripe]
|
||||
[o:dolibarr-association:p:dolibarr:r:stripe]
|
||||
file_filter = htdocs/langs/<lang>/stripe.lang
|
||||
source_file = htdocs/langs/en_US/stripe.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.supplier_proposal]
|
||||
[o:dolibarr-association:p:dolibarr:r:supplier_proposal]
|
||||
file_filter = htdocs/langs/<lang>/supplier_proposal.lang
|
||||
source_file = htdocs/langs/en_US/supplier_proposal.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.suppliers]
|
||||
[o:dolibarr-association:p:dolibarr:r:suppliers]
|
||||
file_filter = htdocs/langs/<lang>/suppliers.lang
|
||||
source_file = htdocs/langs/en_US/suppliers.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.ticket]
|
||||
[o:dolibarr-association:p:dolibarr:r:ticket]
|
||||
file_filter = htdocs/langs/<lang>/ticket.lang
|
||||
source_file = htdocs/langs/en_US/ticket.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.trips]
|
||||
[o:dolibarr-association:p:dolibarr:r:trips]
|
||||
file_filter = htdocs/langs/<lang>/trips.lang
|
||||
source_file = htdocs/langs/en_US/trips.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.users]
|
||||
[o:dolibarr-association:p:dolibarr:r:users]
|
||||
file_filter = htdocs/langs/<lang>/users.lang
|
||||
source_file = htdocs/langs/en_US/users.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.website]
|
||||
[o:dolibarr-association:p:dolibarr:r:website]
|
||||
file_filter = htdocs/langs/<lang>/website.lang
|
||||
source_file = htdocs/langs/en_US/website.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.withdrawals]
|
||||
[o:dolibarr-association:p:dolibarr:r:withdrawals]
|
||||
file_filter = htdocs/langs/<lang>/withdrawals.lang
|
||||
source_file = htdocs/langs/en_US/withdrawals.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.workflow]
|
||||
[o:dolibarr-association:p:dolibarr:r:workflow]
|
||||
file_filter = htdocs/langs/<lang>/workflow.lang
|
||||
source_file = htdocs/langs/en_US/workflow.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.zapier]
|
||||
[o:dolibarr-association:p:dolibarr:r:zapier]
|
||||
file_filter = htdocs/langs/<lang>/zapier.lang
|
||||
source_file = htdocs/langs/en_US/zapier.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
|
||||
@ -26,14 +26,14 @@ PHP libraries:
|
||||
EvalMath 1.0 BSD Yes Safe math expressions evaluation
|
||||
Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
||||
GeoIP2 0.2.0 Apache License 2.0 Yes Lib to make geoip convert
|
||||
Mobiledetect 2.8.39 MIT License Yes Detect mobile devices browsers
|
||||
Mobiledetect 2.8.41 MIT License Yes Detect mobile devices browsers
|
||||
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
|
||||
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
|
||||
ParseDown 1.6 MIT License Yes Markdown parser
|
||||
PCLZip 2.8.4 LGPL-3+ Yes Library to zip/unzip files
|
||||
PHPDebugBar 1.15.1 MIT License Yes Used only by the module "debugbar" for developers
|
||||
PHPDebugBar 1.18.2 MIT License Yes Used only by the module "debugbar" for developers
|
||||
PHP-Imap 2.7.2 MIT License Yes Library to use IMAP with OAuth
|
||||
PHPSpreadSheet 1.8.2 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
|
||||
PHPSpreadSheet 1.12.0 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
|
||||
@ -51,7 +51,7 @@ 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.0 MIT License Yes JS library
|
||||
jQuery 3.6.4 MIT License Yes JS library
|
||||
jQuery UI 1.13.2 GPL and MIT License Yes JS library plugin UI
|
||||
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css
|
||||
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
||||
|
||||
427
ChangeLog
@ -3,33 +3,446 @@ English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
|
||||
***** ChangeLog for 18.0.0 compared to 17.0.0 *****
|
||||
|
||||
NEW: PHP 8.2 compatibility.
|
||||
|
||||
|
||||
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
|
||||
* The deprecated method "escapeunderscore()" of database handlers has been removed. You must use "escapeforlike()" instead.
|
||||
* The method "nb_expedition()" has been renamed into "countNbOfShipments()"
|
||||
* Revert default type of hooks. Default is now 'addreplace' hooks (and exception become 'output' hooks, that become deprecated).
|
||||
* Deprecated property libelle removed from entrepot class.
|
||||
* The type 'text' in ->fields property dos not accept html content anymore. Use the type 'html' for that.
|
||||
* The 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
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 17.0.1 compared to 17.0.0 *****
|
||||
|
||||
FIX: 17.0 PHP Warning invalid argument supplied for foreach
|
||||
FIX: #[23799] - External users are not able to create events - correction
|
||||
FIX: #23966 Error "Param dbt_keyfield is required but not defined
|
||||
FIX: #24138 Fix box_birthdays SQL for postgres
|
||||
FIX: #24201 Upload of external module fails to copy from incorrectly generated temp source dir
|
||||
FIX: #24240 Dolibarr V17.0.0 PHP8 fatal error
|
||||
FIX: accountancy lettering: better error management
|
||||
FIX: accountancy lettering: correctly calculated number of lettering operations done
|
||||
FIX: accountancy lettering: error management and prevention
|
||||
FIX: accountancy lettering: prevent null results when fetching link with payments
|
||||
FIX: action delete card fac rec
|
||||
FIX: Add bookmark with search fields that are arrays (backport 4157263cb898f1847cfcfc22dee6007c01b13a4d)
|
||||
FIX: Add missing hook on LibStatut
|
||||
FIX: Add more context for selectForFormsListWhere Hook
|
||||
FIX: Autofill / clear qty in inventory page
|
||||
FIX: avoid php8 warnings
|
||||
FIX: avoid phpunit error
|
||||
FIX: can not show all csv fields (a reason for that ?)
|
||||
FIX: change date on select date input when prefix is used
|
||||
FIX: dol_textishtml() function
|
||||
FIX: expense report accountancy: sql syntax error when performing automatic linking
|
||||
FIX: Extrafields in Notes to unify with orders or invoices.
|
||||
FIX: fatal error when margin enable (missing check on element), fix User::hasRight() when checking a margin right
|
||||
FIX: feedbacks
|
||||
FIX: FILTER_VALIDATE_EMAIL param is not a string
|
||||
FIX: #24298 No error or 0.00 instead of NULL in database anymore when emptying an extrafield of type price on a propal card
|
||||
FIX: full group by handle
|
||||
FIX: holiday counter massaction: ErrorBadValueForParamNotAString and PHP 8 warning when no approval user right
|
||||
FIX: installation superadmin creation: PHP 8 warning
|
||||
FIX: invoices order on sells journal
|
||||
FIX: it was not possible to update extrafields of expedition lines with batch without editing batch value
|
||||
FIX: limit after order in get objects in category
|
||||
FIX: method dolGetGlobalString not defined with saphir
|
||||
FIX: missing column default workstation
|
||||
FIX: missing drop foreign key before modify field
|
||||
FIX: missing "multidir_output" for project sharing (Multicompany)
|
||||
FIX: missing protection on ajax public ticket page for valid email
|
||||
FIX: ODT management inverted between purchase invoice and order
|
||||
FIX: PDF Espadon => display extrafields
|
||||
FIX: PDF Espadon Expedition : notes and tracking number
|
||||
FIX: Phpunit Rename WebsiteTest.class.php to WebsiteTest.php
|
||||
FIX: project referent elements list: conf to hide tasks was flipped
|
||||
FIX: Protection on agenda view for a thirdparty id that does not exist
|
||||
FIX: search_project_user
|
||||
FIX: societe list: regression to redirection to customer card when single result of search filters
|
||||
FIX: SQL error "unknown column p.fk_soc" because ANSI-92 joins take precedence over ANSI-89 joins
|
||||
FIX: task have the same entity of project
|
||||
FIX: token error when closing ticket from public interface
|
||||
FIX: Warning on purchase order + Property fk_commande not defined
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 17.0.0 compared to 16.0.0 *****
|
||||
|
||||
For users:
|
||||
---------------
|
||||
|
||||
NEW Minimal PHP version is now PHP 7.0 instead of PHP 5.6
|
||||
|
||||
...
|
||||
NEW: Minimal PHP version is now PHP 7.0 instead of PHP 5.6
|
||||
NEW: #21780 Add pid field to Cronjob class and store PID on job execution
|
||||
NEW: #20650 can move the checkbox column on left (experimental option MAIN_CHECKBOX_LEFT_COLUMN)
|
||||
NEW: #21000 Added columns 'alias_name' on project, supplier invoice, supplier order, supplier proposals and task list
|
||||
NEW: #21395 Added option for dark theme mode in display - color and theme
|
||||
NEW: #21397 added option to auto define barcode numbers for third-parties in barcode module setup
|
||||
NEW: #21399
|
||||
NEW: #21442 Enhancement of module builder init
|
||||
NEW: #21654 add bank account number used on invoices for debit
|
||||
NEW: #22048 Added notes to productlot module
|
||||
NEW: #22298 Bank - Add salaries & vat in the tab of planned entries of a bank account
|
||||
NEW: #22328
|
||||
NEW: #22424
|
||||
NEW: #22500 member module set up made easier
|
||||
NEW: #22527 projects and thirdparties can be viewed as conversation ("Message" view), like events/agenda.
|
||||
NEW: #22546 can now set user supervisors using mass action in htdocs/user
|
||||
NEW: #22594 can chose if VAT ID is unique or not for third parties
|
||||
NEW: #22622 all partnerships displayed on tab partnership of a thirdparty and member
|
||||
NEW: #22676 massaction for updating product prices
|
||||
NEW: #22735 Massaction to assign users on projects
|
||||
NEW: #4482 adding js to hide/show advanced option on the export data page
|
||||
NEW: Accountancy - Add a graphic option to enable lettering function - FPC21
|
||||
NEW: Accountancy - Add a way to clean some words when you generate thirdparty accounting account
|
||||
NEW: Accountancy - Added an option during export to export or not the lettering FPC21
|
||||
NEW: Accountancy - Manage supplier deposit with specific account
|
||||
NEW: Accountancy - Model Digitaria - Add a way to clean some words when you generate thirdparty accounting account FPC22
|
||||
NEW: Add a button "Test collect" in email collector
|
||||
NEW: Add a constant to disallow modification of the product reference.
|
||||
NEW: Add a method doAutoRenewContracts that can be used as a cron task.
|
||||
NEW: Add " as enclosure by default for CSV export. Keep removing CR/LF.
|
||||
NEW: add attached file in presend email form of thirdparty card
|
||||
NEW: Add a way to enter LICENSE file content in property of website
|
||||
NEW: Add badge in admin extrafields setup
|
||||
NEW: add constant PROPAL_BYPASS_VALIDATED_STATUS
|
||||
NEW: Add date event (!= date project) and location on event organization
|
||||
NEW: Add employment anniversary in birthday box
|
||||
NEW: Add extrafield type "IP" to store IP addresses
|
||||
NEW: Add fail2ban rules examples to limit access to /public pages
|
||||
NEW: Add filter "Product subject to lot/Serial" in stock per lot/serial
|
||||
NEW: Add hidden option MAIN_EMAIL_SUPPORT_ACK to restore Email ack checkbox (feature abandonned by mailers)
|
||||
NEW: Add IMAP port setting on email collector module
|
||||
NEW: Adding JAPAN Chart-of-Account and regions/departments
|
||||
NEW: Adding NIF verification for Algeria
|
||||
NEW: Add link to create an element from the category page
|
||||
NEW: add margin infos to takepos invoice lines
|
||||
NEW: Add max size send for "backup and link to mail" option
|
||||
NEW: Add method httponly_accessforbidden()
|
||||
NEW: Add more advices into the Setup security page
|
||||
NEW: Add new global variable for keeping the previous signature information on proposal (case of reopening a proposal)
|
||||
NEW: Add objectLink on shipment
|
||||
NEW: Add option --force on CLI cron_run_jobs.php
|
||||
NEW: Add option "Show price on the generated documents for receptions"
|
||||
NEW: Add performance index (name for company and contact) and llx_bank_url(url_id)
|
||||
NEW: Add picto property on sub-module for password generation
|
||||
NEW: add redirect on action confirm addconsumedline and addproduceline
|
||||
NEW: Add a new advanced permission "read price"
|
||||
NEW: Add substitution key __SENDEREMAIL_SIGNATURE__
|
||||
NEW: Add the referrer-policy to "same-origin" by default on all public pages.
|
||||
NEW: Add the SMTP header References on ticket email created by email
|
||||
NEW: Add the thirdparty column to the time list (projet/tasks/time.php)
|
||||
NEW: Add trigger to record the event of sending an email from a project #20912
|
||||
NEW: Allow download link option in module configuration (propal,invoice,supplier proposal, order)
|
||||
NEW: Bulk action to remove a category in list/search website pages
|
||||
NEW: Can copy/paste images into emails sent.
|
||||
NEW: Can edit label of an emailing even once sent
|
||||
NEW: Can edit property css, cssview, csslist on extrafields
|
||||
NEW: Can enter the unit price including the vat when adding new product lines on invoices, orders, proposals, ...
|
||||
NEW: Can invoice task time per different services
|
||||
NEW: Can join several files by default on email form
|
||||
NEW: Can send an email on scheduled job error
|
||||
NEW: Can set a commercial discount by entering amount including VAT
|
||||
NEW: Can set a monthly frequency (or multiple) in cron tasks.
|
||||
NEW: Can set start and end dates and comment on button "Activate all services"
|
||||
NEW: Can sort on preselected best supplier price
|
||||
NEW: Can use products categories to make inventory
|
||||
NEW: Change filter type on tickets list into a multiselect combo
|
||||
NEW: conf TIMESPENT_ALWAYS_UPDATE_THM, when it's on we always check current thm of user to update it in task time line
|
||||
NEW: constant PROPAL_NEW_AS_SIGNED
|
||||
NEW: show date delivery planned on orders linked to company and product
|
||||
NEW: Default doc template of contracts is not mandatory
|
||||
NEW: Default values in extrafields are no more limited to 255 char.
|
||||
NEW: display currency in takepos menu
|
||||
NEW: Enable online signature for interventions
|
||||
NEW: extrafield price with currency
|
||||
NEW: filter on reception dates (from / to) in cheque paiement card
|
||||
NEW: Members: default_lang for members
|
||||
NEW: Members: Table of membership types
|
||||
NEW: Members: add free membership amounts at the membership type level
|
||||
NEW: TakePOS: Header Scroll in TakePOS
|
||||
NEW: TakePOS: add price to product box in TakePOS
|
||||
NEW: TakePOS: add setup parameters, can setup terminal name
|
||||
NEW: TakePOS: support of Stripe Terminal with TakePOS
|
||||
NEW: TakePOS: Receipt preview in TakePOS setup
|
||||
NEW: TakePOS: different product list on smartphone
|
||||
NEW: Website: can delete a whole website if disabled
|
||||
NEW: Website: can remove a website template
|
||||
NEW: Website: can set header "Strict-Transport-Security" in web sites.
|
||||
NEW: Website: can switch status of website and page from the website toolbar
|
||||
NEW: Website: Templates of websites are now directories and not zip into core repo
|
||||
NEW: Website: add 4 other templates in website module
|
||||
NEW: Website: Add counters for public access of pages on a website
|
||||
NEW: If we select another view list mode, we keep it
|
||||
NEW: Init module bookcal
|
||||
NEW: Encrypt all sensitive constants in llx_const using dolEncrypt/dolDecrypt
|
||||
NEW: Invoice - Add french mention on pdf when vat debit option is on
|
||||
NEW: invoice export : add accounting affectation
|
||||
NEW: label on products categories filter
|
||||
NEW: The link "add to bookmark" is always on top in the bookmark popup
|
||||
NEW: MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS const to show category customer filter
|
||||
NEW: Make module WebservicesClient deprecated. Use module WebHook instead.
|
||||
NEW: manage no email with thirdparties (better for GDPR)
|
||||
NEW: Manage Position (Rank) on Contract Lines
|
||||
NEW: Manage VAT on all lines on purchases cycle
|
||||
NEW: Page to show virtual stock at a future date
|
||||
NEW: On a bank reconciled line, we can modify the bank receipt
|
||||
NEW: On a form to send an email, we show all emails of all contacts of object
|
||||
NEW: Option PRODUCTBATCH_SHOW_WAREHOUSE_ON_SHIPMENT showing wh on PDF
|
||||
NEW: Option PRODUIT_DESC_IN_FORM accept (desktop only or +smartphone)
|
||||
NEW: Page for mass stock transfer can be used with no source stock
|
||||
NEW: parent company column and filter in invoice and order list
|
||||
NEW: Add "Show Sales rep" option for PDF
|
||||
NEW: Picto for shared link is clickable
|
||||
NEW: possibility to select scopes with checkbox for Oauth tokens
|
||||
NEW: private and public note on user, thirdparty and contact list
|
||||
NEW: product categories filter on inventory list
|
||||
NEW: Product supplier price: autofill default supplier VAT
|
||||
NEW: Project - author field become an available column on lists
|
||||
NEW: Reception - Add a from/to on search on date field
|
||||
NEW: Start a simple support of recurrent events on agenda
|
||||
NEW: Resize parent company column in order list
|
||||
NEW: Saved token of OAUTH module are now encrypted into llx_oauth_token
|
||||
NEW: Save one click to select on delivery ack, on emails.
|
||||
NEW: scheduled job to send unpaid invoice reminder can now use the cc and bcc from email template
|
||||
NEW: set thirdparty type with company modify trigger
|
||||
NEW: Show also scheduled task never finished in scheduled task widget
|
||||
NEW: show badge with number of extrafields in setup
|
||||
NEW: show category tree in sellist and chkbxlst for common object
|
||||
NEW: Show picto and color into combo for selection of tags
|
||||
NEW: show product label on inventory
|
||||
NEW: show sell-by and eat-by dates only if not empty
|
||||
NEW: show SellBy/EatBy dates for each batch product in shipment card
|
||||
NEW: Can skip accept/refuse steps for proposals (option PROPAL_SKIP_ACCEPT_REFUSE)
|
||||
NEW: experimental SMTP using PhpImap allowing OAuth2 authentication (need to add option MAIN_IMAP_USE_PHPIMAP)
|
||||
NEW: can substitue project title in mail template
|
||||
NEW: Supplier order list - Add column private and public note
|
||||
NEW: The purge of files can purge only if older than a number of seconds
|
||||
NEW: Update ActionComm type_code on email message ticket
|
||||
NEW: VAT - Admin - Add information on deadline day for submission of VAT declaration
|
||||
NEW: expand/collapse permissions on user permission page
|
||||
NEW: Show delivery mode on PDF for proposals
|
||||
NEW: Add the target to select attendees of event for emailings
|
||||
NEW: Can set background style with MAIN_LOGIN_BACKGROUND_STYLE
|
||||
|
||||
Modules
|
||||
NEW: Experimental module Asset
|
||||
|
||||
For developers or integrators:
|
||||
------------------------------
|
||||
|
||||
NEW Minimal PHP version is now PHP 7.0 instead of PHP 5.6
|
||||
|
||||
...
|
||||
NEW: ModuleBuilder can generate code for a class from an existing SQL table
|
||||
NEW: #22370 Modulebuilder supports 'alwayseditable' (like extrafields)
|
||||
NEW: #20912 Add trigger to record the event of sending an email from a project
|
||||
NEW: #21750 Added "Get lines and Post lines from BOM" at the REST Service
|
||||
NEW: Removed completely the need for the library adodbtime
|
||||
NEW: hook on agenda pages
|
||||
NEW: hook to complete payment in TakePOS
|
||||
NEW: hook "changeHelpURL" to modify target of the help button
|
||||
NEW: hook formConfirm on action comm card
|
||||
NEW: hook to modify supplier product html select
|
||||
NEW: Add new hook for show virtual stock details on product stock card
|
||||
NEW: Add new hooks for actioncomm
|
||||
NEW: conf->global->SYSLOG_FILE_ONEPERSESSION accept a string
|
||||
NEW: translation for contact type API, setup/ticket API, shipping method API
|
||||
NEW: All ajax pages have now a header build with top_httphead()
|
||||
NEW: support multilang in Civilities API
|
||||
NEW: Add API for the partnership module
|
||||
NEW: Add "Get lines and Post lines from BOM" in the API
|
||||
NEW: Replace property fk_categories_product with categories_product in inventory class
|
||||
NEW: Rewrite of SQL request. Removed the join on category table (for filter on category), replaced with a EXISTS/NOT
|
||||
NEW: Add oldcopy to Ticket so triggers intercepting TICKET_MODIFY have access to old values of the updated properties
|
||||
NEW: #19680 Add option PRODUCT_ALLOW_EXTERNAL_DOWNLOAD to automatically have uploaded files shared publicly by a link
|
||||
NEW: Add option FICHINTER_ALLOW_EXTERNAL_DOWNLOAD
|
||||
|
||||
|
||||
WARNING:
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product
|
||||
* Minimal PHP version is now PHP 7.0 instead of PHP 5.6
|
||||
* The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product->getNomUrl()
|
||||
* Trigger ORDER_SUPPLIER_DISPATCH is removed, use ORDER_SUPPLIER_RECEIVE and/or LINEORDER_SUPPLIER_DISPATCH instead.
|
||||
* All functions fetch_all() have been set to deprecated for naming consitency, use fetchAll() instead.
|
||||
* Code standardization: '$user->rights->propale' is now '$user->rights->propal' everywhere.
|
||||
* Deprecated method set_billed() on shipment and reception class has been removed. Use setBilled() instead.
|
||||
* Tables llx_prelevement_facture and llx_prelevement_facture_demande have been renamed into llx_prelevement and llx_prelevement_demande.
|
||||
* Rename MAIN_LIST_ALLOW_NOTES into MAIN_LIST_HIDE_NOTES and rename MAIN_LIST_ALLOW_PRIVATE_NOTES into MAIN_LIST_HIDE_PRIVATE_NOTES
|
||||
* Rename the substitution for "project label" instead of "project title" in substitution variables
|
||||
* You must use "$objectoffield" to manipulate the current object inside the formulare of computed custom extrafields instead of $obj/$object.
|
||||
* 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;
|
||||
|
||||
***** ChangeLog for 16.0.5 compared to 16.0.4 *****
|
||||
|
||||
FIX: 16.0 propalestats Unknown column 'p.fk_soc' in 'on clause'
|
||||
FIX: #23804
|
||||
FIX: #23860
|
||||
FIX: #23966 Error "Param dbt_keyfield is required but not defined"
|
||||
FIX: accountancy lettering: better error management
|
||||
FIX: accountancy lettering: correctly calculated number of lettering operations done
|
||||
FIX: accountancy lettering: error management and prevention
|
||||
FIX: accountancy lettering: prevent null results when fetching link with payments
|
||||
FIX: Add missing hook on LibStatut
|
||||
FIX: Add more context for selectForFormsListWhere Hook
|
||||
FIX: attach file and send by mail in ticket
|
||||
FIX: bad check on if in get_all_ways
|
||||
FIX: Cannot import find type_fees with cgenericdic.class because it has id and not rowid
|
||||
FIX: clicktodial backtopage
|
||||
FIX: discount wasn't taken into account when adding a line in BOM
|
||||
FIX: expense reports: error when selecting mileage fees expense type if MAIN_USE_EXPENSE_IK disabled
|
||||
FIX: expense reports: JS error when selecting mileage fees expense type if MAIN_USE_EXPENSE_IK disabled
|
||||
FIX: Extrafields in Notes to unify with orders or invoices.
|
||||
FIX: fatal error on clicktodial backtopage
|
||||
FIX: filter sql accounting account
|
||||
FIX: Get data back on product update
|
||||
FIX: Get data back when error on command create
|
||||
FIX: label dictionary is used by barcode and member module
|
||||
FIX: mandatory date for service didnt work for invoice
|
||||
FIX: missing "authorid" for getNomUrl link right access
|
||||
FIX: missing getEntity filter
|
||||
FIX: vulnerability: missing protection on ajax public ticket page for valid email.
|
||||
FIX: Missing right to edit service note when module product is disabled
|
||||
FIX: multicompany compatibility
|
||||
FIX: object $user is not defined
|
||||
FIX: Object of class LDAP\Connection could not be converted to string
|
||||
FIX: parse error and NAN
|
||||
FIX: product ref fourn same size in supplier order/invoice as in product price fourn
|
||||
FIX: Profit calculation on project preview tab.
|
||||
FIX: Remove orphelan $this->db->rollback() in the function insertExtrafields()
|
||||
FIX: request new password with "mc" and "twofactor" authentication
|
||||
FIX: Resolve error message due to missing arguments
|
||||
FIX: select for task in event card
|
||||
FIX: several email sent to the same recipient when adding message from ticket
|
||||
FIX: shipping list for external user
|
||||
FIX: SQL error "unknown column p.fk_soc" because ANSI-92 joins take precedence over ANSI-89 joins
|
||||
FIX: strato pdf
|
||||
FIX: typos in getAttchments() $arrayobject
|
||||
FIX: whitespaces
|
||||
FIX: wrong url param name action
|
||||
|
||||
|
||||
***** ChangeLog for 16.0.4 compared to 16.0.3 *****
|
||||
|
||||
FIX: Amount of localtax1 and 2 not correctly save on purchase order (the rate was saved instead)
|
||||
FIX: #20415
|
||||
FIX: #21280
|
||||
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: #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: API access for deactivated users
|
||||
FIX: bad selection of barcode numbering module
|
||||
FIX: Can't see all time spent by all user
|
||||
FIX: CI
|
||||
FIX: CommonObject - showOptionals - Display blank td when MAIN_VIEW_LINE_NUMBER is enabled and action is confirm_valid
|
||||
FIX: Documents API inconsistency
|
||||
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: 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
|
||||
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: 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
|
||||
FIX: Stickler
|
||||
FIX: travis
|
||||
FIX: wrong check on $search_categ value causing fatal error
|
||||
FIX: wrong stock list with multicompany and without stock sharing
|
||||
|
||||
***** ChangeLog for 16.0.3 compared to 16.0.2 *****
|
||||
|
||||
FIX: $sign is useless
|
||||
FIX: #18304 Member subscription confirmation email sent even if mandatory fields are missing
|
||||
FIX: #19828
|
||||
FIX: #19877
|
||||
FIX: #22509 default value on integer fields don't retrieve by setSaveQuery
|
||||
FIX: #22786
|
||||
FIX: #22813
|
||||
FIX: #22824 Accountancy - Journal - Search on subledger when list of subledger is disabled
|
||||
FIX: Backup using the low memory mode
|
||||
FIX: Bankaccounts API fetch with 'id' and 'socid'
|
||||
FIX: base64_decode should be forbiden in dol_eval
|
||||
FIX: Broken Permissions check, $object is null.
|
||||
FIX: compute next value when year is on one digit for reset counter
|
||||
FIX: copy same behaviour in other accountancy files
|
||||
FIX: Fix the position of the verification condition of the test field in case of multi entities
|
||||
FIX: for #22882
|
||||
FIX: for #22952
|
||||
FIX: merge errors on mailing card
|
||||
FIX: PaymentBankTransfer Type page management with Select and Input on create.php
|
||||
FIX: remove not initialized variable
|
||||
FIX: SQL request parenthesis
|
||||
FIX: Use the Hook addMoreActionsButtons resPrint
|
||||
FIX: Wrong Extrafields Element For Assets
|
||||
|
||||
***** ChangeLog for 16.0.2 compared to 16.0.1 *****
|
||||
|
||||
FIX: 16.0 - computed extrafields are not displayed if the object has no other extrafields
|
||||
FIX: #22538
|
||||
FIX: Accountancy - Review of Winfic - eWinfic - Winsis compta export format
|
||||
FIX: add loadRoleMode on getlinearray
|
||||
FIX: Autosearch on takepos was broken
|
||||
FIX: avoid access forbidden with numeric ref
|
||||
FIX: avoid error, check of product fetch is already check before
|
||||
FIX: avoid error, fetch of product is mandatory (by id or by ref)
|
||||
FIX: avoid unnecessary multiple calculation (#22637)
|
||||
FIX: bug on selected value for select_bom() function
|
||||
FIX: can not set prospect status "Do not contact"
|
||||
FIX: change in the communication status of the prospect
|
||||
FIX: check $id, already checked before
|
||||
FIX: closed warehouse for shipping
|
||||
FIX: extrafields_add tpl for stock movement
|
||||
FIX: the request SQL for transversal user, the join on usergroup table must be with getEntity('usergroup')
|
||||
FIX: Import of contact when there is duplicate thirdparties
|
||||
FIX: Import of socialnetwork field
|
||||
FIX: input selector is wrong with PRODUCT_LOAD_EXTRAFIELD_INTO_OBJECTLINES usage
|
||||
FIX: install wizard error management
|
||||
FIX: just add integer
|
||||
FIX: Missing $object for online signature link build
|
||||
FIX: missing quote
|
||||
FIX: only modify hidden checkbox/multislected extrafields on update if they are provided in request
|
||||
FIX: php doc
|
||||
FIX: private message ticket become public if edit action
|
||||
FIX: remove > 0 and -1
|
||||
FIX: remove db object to avoid error with postgresql
|
||||
FIX: Search ambigous field on MO list
|
||||
FIX: Search on social networks
|
||||
FIX: Subscription must be stopped when max of attendees reached.
|
||||
FIX: supplier price update: missing error reporting
|
||||
FIX: travis & stickler feedbacks
|
||||
FIX: we must be able to select only bom of a specific product + several fixes on select_bom() function
|
||||
FIX: wrong perm check
|
||||
FIX: wrong typo, remove quote
|
||||
FIX: wrong var typo
|
||||
|
||||
|
||||
***** ChangeLog for 16.0.1 compared to 16.0.0 *****
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||

|
||||

|
||||
[](https://php.net/)
|
||||
[](https://php.net/)
|
||||
[](https://github.com/Dolibarr/dolibarr)
|
||||
[](https://bestpractices.coreinfrastructure.org/projects/5521)
|
||||
|
||||
|
||||
15
SECURITY.md
@ -6,9 +6,8 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
|
||||
|
||||
| Version | Supported |
|
||||
| ---------- | ---------------------- |
|
||||
| <= 15.0.0 | :x: |
|
||||
| >= 15.0.1+ | :white_check_mark: except CSRF attacks|
|
||||
| >= 16.0.0 | :white_check_mark: |
|
||||
| <= 16.0.2 | :x: |
|
||||
| >= 16.0.3 | :white_check_mark: |
|
||||
| >= develop | :white_check_mark: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
@ -54,20 +53,21 @@ ONLY vulnerabilities discovered, when the following setup on test platform is us
|
||||
* $dolibarr_nocsrfcheck must be kept to the value 0 into conf.php (this is the default value)
|
||||
* $dolibarr_main_force_https must be set to something else than 0.
|
||||
* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 3 into backoffice menu Home - Setup - Other (this protection should be set to 3 soon by default)
|
||||
* The module DebugBar and ModuleBuilder must NOT be enabled (by default, these modules are not enabled. They are developer tools)
|
||||
* ONLY security reports on modules provided by default and with the "stable" status are valid (troubles into "experimental", "developement" or external modules are not valid vulnerabilities).
|
||||
* The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer).
|
||||
* The web server setup must be done so that only the documents directory is in write mode. The root directory called htdocs must be read-only.
|
||||
* CSRF attacks are accepted but double check that you have set MAIN_SECURITY_CSRF_WITH_TOKEN to value 3.
|
||||
* The module DebugBar and ModuleBuilder must NOT be enabled (by default, these modules are not enabled. They are developer tools)
|
||||
* Ability for a high level user to edit web site pages into the CMS by including HTML or Javascript is an expected feature. Vulnerabilities into the website module are validated only if HTML or Javascript injection can be done by a non allowed user.
|
||||
* Fail2ban rules for rate limit on the login page,password forgotten page and all public pages (/public/*) must be installed as recommendend into the section "About - Admin tools - Section Access limits and mitigation".
|
||||
|
||||
Scope is the web application (back office) and the APIs.
|
||||
|
||||
## Qualifying vulnerabilities for reporting
|
||||
## Example of vulnerabilities Qualified for reporting.
|
||||
|
||||
* Remote code execution (RCE)
|
||||
* Local files access and manipulation (LFI, RFI, XXE, SSRF, XSPA)
|
||||
* Code injections (HTML, JS, SQL, PHP, ...)
|
||||
* Code injections (JS, SQL, PHP). HTML are covered only for fields that are not description, notes or comments fields (where rich content is allowed on purpose).
|
||||
* Cross-Site Scripting (XSS), except from setup page of module "External web site" (allowing any content here, editable by admin user only, is accepted on purpose) and except into module "Web site" when permission to edit website content is allowed (injecting any data in this case is allowed too).
|
||||
* Cross-Site Requests Forgery (CSRF) with real security impact (when using GET URLs, CSRF are qualified only for creating, updating or deleting data from pages restricted to admin users)
|
||||
* Open redirect
|
||||
@ -79,7 +79,7 @@ Scope is the web application (back office) and the APIs.
|
||||
* Software version disclosure (for non admin users only)
|
||||
* Stack traces or path disclosure (for non admin users only)
|
||||
|
||||
## Non-qualifying vulnerabilities for reporting
|
||||
## Example of vulnerabilities non Non-qualified for reporting.
|
||||
|
||||
* "Self" XSS
|
||||
* SSL/TLS best practices
|
||||
@ -96,3 +96,4 @@ Scope is the web application (back office) and the APIs.
|
||||
* Software version or private IP disclosure when logged user is admin
|
||||
* Stack traces or path disclosure when logged user is admin
|
||||
* Any vulnerabilities due to a configuration different than the one defined into chapter "Scope for qualified vulnerabilities".
|
||||
* Brute force attacks on login page, password forgotten page or any public pages (/public/*) are not qualified if the fail2ban recommended fail2ban rules were not installed.
|
||||
|
||||
@ -1 +1 @@
|
||||
7
|
||||
10
|
||||
@ -1,2 +0,0 @@
|
||||
htdocs/install/doctemplates/websites/website_template-corporate.zip
|
||||
htdocs/install/doctemplates/websites/website_template-stellar.zip
|
||||
3
build/debian/source/options
Normal file
@ -0,0 +1,3 @@
|
||||
# Force use of gzip compression by dpkg-buildpackage
|
||||
compression = "gzip"
|
||||
#compression-level = 9
|
||||
@ -1,4 +1,4 @@
|
||||
FROM php:7.3-apache
|
||||
FROM php:8.1-apache-bullseye
|
||||
|
||||
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-png-dir=/usr --with-jpeg-dir=/usr \
|
||||
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
||||
&& 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 && \
|
||||
|
||||
@ -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
|
||||
|
||||
@ -34,6 +34,8 @@ 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
|
||||
|
||||
@ -15,10 +15,10 @@ fi
|
||||
echo "[docker-run] => Set Permission to www-data for /var/documents"
|
||||
chown -R www-data:www-data /var/documents
|
||||
|
||||
if [ ! -f /usr/local/etc/php/php.ini ]; then
|
||||
cat <<EOF > /usr/local/etc/php/php.ini
|
||||
date.timezone = $PHP_INI_DATE_TIMEZONE
|
||||
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}
|
||||
EOF
|
||||
fi
|
||||
|
||||
exec apache2-foreground
|
||||
|
||||
@ -17,9 +17,9 @@ use Cwd;
|
||||
my $dir = getcwd;
|
||||
|
||||
print "Current dir is: $dir\n";
|
||||
print "Running dir for doxygen must be: $DIR\n";
|
||||
#print "Running dir for doxygen must be: $DIR\n";
|
||||
|
||||
if (! -s $CONFFILE)
|
||||
if (! -s "build/doxygen/$CONFFILE")
|
||||
{
|
||||
print "Error: current directory for building Dolibarr doxygen documentation is not correct.\n";
|
||||
print "\n";
|
||||
@ -30,7 +30,7 @@ if (! -s $CONFFILE)
|
||||
exit 1;
|
||||
}
|
||||
|
||||
$SOURCE="../..";
|
||||
$SOURCE=".";
|
||||
|
||||
# Get version $MAJOR, $MINOR and $BUILD
|
||||
$result = open( IN, "< " . $SOURCE . "/htdocs/filefunc.inc.php" );
|
||||
@ -47,8 +47,8 @@ $version=$MAJOR.".".$MINOR.".".$BUILD;
|
||||
|
||||
|
||||
print "Running doxygen for version ".$version.", please wait...\n";
|
||||
print "cat $CONFFILE | sed -e 's/x\.y\.z/".$version."/' | doxygen $OPTIONS - 2>&1\n";
|
||||
$result=`cat $CONFFILE | sed -e 's/x\.y\.z/$version/' | doxygen $OPTIONS - 2>&1`;
|
||||
print "cat build/doxygen/$CONFFILE | sed -e 's/x\.y\.z/".$version."/' | doxygen $OPTIONS - 2>&1\n";
|
||||
$result=`cat build/doxygen/$CONFFILE | sed -e 's/x\.y\.z/$version/' | doxygen $OPTIONS - 2>&1`;
|
||||
|
||||
print $result;
|
||||
|
||||
|
||||
@ -1,14 +1,17 @@
|
||||
# Doxyfile 1.7.3
|
||||
# Doxyfile 1.8.16
|
||||
|
||||
# This file describes the settings to be used by the documentation system
|
||||
# doxygen (www.doxygen.org) for a project
|
||||
# doxygen (www.doxygen.org) for a project.
|
||||
#
|
||||
# All text after a hash (#) is considered a comment and will be ignored
|
||||
# All text after a double hash (##) is considered a comment and is placed in
|
||||
# front of the TAG it is preceding.
|
||||
#
|
||||
# All text after a single hash (#) is considered a comment and will be ignored.
|
||||
# The format is:
|
||||
# TAG = value [value, ...]
|
||||
# For lists items can also be appended using:
|
||||
# TAG += value [value, ...]
|
||||
# Values that contain spaces should be placed between quotes (" ")
|
||||
# TAG = value [value, ...]
|
||||
# For lists, items can also be appended using:
|
||||
# TAG += value [value, ...]
|
||||
# Values that contain spaces should be placed between quotes (\" \").
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
@ -38,7 +41,7 @@ PROJECT_NUMBER = x.y.z
|
||||
# If a relative path is entered, it will be relative to the location
|
||||
# where doxygen was started. If left blank the current directory will be used.
|
||||
|
||||
OUTPUT_DIRECTORY = ../../build
|
||||
OUTPUT_DIRECTORY = build
|
||||
|
||||
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
|
||||
# 4096 sub-directories (in 2 levels) under the output directory of each output
|
||||
@ -114,7 +117,7 @@ FULL_PATH_NAMES = YES
|
||||
# If left blank the directory from which doxygen is run is used as the
|
||||
# path to strip.
|
||||
|
||||
STRIP_FROM_PATH = "../.."
|
||||
STRIP_FROM_PATH = "/home/dolibarr/doxygen.dolibarr.org/"
|
||||
|
||||
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
|
||||
# the path mentioned in the documentation of a class, which tells
|
||||
@ -287,7 +290,7 @@ TYPEDEF_HIDES_STRUCT = NO
|
||||
# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
|
||||
# corresponding to a cache size of 2^16 = 65536 symbols
|
||||
|
||||
SYMBOL_CACHE_SIZE = 0
|
||||
#SYMBOL_CACHE_SIZE = 0
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
@ -448,7 +451,7 @@ GENERATE_TODOLIST = NO
|
||||
# disable (NO) the test list. This list is created by putting \test
|
||||
# commands in the documentation.
|
||||
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_TESTLIST = NO
|
||||
|
||||
# The GENERATE_BUGLIST tag can be used to enable (YES) or
|
||||
# disable (NO) the bug list. This list is created by putting \bug
|
||||
@ -487,7 +490,7 @@ SHOW_USED_FILES = YES
|
||||
# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
|
||||
# in the documentation. The default is NO.
|
||||
|
||||
SHOW_DIRECTORIES = YES
|
||||
#SHOW_DIRECTORIES = YES
|
||||
|
||||
# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
|
||||
# This will remove the Files entry from the Quick Index and from the
|
||||
@ -571,7 +574,7 @@ WARN_FORMAT = "$file:$line: $text"
|
||||
# and error messages should be written. If left blank the output is written
|
||||
# to stderr.
|
||||
|
||||
WARN_LOGFILE = doxygen_warnings.log
|
||||
WARN_LOGFILE = build/html/doxygen_warnings.log
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
@ -582,7 +585,7 @@ WARN_LOGFILE = doxygen_warnings.log
|
||||
# directories like "/usr/src/myproject". Separate the files or directories
|
||||
# with spaces.
|
||||
|
||||
INPUT = ../../htdocs ../../scripts
|
||||
INPUT = htdocs scripts
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
|
||||
@ -611,7 +614,7 @@ RECURSIVE = YES
|
||||
# excluded from the INPUT source files. This way you can easily exclude a
|
||||
# subdirectory from a directory tree whose root is specified with the INPUT tag.
|
||||
|
||||
EXCLUDE = ../../build ../../dev ../../doc ../../document ../../documents ../../htdocs/conf/conf.php ../../htdocs/custom ../../htdocs/document ../../htdocs/documents ../../htdocs/includes
|
||||
EXCLUDE = build dev doc document documents htdocs/conf/conf.php htdocs/custom htdocs/document htdocs/documents htdocs/includes htdocs/install/doctemplates
|
||||
|
||||
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
|
||||
# directories that are symbolic links (a Unix filesystem feature) are excluded
|
||||
@ -625,7 +628,7 @@ EXCLUDE_SYMLINKS = YES
|
||||
# against the file with absolute path, so to exclude all test directories
|
||||
# for example use the pattern */test/*
|
||||
|
||||
EXCLUDE_PATTERNS = */CVS/* *google* *pibarcode*
|
||||
EXCLUDE_PATTERNS = */CVS/*
|
||||
|
||||
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
|
||||
# (namespaces, classes, functions, etc.) that should be excluded from the
|
||||
@ -639,27 +642,27 @@ EXCLUDE_SYMBOLS =
|
||||
# directories that contain example code fragments that are included (see
|
||||
# the \include command).
|
||||
|
||||
EXAMPLE_PATH = ../../htdocs/modulebuilder/template
|
||||
#EXAMPLE_PATH = htdocs/modulebuilder/template
|
||||
|
||||
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
|
||||
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
||||
# and *.h) to filter out the source-files in the directories. If left
|
||||
# blank all files are included.
|
||||
|
||||
EXAMPLE_PATTERNS = *.php
|
||||
#EXAMPLE_PATTERNS = *.php
|
||||
|
||||
# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
|
||||
# searched for input files to be used with the \include or \dontinclude
|
||||
# commands irrespective of the value of the RECURSIVE tag.
|
||||
# Possible values are YES and NO. If left blank NO is used.
|
||||
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
#EXAMPLE_RECURSIVE = NO
|
||||
|
||||
# The IMAGE_PATH tag can be used to specify one or more files or
|
||||
# directories that contain image that are included in the documentation (see
|
||||
# the \image command).
|
||||
|
||||
IMAGE_PATH = ../../doc/images
|
||||
IMAGE_PATH = doc/images
|
||||
|
||||
# The INPUT_FILTER tag can be used to specify a program that doxygen should
|
||||
# invoke to filter for each input file. Doxygen will invoke the filter program
|
||||
@ -762,7 +765,7 @@ ALPHABETICAL_INDEX = YES
|
||||
# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
|
||||
# in which this list will be split (can be a number in the range [1..20])
|
||||
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
#COLS_IN_ALPHA_INDEX = 5
|
||||
|
||||
# In case all classes in a project start with a common prefix, all
|
||||
# classes will be put under the same header in the alphabetical index.
|
||||
@ -775,14 +778,16 @@ IGNORE_PREFIX =
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
|
||||
# generate HTML output.
|
||||
# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
|
||||
# The default value is: YES.
|
||||
|
||||
GENERATE_HTML = YES
|
||||
|
||||
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
|
||||
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
|
||||
# put in front of it. If left blank `html' will be used as the default path.
|
||||
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
|
||||
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
|
||||
# it.
|
||||
# The default directory is: html.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_OUTPUT = html
|
||||
|
||||
@ -797,14 +802,14 @@ HTML_FILE_EXTENSION = .html
|
||||
# standard header.
|
||||
|
||||
# Does not work with 1.7.3
|
||||
#HTML_HEADER = doxygen_header.html
|
||||
#HTML_HEADER = build/doxygen/doxygen_header.html
|
||||
|
||||
# The HTML_FOOTER tag can be used to specify a personal HTML footer for
|
||||
# each generated HTML page. If it is left blank doxygen will generate a
|
||||
# standard footer.
|
||||
|
||||
# Does not work with 1.7.3
|
||||
HTML_FOOTER = doxygen_footer.html
|
||||
HTML_FOOTER = build/doxygen/doxygen_footer.html
|
||||
|
||||
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
|
||||
# style sheet that is used by each HTML page. It can be used to
|
||||
@ -850,7 +855,18 @@ HTML_TIMESTAMP = YES
|
||||
# files or namespaces will be aligned in HTML using tables. If set to
|
||||
# NO a bullet list will be used.
|
||||
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
#HTML_ALIGN_MEMBERS = YES
|
||||
|
||||
# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
|
||||
# documentation will contain a main index with vertical navigation menus that
|
||||
# are dynamically created via Javascript. If disabled, the navigation index will
|
||||
# consists of multiple levels of tabs that are statically embedded in every HTML
|
||||
# page. Disable this option to support browsers that do not have Javascript,
|
||||
# like the Qt help browser.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_DYNAMIC_MENUS = NO
|
||||
|
||||
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
|
||||
# documentation will contain sections that can be hidden and shown after the
|
||||
@ -858,7 +874,7 @@ HTML_ALIGN_MEMBERS = YES
|
||||
# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
|
||||
# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
|
||||
|
||||
HTML_DYNAMIC_SECTIONS = YES
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
|
||||
# If the GENERATE_DOCSET tag is set to YES, additional index files
|
||||
# will be generated that can be used as input for Apple's Xcode 3
|
||||
@ -1003,7 +1019,7 @@ QHG_LOCATION =
|
||||
# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
|
||||
# the help appears.
|
||||
|
||||
GENERATE_ECLIPSEHELP = YES
|
||||
GENERATE_ECLIPSEHELP = NO
|
||||
|
||||
# A unique identifier for the eclipse help plugin. When installing the plugin
|
||||
# the directory name containing the HTML and XML files should also have
|
||||
@ -1035,7 +1051,7 @@ GENERATE_TREEVIEW = NO
|
||||
# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
|
||||
# and Class Hierarchy pages using a tree view instead of an ordered list.
|
||||
|
||||
USE_INLINE_TREES = NO
|
||||
#USE_INLINE_TREES = NO
|
||||
|
||||
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
|
||||
# used to set the initial width (in pixels) of the frame in which the tree
|
||||
@ -1072,7 +1088,7 @@ FORMULA_TRANSPARENT = YES
|
||||
# typically be disabled. For large projects the javascript based search engine
|
||||
# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
|
||||
|
||||
SEARCHENGINE = NO
|
||||
SEARCHENGINE = YES
|
||||
|
||||
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
|
||||
# implemented using a PHP enabled web server instead of at the web client
|
||||
@ -1082,7 +1098,7 @@ SEARCHENGINE = NO
|
||||
# full text search. The disadvances is that it is more difficult to setup
|
||||
# and does not have live searching capabilities.
|
||||
|
||||
SERVER_BASED_SEARCH = NO
|
||||
SERVER_BASED_SEARCH = YES
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
@ -1260,13 +1276,13 @@ XML_OUTPUT = xml
|
||||
# which can be used by a validating XML parser to check the
|
||||
# syntax of the XML files.
|
||||
|
||||
XML_SCHEMA =
|
||||
#XML_SCHEMA =
|
||||
|
||||
# The XML_DTD tag can be used to specify an XML DTD,
|
||||
# which can be used by a validating XML parser to check the
|
||||
# syntax of the XML files.
|
||||
|
||||
XML_DTD =
|
||||
#XML_DTD =
|
||||
|
||||
# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
|
||||
# dump the program listings (including syntax highlighting
|
||||
@ -1431,7 +1447,7 @@ EXTERNAL_GROUPS = YES
|
||||
# The PERL_PATH should be the absolute path and name of the perl script
|
||||
# interpreter (i.e. the result of `which perl').
|
||||
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#PERL_PATH = /usr/bin/perl
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
@ -1453,7 +1469,7 @@ CLASS_DIAGRAMS = NO
|
||||
# the mscgen tool resides. If left empty the tool is assumed to be found in the
|
||||
# default search path.
|
||||
|
||||
MSCGEN_PATH =
|
||||
#MSCGEN_PATH =
|
||||
|
||||
# If set to YES, the inheritance and collaboration graphs will hide
|
||||
# inheritance and usage relations if the target is undocumented
|
||||
@ -1485,7 +1501,7 @@ DOT_NUM_THREADS = 0
|
||||
# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
|
||||
# containing the font.
|
||||
|
||||
DOT_FONTNAME = FreeSans.ttf
|
||||
#DOT_FONTNAME = FreeSans.ttf
|
||||
|
||||
# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
|
||||
# The default size is 10pt.
|
||||
@ -1634,3 +1650,7 @@ GENERATE_LEGEND = YES
|
||||
# the various graphs.
|
||||
|
||||
DOT_CLEANUP = YES
|
||||
|
||||
|
||||
FULL_SIDEBAR = NO
|
||||
HTML_EXTRA_STYLESHEET = build/doxygen/doxygen-awesome.css
|
||||
|
||||
2413
build/doxygen/doxygen-awesome.css
Normal 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 + 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 ?
|
||||
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?
|
||||
|
||||
TechnicalParameters=Technical parameters
|
||||
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.
|
||||
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.
|
||||
|
||||
; 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 warning but you may have to remove it manually later when asked. Click OK to continue...
|
||||
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...
|
||||
|
||||
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 ?
|
||||
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?
|
||||
|
||||
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 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'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.
|
||||
|
||||
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 ?
|
||||
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?
|
||||
|
||||
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
|
||||
OldVersionFoundAndMoveInNew=An old database version has been found and moved to be used by the new Dolibarr version
|
||||
OldVersionFoundButFailedToMoveInNew=An old database version has been found but could not be moved to be used with the new Dolibarr version
|
||||
|
||||
DLLMissing=Your Windows installation is missing The "Micrsoft Visual C++ Redistributable for Visual Studio 2012" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after.
|
||||
ContinueAnyway=Continue anyway (install process may fails without this prerequisite)
|
||||
DLLMissing=Your Windows installation is missing the "Microsoft Visual C++ Redistributable for Visual Studio 2012" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after.
|
||||
ContinueAnyway=Continue anyway (install process may fail without this prerequisite)
|
||||
|
||||
@ -46,6 +46,7 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
|
||||
|
||||
$includecustom=0;
|
||||
$includeconstants=array();
|
||||
$buildzip=0;
|
||||
|
||||
if (empty($argv[1])) {
|
||||
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value] [buildzip=1]\n";
|
||||
@ -55,14 +56,27 @@ if (empty($argv[1])) {
|
||||
|
||||
|
||||
$i=0;
|
||||
$result = array();
|
||||
while ($i < $argc) {
|
||||
if (!empty($argv[$i])) {
|
||||
parse_str($argv[$i]); // set all params $release, $includecustom, $includeconstant, $buildzip ...
|
||||
parse_str($argv[$i], $result); // set all params $release, $includecustom, $includeconstant, $buildzip ...
|
||||
}
|
||||
if (preg_match('/includeconstant=/', $argv[$i])) {
|
||||
$tmp=explode(':', $includeconstant, 3); // $includeconstant has been set with previous parse_str()
|
||||
if (!empty($result["release"])) {
|
||||
$release = $result["release"];
|
||||
}
|
||||
if (!empty($result["includecustom"])) {
|
||||
$includecustom = $result["includecustom"];
|
||||
}
|
||||
if (!empty($result["includeconstant"])) {
|
||||
$includeconstants[$i] = $result["includeconstant"];
|
||||
}
|
||||
if (!empty($result["buildzip"])) {
|
||||
$buildzip=1;
|
||||
}
|
||||
if (preg_match('/includeconstant=/', strval($argv[$i]))) {
|
||||
$tmp=explode(':', $result['includeconstant'], 3); // $includeconstant has been set with previous parse_str()
|
||||
if (count($tmp) != 3) {
|
||||
print "Error: Bad parameter includeconstant=".$includeconstant."\n";
|
||||
print "Error: Bad parameter includeconstant=".$result['includeconstant'] ."\n";
|
||||
exit -1;
|
||||
}
|
||||
$includeconstants[$tmp[0]][$tmp[1]] = $tmp[2];
|
||||
@ -71,7 +85,7 @@ while ($i < $argc) {
|
||||
}
|
||||
|
||||
if (empty($release)) {
|
||||
print "Error: Missing release paramater\n";
|
||||
print "Error: Missing release parameter\n";
|
||||
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
|
||||
exit -1;
|
||||
}
|
||||
|
||||
@ -524,12 +524,13 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/ansible`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/codesniffer`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/codetemplates`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/dbmodel`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/examples/ldap`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/examples/zapier`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/initdata`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/initdemo`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/iso-normes`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/ldap`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/licence`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/resources/dbmodel`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/resources/iso-normes`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/resources/licence`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/mail`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/multitail`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/phpcheckstyle`;
|
||||
@ -621,7 +622,6 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/scripts`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/src`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/test`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/*/tests`;
|
||||
@ -679,7 +679,7 @@ if ($nboftargetok) {
|
||||
mkdir($DESTI.'/standard');
|
||||
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
|
||||
}
|
||||
|
||||
|
||||
print "Remove target $FILENAMETGZ.tgz...\n";
|
||||
unlink("$NEWDESTI/$FILENAMETGZ.tgz");
|
||||
|
||||
@ -895,7 +895,7 @@ if ($nboftargetok) {
|
||||
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build`;
|
||||
|
||||
|
||||
print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$PROJECT.tmp\n";
|
||||
$cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$PROJECT.tmp\"";
|
||||
$ret=`$cmd`;
|
||||
@ -1065,7 +1065,8 @@ 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/"`;
|
||||
#$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;
|
||||
}
|
||||
@ -1147,7 +1148,8 @@ if ($nboftargetok) {
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_amd64.changes"=>'none', # none means it won't be published on SF
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.dsc"=>'none', # none means it won't be published on SF
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.xz"=>'none', # none means it won't be published on SF
|
||||
#"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.xz"=>'none', # none means it won't be published on SF
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.gz"=>'none', # none means it won't be published on SF
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'none', # none means it won't be published on SF
|
||||
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)',
|
||||
"$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM',
|
||||
|
||||
@ -164,6 +164,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/blockedlog
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
%_datadir/dolibarr/htdocs/bookcal
|
||||
%_datadir/dolibarr/htdocs/bom
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
%_datadir/dolibarr/htdocs/collab
|
||||
|
||||
@ -245,6 +245,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/blockedlog
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
%_datadir/dolibarr/htdocs/bookcal
|
||||
%_datadir/dolibarr/htdocs/bom
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
%_datadir/dolibarr/htdocs/collab
|
||||
|
||||
@ -162,6 +162,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/blockedlog
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
%_datadir/dolibarr/htdocs/bookcal
|
||||
%_datadir/dolibarr/htdocs/bom
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
%_datadir/dolibarr/htdocs/collab
|
||||
|
||||
@ -67,7 +67,7 @@ Programmo web, progettato per poter fornire solo ciò di
|
||||
cui hai bisogno ed essere facile da usare.
|
||||
|
||||
|
||||
#---- prep
|
||||
#---- prepo
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p0 -b .patch
|
||||
@ -172,6 +172,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/blockedlog
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
%_datadir/dolibarr/htdocs/bookcal
|
||||
%_datadir/dolibarr/htdocs/bom
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
%_datadir/dolibarr/htdocs/collab
|
||||
|
||||
@ -1,15 +1,17 @@
|
||||
*~
|
||||
.#*
|
||||
.git
|
||||
.gitignore
|
||||
.scrutinizer.yml
|
||||
Thumbs.db
|
||||
build/exe
|
||||
build/html
|
||||
dev/dbmodel
|
||||
dev/fpdf
|
||||
dev/examples/zapier
|
||||
dev/initdemo
|
||||
dev/initdata
|
||||
dev/iso-normes
|
||||
dev/licence
|
||||
dev/load
|
||||
dev/resources/dbmodel
|
||||
dev/resources/iso-normes
|
||||
dev/resources/licence
|
||||
htdocs/conf/conf.php
|
||||
htdocs/conf/conf.php.mysql
|
||||
htdocs/conf/conf.php.old
|
||||
|
||||
@ -209,6 +209,11 @@ with
|
||||
with
|
||||
foreach ($value[1] as $k => $v) {
|
||||
|
||||
* Fix by replacing
|
||||
if ($res[0] == PDF_TYPE_OBJECT)
|
||||
with
|
||||
if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT)
|
||||
|
||||
|
||||
|
||||
JSGANTT:
|
||||
@ -283,6 +288,9 @@ RESTLER:
|
||||
|
||||
elseif (count($value) && isset($value[0]) && is_numeric($value[0]))
|
||||
|
||||
* Add CommentParser.php line 406 & 407 to remove a warning on api request in php 8.1
|
||||
empty($value[0]) ? null :
|
||||
empty($value[1]) ? null :
|
||||
|
||||
+With swagger 2 provided into /explorer:
|
||||
----------------------------------------
|
||||
|
||||
@ -1,28 +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 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.
|
||||
32
dev/initdemo/README.md
Normal file
@ -0,0 +1,32 @@
|
||||
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.
|
||||
|
||||
@ -290,6 +290,7 @@ export list="
|
||||
--ignore-table=$base.llx_monmodule_abcdef
|
||||
--ignore-table=$base.llx_notes
|
||||
--ignore-table=$base.llx_packages
|
||||
--ignore-table=$base.llx_packages_extrafields
|
||||
--ignore-table=$base.llx_pos_cash
|
||||
--ignore-table=$base.llx_pos_control_cash
|
||||
--ignore-table=$base.llx_pos_facture
|
||||
@ -305,6 +306,19 @@ export list="
|
||||
--ignore-table=$base.llx_residence
|
||||
--ignore-table=$base.llx_residence_building
|
||||
--ignore-table=$base.llx_residence_building_links
|
||||
--ignore-table=$base.llx_scaninvoices_filestoimport
|
||||
--ignore-table=$base.llx_scaninvoices_filestoimport_extrafields
|
||||
--ignore-table=$base.llx_scaninvoices_settings
|
||||
--ignore-table=$base.llx_scaninvoices_settings_extrafields
|
||||
--ignore-table=$base.llx_sellyoursaas_blacklistcontent
|
||||
--ignore-table=$base.llx_sellyoursaas_blacklistdir
|
||||
--ignore-table=$base.llx_sellyoursaas_blacklistfrom
|
||||
--ignore-table=$base.llx_sellyoursaas_blacklistip
|
||||
--ignore-table=$base.llx_sellyoursaas_blacklistmail
|
||||
--ignore-table=$base.llx_sellyoursaas_blacklistto
|
||||
--ignore-table=$base.llx_sellyoursaas_deploymentserver
|
||||
--ignore-table=$base.llx_sellyoursaas_stats
|
||||
--ignore-table=$base.llx_sellyoursaas_whitelistip
|
||||
--ignore-table=$base.llx_societe_rib2
|
||||
--ignore-table=$base.llx_sellyoursaas_cancellation
|
||||
--ignore-table=$base.llx_ticketsup
|
||||
|
||||
@ -22,8 +22,7 @@ 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
|
||||
----------------------------
|
||||
Syntax of QR Code https://www.swiss-qr-invoice.org/fr/
|
||||
* FOR QR-Bill in switzerland - Facture-QR
|
||||
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/
|
||||
|
||||
@ -10,8 +10,7 @@ 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 :
|
||||
|
||||
Voici la liste des codes pays ou systeme, les préfixes qui ne sont pas explicitement mentionnés sont réservés par GS1 :
|
||||
|
||||
|
||||
EN
|
||||
@ -25,105 +24,139 @@ 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:
|
||||
Here is the list of country codes or system, prefixes not explicitly listed are reserved by GS1:
|
||||
|
||||
|
||||
List
|
||||
====
|
||||
List (https://www.gs1.org/prefixes)
|
||||
===================================
|
||||
|
||||
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
|
||||
0000000 Flag for internal numbering / Codification interne en magasin
|
||||
00001–01999 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
|
||||
|
||||
71291
dev/resources/iso-normes/qr-bar-codes/ig-qr-bill-v2.2-fr.pdf
Normal file
@ -1,9 +1,18 @@
|
||||
<VirtualHost *:80>
|
||||
#php_admin_value sendmail_path "/usr/sbin/sendmail -t -i"
|
||||
#php_admin_value mail.force_extra_parameters "-f postmaster@mydomain.com"
|
||||
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com"
|
||||
php_admin_value open_basedir /tmp/:/home/.../htdocs:/home/.../dolibarr_documents:
|
||||
#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>
|
||||
|
||||
|
||||
# The URLs of the web site
|
||||
ServerName myvirtualalias
|
||||
ServerAlias myvirtualalias
|
||||
|
||||
@ -15,8 +24,13 @@
|
||||
|
||||
AddDefaultCharset UTF-8
|
||||
|
||||
DocumentRoot "/home/.../htdocs"
|
||||
|
||||
# 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
|
||||
@ -28,43 +42,47 @@
|
||||
#AuthUserFile /etc/apache2/.htpasswd
|
||||
#require valid-user
|
||||
</Directory>
|
||||
|
||||
# Leaving /public and /api, /dav, .well_known but also wrappers for document and viewimage accessible to everyone
|
||||
|
||||
# Leaving /public and /api, /dav, .well_known but also wrappers for document, viewimage and public json/img accessible to everyone
|
||||
<Directory /home/admin/wwwroot/dolibarr/htdocs/public/>
|
||||
AuthType None
|
||||
Require all granted
|
||||
Satisfy any
|
||||
Require all granted
|
||||
</Directory>
|
||||
<Directory /home/admin/wwwroot/dolibarr/htdocs/api/>
|
||||
AuthType None
|
||||
Require all granted
|
||||
Satisfy any
|
||||
Require all granted
|
||||
</Directory>
|
||||
<Directory /home/admin/wwwroot/dolibarr/htdocs/dav/>
|
||||
AuthType None
|
||||
Require all granted
|
||||
Satisfy any
|
||||
Require all granted
|
||||
</Directory>
|
||||
<Directory /home/admin/wwwroot/dolibarr/htdocs/.well-known/>
|
||||
AuthType None
|
||||
Require all granted
|
||||
Satisfy any
|
||||
Require all granted
|
||||
</Directory>
|
||||
<Files ~ "(document\.php|viewimage\.php|\.js\.php|\.json\.php|\.js|\.css\.php|\.css|\.gif|\.png|\.svg|\.woff2|favicon\.ico)$">
|
||||
AuthType None
|
||||
Require all granted
|
||||
Satisfy any
|
||||
Require all granted
|
||||
</Files>
|
||||
|
||||
|
||||
|
||||
# Log directoves
|
||||
ErrorLog /var/log/apache2/myvirtualalias_error_log
|
||||
TransferLog /var/log/apache2/myvirtualalias_access_log
|
||||
|
||||
# Compress returned resources of type php pages, text file export, css and javascript
|
||||
|
||||
# Compress is done on 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
|
||||
@ -75,19 +93,20 @@
|
||||
ExpiresByType application/x-javascript A2592000
|
||||
ExpiresByType application/javascript A2592000
|
||||
|
||||
SSLEngine On
|
||||
|
||||
# A self-signed (snakeoil) certificate can be created by installing
|
||||
# the ssl-cert package. See
|
||||
# /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
|
||||
# If both key and certificate are stored in the same file, only the
|
||||
# SSLCertificateFile directive is needed.
|
||||
SSLCertificateFile /etc/letsencrypt/live/www.mydomain.com/cert.pem
|
||||
SSLCertificateKeyFile /etc/letsencrypt/live/www.mydomain.com/privkey.pem
|
||||
SSLCertificateChainFile /etc/letsencrypt/live/www.mydomain.com/chain.pem
|
||||
# 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>
|
||||
|
||||
#RewriteEngine on
|
||||
#RewriteCond %{SERVER_PORT} ^80$
|
||||
#RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]
|
||||
|
||||
</VirtualHost>
|
||||
|
||||
19
dev/setup/fail2ban/filter.d/web-accesslog-limit403.conf
Normal file
@ -0,0 +1,19 @@
|
||||
# Fail2Ban configuration file
|
||||
#
|
||||
# Regexp to detect forbidden access on pages (public or not) so we can add mitigation on IP making too much
|
||||
# access to your a Dolibarr instance.
|
||||
|
||||
|
||||
[Definition]
|
||||
|
||||
# To test, you can inject this example into log
|
||||
# echo `myvirtualhost.com:443 1.2.3.4 - - [15/Dec/2022:09:57:47 +0000] "GET /public/abc" 403 123 "-" "Mozilla" >> /var/log/apache2/access.log
|
||||
#
|
||||
# then
|
||||
# fail2ban-client status web-accesslog-limit403
|
||||
#
|
||||
# To test rule file on a existing log file
|
||||
# fail2ban-regex /var/log/apache2/access.log /etc/fail2ban/filter.d/web-accesslog-limit403.conf
|
||||
|
||||
failregex = <HOST> - - .*HTTP/[0-9]+(.[0-9]+)?" 403
|
||||
ignoreregex =
|
||||
@ -31,6 +31,7 @@ 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
|
||||
@ -38,5 +39,5 @@ logpath = /mypath/documents/documents/dolibarr.log
|
||||
action = %(action_mw)s
|
||||
bantime = 86400 ; 1 day
|
||||
findtime = 86400 ; 1 day
|
||||
maxretry = 500
|
||||
maxretry = 1000
|
||||
|
||||
|
||||
14
dev/setup/qodana/README.md
Normal file
@ -0,0 +1,14 @@
|
||||
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
|
||||
|
||||
@ -36,7 +36,7 @@ then
|
||||
echo "tx pull -a"
|
||||
tx pull -a
|
||||
|
||||
echo "Remove some language directories (not enough translated)"
|
||||
echo "Remove some language directories (not enough translated) like ach, br_FR, en, frp, fy_NL, ..."
|
||||
rm -fr htdocs/langs/ach
|
||||
rm -fr htdocs/langs/br_FR
|
||||
rm -fr htdocs/langs/en
|
||||
|
||||
BIN
doc/images/dolibarr_screenshot12_1280x800.jpg
Normal file
|
After Width: | Height: | Size: 134 KiB |
|
Before Width: | Height: | Size: 138 KiB After Width: | Height: | Size: 171 KiB |
|
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 181 KiB |
BIN
doc/images/dolibarr_screenshot4_1280x800.jpg
Normal file
|
After Width: | Height: | Size: 114 KiB |
|
Before Width: | Height: | Size: 132 KiB After Width: | Height: | Size: 154 KiB |
@ -47,6 +47,7 @@ $search_label = GETPOST('search_label', 'alpha');
|
||||
$search_labelshort = GETPOST('search_labelshort', 'alpha');
|
||||
$search_accountparent = GETPOST('search_accountparent', 'alpha');
|
||||
$search_pcgtype = GETPOST('search_pcgtype', 'alpha');
|
||||
$search_import_key = GETPOST('search_import_key', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
@ -83,16 +84,19 @@ if (!$sortorder) {
|
||||
}
|
||||
|
||||
$arrayfields = array(
|
||||
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
|
||||
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||
'aa.labelshort'=>array('label'=>$langs->trans("LabelToShow"), 'checked'=>1),
|
||||
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1),
|
||||
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
|
||||
'aa.reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1),
|
||||
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
|
||||
'aa.account_number'=>array('label'=>"AccountNumber", 'checked'=>1),
|
||||
'aa.label'=>array('label'=>"Label", 'checked'=>1),
|
||||
'aa.labelshort'=>array('label'=>"LabelToShow", 'checked'=>1),
|
||||
'aa.account_parent'=>array('label'=>"Accountparent", 'checked'=>1),
|
||||
'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.active'=>array('label'=>"Activated", 'checked'=>1),
|
||||
'aa.import_key'=>array('label'=>"ImportId", 'checked'=>-1)
|
||||
);
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
|
||||
unset($arrayfields['categories']);
|
||||
unset($arrayfields['aa.reconcilable']);
|
||||
}
|
||||
|
||||
@ -226,15 +230,12 @@ if ($action == 'delete') {
|
||||
|
||||
$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.reconcilable, aa.active, ";
|
||||
$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,";
|
||||
$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".$conf->entity;
|
||||
if ($db->type == 'pgsql') {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".$conf->entity;
|
||||
} else {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".$conf->entity;
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".((int) $conf->entity);
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".((int) $conf->entity);
|
||||
$sql .= " WHERE asy.rowid = ".((int) $pcgver);
|
||||
//print $sql;
|
||||
if (strlen(trim($search_account))) {
|
||||
@ -337,6 +338,9 @@ if ($resql) {
|
||||
if ($search_pcgtype) {
|
||||
$param .= '&search_pcgtype='.urlencode($search_pcgtype);
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&search_import_key='.urlencode($search_import_key);
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
}
|
||||
@ -399,7 +403,7 @@ if ($resql) {
|
||||
}
|
||||
print "</select>";
|
||||
print ajax_combobox("chartofaccounts");
|
||||
print '<input type="'.(empty($conf->use_javascript_ajax) ? 'submit' : 'button').'" class="button button-edit" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
||||
print '<input type="'.(empty($conf->use_javascript_ajax) ? 'submit' : 'button').'" class="button button-edit small" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
||||
|
||||
print '<br>';
|
||||
|
||||
@ -436,11 +440,20 @@ if ($resql) {
|
||||
}
|
||||
if (!empty($arrayfields['aa.account_parent']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print $formaccounting->select_account($search_accountparent, 'search_accountparent', 2);
|
||||
print $formaccounting->select_account($search_accountparent, 'search_accountparent', 2, array(), 0, 0, 'maxwidth150');
|
||||
print '</td>';
|
||||
}
|
||||
// Predefined group
|
||||
if (!empty($arrayfields['aa.pcg_type']['checked'])) {
|
||||
print '<td class="liste_titre"><input type="text" class="flat width100" name="search_pcgtype" value="'.$search_pcgtype.'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat width75" name="search_pcgtype" value="'.$search_pcgtype.'"></td>';
|
||||
}
|
||||
// Custom groups
|
||||
if (!empty($arrayfields['categories']['checked'])) {
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
// Import key
|
||||
if (!empty($arrayfields['aa.import_key']['checked'])) {
|
||||
print '<td class="liste_titre"><input type="text" class="flat width75" name="search_import_key" value="'.$search_import_key.'"></td>';
|
||||
}
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
if (!empty($arrayfields['aa.reconcilable']['checked'])) {
|
||||
@ -471,6 +484,12 @@ if ($resql) {
|
||||
if (!empty($arrayfields['aa.pcg_type']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type,aa.account_number', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help'], 1);
|
||||
}
|
||||
if (!empty($arrayfields['categories']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['categories']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '', $arrayfields['categories']['help'], 1);
|
||||
}
|
||||
if (!empty($arrayfields['aa.import_key']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['aa.import_key']['label'], $_SERVER["PHP_SELF"], 'aa.import_key', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.import_key']['help'], 1);
|
||||
}
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
if (!empty($arrayfields['aa.reconcilable']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['aa.reconcilable']['label'], $_SERVER["PHP_SELF"], 'aa.reconcilable', '', $param, '', $sortfield, $sortorder);
|
||||
@ -505,7 +524,7 @@ if ($resql) {
|
||||
// Account label
|
||||
if (!empty($arrayfields['aa.label']['checked'])) {
|
||||
print "<td>";
|
||||
print $obj->label;
|
||||
print dol_escape_htmltag($obj->label);
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
@ -515,7 +534,7 @@ if ($resql) {
|
||||
// Account label to show (label short)
|
||||
if (!empty($arrayfields['aa.labelshort']['checked'])) {
|
||||
print "<td>";
|
||||
print $obj->labelshort;
|
||||
print dol_escape_htmltag($obj->labelshort);
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
@ -549,10 +568,30 @@ if ($resql) {
|
||||
}
|
||||
}
|
||||
|
||||
// Chart of accounts type
|
||||
// Predefined group (deprecated)
|
||||
if (!empty($arrayfields['aa.pcg_type']['checked'])) {
|
||||
print "<td>";
|
||||
print $obj->pcg_type;
|
||||
print dol_escape_htmltag($obj->pcg_type);
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Custom accounts
|
||||
if (!empty($arrayfields['categories']['checked'])) {
|
||||
print "<td>";
|
||||
// TODO Get all custom groups labels the account is in
|
||||
print dol_escape_htmltag($obj->fk_accounting_category);
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Import id
|
||||
if (!empty($arrayfields['aa.import_key']['checked'])) {
|
||||
print "<td>";
|
||||
print dol_escape_htmltag($obj->import_key);
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
||||
@ -504,8 +504,8 @@ if ($id) {
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '</td>';
|
||||
print '<td style="min-width: 26px;"></td>';
|
||||
print '<td style="min-width: 26px;"></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Line to enter new values
|
||||
@ -640,7 +640,8 @@ if ($id) {
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
$showfield = 1;
|
||||
$class = "left";
|
||||
$valuetoshow = $obj->{$fieldlist[$field]};
|
||||
$tmpvar = $fieldlist[$field];
|
||||
$valuetoshow = $obj->$tmpvar;
|
||||
if ($value == 'type_template') {
|
||||
$valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ $ref = GETPOST('ref', 'alpha');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
|
||||
$account_number = GETPOST('account_number', 'string');
|
||||
$account_number = GETPOST('account_number', 'alphanohtml');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
|
||||
// Security check
|
||||
@ -282,7 +282,7 @@ if ($action == 'create') {
|
||||
print $form->textwithpicto($langs->trans("AccountingCategory"), $langs->transnoentitiesnoconv("AccountingAccountGroupsDesc"));
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1);
|
||||
print $formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@ -329,7 +329,8 @@ if ($action == 'create') {
|
||||
// Account parent
|
||||
print '<tr><td>'.$langs->trans("Accountparent").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->account_parent, 'account_parent', 1);
|
||||
// Note: We accept disabled account as parent account so we can build a hierarchy and use only childs
|
||||
print $formaccounting->select_account($object->account_parent, 'account_parent', 1, array(), 0, 0, 'minwidth100 maxwidth300 maxwidthonsmartphone', 1, '');
|
||||
print '</td></tr>';
|
||||
|
||||
// Chart of accounts type
|
||||
@ -358,7 +359,7 @@ if ($action == 'create') {
|
||||
print $form->textwithpicto($langs->trans("AccountingCategory"), $langs->transnoentitiesnoconv("AccountingAccountGroupsDesc"));
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
|
||||
print $formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
|
||||
* Copyright (C) 2017-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2022 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -31,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
$error = 0;
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("bills", "accountancy"));
|
||||
$langs->loadLangs(array("bills", "accountancy", "compta"));
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
@ -44,6 +45,26 @@ 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();
|
||||
@ -110,18 +131,22 @@ print '<table class="border centpercent">';
|
||||
// Select the category
|
||||
print '<tr><td class="titlefield">'.$langs->trans("AccountingCategory").'</td>';
|
||||
print '<td>';
|
||||
$formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Select").'">';
|
||||
print $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>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
||||
// Select the accounts
|
||||
if (!empty($cat_id)) {
|
||||
$return = $accountingcategory->getAccountsWithNoCategory($cat_id);
|
||||
if ($return < 0) {
|
||||
setEventMessages(null, $accountingcategory->errors, 'errors');
|
||||
}
|
||||
print '<tr><td>'.$langs->trans("AddAccountFromBookKeepingWithNoCategories").'</td>';
|
||||
print '<td>';
|
||||
print '<br>';
|
||||
|
||||
$arraykeyvalue = array();
|
||||
foreach ($accountingcategory->lines_cptbk as $key => $val) {
|
||||
@ -130,33 +155,25 @@ if (!empty($cat_id)) {
|
||||
}
|
||||
|
||||
if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) {
|
||||
print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, null, null, "90%");
|
||||
print '<br>';
|
||||
/*print '<select class="flat minwidth200" size="8" name="cpt_bk[]" multiple>';
|
||||
foreach ( $accountingcategory->lines_cptbk as $cpt ) {
|
||||
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" id="" class="action-delete" value="'.$langs->trans("Add").'"> ';
|
||||
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 '<input type="submit" class="button button-add small" id="" class="action-delete" value="'.$langs->trans("Add").'"> ';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
if ($action == 'display' || $action == 'delete') {
|
||||
print "<table class='noborder' width='100%'>\n";
|
||||
if ((empty($action) || $action == 'display' || $action == 'delete') && $cat_id > 0) {
|
||||
$param = 'account_category='.((int) $cat_id);
|
||||
|
||||
print '<br>';
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">'.$langs->trans("AccountAccounting")."</td>";
|
||||
print '<td class="liste_titre" colspan="2">'.$langs->trans("Label")."</td>";
|
||||
print "</tr>\n";
|
||||
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";
|
||||
|
||||
if (!empty($cat_id)) {
|
||||
$return = $accountingcategory->display($cat_id); // This load ->lines_display
|
||||
@ -165,6 +182,8 @@ if ($action == 'display' || $action == 'delete') {
|
||||
}
|
||||
|
||||
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>';
|
||||
@ -177,6 +196,8 @@ if ($action == 'display' || $action == 'delete') {
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
}
|
||||
} else {
|
||||
print '<tr><td colspan="3"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -190,7 +190,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
|
||||
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
||||
}
|
||||
}
|
||||
if (!is_numeric(GETPOST('position', 'alpha'))) {
|
||||
if (GETPOST('position') && !is_numeric(GETPOST('position', 'alpha'))) {
|
||||
$langs->loadLangs(array("errors"));
|
||||
$ok = 0;
|
||||
setEventMessages($langs->transnoentities('ErrorFieldMustBeANumeric', $langs->transnoentities("Position")), null, 'errors');
|
||||
@ -444,15 +444,37 @@ 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'));
|
||||
}
|
||||
|
||||
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">';
|
||||
print '<table class="noborder centpercent">';
|
||||
@ -523,9 +545,9 @@ if ($tabname[$id]) {
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '</td>';
|
||||
print '<td style="min-width: 26px;"></td>';
|
||||
print '<td style="min-width: 26px;"></td>';
|
||||
print '<td style="min-width: 26px;"></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Line to enter new values
|
||||
@ -571,20 +593,6 @@ 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="'.(3 + count($fieldlist)).'">';
|
||||
@ -605,7 +613,7 @@ if ($resql) {
|
||||
if ($showfield) {
|
||||
if ($value == 'country') {
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth150 maxwidthonsmartphone');
|
||||
print '</td>';
|
||||
$filterfound++;
|
||||
} else {
|
||||
@ -725,11 +733,11 @@ if ($resql) {
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td class="center">';
|
||||
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||
print '<input type="submit" class="button button-edit" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
|
||||
print '<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||
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>';
|
||||
print '<td></td>';
|
||||
} else {
|
||||
@ -743,7 +751,8 @@ if ($resql) {
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
$showfield = 1;
|
||||
$class = "left";
|
||||
$valuetoshow = $obj->{$fieldlist[$field]};
|
||||
$tmpvar = $fieldlist[$field];
|
||||
$valuetoshow = $obj->$tmpvar;
|
||||
if ($value == 'category_type') {
|
||||
$valuetoshow = yn($valuetoshow);
|
||||
} elseif ($valuetoshow == 'all') {
|
||||
@ -822,7 +831,7 @@ if ($resql) {
|
||||
}
|
||||
|
||||
// Link to setup the group
|
||||
print '<td class="center">';
|
||||
print '<td>';
|
||||
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");
|
||||
@ -887,10 +896,10 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co
|
||||
if ($context == 'add') {
|
||||
$fieldname = 'country_id';
|
||||
$preselectcountrycode = GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : $mysoc->country_code;
|
||||
print $form->select_country($preselectcountrycode, $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
print $form->select_country($preselectcountrycode, $fieldname, '', 28, 'maxwidth150 maxwidthonsmartphone');
|
||||
} else {
|
||||
$preselectcountrycode = (empty($obj->country_code) ? (empty($obj->country) ? $mysoc->country_code : $obj->country) : $obj->country_code);
|
||||
print $form->select_country($preselectcountrycode, $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
print $form->select_country($preselectcountrycode, $fieldname, '', 28, 'maxwidth150 maxwidthonsmartphone');
|
||||
}
|
||||
print '</td>';
|
||||
} elseif ($fieldlist[$field] == 'country_id') {
|
||||
|
||||
@ -84,6 +84,9 @@ $list_account[] = 'ACCOUNTING_VAT_PAY_ACCOUNT';
|
||||
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';
|
||||
}
|
||||
|
||||
@ -269,9 +269,9 @@ if ($num2) {
|
||||
// Value
|
||||
print '<td>';
|
||||
if (is_array($key['param'])) {
|
||||
print $form->selectarray($label, $key['param'], $conf->global->$label, 0);
|
||||
print $form->selectarray($label, $key['param'], getDolGlobalString($label), 0);
|
||||
} else {
|
||||
print '<input type="text" size="20" id="'.$label.'" name="'.$key['label'].'" value="'.$conf->global->$label.'">';
|
||||
print '<input type="text" size="20" id="'.$label.'" name="'.$key['label'].'" value="'.getDolGlobalString($label).'">';
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
@ -247,6 +247,34 @@ if ($action == 'setdisablebindingonexpensereports') {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setenablelettering') {
|
||||
$setenablelettering = GETPOST('value', 'int');
|
||||
$res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_LETTERING", $setenablelettering, 'yesno', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setenableautolettering') {
|
||||
$setenableautolettering = GETPOST('value', 'int');
|
||||
$res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_AUTOLETTERING", $setenableautolettering, 'yesno', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -416,7 +444,7 @@ foreach ($list_binding as $key) {
|
||||
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, (isset($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER) ? $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER : 0));
|
||||
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).'">';
|
||||
}
|
||||
@ -464,6 +492,43 @@ if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) {
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
// Lettering params
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans('Options').' '.$langs->trans('Lettering').'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("ACCOUNTING_ENABLE_LETTERING").'</td>';
|
||||
if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
|
||||
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
|
||||
print '<tr class="oddeven">';
|
||||
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');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenableautolettering&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>';
|
||||
|
||||
@ -431,9 +431,9 @@ if ($id) {
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '</td>';
|
||||
print '<td style="min-width: 26px;"></td>';
|
||||
print '<td style="min-width: 26px;"></td>';
|
||||
print '<td style="min-width: 26px;"></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Line to enter new values
|
||||
@ -587,7 +587,8 @@ if ($id) {
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
$showfield = 1;
|
||||
$class = "left";
|
||||
$valuetoshow = $obj->{$fieldlist[$field]};
|
||||
$tmpvar = $fieldlist[$field];
|
||||
$valuetoshow = $obj->$tmpvar;
|
||||
if ($valuetoshow == 'all') {
|
||||
$valuetoshow = $langs->trans('All');
|
||||
} elseif ($fieldlist[$field] == 'nature' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') {
|
||||
|
||||
@ -194,7 +194,7 @@ if ($action == 'update') {
|
||||
}
|
||||
if ($result <= 0) {
|
||||
// setEventMessages(null, $accounting->errors, 'errors');
|
||||
$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>';
|
||||
$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>';
|
||||
$ko++;
|
||||
} else {
|
||||
$sql = '';
|
||||
@ -203,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 style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br> <pre>'.$resql_exists.'</pre></span></div>';
|
||||
$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>';
|
||||
$ko++;
|
||||
} else {
|
||||
$nb_exists = $db->num_rows($resql_exists);
|
||||
|
||||
@ -19,17 +19,18 @@
|
||||
|
||||
/**
|
||||
* \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/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta", "bills", "admin", "accountancy", "salaries", "hrm", "errors"));
|
||||
$langs->loadLangs(array("accountancy", "admin", "bills", "compta", "errors", "hrm", "salaries"));
|
||||
|
||||
$mesg = '';
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
@ -81,6 +82,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
|
||||
unset($arrayfields['reconcilable']);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -120,11 +122,13 @@ if (empty($reshook)) {
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$help_url = '';
|
||||
$title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger');
|
||||
|
||||
// Page Header
|
||||
$help_url = 'EN:Module_Double_Entry_Accounting#Setup';
|
||||
$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";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe sa";
|
||||
@ -219,7 +223,7 @@ if (!empty($search_type) && $search_type >= 0) {
|
||||
$sql .= " HAVING type LIKE '".$db->escape($search_type)."'";
|
||||
}
|
||||
|
||||
// User
|
||||
// User - Employee
|
||||
$sql .= " UNION ";
|
||||
$sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '3' as type, u.entity FROM ".MAIN_DB_PREFIX."user u";
|
||||
$sql .= " WHERE u.entity IN (".getEntity('user').")";
|
||||
@ -400,6 +404,7 @@ 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>';
|
||||
@ -407,8 +412,8 @@ 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
|
||||
$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->id.'">'.$langs->trans("Employee").'</a>';
|
||||
// User - Employee
|
||||
$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;
|
||||
print '</td>';
|
||||
@ -440,6 +445,7 @@ if ($resql) {
|
||||
// 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>';
|
||||
@ -447,7 +453,7 @@ if ($resql) {
|
||||
// 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
|
||||
// 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;
|
||||
|
||||
@ -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-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2016-2023 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,22 +42,13 @@ $langs->loadLangs(array("accountancy", "compta"));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$contextpage = GETPOST('contextpage', 'aZ09');
|
||||
|
||||
// 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 == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
//if (! $sortfield) $sortfield="p.date_fin";
|
||||
//if (! $sortorder) $sortorder="DESC";
|
||||
|
||||
$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'));
|
||||
@ -70,10 +61,29 @@ $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');
|
||||
|
||||
// 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 == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if ($sortorder == "") {
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
if ($sortfield == "") {
|
||||
$sortfield = "t.numero_compte";
|
||||
}
|
||||
|
||||
// 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('balancelist')); // Note that conf->hooks_modules contains array
|
||||
$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array
|
||||
|
||||
$formaccounting = new FormAccounting($db);
|
||||
$formother = new FormOther($db);
|
||||
@ -84,6 +94,7 @@ 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);
|
||||
@ -104,45 +115,6 @@ 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();
|
||||
@ -154,14 +126,13 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
$parameters = array();
|
||||
$arrayfields = array();
|
||||
$param = '';
|
||||
|
||||
$parameters = array('socid'=>$socid);
|
||||
$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');
|
||||
@ -172,16 +143,67 @@ 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();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
// 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);
|
||||
}
|
||||
|
||||
// param with type of list
|
||||
$url_param = substr($param, 1); // remove first "&"
|
||||
if (!empty($type)) {
|
||||
$param = '&type=' . $type . $param;
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'export_csv') {
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
@ -190,14 +212,23 @@ if ($action == 'export_csv') {
|
||||
$type_export = 'balance';
|
||||
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter);
|
||||
if ($type == 'sub') {
|
||||
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter, 'AND', 1);
|
||||
} else {
|
||||
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter);
|
||||
}
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
foreach ($object->lines as $line) {
|
||||
print '"'.length_accountg($line->numero_compte).'"'.$sep;
|
||||
print '"'.$object->get_compte_desc($line->numero_compte).'"'.$sep;
|
||||
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 '"'.price($line->debit).'"'.$sep;
|
||||
print '"'.price($line->credit).'"'.$sep;
|
||||
print '"'.price($line->debit - $line->credit).'"'.$sep;
|
||||
@ -207,8 +238,15 @@ if ($action == 'export_csv') {
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$title_page = $langs->trans("AccountBalance");
|
||||
if ($type == 'sub') {
|
||||
$title_page = $langs->trans("AccountBalanceSubAccount");
|
||||
} else {
|
||||
$title_page = $langs->trans("AccountBalance");
|
||||
}
|
||||
|
||||
llxHeader('', $title_page);
|
||||
|
||||
@ -217,32 +255,52 @@ if ($action != 'export_csv') {
|
||||
// List
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
|
||||
if ($type == 'sub') {
|
||||
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter, 'AND', 1);
|
||||
} else {
|
||||
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
|
||||
}
|
||||
|
||||
if ($nbtotalofrecords < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter);
|
||||
if ($type == 'sub') {
|
||||
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 1);
|
||||
} else {
|
||||
$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="action" id="action" value="list">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
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('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $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;
|
||||
|
||||
if (empty($reshook)) {
|
||||
$button = '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
||||
$newcardbutton = '<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() {
|
||||
@ -255,12 +313,32 @@ 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='.urlencode($limit);
|
||||
}
|
||||
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
$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">';
|
||||
@ -268,18 +346,38 @@ 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 .= ' - ';
|
||||
$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 .= '<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 .= $langs->trans("Journal");
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans("Journals").': ';
|
||||
$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>';
|
||||
|
||||
$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)) {
|
||||
@ -298,9 +396,6 @@ if ($action != 'export_csv') {
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
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
|
||||
@ -317,6 +412,10 @@ if ($action != 'export_csv') {
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
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);
|
||||
}
|
||||
@ -352,7 +451,7 @@ if ($action != 'export_csv') {
|
||||
$sql .= " GROUP BY t.numero_compte";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
$nrows = $db->num_rows($resql);
|
||||
$nrows = $resql->num_rows;
|
||||
$opening_balances = array();
|
||||
for ($i = 0; $i < $nrows; $i++) {
|
||||
$arr = $resql->fetch_array();
|
||||
@ -365,11 +464,13 @@ if ($action != 'export_csv') {
|
||||
$accountingaccountstatic->id = 0;
|
||||
$accountingaccountstatic->account_number = '';
|
||||
|
||||
$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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
$link = '';
|
||||
@ -420,7 +521,7 @@ if ($action != 'export_csv') {
|
||||
|
||||
// Show first line of a break
|
||||
print '<tr class="trforbreak">';
|
||||
print '<td colspan="'.($colspan+1).'" class="tdforbreak">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
|
||||
print '<td colspan="'.($colspan+1).'" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$displayed_account = $root_account_number;
|
||||
@ -431,19 +532,43 @@ if ($action != 'export_csv') {
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$accounting_account.'</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>';
|
||||
//}
|
||||
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
|
||||
print '<td class="right nowraponall amount">'.price(price2num($opening_balance, 'MT')).'</td>';
|
||||
}
|
||||
|
||||
$urlzoom = '';
|
||||
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 ($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 (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');
|
||||
} 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');
|
||||
}
|
||||
}
|
||||
}
|
||||
// Debit
|
||||
@ -497,6 +622,10 @@ if ($action != 'export_csv') {
|
||||
print "<td></td>\n";
|
||||
print '</tr>';
|
||||
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print "</table>";
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
@ -412,7 +412,11 @@ if ($action == 'create') {
|
||||
if (!empty($object->piece_num)) {
|
||||
$backlink = '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?restore_lastsearch_values=1">'.$langs->trans('BackToList').'</a>';
|
||||
|
||||
print load_fiche_titre($langs->trans("UpdateMvts"), $backlink);
|
||||
if ($mode == '_tmp') {
|
||||
print load_fiche_titre($langs->trans("CreateMvts"), $backlink);
|
||||
} else {
|
||||
print load_fiche_titre($langs->trans("UpdateMvts"), $backlink);
|
||||
}
|
||||
|
||||
$head = array();
|
||||
$h = 0;
|
||||
@ -608,7 +612,7 @@ if ($action == 'create') {
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
print '<div style="clear:both"></div>';
|
||||
print '<div class="clearboth"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
@ -617,6 +621,7 @@ if ($action == 'create') {
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
// List of movements
|
||||
print load_fiche_titre($langs->trans("ListeMvts"), '', '');
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?piece_num='.$object->piece_num.'" method="post">';
|
||||
@ -644,8 +649,8 @@ if ($action == 'create') {
|
||||
print_liste_field_titre("AccountAccountingShort");
|
||||
print_liste_field_titre("SubledgerAccount");
|
||||
print_liste_field_titre("LabelOperation");
|
||||
print_liste_field_titre("Debit", "", "", "", "", 'class="right"');
|
||||
print_liste_field_titre("Credit", "", "", "", "", 'class="right"');
|
||||
print_liste_field_titre("AccountingDebit", "", "", "", "", 'class="right"');
|
||||
print_liste_field_titre("AccountingCredit", "", "", "", "", 'class="right"');
|
||||
if (empty($object->date_validation)) {
|
||||
print_liste_field_titre("Action", "", "", "", "", 'width="60"', "", "", 'center ');
|
||||
} else {
|
||||
@ -664,14 +669,14 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
foreach ($object->linesmvt as $line) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<tr class="oddeven" data-lineid="'.((int) $line->id).'">';
|
||||
$total_debit += $line->debit;
|
||||
$total_credit += $line->credit;
|
||||
|
||||
if ($action == 'update' && $line->id == $id) {
|
||||
print '<!-- td columns in edit mode -->';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, '');
|
||||
print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because:
|
||||
@ -697,7 +702,7 @@ if ($action == 'create') {
|
||||
if ($action == "" || $action == 'add') {
|
||||
print '<!-- td columns in add mode -->';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, '');
|
||||
print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, 'minwidth200 maxwidth500');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because:
|
||||
@ -714,7 +719,7 @@ if ($action == 'create') {
|
||||
print '<td><input type="text" class="minwidth200" name="label_operation" value="' . $label_operation . '"/></td>';
|
||||
print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>';
|
||||
print '<td class="right"><input type="text" size="6" class="right" name="credit" value=""/></td>';
|
||||
print '<td class="center"><input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '"></td>';
|
||||
print '<td class="center"><input type="submit" class="button small" name="save" value="' . $langs->trans("Add") . '"></td>';
|
||||
}
|
||||
} else {
|
||||
print '<!-- td columns in display mode -->';
|
||||
@ -732,8 +737,8 @@ if ($action == 'create') {
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.$line->label_operation.'</td>';
|
||||
print '<td class="right nowraponall amount">'.price($line->debit).'</td>';
|
||||
print '<td class="right nowraponall amount">'.price($line->credit).'</td>';
|
||||
print '<td class="right nowraponall amount">'.($line->debit != 0 ? price($line->debit) : '').'</td>';
|
||||
print '<td class="right nowraponall amount">'.($line->credit != 0 ? price($line->credit) : '').'</td>';
|
||||
|
||||
print '<td class="center nowraponall">';
|
||||
if (empty($line->date_export) && empty($line->date_validation)) {
|
||||
|
||||
@ -2,8 +2,10 @@
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2022 Lionel Vessiller <lvessiller@open-dsi.fr>
|
||||
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* 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
|
||||
@ -102,7 +104,9 @@ if (GETPOST("button_export_file_x") || GETPOST("button_export_file.x") || GETPOS
|
||||
$action = 'export_file';
|
||||
}
|
||||
|
||||
$search_accountancy_code = GETPOST("search_accountancy_code");
|
||||
$search_account_category = GETPOST('search_account_category', 'int');
|
||||
|
||||
$search_accountancy_code = GETPOST("search_accountancy_code", 'alpha');
|
||||
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
|
||||
if ($search_accountancy_code_start == - 1) {
|
||||
$search_accountancy_code_start = '';
|
||||
@ -192,8 +196,8 @@ $arrayfields = array(
|
||||
't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1),
|
||||
't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
|
||||
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
|
||||
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
|
||||
't.debit'=>array('label'=>$langs->trans("AccountingDebit"), 'checked'=>1),
|
||||
't.credit'=>array('label'=>$langs->trans("AccountingCredit"), 'checked'=>1),
|
||||
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
|
||||
't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
|
||||
't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
|
||||
@ -253,6 +257,7 @@ 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 = '';
|
||||
@ -335,6 +340,20 @@ 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['id'])."'";
|
||||
}
|
||||
}
|
||||
$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);
|
||||
@ -347,6 +366,10 @@ if (empty($reshook)) {
|
||||
$filter['t.numero_compte<='] = $search_accountancy_code_end;
|
||||
$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
|
||||
}
|
||||
if (!empty($search_accountancy_aux_code)) {
|
||||
$filter['t.subledger_account'] = $search_accountancy_aux_code;
|
||||
$param .= '&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code);
|
||||
}
|
||||
if (!empty($search_accountancy_aux_code_start)) {
|
||||
$filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
|
||||
$param .= '&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start);
|
||||
@ -470,7 +493,7 @@ if (empty($reshook)) {
|
||||
if ($conf->global->ACCOUNTING_REEXPORT == 1) {
|
||||
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'mesgs');
|
||||
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'warnings');
|
||||
}
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
@ -482,7 +505,7 @@ if (empty($reshook)) {
|
||||
$objectlabel = 'Bookkeeping';
|
||||
$permissiontoread = $user->hasRight('societe', 'lire');
|
||||
$permissiontodelete = $user->hasRight('societe', 'supprimer');
|
||||
$permissiontoadd = $user->rights->societe->creer;
|
||||
$permissiontoadd = $user->hasRight('societe', 'creer');
|
||||
$uploaddir = $conf->societe->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
@ -638,6 +661,9 @@ $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();
|
||||
@ -668,7 +694,13 @@ if (count($filter) > 0) {
|
||||
} elseif ($key == 't.reconciled_option') {
|
||||
$sqlwhere[] = 't.lettering_code IS NULL';
|
||||
} elseif ($key == 't.code_journal' && !empty($value)) {
|
||||
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
|
||||
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).')';
|
||||
} else {
|
||||
$sqlwhere[] = natural_search($key, $value, 0, 1);
|
||||
}
|
||||
@ -681,16 +713,13 @@ if (empty($conf->global->ACCOUNTING_REEXPORT)) {
|
||||
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 consumes too much memory on large 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));
|
||||
|
||||
@ -700,6 +729,7 @@ if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements
|
||||
// Export files then exit
|
||||
$accountancyexport = new AccountancyExport($db);
|
||||
|
||||
$formatexport = GETPOST('formatexport', 'int');
|
||||
$notexportlettering = GETPOST('notexportlettering', 'alpha');
|
||||
|
||||
if (!empty($notexportlettering)) {
|
||||
@ -711,58 +741,65 @@ if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements
|
||||
}
|
||||
}
|
||||
|
||||
$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');
|
||||
$withAttachment = !empty(trim(GETPOST('notifiedexportfull', 'alphanohtml'))) ? 1 : 0;
|
||||
|
||||
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);
|
||||
// Output data on screen or download
|
||||
$result = $accountancyexport->export($object->lines, $formatexport, $withAttachment);
|
||||
|
||||
$error = 0;
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
} else {
|
||||
if (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) {
|
||||
if (is_array($object->lines)) {
|
||||
dol_syslog("/accountancy/bookkeeping/list.php Function export_file Specify movements as exported", LOG_DEBUG);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
// Specify as export : update field date_export or date_validated
|
||||
$db->begin();
|
||||
|
||||
// TODO Merge update for each line into one gloacl using rowid IN (list of movement ids)
|
||||
foreach ($object->lines as $movement) {
|
||||
$now = dol_now();
|
||||
|
||||
$setfields = '';
|
||||
if (!empty($notifiedexportdate) && empty($movement->date_export)) {
|
||||
$setfields .= ($setfields ? "," : "")." date_export = '".$db->idate($now)."'";
|
||||
}
|
||||
if (!empty($notifiedvalidationdate) && empty($movement->date_validation)) {
|
||||
$setfields .= ($setfields ? "," : "")." date_validated = '".$db->idate($now)."'";
|
||||
}
|
||||
|
||||
if ($setfields) {
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||
$sql .= " SET ".$setfields;
|
||||
$sql .= " WHERE rowid = ".((int) $movement->id);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
} else {
|
||||
$error++;
|
||||
break;
|
||||
$accountancyexport->errors[] = $langs->trans('NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated');
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
} else {
|
||||
$error++;
|
||||
$db->rollback();
|
||||
dol_print_error('', $langs->trans("NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated"));
|
||||
}
|
||||
}
|
||||
exit;
|
||||
|
||||
if ($error) {
|
||||
setEventMessages('', $accountancyexport->errors, 'errors');
|
||||
header('Location: '.$_SERVER['PHP_SELF']);
|
||||
}
|
||||
exit(); // download or show errors
|
||||
}
|
||||
}
|
||||
|
||||
@ -779,28 +816,38 @@ $title_page = $langs->trans("Operations").' - '.$langs->trans("Journals");
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
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
|
||||
/* 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
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
// 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 {
|
||||
|
||||
// Complete request and execute it with limit
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
|
||||
// Output page
|
||||
@ -813,6 +860,17 @@ $formconfirm = '';
|
||||
if ($action == 'export_file') {
|
||||
$form_question = array();
|
||||
|
||||
$form_question['formatexport'] = array(
|
||||
'name' => 'formatexport',
|
||||
'type' => 'select',
|
||||
'label' => $langs->trans('Modelcsv'), // TODO Use Selectmodelcsv and show a select combo
|
||||
'values' => $listofformat,
|
||||
'default' => $formatexportset,
|
||||
'morecss' => 'minwidth200 maxwidth200'
|
||||
);
|
||||
|
||||
$form_question['separator0'] = array('name'=>'separator0', 'type'=>'separator');
|
||||
|
||||
if (getDolGlobalInt("ACCOUNTING_ENABLE_LETTERING")) {
|
||||
// If 1, we check by default.
|
||||
$checked = !empty($conf->global->ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING) ? 'true' : 'false';
|
||||
@ -823,7 +881,7 @@ if ($action == 'export_file') {
|
||||
'value' => $checked,
|
||||
);
|
||||
|
||||
$form_question['separator'] = array('name'=>'separator', 'type'=>'separator');
|
||||
$form_question['separator1'] = array('name'=>'separator1', 'type'=>'separator');
|
||||
}
|
||||
|
||||
// If 1 or not set, we check by default.
|
||||
@ -850,7 +908,17 @@ if ($action == 'export_file') {
|
||||
$form_question['separator3'] = array('name'=>'separator3', 'type'=>'separator');
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 350, 600);
|
||||
// add documents in an archive for accountancy export (Quadratus)
|
||||
if (getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV') == AccountancyExport::$EXPORT_TYPE_QUADRATUS) {
|
||||
$form_question['notifiedexportfull'] = array(
|
||||
'name' => 'notifiedexportfull',
|
||||
'type' => 'checkbox',
|
||||
'label' => $langs->trans('NotifiedExportFull'),
|
||||
'value' => 'false',
|
||||
);
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").'...', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 420, 600);
|
||||
}
|
||||
|
||||
//if ($action == 'delbookkeepingyear') {
|
||||
@ -938,19 +1006,28 @@ if (count($filter)) {
|
||||
$buttonLabel = $langs->trans("ExportList");
|
||||
}
|
||||
|
||||
$parameters = array();
|
||||
$parameters = array('param' => $param);
|
||||
$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;
|
||||
|
||||
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("Activated"), 'switch_on').'</a> ';
|
||||
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'">'.img_picto($langs->trans("ClickToHideAlreadyExportedLines"), 'switch_off', 'class="small size15x valignmiddle"');
|
||||
$newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("ClickToHideAlreadyExportedLines").'</span>';
|
||||
$newcardbutton .= '</a>';
|
||||
} else {
|
||||
$newcardbutton = '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> ';
|
||||
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'">'.img_picto($langs->trans("DocsAlreadyExportedAreExcluded"), 'switch_on', 'class="warning size15x valignmiddle"');
|
||||
$newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("DocsAlreadyExportedAreExcluded").'</span>';
|
||||
$newcardbutton .= '</a>';
|
||||
}
|
||||
$newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>';
|
||||
|
||||
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($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : '').'&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder), $user->hasRight('accounting', 'mouvements', 'export'));
|
||||
}
|
||||
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
|
||||
@ -981,27 +1058,43 @@ if ($massaction == 'preunletteringauto') {
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
|
||||
if ($massactionbutton && $contextpage != 'poslist') {
|
||||
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
||||
}
|
||||
|
||||
$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); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // 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 centpercent">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">';
|
||||
|
||||
// Filters lines
|
||||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre center">';
|
||||
$searchpicto = $form->showFilterButtons('left');
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
// Movement number
|
||||
if (!empty($arrayfields['t.piece_num']['checked'])) {
|
||||
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
|
||||
@ -1137,13 +1230,17 @@ if (!empty($arrayfields['t.import_key']['checked'])) {
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre center">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre center">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');}
|
||||
if (!empty($arrayfields['t.piece_num']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
|
||||
}
|
||||
@ -1193,7 +1290,9 @@ if (!empty($arrayfields['t.date_validated']['checked'])) {
|
||||
if (!empty($arrayfields['t.import_key']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['t.import_key']['label'], $_SERVER["PHP_SELF"], "t.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -1248,6 +1347,21 @@ while ($i < min($num, $limit)) {
|
||||
$total_credit += $line->credit;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="nowraponall center">';
|
||||
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($line->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$line->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.'"'.($selected ? ' checked="checked"' : '').' />';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Piece number
|
||||
if (!empty($arrayfields['t.piece_num']['checked'])) {
|
||||
@ -1266,7 +1380,7 @@ while ($i < min($num, $limit)) {
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$result = $accountingjournal->fetch('', $line->code_journal);
|
||||
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
|
||||
print '<td class="center">'.$journaltoshow.'</td>';
|
||||
print '<td class="center tdoverflowmax150">'.$journaltoshow.'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1414,7 +1528,7 @@ while ($i < min($num, $limit)) {
|
||||
|
||||
// Creation operation date
|
||||
if (!empty($arrayfields['t.date_creation']['checked'])) {
|
||||
print '<td class="center">'.dol_print_date($line->date_creation, 'dayhour').'</td>';
|
||||
print '<td class="center">'.dol_print_date($line->date_creation, 'dayhour', 'tzuserrel').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1422,7 +1536,7 @@ while ($i < min($num, $limit)) {
|
||||
|
||||
// Modification operation date
|
||||
if (!empty($arrayfields['t.tms']['checked'])) {
|
||||
print '<td class="center">'.dol_print_date($line->date_modification, 'dayhour').'</td>';
|
||||
print '<td class="center">'.dol_print_date($line->date_modification, 'dayhour', 'tzuserrel').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1430,7 +1544,7 @@ while ($i < min($num, $limit)) {
|
||||
|
||||
// Exported operation date
|
||||
if (!empty($arrayfields['t.date_export']['checked'])) {
|
||||
print '<td class="center nowraponall">'.dol_print_date($line->date_export, 'dayhour').'</td>';
|
||||
print '<td class="center nowraponall">'.dol_print_date($line->date_export, 'dayhour', 'tzuserrel').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1438,7 +1552,7 @@ while ($i < min($num, $limit)) {
|
||||
|
||||
// Validated operation date
|
||||
if (!empty($arrayfields['t.date_validated']['checked'])) {
|
||||
print '<td class="center nowraponall">'.dol_print_date($line->date_validation, 'dayhour').'</td>';
|
||||
print '<td class="center nowraponall">'.dol_print_date($line->date_validation, 'dayhour', 'tzuserrel').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1452,19 +1566,21 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
|
||||
// Action column
|
||||
print '<td class="nowraponall center">';
|
||||
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($line->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="nowraponall center">';
|
||||
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($line->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$line->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.'"'.($selected ? ' checked="checked"' : '').' />';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
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']++;
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
@ -1474,6 +1590,20 @@ while ($i < min($num, $limit)) {
|
||||
// Show total line
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
// 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>';
|
||||
}
|
||||
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
@ -1489,4 +1619,5 @@ print '</form>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -79,7 +79,8 @@ $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_accountancy_code = GETPOST("search_accountancy_code");
|
||||
$search_account_category = GETPOST('search_account_category', 'int');
|
||||
|
||||
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
|
||||
if ($search_accountancy_code_start == - 1) {
|
||||
$search_accountancy_code_start = '';
|
||||
@ -163,8 +164,8 @@ $arrayfields = array(
|
||||
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
|
||||
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
|
||||
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
|
||||
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
|
||||
't.debit'=>array('label'=>$langs->trans("AccountingDebit"), 'checked'=>1),
|
||||
't.credit'=>array('label'=>$langs->trans("AccountingCredit"), 'checked'=>1),
|
||||
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
|
||||
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
|
||||
't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
|
||||
@ -198,6 +199,8 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
@ -224,7 +227,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_accountancy_code = '';
|
||||
$search_account_category = '';
|
||||
$search_accountancy_code_start = '';
|
||||
$search_accountancy_code_end = '';
|
||||
$search_label_account = '';
|
||||
@ -280,6 +283,20 @@ 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['id'])."'";
|
||||
}
|
||||
}
|
||||
$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;
|
||||
@ -358,7 +375,6 @@ 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)) {
|
||||
@ -397,7 +413,7 @@ if (empty($reshook)) {
|
||||
$objectlabel = 'Bookkeeping';
|
||||
$permissiontoread = $user->hasRight('societe', 'lire');
|
||||
$permissiontodelete = $user->hasRight('societe', 'supprimer');
|
||||
$permissiontoadd = $user->rights->societe->creer;
|
||||
$permissiontoadd = $user->hasRight('societe', 'creer');
|
||||
$uploaddir = $conf->societe->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
@ -544,25 +560,29 @@ llxHeader('', $title_page);
|
||||
// List
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
// TODO Perf Replace this by a count
|
||||
if ($type == 'sub') {
|
||||
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 1);
|
||||
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 1, 1);
|
||||
} else {
|
||||
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter);
|
||||
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 0, 1);
|
||||
}
|
||||
|
||||
if ($nbtotalofrecords < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($type == 'sub') {
|
||||
$result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 1);
|
||||
} else {
|
||||
$result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter);
|
||||
}
|
||||
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 ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
@ -642,8 +662,14 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
$parameters = array();
|
||||
$parameters = array('param' => $param);
|
||||
$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;
|
||||
|
||||
if (empty($reshook)) {
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
|
||||
if ($type == 'sub') {
|
||||
@ -686,7 +712,7 @@ if ($massaction == 'preunletteringauto') {
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
|
||||
if ($massactionbutton && $contextpage != 'poslist') {
|
||||
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
||||
}
|
||||
@ -705,7 +731,7 @@ if ($type == 'sub') {
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
// Accountancy account
|
||||
// Search on accountancy custom groups or account
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('AccountAccounting').': ';
|
||||
$moreforfilter .= '<div class="nowrap inline-block">';
|
||||
@ -723,6 +749,13 @@ 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)) {
|
||||
@ -740,7 +773,13 @@ print '<table class="tagtable liste centpercent">';
|
||||
|
||||
// Filters lines
|
||||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre center">';
|
||||
$searchpicto = $form->showFilterButtons('left');
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
// Movement number
|
||||
if (!empty($arrayfields['t.piece_num']['checked'])) {
|
||||
print '<td class="liste_titre"><input type="text" name="search_mvt_num" class="width50" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
|
||||
@ -819,15 +858,20 @@ $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // N
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Action column
|
||||
print '<td class="liste_titre center">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre center">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
}
|
||||
if (!empty($arrayfields['t.piece_num']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder, 'tdoverflowmax80imp ');
|
||||
}
|
||||
if (!empty($arrayfields['t.code_journal']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
@ -863,7 +907,9 @@ if (!empty($arrayfields['t.import_key']['checked'])) {
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
$displayed_account_number = null; // Start with undefined to be able to distinguish with empty
|
||||
@ -905,6 +951,10 @@ while ($i < min($num, $limit)) {
|
||||
if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; }
|
||||
if (!empty($arrayfields['t.date_validating']['checked'])) { $colspanend++; }
|
||||
if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspanend++; }
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
$colspan++;
|
||||
$colspanend--;
|
||||
}
|
||||
|
||||
// Is it a break ?
|
||||
if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
|
||||
@ -916,8 +966,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($sous_total_debit).'</td>';
|
||||
print '<td class="nowrap right">'.price($sous_total_credit).'</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 colspan="'.$colspanend.'"></td>';
|
||||
print '</tr>';
|
||||
// Show balance of last shown account
|
||||
@ -926,13 +976,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($sous_total_debit - $sous_total_credit);
|
||||
print price(price2num($sous_total_debit - $sous_total_credit, 'MT'));
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
print '<td class="nowraponall right">';
|
||||
print price($sous_total_credit - $sous_total_debit);
|
||||
print price(price2num($sous_total_credit - $sous_total_debit, 'MT'));
|
||||
print '</td>';
|
||||
}
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
@ -944,7 +994,9 @@ 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 $line->subledger_label . ' : ' . length_accounta($line->subledger_account);
|
||||
print empty($line->subledger_label) ? '<span class="error">'.$langs->trans("Unknown").'</span>' : $line->subledger_label;
|
||||
print ' : ';
|
||||
print 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");
|
||||
@ -976,7 +1028,21 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="nowraponall center">';
|
||||
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($line->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb' . $line->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $line->id . '"' . ($selected ? ' checked="checked"' : '') . ' />';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Piece number
|
||||
if (!empty($arrayfields['t.piece_num']['checked'])) {
|
||||
print '<td>';
|
||||
@ -994,7 +1060,7 @@ while ($i < min($num, $limit)) {
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$result = $accountingjournal->fetch('', $line->code_journal);
|
||||
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
|
||||
print '<td class="center">'.$journaltoshow.'</td>';
|
||||
print '<td class="center tdoverflowmax80">'.$journaltoshow.'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1090,7 +1156,7 @@ while ($i < min($num, $limit)) {
|
||||
|
||||
// Amount debit
|
||||
if (!empty($arrayfields['t.debit']['checked'])) {
|
||||
print '<td class="right nowraponall amount">'.($line->debit ? price($line->debit) : '').'</td>';
|
||||
print '<td class="right nowraponall amount">'.($line->debit != 0 ? price($line->debit) : '').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1102,7 +1168,7 @@ while ($i < min($num, $limit)) {
|
||||
|
||||
// Amount credit
|
||||
if (!empty($arrayfields['t.credit']['checked'])) {
|
||||
print '<td class="right nowraponall amount">'.($line->credit ? price($line->credit) : '').'</td>';
|
||||
print '<td class="right nowraponall amount">'.($line->credit != 0 ? price($line->credit) : '').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1149,17 +1215,19 @@ while ($i < min($num, $limit)) {
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Action column
|
||||
print '<td class="nowraponall center">';
|
||||
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($line->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="nowraponall center">';
|
||||
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($line->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb' . $line->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $line->id . '"' . ($selected ? ' checked="checked"' : '') . ' />';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
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']++;
|
||||
}
|
||||
|
||||
// Comptabilise le sous-total
|
||||
@ -1174,8 +1242,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($sous_total_debit).'</td>';
|
||||
print '<td class="nowrap right">'.price($sous_total_credit).'</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 colspan="'.$colspanend.'"></td>';
|
||||
print '</tr>';
|
||||
// Show balance of last shown account
|
||||
@ -1184,22 +1252,46 @@ 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($sous_total_debit - $sous_total_credit);
|
||||
print price(price2num($sous_total_debit - $sous_total_credit, 'MT'));
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
print '<td class="nowraponall right">';
|
||||
print price($sous_total_credit - $sous_total_debit);
|
||||
print price(price2num($sous_total_credit - $sous_total_debit, 'MT'));
|
||||
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';
|
||||
|
||||
// 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>';
|
||||
}
|
||||
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
@ -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();
|
||||
@ -446,62 +446,12 @@ class AccountancyCategory // extends CommonObject
|
||||
} else {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
$this->errors[] = $this->error;
|
||||
dol_syslog(__METHOD__." ".implode(','.$this->errors), LOG_ERR);
|
||||
dol_syslog(__METHOD__." ".implode(',', $this->errors), LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to fill ->lines_cptbk with accounting account used (into bookkeeping) and not yet into a custom group
|
||||
*
|
||||
* @param int $id Id of custom group
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
/*
|
||||
public function getCptBK($id)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT DISTINCT t.numero_compte, t.label_operation, t.doc_ref";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t";
|
||||
$sql .= " WHERE t.numero_compte NOT IN ("; // account not into a custom group
|
||||
$sql .= " SELECT t.account_number";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t";
|
||||
$sql .= " WHERE t.fk_accounting_category = ".((int) $id)." AND t.entity = ".$conf->entity.")";
|
||||
$sql .= " AND t.numero_compte IN ("; // account into current chart of account
|
||||
$sql .= " SELECT DISTINCT aa.account_number";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = ".((int) $conf->global->CHARTOFACCOUNTS);
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " AND aa.entity = ".$conf->entity.")";
|
||||
$sql .= " GROUP BY t.numero_compte, t.label_operation, t.doc_ref";
|
||||
$sql .= " ORDER BY t.numero_compte";
|
||||
|
||||
$this->lines_cptbk = array();
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$this->lines_cptbk[] = $obj;
|
||||
}
|
||||
}
|
||||
|
||||
return $num;
|
||||
} else {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
$this->errors[] = $this->error;
|
||||
dol_syslog(__METHOD__." ".implode(','.$this->errors), LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function to fill ->lines_cptbk with accounting account (defined in chart of account) and not yet into a custom group
|
||||
*
|
||||
@ -538,7 +488,7 @@ class AccountancyCategory // extends CommonObject
|
||||
} else {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
$this->errors[] = $this->error;
|
||||
dol_syslog(__METHOD__." ".implode(','.$this->errors), LOG_ERR);
|
||||
dol_syslog(__METHOD__." ".implode(',', $this->errors), LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -655,60 +605,6 @@ 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
|
||||
*
|
||||
@ -728,22 +624,31 @@ class AccountancyCategory // extends CommonObject
|
||||
$this->sdc = 0;
|
||||
$this->sdcpermonth = array();
|
||||
|
||||
if (is_array($cpt)) {
|
||||
$listofaccount = '';
|
||||
foreach ($cpt as $cptcursor) {
|
||||
if (! is_null($cptcursor)) {
|
||||
if ($listofaccount) {
|
||||
$listofaccount .= ",";
|
||||
}
|
||||
$listofaccount .= "'".$cptcursor."'";
|
||||
}
|
||||
}
|
||||
if (empty($listofaccount)) {
|
||||
// List of account is empty, so we do no try sql request, we can say result is empty.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
|
||||
if (is_array($cpt)) {
|
||||
$sql .= ", t.numero_compte as accountancy_account";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t";
|
||||
//if (in_array($this->db->type, array('mysql', 'mysqli'))) $sql.=' USE INDEX idx_accounting_bookkeeping_doc_date';
|
||||
$sql .= " WHERE t.entity = ".$conf->entity;
|
||||
$sql .= " WHERE t.entity = ".((int) $conf->entity);
|
||||
if (is_array($cpt)) {
|
||||
$listofaccount = '';
|
||||
foreach ($cpt as $cptcursor) {
|
||||
if ($listofaccount) {
|
||||
$listofaccount .= ",";
|
||||
}
|
||||
$listofaccount .= "'".$cptcursor."'";
|
||||
}
|
||||
$sql .= " AND t.numero_compte IN (".$this->db->sanitize($listofaccount).")";
|
||||
$sql .= " AND t.numero_compte IN (".$this->db->sanitize($listofaccount, 1).")";
|
||||
} else {
|
||||
$sql .= " AND t.numero_compte = '".$this->db->escape($cpt)."'";
|
||||
}
|
||||
@ -759,22 +664,28 @@ class AccountancyCategory // extends CommonObject
|
||||
if (is_array($cpt)) {
|
||||
$sql .= " GROUP BY t.numero_compte";
|
||||
}
|
||||
//print $sql;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($sens == 1) {
|
||||
$this->sdc = $obj->debit - $obj->credit;
|
||||
} else {
|
||||
$this->sdc = $obj->credit - $obj->debit;
|
||||
}
|
||||
if (is_array($cpt)) {
|
||||
$this->sdcperaccount[$obj->accountancy_account] = $this->sdc;
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
if ($sens == 1) {
|
||||
$this->sdc = $obj->debit - $obj->credit;
|
||||
} else {
|
||||
$this->sdc = $obj->credit - $obj->debit;
|
||||
}
|
||||
if (is_array($cpt)) {
|
||||
$this->sdcperaccount[$obj->accountancy_account] = $this->sdc;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $num;
|
||||
} else {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
@ -784,12 +695,75 @@ 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)
|
||||
{
|
||||
@ -824,9 +798,10 @@ 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++;
|
||||
@ -844,12 +819,15 @@ class AccountancyCategory // extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Get all accounting account of a custom group (or a list of custom groups).
|
||||
* Get all accounting account of a given 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 not come from an input of a user.
|
||||
* @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"
|
||||
* @return array|int Array of accounting accounts or -1 if error
|
||||
* @see getCats(), getCatsCpts()
|
||||
*/
|
||||
public function getCptsCat($cat_id, $predefinedgroupwhere = '')
|
||||
{
|
||||
@ -861,20 +839,29 @@ class AccountancyCategory // extends CommonObject
|
||||
exit();
|
||||
}
|
||||
|
||||
$pcgverid = $conf->global->CHARTOFACCOUNTS;
|
||||
$pcgvercode = dol_getIdFromCode($this->db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version');
|
||||
if (empty($pcgvercode)) {
|
||||
$pcgvercode = $pcgverid;
|
||||
}
|
||||
|
||||
if (!empty($cat_id)) {
|
||||
$sql = "SELECT t.rowid, t.account_number, t.label as account_label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t";
|
||||
$sql .= " WHERE t.fk_accounting_category = ".((int) $cat_id);
|
||||
$sql .= " AND t.entity = ".$conf->entity;
|
||||
$sql .= " AND t.active = 1";
|
||||
$sql .= " AND t.fk_pcg_version = '".$this->db->escape($pcgvercode)."'";
|
||||
$sql .= " ORDER BY t.account_number";
|
||||
} else {
|
||||
$sql = "SELECT t.rowid, t.account_number, t.label as account_label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t";
|
||||
$sql .= " WHERE ".$predefinedgroupwhere;
|
||||
$sql .= " AND t.entity = ".$conf->entity;
|
||||
$sql .= ' AND t.active = 1';
|
||||
$sql .= " AND t.fk_pcg_version = '".$this->db->escape($pcgvercode)."'";
|
||||
$sql .= " ORDER BY t.account_number";
|
||||
}
|
||||
//echo $sql;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
@ -5,13 +5,15 @@
|
||||
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||
* Copyright (C) 2016-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2016-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2022 Lionel Vessiller <lvessiller@open-dsi.fr>
|
||||
* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com>
|
||||
* Copyright (C) 2017-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2017 André Schild <a.schild@aarboard.ch>
|
||||
* Copyright (C) 2020 Guillaume Alexandre <guillaume@tag-info.fr>
|
||||
* Copyright (C) 2022 Joachim Kueter <jkueter@gmx.de>
|
||||
* 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
|
||||
@ -35,7 +37,7 @@
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
@ -200,7 +202,7 @@ class AccountancyExport
|
||||
'ACCOUNTING_EXPORT_FORMAT' => empty($conf->global->ACCOUNTING_EXPORT_FORMAT) ? 'txt' : $conf->global->ACCOUNTING_EXPORT_FORMAT,
|
||||
'ACCOUNTING_EXPORT_SEPARATORCSV' => empty($conf->global->ACCOUNTING_EXPORT_SEPARATORCSV) ? ',' : $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV,
|
||||
'ACCOUNTING_EXPORT_ENDLINE' => empty($conf->global->ACCOUNTING_EXPORT_ENDLINE) ? 1 : $conf->global->ACCOUNTING_EXPORT_ENDLINE,
|
||||
'ACCOUNTING_EXPORT_DATE' => empty($conf->global->ACCOUNTING_EXPORT_DATE) ? '%d%m%Y' : $conf->global->ACCOUNTING_EXPORT_DATE,
|
||||
'ACCOUNTING_EXPORT_DATE' => getDolGlobalString('ACCOUNTING_EXPORT_DATE', '%Y-%m-%d'),
|
||||
),
|
||||
self::$EXPORT_TYPE_CEGID => array(
|
||||
'label' => $langs->trans('Modelcsv_CEGID'),
|
||||
@ -313,9 +315,10 @@ class AccountancyExport
|
||||
*
|
||||
* @param array $TData Array with data
|
||||
* @param int $formatexportset Id of export format
|
||||
* @return void
|
||||
* @param int $withAttachment [=0] Not add files or 1 to have attached in an archive (ex : Quadratus)
|
||||
* @return int <0 if KO, >0 OK
|
||||
*/
|
||||
public function export(&$TData, $formatexportset)
|
||||
public function export(&$TData, $formatexportset, $withAttachment = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $search_date_end; // Used into /accountancy/tpl/export_journal.tpl.php
|
||||
@ -325,8 +328,44 @@ class AccountancyExport
|
||||
$type_export = 'general_ledger';
|
||||
|
||||
global $db; // The tpl file use $db
|
||||
$completefilename = '';
|
||||
$exportFile = null;
|
||||
$exportFileName = '';
|
||||
$exportFilePath = '';
|
||||
$archiveFileList = array();
|
||||
if ($withAttachment == 1) {
|
||||
// PHP ZIP extension must be enabled
|
||||
if (!extension_loaded('zip')) {
|
||||
$langs->load('install');
|
||||
$this->errors[] = $langs->trans('ErrorPHPDoesNotSupport', 'ZIP');
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
$mimetype = $this->getMimeType($formatexportset);
|
||||
top_httphead($mimetype, 1);
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
|
||||
if ($withAttachment == 1 && !empty($completefilename)) {
|
||||
// create export file
|
||||
$tmpDir = !empty($conf->accounting->multidir_temp[$conf->entity]) ? $conf->accounting->multidir_temp[$conf->entity] : $conf->accounting->dir_temp;
|
||||
$exportFileFullName = $completefilename;
|
||||
$exportFileBaseName = basename($exportFileFullName);
|
||||
$exportFileName = pathinfo($exportFileBaseName, PATHINFO_FILENAME);
|
||||
$exportFilePath = $tmpDir.'/'.$exportFileFullName;
|
||||
$exportFile = fopen($exportFilePath, 'w');
|
||||
if (!$exportFile) {
|
||||
$this->errors[] = $langs->trans('ErrorFileNotFound', $exportFilePath);
|
||||
return -1;
|
||||
}
|
||||
$archiveFileList[0] = array(
|
||||
'path' => $exportFilePath,
|
||||
'name' => $exportFileFullName,
|
||||
);
|
||||
|
||||
// archive name and path
|
||||
$archiveFullName = $exportFileName.'.zip';
|
||||
$archivePath = $tmpDir.'/'.$archiveFullName;
|
||||
}
|
||||
|
||||
switch ($formatexportset) {
|
||||
case self::$EXPORT_TYPE_CONFIGURABLE:
|
||||
@ -345,7 +384,7 @@ class AccountancyExport
|
||||
$this->exportCiel($TData);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_QUADRATUS:
|
||||
$this->exportQuadratus($TData);
|
||||
$archiveFileList = $this->exportQuadratus($TData, $exportFile, $archiveFileList, $withAttachment);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_WINFIC:
|
||||
$this->exportWinfic($TData);
|
||||
@ -399,6 +438,69 @@ class AccountancyExport
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// create and download export file or archive
|
||||
if ($withAttachment == 1) {
|
||||
$error = 0;
|
||||
|
||||
// close export file
|
||||
if ($exportFile) {
|
||||
fclose($exportFile);
|
||||
}
|
||||
|
||||
if (!empty($archiveFullName) && !empty($archivePath) && !empty($archiveFileList)) {
|
||||
// archive files
|
||||
$downloadFileMimeType = 'application/zip';
|
||||
$downloadFileFullName = $archiveFullName;
|
||||
$downloadFilePath = $archivePath;
|
||||
|
||||
// create archive
|
||||
$archive = new ZipArchive();
|
||||
$res = $archive->open($archivePath, ZipArchive::OVERWRITE | ZipArchive::CREATE);
|
||||
if ($res !== true) {
|
||||
$error++;
|
||||
$this->errors[] = $langs->trans('ErrorFileNotFound', $archivePath);
|
||||
}
|
||||
if (!$error) {
|
||||
// add files
|
||||
foreach ($archiveFileList as $archiveFileArr) {
|
||||
$res = $archive->addFile($archiveFileArr['path'], $archiveFileArr['name']);
|
||||
if (!$res) {
|
||||
$error++;
|
||||
$this->errors[] = $langs->trans('ErrorArchiveAddFile', $archiveFileArr['name']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$error) {
|
||||
// close archive
|
||||
$archive->close();
|
||||
}
|
||||
} elseif (!empty($exportFileFullName) && !empty($exportFilePath)) {
|
||||
// only one file to download
|
||||
$downloadFileMimeType = 'text/csv';
|
||||
$downloadFileFullName = $exportFileFullName;
|
||||
$downloadFilePath = $exportFilePath;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
// download export file
|
||||
if (!empty($downloadFileMimeType) && !empty($downloadFileFullName) && !empty($downloadFilePath)) {
|
||||
header('Content-Type: '.$downloadFileMimeType);
|
||||
header('Content-Disposition: attachment; filename='.$downloadFileFullName);
|
||||
header('Cache-Control: Public, must-revalidate');
|
||||
header('Pragma: public');
|
||||
header('Content-Length: '.dol_filesize($downloadFilePath));
|
||||
readfileLowMemory($downloadFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -444,14 +546,14 @@ class AccountancyExport
|
||||
print $date.$separator;
|
||||
print $line->piece_num.$separator;
|
||||
print length_accountg($line->numero_compte).$separator;
|
||||
print ''.$separator;
|
||||
print $separator;
|
||||
print $line->label_operation.$separator;
|
||||
print $date.$separator;
|
||||
if ($line->sens == 'D') {
|
||||
print price($line->debit).$separator;
|
||||
print ''.$separator;
|
||||
print $separator;
|
||||
} elseif ($line->sens == 'C') {
|
||||
print ''.$separator;
|
||||
print $separator;
|
||||
print price($line->credit).$separator;
|
||||
}
|
||||
print $line->doc_ref.$separator;
|
||||
@ -579,15 +681,18 @@ class AccountancyExport
|
||||
/**
|
||||
* Export format : Quadratus (Format ASCII)
|
||||
* Format since 2015 compatible QuadraCOMPTA
|
||||
* Last review for this format : 2021/09/13 Alexandre Spangaro (aspangaro@open-dsi.fr)
|
||||
* Last review for this format : 2023/01/28 Alexandre Spangaro (aspangaro@open-dsi.fr)
|
||||
*
|
||||
* Help : https://docplayer.fr/20769649-Fichier-d-entree-ascii-dans-quadracompta.html
|
||||
* In QuadraCompta | Use menu : "Outils" > "Suivi des dossiers" > "Import ASCII(Compta)"
|
||||
*
|
||||
* @param array $TData data
|
||||
* @return void
|
||||
* @param array $TData Data
|
||||
* @param resource $exportFile [=null] File resource to export or print if null
|
||||
* @param array $archiveFileList [=array()] Archive file list : array of ['path', 'name']
|
||||
* @param bool $withAttachment [=0] Not add files or 1 to have attached in an archive
|
||||
* @return array Archive file list : array of ['path', 'name']
|
||||
*/
|
||||
public function exportQuadratus(&$TData)
|
||||
public function exportQuadratus(&$TData, $exportFile = null, $archiveFileList = array(), $withAttachment = 0)
|
||||
{
|
||||
global $conf, $db;
|
||||
|
||||
@ -597,6 +702,14 @@ class AccountancyExport
|
||||
// $date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||
// $date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||
foreach ($TData as $data) {
|
||||
// Clean some data
|
||||
$data->doc_ref = dol_string_unaccent($data->doc_ref);
|
||||
$data->label_operation = dol_string_unaccent($data->label_operation);
|
||||
$data->numero_compte = dol_string_unaccent($data->numero_compte);
|
||||
$data->label_compte = dol_string_unaccent($data->label_compte);
|
||||
$data->subledger_account = dol_string_unaccent($data->subledger_account);
|
||||
$data->subledger_label = dol_string_unaccent($data->subledger_label);
|
||||
|
||||
$code_compta = $data->numero_compte;
|
||||
if (!empty($data->subledger_account)) {
|
||||
$code_compta = $data->subledger_account;
|
||||
@ -628,16 +741,20 @@ class AccountancyExport
|
||||
if ($data->doc_type == 'customer_invoice') {
|
||||
$Tab['type_compte'] = 'C';
|
||||
} elseif ($data->doc_type == 'supplier_invoice') {
|
||||
$Tab['coll_compte'] = 'F';
|
||||
$Tab['type_compte'] = 'F';
|
||||
} else {
|
||||
$Tab['coll_compte'] = 'G';
|
||||
$Tab['type_compte'] = 'G';
|
||||
}
|
||||
|
||||
$Tab['filler3'] = str_repeat(' ', 235);
|
||||
|
||||
$Tab['end_line'] = $end_line;
|
||||
|
||||
print implode($Tab);
|
||||
if ($exportFile) {
|
||||
fwrite($exportFile, implode($Tab));
|
||||
} else {
|
||||
print implode($Tab);
|
||||
}
|
||||
}
|
||||
|
||||
$Tab = array();
|
||||
@ -651,7 +768,7 @@ class AccountancyExport
|
||||
//$Tab['date_ecriture'] = $date_ecriture;
|
||||
$Tab['date_ecriture'] = dol_print_date($data->doc_date, '%d%m%y');
|
||||
$Tab['filler'] = ' ';
|
||||
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 20), 20);
|
||||
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref.' '.$data->label_operation, 20), 20);
|
||||
|
||||
// Credit invoice - invert sens
|
||||
/*
|
||||
@ -701,19 +818,70 @@ class AccountancyExport
|
||||
// TODO: we should filter more than only accent to avoid wrong line size
|
||||
// TODO: remove invoice number doc_ref in libelle,
|
||||
// TODO: we should offer an option for customer to build the libelle using invoice number / name / date in accounting software
|
||||
//$Tab['libelle_ecriture2'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref) . ' ' . dol_string_unaccent($data->label_operation), 30), 30);
|
||||
$Tab['libelle_ecriture2'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 30), 30);
|
||||
//$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_operation, 30), 30);
|
||||
$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->label_operation, 30), 30);
|
||||
$Tab['codetva'] = str_repeat(' ', 2);
|
||||
|
||||
// We need to keep the 10 lastest number of invoice doc_ref not the beginning part that is the unusefull almost same part
|
||||
// $Tab['num_piece3'] = str_pad(self::trunc($data->piece_num, 10), 10);
|
||||
$Tab['num_piece3'] = substr(self::trunc($data->doc_ref, 20), -10);
|
||||
$Tab['filler4'] = str_repeat(' ', 73);
|
||||
$Tab['reserved'] = str_repeat(' ', 10); // position 159
|
||||
$Tab['currency_amount'] = str_repeat(' ', 13); // position 169
|
||||
// get document file
|
||||
$attachmentFileName = '';
|
||||
if ($withAttachment == 1) {
|
||||
$attachmentFileKey = trim($data->piece_num);
|
||||
|
||||
if (!isset($archiveFileList[$attachmentFileKey])) {
|
||||
$objectDirPath = '';
|
||||
$objectFileName = dol_sanitizeFileName($data->doc_ref);
|
||||
if ($data->doc_type == 'customer_invoice') {
|
||||
$objectDirPath = !empty($conf->facture->multidir_output[$conf->entity]) ? $conf->facture->multidir_output[$conf->entity] : $conf->facture->dir_output;
|
||||
} elseif ($data->doc_type == 'expense_report') {
|
||||
$objectDirPath = !empty($conf->expensereport->multidir_output[$conf->entity]) ? $conf->expensereport->multidir_output[$conf->entity] : $conf->factureexpensereport->dir_output;
|
||||
} elseif ($data->doc_type == 'supplier_invoice') {
|
||||
$objectDirPath = !empty($conf->fournisseur->facture->multidir_output[$conf->entity]) ? $conf->fournisseur->facture->multidir_output[$conf->entity] : $conf->fournisseur->facture->dir_output;
|
||||
}
|
||||
$arrayofinclusion = array();
|
||||
$arrayofinclusion[] = '^'.preg_quote($objectFileName, '/').'\.pdf$';
|
||||
$fileFoundList = dol_dir_list($objectDirPath.'/'.$objectFileName, 'files', 0, implode('|', $arrayofinclusion), '(\.meta|_preview.*\.png)$', 'date', SORT_DESC, 0, true);
|
||||
if (!empty($fileFoundList)) {
|
||||
$attachmentFileNameTrunc = str_pad(self::trunc($data->piece_num, 8), 8, '0', STR_PAD_LEFT);
|
||||
foreach ($fileFoundList as $fileFound) {
|
||||
if (strstr($fileFound['name'], $objectFileName)) {
|
||||
$fileFoundPath = $objectDirPath.'/'.$objectFileName.'/'.$fileFound['name'];
|
||||
if (file_exists($fileFoundPath)) {
|
||||
$archiveFileList[$attachmentFileKey] = array(
|
||||
'path' => $fileFoundPath,
|
||||
'name' => $attachmentFileNameTrunc.'.pdf',
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($archiveFileList[$attachmentFileKey])) {
|
||||
$attachmentFileName = $archiveFileList[$attachmentFileKey]['name'];
|
||||
}
|
||||
}
|
||||
if (dol_strlen($attachmentFileName) == 12) {
|
||||
$Tab['attachment'] = $attachmentFileName; // position 182
|
||||
} else {
|
||||
$Tab['attachment'] = str_repeat(' ', 12); // position 182
|
||||
}
|
||||
$Tab['filler4'] = str_repeat(' ', 38);
|
||||
$Tab['end_line'] = $end_line;
|
||||
|
||||
print implode($Tab);
|
||||
if ($exportFile) {
|
||||
fwrite($exportFile, implode($Tab));
|
||||
} else {
|
||||
print implode($Tab);
|
||||
}
|
||||
}
|
||||
|
||||
return $archiveFileList;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1008,7 +1176,9 @@ class AccountancyExport
|
||||
print $line->code_journal . $separator;
|
||||
|
||||
// FEC:JournalLib
|
||||
print dol_string_unaccent($langs->transnoentities($line->journal_label)) . $separator;
|
||||
$labeljournal = dol_string_unaccent($langs->transnoentities($line->journal_label));
|
||||
$labeljournal = dol_string_nospecial($labeljournal, ' ');
|
||||
print $labeljournal . $separator;
|
||||
|
||||
// FEC:EcritureNum
|
||||
print $line->piece_num . $separator;
|
||||
@ -1139,7 +1309,9 @@ class AccountancyExport
|
||||
print $line->code_journal . $separator;
|
||||
|
||||
// FEC:JournalLib
|
||||
print dol_string_unaccent($langs->transnoentities($line->journal_label)) . $separator;
|
||||
$labeljournal = dol_string_unaccent($langs->transnoentities($line->journal_label));
|
||||
$labeljournal = dol_string_nospecial($labeljournal, ' ');
|
||||
print $labeljournal . $separator;
|
||||
|
||||
// FEC:EcritureNum
|
||||
print $line->piece_num . $separator;
|
||||
@ -1961,14 +2133,16 @@ class AccountancyExport
|
||||
//Calcul de la longueur des numéros de comptes
|
||||
$taille_numero = strlen(length_accountg($line->numero_compte));
|
||||
|
||||
//Création du numéro de client générique
|
||||
//Création du numéro de client et fournisseur générique
|
||||
$numero_cpt_client = '411';
|
||||
$numero_cpt_fourn = '401';
|
||||
for ($i = 1; $i <= ($taille_numero - 3); $i++) {
|
||||
$numero_cpt_client .= '0';
|
||||
$numero_cpt_fourn .= '0';
|
||||
}
|
||||
|
||||
//Création des comptes auxiliaire des clients
|
||||
if (length_accountg($line->numero_compte) == $numero_cpt_client) {
|
||||
//Création des comptes auxiliaire des clients et fournisseur
|
||||
if (length_accountg($line->numero_compte) == $numero_cpt_client || length_accountg($line->numero_compte) == $numero_cpt_fourn) {
|
||||
$tab[] = rtrim(length_accounta($line->subledger_account), "0");
|
||||
} else {
|
||||
$tab[] = length_accountg($line->numero_compte);
|
||||
|
||||
@ -38,6 +38,11 @@ class AccountancySystem
|
||||
*/
|
||||
public $error = '';
|
||||
|
||||
/**
|
||||
* @var string[] Array of Errors code (or messages)
|
||||
*/
|
||||
public $errors = array();
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
|
||||
@ -723,16 +723,18 @@ class AccountingAccount extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Suggest accounting accounts to bind
|
||||
* Return a suggested account (from chart of accounts) to bind
|
||||
*
|
||||
* @param Societe $buyer Object buyer
|
||||
* @param Societe $seller Object seller
|
||||
* @param Product $product Product object sell or buy
|
||||
* @param Facture|FactureFournisseur $facture Facture
|
||||
* @param FactureLigne|SupplierInvoiceLine $factureDet Facture Det
|
||||
* @param array $accountingAccount Array of Account account
|
||||
* @param array $accountingAccount Array of Accounting account
|
||||
* @param string $type Customer / Supplier
|
||||
* @return array|int Accounting accounts suggested or < 0 if technical error.
|
||||
* 'suggestedaccountingaccountbydefaultfor'=>Will be used for the label to show on tooltip for account by default on any product
|
||||
* 'suggestedaccountingaccountfor'=>Is the account suggested for this product
|
||||
*/
|
||||
public function getAccountingCodeToBind(Societe $buyer, Societe $seller, Product $product, $facture, $factureDet, $accountingAccount = array(), $type = '')
|
||||
{
|
||||
@ -868,20 +870,44 @@ class AccountingAccount extends CommonObject
|
||||
}
|
||||
|
||||
// Manage Deposit
|
||||
if ($factureDet->desc == "(DEPOSIT)" || $facture->type == $facture::TYPE_DEPOSIT) {
|
||||
$accountdeposittoventilated = new self($this->db);
|
||||
if ($type == 'customer') {
|
||||
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
|
||||
} elseif ($type == 'supplier') {
|
||||
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT, 1);
|
||||
}
|
||||
if (isset($result) && $result < 0) {
|
||||
return -1;
|
||||
if (getDolGlobalString('ACCOUNTING_ACCOUNT_' . strtoupper($type) . '_DEPOSIT')) {
|
||||
if ($factureDet->desc == "(DEPOSIT)" || $facture->type == $facture::TYPE_DEPOSIT) {
|
||||
$accountdeposittoventilated = new self($this->db);
|
||||
if ($type == 'customer') {
|
||||
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
|
||||
} elseif ($type == 'supplier') {
|
||||
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT, 1);
|
||||
}
|
||||
if (isset($result) && $result < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
$code_l = $accountdeposittoventilated->ref;
|
||||
$code_p = '';
|
||||
$code_t = '';
|
||||
$suggestedid = $accountdeposittoventilated->rowid;
|
||||
$suggestedaccountingaccountfor = 'deposit';
|
||||
}
|
||||
|
||||
$code_l = $accountdeposittoventilated->ref;
|
||||
$suggestedid = $accountdeposittoventilated->rowid;
|
||||
$suggestedaccountingaccountfor = 'deposit';
|
||||
// For credit note invoice, if origin invoice is a deposit invoice, force also on specific customer/supplier deposit account
|
||||
if (!empty($facture->fk_facture_source)) {
|
||||
$invoiceSource = new $facture($this->db);
|
||||
$invoiceSource->fetch($facture->fk_facture_source);
|
||||
|
||||
if ($facture->type == $facture::TYPE_CREDIT_NOTE && $invoiceSource->type == $facture::TYPE_DEPOSIT) {
|
||||
$accountdeposittoventilated = new self($this->db);
|
||||
if ($type == 'customer') {
|
||||
$accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
|
||||
} elseif ($type == 'supplier') {
|
||||
$accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT, 1);
|
||||
}
|
||||
$code_l = $accountdeposittoventilated->ref;
|
||||
$code_p = '';
|
||||
$code_t = '';
|
||||
$suggestedid = $accountdeposittoventilated->rowid;
|
||||
$suggestedaccountingaccountfor = 'deposit';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If $suggestedid could not be guessed yet, we set it from the generic default accounting code $code_l
|
||||
|
||||
@ -388,12 +388,6 @@ 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'));
|
||||
@ -454,27 +448,12 @@ 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') {
|
||||
@ -488,11 +467,6 @@ 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);
|
||||
@ -755,7 +729,7 @@ class AccountingJournal extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
$journal_data[$pre_data_id] = $element;
|
||||
$journal_data[(int) $pre_data_id] = $element;
|
||||
}
|
||||
unset($pre_data);
|
||||
|
||||
@ -810,12 +784,6 @@ 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'));
|
||||
@ -960,11 +928,6 @@ 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
|
||||
@ -987,8 +950,8 @@ class AccountingJournal extends CommonObject
|
||||
$langs->transnoentitiesnoconv("LedgerAccount"),
|
||||
$langs->transnoentitiesnoconv("SubledgerAccount"),
|
||||
$langs->transnoentitiesnoconv("Label"),
|
||||
$langs->transnoentitiesnoconv("Debit"),
|
||||
$langs->transnoentitiesnoconv("Credit"),
|
||||
$langs->transnoentitiesnoconv("AccountingDebit"),
|
||||
$langs->transnoentitiesnoconv("AccountingCredit"),
|
||||
$langs->transnoentitiesnoconv("Journal"),
|
||||
$langs->transnoentitiesnoconv("Note"),
|
||||
);
|
||||
@ -998,8 +961,8 @@ class AccountingJournal extends CommonObject
|
||||
$langs->transnoentitiesnoconv("Piece"),
|
||||
$langs->transnoentitiesnoconv("AccountAccounting"),
|
||||
$langs->transnoentitiesnoconv("LabelOperation"),
|
||||
$langs->transnoentitiesnoconv("Debit"),
|
||||
$langs->transnoentitiesnoconv("Credit"),
|
||||
$langs->transnoentitiesnoconv("AccountingDebit"),
|
||||
$langs->transnoentitiesnoconv("AccountingCredit"),
|
||||
);
|
||||
} elseif ($this->nature == 1) {
|
||||
$header = array(
|
||||
@ -1007,8 +970,8 @@ class AccountingJournal extends CommonObject
|
||||
$langs->transnoentitiesnoconv("Piece"),
|
||||
$langs->transnoentitiesnoconv("AccountAccounting"),
|
||||
$langs->transnoentitiesnoconv("LabelOperation"),
|
||||
$langs->transnoentitiesnoconv("Debit"),
|
||||
$langs->transnoentitiesnoconv("Credit"),
|
||||
$langs->transnoentitiesnoconv("AccountingDebit"),
|
||||
$langs->transnoentitiesnoconv("AccountingCredit"),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -817,56 +817,61 @@ class BookKeeping extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
* Load object in memory from the database in ->lines. Or just make a simple count if $countonly=1.
|
||||
*
|
||||
* @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
|
||||
* @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
|
||||
*/
|
||||
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $option = 0)
|
||||
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $option = 0, $countonly = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$this->lines = array();
|
||||
$num = 0;
|
||||
|
||||
$sql = 'SELECT';
|
||||
$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";
|
||||
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";
|
||||
}
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
@ -880,7 +885,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->escape($value).'%\'';
|
||||
$sqlwhere[] = $key.' LIKE \''.$this->db->escapeforlike($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<=') {
|
||||
@ -897,18 +902,19 @@ 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 1 = 1';
|
||||
$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||
$sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere);
|
||||
}
|
||||
// Affichage par compte comptable
|
||||
// Filter by ledger account or subledger account
|
||||
if (!empty($option)) {
|
||||
$sql .= " AND t.subledger_account IS NOT NULL";
|
||||
$sql .= " AND t.subledger_account <> ''";
|
||||
@ -919,54 +925,63 @@ class BookKeeping extends CommonObject
|
||||
$sortorder = 'ASC'.($sortorder ? ','.$sortorder : '');
|
||||
}
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
if (!empty($limit)) {
|
||||
$sql .= $this->db->plimit($limit + 1, $offset);
|
||||
if (!$countonly) {
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
if (!empty($limit)) {
|
||||
$sql .= $this->db->plimit($limit + 1, $offset);
|
||||
}
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($countonly) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
$num = $obj->nb;
|
||||
}
|
||||
} else {
|
||||
$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 = $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);
|
||||
|
||||
@ -1139,9 +1154,10 @@ 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')
|
||||
public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $option = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -1151,6 +1167,11 @@ class BookKeeping extends CommonObject
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= " t.numero_compte,";
|
||||
$sql .= " t.label_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';
|
||||
@ -1176,6 +1197,8 @@ 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)."%'";
|
||||
}
|
||||
@ -1186,7 +1209,17 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere);
|
||||
}
|
||||
|
||||
$sql .= ' GROUP BY t.numero_compte';
|
||||
if (!empty($option)) {
|
||||
$sql .= ' AND t.subledger_account IS NOT NULL';
|
||||
$sql .= ' AND t.subledger_account != ""';
|
||||
$sql .= ' GROUP BY t.numero_compte, t.label_compte, t.subledger_account, t.subledger_label';
|
||||
$sortfield = 't.subledger_account'.($sortfield ? ','.$sortfield : '');
|
||||
$sortorder = 'ASC'.($sortfield ? ','.$sortfield : '');
|
||||
} else {
|
||||
$sql .= ' GROUP BY t.numero_compte, t.label_compte';
|
||||
$sortfield = 't.numero_compte'.($sortfield ? ','.$sortfield : '');
|
||||
$sortorder = 'ASC'.($sortorder ? ','.$sortorder : '');
|
||||
}
|
||||
|
||||
if (!empty($sortfield)) {
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
@ -1204,6 +1237,9 @@ 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;
|
||||
|
||||
@ -2052,7 +2088,7 @@ class BookKeeping extends CommonObject
|
||||
* FIXME: This function takes the parent of parent to get the root account !
|
||||
*
|
||||
* @param string $account Accounting account
|
||||
* @return array Array with root account information (max 2 upper level)
|
||||
* @return array|int Array with root account information (max 2 upper level), <0 if KO
|
||||
*/
|
||||
public function getRootAccount($account = null)
|
||||
{
|
||||
|
||||
@ -329,6 +329,7 @@ class Lettering extends BookKeeping
|
||||
// Update request
|
||||
|
||||
$now = dol_now();
|
||||
$affected_rows = 0;
|
||||
|
||||
if (!$error) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
|
||||
@ -341,6 +342,8 @@ class Lettering extends BookKeeping
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
} else {
|
||||
$affected_rows = $this->db->affected_rows($resql);
|
||||
}
|
||||
}
|
||||
|
||||
@ -352,7 +355,7 @@ class Lettering extends BookKeeping
|
||||
}
|
||||
return -1 * $error;
|
||||
} else {
|
||||
return 1;
|
||||
return $affected_rows;
|
||||
}
|
||||
}
|
||||
|
||||
@ -387,7 +390,7 @@ class Lettering extends BookKeeping
|
||||
}
|
||||
return -1 * $error;
|
||||
} else {
|
||||
return 1;
|
||||
return $this->db->affected_rows($resql);
|
||||
}
|
||||
}
|
||||
|
||||
@ -482,7 +485,7 @@ class Lettering extends BookKeeping
|
||||
else $result = $this->updateLettering($bookkeeping_lines);
|
||||
if ($result < 0) {
|
||||
$group_error++;
|
||||
} else {
|
||||
} elseif ($result > 0) {
|
||||
$nb_lettering++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,29 +121,15 @@ 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,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql = "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,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " ppe.accountancy_code_sell as code_sell, ppe.accountancy_code_sell_intra as code_sell_intra, ppe.accountancy_code_sell_export as code_sell_export,";
|
||||
@ -207,37 +193,38 @@ if ($action == 'validatehistory') {
|
||||
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$thirdpartystatic->id = $objp->socid;
|
||||
$thirdpartystatic->name = $objp->name;
|
||||
$thirdpartystatic->client = $objp->client;
|
||||
$thirdpartystatic->fournisseur = $objp->fournisseur;
|
||||
$thirdpartystatic->code_client = $objp->code_client;
|
||||
$thirdpartystatic->code_compta_client = $objp->code_compta_client;
|
||||
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
|
||||
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
|
||||
$thirdpartystatic->email = $objp->email;
|
||||
$thirdpartystatic->country_code = $objp->country_code;
|
||||
$thirdpartystatic->tva_intra = $objp->tva_intra;
|
||||
$thirdpartystatic->code_compta_product = $objp->company_code_sell; // The accounting account for product stored on thirdparty object (for level3 suggestion)
|
||||
$thirdpartystatic->id = !empty($objp->socid) ? $objp->socid : 0;
|
||||
$thirdpartystatic->name = !empty($objp->name) ? $objp->name : "";
|
||||
$thirdpartystatic->client = !empty($objp->client) ? $objp->client : "";
|
||||
$thirdpartystatic->fournisseur = !empty($objp->fournisseur) ? $objp->fournisseur : "";
|
||||
$thirdpartystatic->code_client = !empty($objp->code_client) ? $objp->code_client : "";
|
||||
$thirdpartystatic->code_compta_client = !empty($objp->code_compta_client) ? $objp->code_compta_client : "";
|
||||
$thirdpartystatic->code_fournisseur = !empty($objp->code_fournisseur) ? $objp->code_fournisseur : "";
|
||||
$thirdpartystatic->code_compta_fournisseur = !empty($objp->code_compta_fournisseur) ? $objp->code_compta_fournisseur : "";
|
||||
$thirdpartystatic->email = !empty($objp->email) ? $objp->email : "";
|
||||
$thirdpartystatic->country_code = !empty($objp->country_code) ? $objp->country_code : "";
|
||||
$thirdpartystatic->tva_intra = !empty($objp->tva_intra) ? $objp->tva_intra : "";
|
||||
$thirdpartystatic->code_compta_product = !empty($objp->company_code_sell) ? $objp->company_code_sell : ""; // The accounting account for product stored on thirdparty object (for level3 suggestion)
|
||||
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
$product_static->type = $objp->type;
|
||||
$product_static->label = $objp->product_label;
|
||||
$product_static->status = $objp->status;
|
||||
$product_static->status_buy = $objp->status_buy;
|
||||
$product_static->status = !empty($objp->status) ? $objp->status : 0;
|
||||
$product_static->status_buy = !empty($objp->status_buy) ? $objp->status_buy : 0;
|
||||
$product_static->accountancy_code_sell = $objp->code_sell;
|
||||
$product_static->accountancy_code_sell_intra = $objp->code_sell_intra;
|
||||
$product_static->accountancy_code_sell_export = $objp->code_sell_export;
|
||||
$product_static->accountancy_code_buy = $objp->code_buy;
|
||||
$product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
|
||||
$product_static->accountancy_code_buy_export = $objp->code_buy_export;
|
||||
$product_static->accountancy_code_buy = !empty($objp->code_buy) ? $objp->code_buy : "";
|
||||
$product_static->accountancy_code_buy_intra = !empty($objp->code_buy_intra) ? $objp->code_buy_intra : "";
|
||||
$product_static->accountancy_code_buy_export = !empty($objp->code_buy_export) ? $objp->code_buy_export : "";
|
||||
$product_static->tva_tx = $objp->tva_tx_prod;
|
||||
|
||||
$facture_static->ref = $objp->ref;
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
$facture_static->date = $objp->datef;
|
||||
$facture_static->date = $db->jdate($objp->datef);
|
||||
$facture_static->fk_facture_source = $objp->fk_facture_source;
|
||||
|
||||
$facture_static_det->id = $objp->rowid;
|
||||
$facture_static_det->total_ht = $objp->total_ht;
|
||||
@ -280,12 +267,14 @@ if ($action == 'validatehistory') {
|
||||
if (!$resqlupdate) {
|
||||
$error++;
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
$nbbindfailed++;
|
||||
break;
|
||||
} else {
|
||||
$nbbinddone++;
|
||||
}
|
||||
} else {
|
||||
$notpossible++;
|
||||
$nbbindfailed++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
@ -299,7 +288,10 @@ if ($action == 'validatehistory') {
|
||||
$db->rollback();
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs');
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
|
||||
if ($nbbindfailed) {
|
||||
setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -320,10 +312,14 @@ print '<span class="opacitymedium">'.$langs->trans("DescVentilCustomer").'</span
|
||||
print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")).'<br>';
|
||||
print '</span><br>';
|
||||
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
print info_admin($langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices"));
|
||||
print "<br>";
|
||||
}
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.$langs->trans("ValidateHistory").'</a>';
|
||||
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.img_picto($langs->trans("ValidateHistory"), 'link', 'class="pictofixedwidth fa-color-unset"').$langs->trans("ValidateHistory").'</a>';
|
||||
|
||||
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, '');
|
||||
@ -394,6 +390,11 @@ if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
// TODO When INVOICE_USE_SITUATION = 1, values here are wrong. There is no compensation on bad stored amounts
|
||||
//$situation_ratio = 1;
|
||||
//if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
//}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
@ -404,7 +405,17 @@ if ($resql) {
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("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"));
|
||||
} else {
|
||||
print $row[1];
|
||||
}
|
||||
@ -419,6 +430,12 @@ 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>';
|
||||
@ -511,6 +528,11 @@ if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
// TODO When INVOICE_USE_SITUATION = 1, values here are wrong. There is no compensation on bad stored amounts
|
||||
//$situation_ratio = 1;
|
||||
//if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
//}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
@ -557,7 +579,7 @@ print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange. Why showing a report that should rely on result of this step ?
|
||||
if (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 ?
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
@ -622,7 +644,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
|
||||
if (isModEnabled('margin')) {
|
||||
print "<br>\n";
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
@ -636,22 +657,41 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
|
||||
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
|
||||
}
|
||||
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
|
||||
$sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j,
|
||||
" (".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))",
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").")",
|
||||
0).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))",
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").") as total";
|
||||
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
// With old situation invoice setup
|
||||
$sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j,
|
||||
" (".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent !
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").")",
|
||||
0).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent !
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").") as total";
|
||||
} else {
|
||||
$sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j,
|
||||
" (".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty)))",
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty))").")",
|
||||
0).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty)))",
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty))").") as total";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " WHERE f.datef >= '".$db->idate($search_date_start)."'";
|
||||
|
||||
@ -189,8 +189,8 @@ print '<script type="text/javascript">
|
||||
/*
|
||||
* Customer Invoice lines
|
||||
*/
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.type, f.datef, f.ref_client,";
|
||||
$sql .= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.type as ftype, f.situation_cycle_ref, f.datef, f.ref_client,";
|
||||
$sql .= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc, fd.situation_percent,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.code_client,";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " spe.accountancy_code_customer as code_compta_client,";
|
||||
@ -199,7 +199,7 @@ if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " s.code_compta as code_compta_client,";
|
||||
$sql .= " s.code_compta_fournisseur,";
|
||||
}
|
||||
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label,";
|
||||
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.tobuy, p.tosell,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,";
|
||||
} else {
|
||||
@ -502,8 +502,33 @@ if ($result) {
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="right nowraponall amount">'.price($objp->total_ht).'</td>';
|
||||
// Amount
|
||||
print '<td class="right nowraponall amount">';
|
||||
|
||||
// Create a compensation rate for old situation invoice feature.
|
||||
$situation_ratio = 1;
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
if ($objp->situation_cycle_ref) {
|
||||
// Avoid divide by 0
|
||||
if ($objp->situation_percent == 0) {
|
||||
$situation_ratio = 0;
|
||||
} else {
|
||||
$line = new FactureLigne($db);
|
||||
$line->fetch($objp->rowid);
|
||||
|
||||
// Situation invoices handling
|
||||
$prev_progress = $line->get_prev_progress($objp->facid);
|
||||
|
||||
$situation_ratio = ($objp->situation_percent - $prev_progress) / $objp->situation_percent;
|
||||
}
|
||||
}
|
||||
print price($objp->total_ht * $situation_ratio);
|
||||
} else {
|
||||
print price($objp->total_ht);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Vat rate
|
||||
print '<td class="right">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>';
|
||||
|
||||
// Thirdparty
|
||||
@ -529,6 +554,10 @@ if ($result) {
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
if ($num_lines == 0) {
|
||||
print '<tr><td colspan="12"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print "</div>";
|
||||
|
||||
|
||||
@ -43,10 +43,11 @@ $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other",
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancycustomerlist'; // To manage different context of search
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
$default_account = GETPOST('default_account', 'int');
|
||||
|
||||
// Select Box
|
||||
@ -73,8 +74,6 @@ $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_en
|
||||
$search_country = GETPOST('search_country', 'alpha');
|
||||
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||
|
||||
$btn_ventil = GETPOST('ventil', '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);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
@ -229,8 +228,8 @@ if (empty($chartaccountcode)) {
|
||||
}
|
||||
|
||||
// Customer Invoice lines
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.datef, f.type as ftype,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql = "SELECT f.rowid as facid, f.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.situation_percent, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " ppe.accountancy_code_sell as code_sell, ppe.accountancy_code_sell_intra as code_sell_intra, ppe.accountancy_code_sell_export as code_sell_export,";
|
||||
@ -496,7 +495,7 @@ if ($result) {
|
||||
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth125', 'code2', 1, 0, 1, null, 1);
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100', 'code2', 1, 0, 1);
|
||||
//print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
|
||||
@ -520,8 +519,8 @@ if ($result) {
|
||||
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall ');
|
||||
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center ');
|
||||
print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall ');
|
||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
|
||||
$checkpicto = '';
|
||||
if ($massactionbutton) {
|
||||
$checkpicto = $form->showCheckAddButtons('checkforselect', 1);
|
||||
@ -579,6 +578,7 @@ if ($result) {
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
$facture_static->date = $db->jdate($objp->datef);
|
||||
$facture_static->fk_facture_source = $objp->fk_facture_source;
|
||||
|
||||
$facture_static_det->id = $objp->rowid;
|
||||
$facture_static_det->total_ht = $objp->total_ht;
|
||||
@ -639,7 +639,7 @@ if ($result) {
|
||||
print '<td class="center">'.dol_print_date($facture_static->date, 'day').'</td>';
|
||||
|
||||
// Ref Product
|
||||
print '<td class="tdoverflowmax150">';
|
||||
print '<td class="tdoverflowmax100">';
|
||||
if ($product_static->id > 0) {
|
||||
print $product_static->getNomUrl(1);
|
||||
}
|
||||
@ -648,15 +648,37 @@ if ($result) {
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Description
|
||||
// Description of line
|
||||
print '<td class="tdoverflowonsmartphone small">';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facture_static_det->desc, 1));
|
||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $facture_static_det->desc);
|
||||
print '</td>';
|
||||
|
||||
// Amount
|
||||
print '<td class="right nowraponall amount">';
|
||||
print price($objp->total_ht);
|
||||
|
||||
// Create a compensation rate for old situation invoice feature.
|
||||
$situation_ratio = 1;
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
if ($objp->situation_cycle_ref) {
|
||||
// Avoid divide by 0
|
||||
if ($objp->situation_percent == 0) {
|
||||
$situation_ratio = 0;
|
||||
} else {
|
||||
$line = new FactureLigne($db);
|
||||
$line->fetch($objp->rowid);
|
||||
|
||||
// Situation invoices handling
|
||||
$prev_progress = $line->get_prev_progress($objp->facid);
|
||||
|
||||
$situation_ratio = ($objp->situation_percent - $prev_progress) / $objp->situation_percent;
|
||||
}
|
||||
}
|
||||
print price($objp->total_ht * $situation_ratio);
|
||||
} else {
|
||||
print price($objp->total_ht);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Vat rate
|
||||
@ -682,15 +704,22 @@ if ($result) {
|
||||
|
||||
// Found accounts
|
||||
print '<td class="small">';
|
||||
// First show default account for any products
|
||||
$s = '1. '.(($facture_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
|
||||
$shelp = '';
|
||||
$shelp = ''; $ttype = 'help';
|
||||
if ($suggestedaccountingaccountbydefaultfor == 'eec') {
|
||||
$shelp .= $langs->trans("SaleEEC");
|
||||
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') {
|
||||
$shelp = $langs->trans("SaleEECWithVAT");
|
||||
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithoutvatnumber') {
|
||||
$shelp = $langs->trans("SaleEECWithoutVATNumber");
|
||||
$ttype = 'warning';
|
||||
} elseif ($suggestedaccountingaccountbydefaultfor == 'export') {
|
||||
$shelp .= $langs->trans("SaleExport");
|
||||
}
|
||||
$s .= ($code_sell_l > 0 ? length_accountg($code_sell_l) : '<span style="'.$code_sell_p_notset.'">'.$langs->trans("NotDefined").'</span>');
|
||||
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
|
||||
print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
|
||||
// Now show account for product
|
||||
if ($product_static->id > 0) {
|
||||
print '<br>';
|
||||
$s = '2. '.(($facture_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
|
||||
@ -748,6 +777,10 @@ if ($result) {
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
if ($num_lines == 0) {
|
||||
print '<tr><td colspan="13"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print "</div>";
|
||||
|
||||
|
||||
@ -58,6 +58,8 @@ $year_current = $year_start;
|
||||
// Validate History
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
@ -65,7 +67,7 @@ if (!isModEnabled('accounting')) {
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -74,7 +76,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accounting->bind->write) {
|
||||
if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('accounting', 'bind', 'write')) {
|
||||
// Clean database
|
||||
$db->begin();
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det as erd";
|
||||
@ -101,6 +103,7 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
|
||||
if ($action == 'validatehistory') {
|
||||
$error = 0;
|
||||
$nbbinddone = 0;
|
||||
$nbbindfailed = 0;
|
||||
$notpossible = 0;
|
||||
|
||||
$db->begin();
|
||||
@ -109,8 +112,7 @@ if ($action == 'validatehistory') {
|
||||
$sql1 = "SELECT erd.rowid, accnt.rowid as suggestedid";
|
||||
$sql1 .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
|
||||
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as t ON erd.fk_c_type_fees = t.id";
|
||||
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as accnt ON t.accountancy_code = accnt.account_number AND accnt.active = 1 AND accnt.entity =".((int) $conf->entity);
|
||||
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as syst ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND syst.active = 1,';
|
||||
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as accnt ON t.accountancy_code = accnt.account_number AND accnt.active = 1 AND accnt.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND accnt.entity =".((int) $conf->entity).",";
|
||||
$sql1 .= " ".MAIN_DB_PREFIX."expensereport as er";
|
||||
$sql1 .= " WHERE erd.fk_expensereport = er.rowid AND er.entity = ".((int) $conf->entity);
|
||||
$sql1 .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0";
|
||||
@ -143,12 +145,14 @@ if ($action == 'validatehistory') {
|
||||
if (!$resqlupdate) {
|
||||
$error++;
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
$nbbindfailed++;
|
||||
break;
|
||||
} else {
|
||||
$nbbinddone++;
|
||||
}
|
||||
} else {
|
||||
$notpossible++;
|
||||
$nbbindfailed++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
@ -162,7 +166,10 @@ if ($action == 'validatehistory') {
|
||||
$db->rollback();
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs');
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
|
||||
if ($nbbindfailed) {
|
||||
setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -176,6 +183,7 @@ llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
||||
$textprevyear = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current - 1).'">'.img_previous().'</a>';
|
||||
$textnextyear = ' <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>';
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("ExpenseReportsVentilation")." ".$textprevyear." ".$langs->trans("Year")." ".$year_start." ".$textnextyear, '', 'title_accountancy');
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("DescVentilExpenseReport").'</span><br>';
|
||||
@ -185,7 +193,7 @@ print '</span><br>';
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'&year='.$year_current.'">'.$langs->trans("ValidateHistory").'</a>';
|
||||
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'&year='.$year_current.'">'.img_picto('', 'link', 'class="paddingright fa-color-unset"').$langs->trans("ValidateHistory").'</a>';
|
||||
|
||||
|
||||
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
|
||||
@ -247,7 +255,7 @@ $sql .= " AND aa.account_number IS NULL";
|
||||
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
$sql .= ' ORDER BY aa.account_number';
|
||||
|
||||
dol_syslog('/accountancy/expensereport/index.php:: sql='.$sql);
|
||||
dol_syslog('/accountancy/expensereport/index.php', LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
@ -263,20 +271,49 @@ if ($resql) {
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("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/expensereport/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"));
|
||||
} else {
|
||||
print $row[1];
|
||||
}
|
||||
print '</td>';
|
||||
for ($i = 2; $i <= 13; $i++) {
|
||||
$cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2);
|
||||
if ($cursormonth > 12) {
|
||||
$cursormonth -= 12;
|
||||
}
|
||||
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
|
||||
|
||||
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>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
if ($num == 0) {
|
||||
print '<tr class="oddeven"><td colspan="16">';
|
||||
print '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
@ -359,6 +396,12 @@ if ($resql) {
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
if ($num == 0) {
|
||||
print '<tr class="oddeven"><td colspan="16">';
|
||||
print '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
@ -367,7 +410,7 @@ print '</div>';
|
||||
|
||||
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange. Why showing a report where results depends on next step (so not yet available) ?
|
||||
if (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 ?
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
@ -427,6 +427,13 @@ if ($result) {
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
if ($num_lines == 0) {
|
||||
$colspan=10;
|
||||
if (!empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
|
||||
$colspan++;
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
|
||||
@ -40,10 +40,9 @@ $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other",
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'expensereportlist'; // To manage different context of search
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancyexpensereportlist'; // To manage different context of search
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
|
||||
@ -160,7 +159,6 @@ if (empty($reshook)) {
|
||||
if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
$msg = '';
|
||||
|
||||
//print '<div><span style="color:red">' . $langs->trans("Processing") . '...</span></div>';
|
||||
if (!empty($mesCasesCochees)) {
|
||||
$msg = '<div>'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'</div>';
|
||||
$msg .= '<div class="detail">';
|
||||
@ -174,7 +172,7 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
$monCompte = GETPOST('codeventil'.$monId);
|
||||
|
||||
if ($monCompte <= 0) {
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</span></div>';
|
||||
$msg .= '<div><span class="error">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</span></div>';
|
||||
$ko++;
|
||||
} else {
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."expensereport_det";
|
||||
@ -186,10 +184,10 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
|
||||
dol_syslog('accountancy/expensereport/list.php:: sql='.$sql, LOG_DEBUG);
|
||||
if ($db->query($sql)) {
|
||||
$msg .= '<div><span style="color:green">'.$langs->trans("LineOfExpenseReport").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
|
||||
$msg .= '<div><span class="green">'.$langs->trans("LineOfExpenseReport").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
|
||||
$ok++;
|
||||
} else {
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br> <pre>'.$sql.'</pre></span></div>';
|
||||
$msg .= '<div><span class="error">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br> <pre>'.$sql.'</pre></span></div>';
|
||||
$ko++;
|
||||
}
|
||||
}
|
||||
@ -419,8 +417,8 @@ if ($result) {
|
||||
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 ');
|
||||
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall ');
|
||||
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', '');
|
||||
print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall ');
|
||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', '');
|
||||
$checkpicto = '';
|
||||
if ($massactionbutton) {
|
||||
$checkpicto = $form->showCheckAddButtons('checkforselect', 1);
|
||||
@ -443,7 +441,6 @@ if ($result) {
|
||||
$expensereport_static->id = $objp->erid;
|
||||
|
||||
$userstatic->id = $objp->userid;
|
||||
$userstatic->ref = $objp->label;
|
||||
$userstatic->login = $objp->login;
|
||||
$userstatic->statut = $objp->statut;
|
||||
$userstatic->email = $objp->email;
|
||||
@ -513,6 +510,9 @@ if ($result) {
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
if ($num_lines == 0) {
|
||||
print '<tr><td colspan="13"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print "</div>";
|
||||
|
||||
@ -83,12 +83,7 @@ $help_url = 'EN:Module_Double_Entry_Accounting#Setup';
|
||||
|
||||
llxHeader('', $langs->trans("AccountancyArea"), $help_url);
|
||||
|
||||
if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_SITUATION == 1) {
|
||||
print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices")."</span>\n";
|
||||
print "<br>";
|
||||
} elseif (isModEnabled('accounting')) {
|
||||
if (isModEnabled('accounting')) {
|
||||
$step = 0;
|
||||
|
||||
$resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
|
||||
@ -113,15 +108,18 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
|
||||
</script>';
|
||||
}
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial);
|
||||
|
||||
if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_SITUATION == 1) {
|
||||
print info_admin($langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices"));
|
||||
print "<br>";
|
||||
}
|
||||
|
||||
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
|
||||
print "<br>\n";
|
||||
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
|
||||
if ($user->hasRight('accounting', 'chartofaccount')) {
|
||||
print "<br>\n"; print "<br>\n";
|
||||
|
||||
print '<br>';
|
||||
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
|
||||
print '<hr>';
|
||||
print "<br>\n";
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2022 Open-DSI <support@open-dsi.fr>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2017-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
@ -349,7 +349,11 @@ if ($result) {
|
||||
$societestatic->email = $tabcompany[$obj->rowid]['email'];
|
||||
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
|
||||
if ($compta_soc) {
|
||||
$tabtp[$obj->rowid][$compta_soc] += $amounttouse;
|
||||
if (empty($tabtp[$obj->rowid][$compta_soc])) {
|
||||
$tabtp[$obj->rowid][$compta_soc] = $amounttouse;
|
||||
} else {
|
||||
$tabtp[$obj->rowid][$compta_soc] += $amounttouse;
|
||||
}
|
||||
}
|
||||
} elseif ($links[$key]['type'] == 'user') {
|
||||
$userstatic->id = $links[$key]['url_id'];
|
||||
@ -430,7 +434,7 @@ if ($result) {
|
||||
$tabpay[$obj->rowid]["paymentsalid"] = $paymentsalstatic->id;
|
||||
|
||||
// This part of code is no more required. it is here to solve case where a link were missing (ith v14.0.0) and keep writing in accountancy complete.
|
||||
// Note: A better way to fix this is to delete payement of salary and recreate it, or to fix the bookkeeping table manually after.
|
||||
// Note: A better way to fix this is to delete payment of salary and recreate it, or to fix the bookkeeping table manually after.
|
||||
if (!empty($conf->global->ACCOUNTANCY_AUTOFIX_MISSING_LINK_TO_USEr_ON_SALARY_BANK_PAYMENT)) {
|
||||
$tmpsalary = new Salary($db);
|
||||
$tmpsalary->fetch($paymentsalstatic->id);
|
||||
@ -510,7 +514,11 @@ if ($result) {
|
||||
}
|
||||
}
|
||||
|
||||
$tabbq[$obj->rowid][$compta_bank] += $amounttouse;
|
||||
if (empty($tabbq[$obj->rowid][$compta_bank])) {
|
||||
$tabbq[$obj->rowid][$compta_bank] = $amounttouse;
|
||||
} else {
|
||||
$tabbq[$obj->rowid][$compta_bank] += $amounttouse;
|
||||
}
|
||||
|
||||
// If no links were found to know the amount on thirdparty, we try to guess it.
|
||||
// This may happens on bank entries without the links lines to 'company'.
|
||||
@ -793,10 +801,16 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
if ($lettering && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
|
||||
if ($lettering && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
$lettering_static = new Lettering($db);
|
||||
$nb_lettering = $lettering_static->bookkeepingLetteringAll(array($bookkeeping->id));
|
||||
|
||||
if ($nb_lettering < 0) {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($lettering_static->error, $lettering_static->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -912,8 +926,8 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
print '"'.$langs->transnoentitiesnoconv("LedgerAccount").'"'.$sep;
|
||||
print '"'.$langs->transnoentitiesnoconv("SubledgerAccount").'"'.$sep;
|
||||
print '"'.$langs->transnoentitiesnoconv("Label").'"'.$sep;
|
||||
print '"'.$langs->transnoentitiesnoconv("Debit").'"'.$sep;
|
||||
print '"'.$langs->transnoentitiesnoconv("Credit").'"'.$sep;
|
||||
print '"'.$langs->transnoentitiesnoconv("AccountingDebit").'"'.$sep;
|
||||
print '"'.$langs->transnoentitiesnoconv("AccountingCredit").'"'.$sep;
|
||||
print '"'.$langs->transnoentitiesnoconv("Journal").'"'.$sep;
|
||||
print '"'.$langs->transnoentitiesnoconv("Note").'"'.$sep;
|
||||
print "\n";
|
||||
@ -1034,7 +1048,7 @@ if (empty($action) || $action == 'view') {
|
||||
|
||||
$title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1);
|
||||
|
||||
llxHeader('', $title);
|
||||
llxHeader('', dol_string_nohtmltag($title));
|
||||
|
||||
$nom = $title;
|
||||
$builddate = dol_now();
|
||||
@ -1136,8 +1150,8 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td>".$langs->trans("SubledgerAccount")."</td>";
|
||||
print "<td>".$langs->trans("LabelOperation")."</td>";
|
||||
print '<td class="center">'.$langs->trans("PaymentMode")."</td>";
|
||||
print '<td class="right">'.$langs->trans("Debit")."</td>";
|
||||
print '<td class="right">'.$langs->trans("Credit")."</td>";
|
||||
print '<td class="right">'.$langs->trans("AccountingDebit")."</td>";
|
||||
print '<td class="right">'.$langs->trans("AccountingCredit")."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$r = '';
|
||||
@ -1162,19 +1176,24 @@ if (empty($action) || $action == 'view') {
|
||||
//var_dump($tabpay[$key]);
|
||||
print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Date
|
||||
print "<td>".$date."</td>";
|
||||
print "<td>".$ref."</td>";
|
||||
|
||||
// Ref
|
||||
print "<td>".dol_escape_htmltag($ref)."</td>";
|
||||
|
||||
// Ledger account
|
||||
print "<td>";
|
||||
$accounttoshow = length_accountg($k);
|
||||
if (empty($accounttoshow) || $accounttoshow == 'NotDefined') {
|
||||
print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
|
||||
} else {
|
||||
print $accounttoshow;
|
||||
$accounttoshow = '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
|
||||
}
|
||||
print '<td class="maxwidth300" title="'.dol_escape_htmltag(dol_string_nohtmltag($accounttoshow)).'">';
|
||||
print $accounttoshow;
|
||||
print "</td>";
|
||||
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '<td class="maxwidth300">';
|
||||
/*$accounttoshow = length_accountg($k);
|
||||
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
|
||||
{
|
||||
@ -1182,9 +1201,12 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
else print $accounttoshow;*/
|
||||
print "</td>";
|
||||
print "<td>";
|
||||
print $reflabel;
|
||||
|
||||
// Label operation
|
||||
print '<td>';
|
||||
print $reflabel; // This is already html escaped content
|
||||
print "</td>";
|
||||
|
||||
print '<td class="center">'.$val["type_payment"]."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
@ -1208,29 +1230,33 @@ if (empty($action) || $action == 'view') {
|
||||
|
||||
print '<!-- Thirdparty bank.rowid='.$key.' -->';
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Date
|
||||
print "<td>".$date."</td>";
|
||||
print "<td>".$ref."</td>";
|
||||
|
||||
// Ref
|
||||
print "<td>".dol_escape_htmltag($ref)."</td>";
|
||||
|
||||
// Ledger account
|
||||
print "<td>";
|
||||
$account_ledger = $k;
|
||||
// Try to force general ledger account depending on type
|
||||
if ($tabtype[$key] == 'payment') {
|
||||
$account_ledger = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||
$account_ledger = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER');
|
||||
}
|
||||
if ($tabtype[$key] == 'payment_supplier') {
|
||||
$account_ledger = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||
$account_ledger = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER');
|
||||
}
|
||||
if ($tabtype[$key] == 'payment_expensereport') {
|
||||
$account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
$account_ledger = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT');
|
||||
}
|
||||
if ($tabtype[$key] == 'payment_salary') {
|
||||
$account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
$account_ledger = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT');
|
||||
}
|
||||
if ($tabtype[$key] == 'payment_vat') {
|
||||
$account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT;
|
||||
$account_ledger = getDolGlobalString('ACCOUNTING_VAT_PAY_ACCOUNT');
|
||||
}
|
||||
if ($tabtype[$key] == 'member') {
|
||||
$account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT;
|
||||
$account_ledger = getDolGlobalString('ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT');
|
||||
}
|
||||
if ($tabtype[$key] == 'payment_various') {
|
||||
$account_ledger = $tabpay[$key]["account_various"];
|
||||
@ -1240,9 +1266,9 @@ if (empty($action) || $action == 'view') {
|
||||
if ($tabtype[$key] == 'unknown') {
|
||||
// We will accept writing, but into a waiting account
|
||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) || $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE == '-1') {
|
||||
print '<span class="error small">'.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').'</span>';
|
||||
$accounttoshow = '<span class="error small">'.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').'</span>';
|
||||
} else {
|
||||
print '<span class="warning small">'.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).'</span>'; // We will use a waiting account
|
||||
$accounttoshow = '<span class="warning small">'.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).'</span>'; // We will use a waiting account
|
||||
}
|
||||
} else {
|
||||
// We will refuse writing
|
||||
@ -1265,15 +1291,15 @@ if (empty($action) || $action == 'view') {
|
||||
if ($tabtype[$key] == 'member') {
|
||||
$errorstring = 'MainAccountForSubscriptionPaymentNotDefined';
|
||||
}
|
||||
print '<span class="error small">'.$langs->trans($errorstring).'</span>';
|
||||
$accounttoshow = '<span class="error small">'.$langs->trans($errorstring).'</span>';
|
||||
}
|
||||
} else {
|
||||
print $accounttoshow;
|
||||
}
|
||||
print '<td class="maxwidth300" title="'.dol_escape_htmltag(dol_string_nohtmltag($accounttoshow)).'">';
|
||||
print $accounttoshow; // This is a HTML string
|
||||
print "</td>";
|
||||
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
$accounttoshowsubledger = '';
|
||||
if (in_array($tabtype[$key], array('payment', 'payment_supplier', 'payment_expensereport', 'payment_salary', 'payment_various'))) { // Type of payments that uses a subledger
|
||||
$accounttoshowsubledger = length_accounta($k);
|
||||
if ($accounttoshow != $accounttoshowsubledger) {
|
||||
@ -1285,18 +1311,20 @@ if (empty($action) || $action == 'view') {
|
||||
if (!empty($tabcompany[$key]['code_compta'])) {
|
||||
if (in_array($tabtype[$key], array('payment_various', 'payment_salary'))) {
|
||||
// For such case, if subledger is not defined, we won't use subledger accounts.
|
||||
print '<span class="warning small">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").'</span>';
|
||||
$accounttoshowsubledger = '<span class="warning small">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").'</span>';
|
||||
} else {
|
||||
print '<span class="warning small">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).'</span>';
|
||||
$accounttoshowsubledger = '<span class="warning small">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).'</span>';
|
||||
}
|
||||
} else {
|
||||
print '<span class="error small">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").'</span>';
|
||||
$accounttoshowsubledger = '<span class="error small">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").'</span>';
|
||||
}
|
||||
} else {
|
||||
print $accounttoshowsubledger;
|
||||
}
|
||||
} else {
|
||||
$accounttoshowsubledger = '';
|
||||
}
|
||||
}
|
||||
print '<td class="maxwidth300">';
|
||||
print $accounttoshowsubledger; // This is a html string
|
||||
print "</td>";
|
||||
|
||||
print "<td>".$reflabel."</td>";
|
||||
@ -1401,9 +1429,19 @@ function getSourceDocRef($val, $typerecord)
|
||||
|
||||
$sqlmid = '';
|
||||
if ($typerecord == 'payment') {
|
||||
$sqlmid = 'SELECT payfac.fk_facture as id, f.ref as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f";
|
||||
$sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=".((int) $val["paymentid"]);
|
||||
if (getDolGlobalInt('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) {
|
||||
$sqlmid = "SELECT payfac.fk_facture as id, ".$db->ifsql('f1.rowid IS NULL', 'f.ref', 'f1.ref')." as ref";
|
||||
$sqlmid .= " FROM ".$db->prefix()."paiement_facture as payfac";
|
||||
$sqlmid .= " LEFT JOIN ".$db->prefix()."facture as f ON f.rowid = payfac.fk_facture";
|
||||
$sqlmid .= " LEFT JOIN ".$db->prefix()."societe_remise_except as sre ON sre.fk_facture_source = payfac.fk_facture";
|
||||
$sqlmid .= " LEFT JOIN ".$db->prefix()."facture as f1 ON f1.rowid = sre.fk_facture";
|
||||
$sqlmid .= " WHERE payfac.fk_paiement=".((int) $val['paymentid']);
|
||||
} else {
|
||||
$sqlmid = "SELECT payfac.fk_facture as id, f.ref as ref";
|
||||
$sqlmid .= " FROM ".$db->prefix()."paiement_facture as payfac";
|
||||
$sqlmid .= " INNER JOIN ".$db->prefix()."facture as f ON f.rowid = payfac.fk_facture";
|
||||
$sqlmid .= " WHERE payfac.fk_paiement=".((int) $val['paymentid']);
|
||||
}
|
||||
$ref = $langs->transnoentitiesnoconv("Invoice");
|
||||
} elseif ($typerecord == 'payment_supplier') {
|
||||
$sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref';
|
||||
|
||||
@ -445,8 +445,8 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
print '"'.$langs->transnoentitiesnoconv("Piece").'"'.$sep;
|
||||
print '"'.$langs->transnoentitiesnoconv("AccountAccounting").'"'.$sep;
|
||||
print '"'.$langs->transnoentitiesnoconv("LabelOperation").'"'.$sep;
|
||||
print '"'.$langs->transnoentitiesnoconv("Debit").'"'.$sep;
|
||||
print '"'.$langs->transnoentitiesnoconv("Credit").'"'.$sep;
|
||||
print '"'.$langs->transnoentitiesnoconv("AccountingDebit").'"'.$sep;
|
||||
print '"'.$langs->transnoentitiesnoconv("AccountingCredit").'"'.$sep;
|
||||
print "\n";
|
||||
|
||||
foreach ($taber as $key => $val) {
|
||||
@ -498,7 +498,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
if (empty($action) || $action == 'view') {
|
||||
$title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1);
|
||||
|
||||
llxHeader('', $title);
|
||||
llxHeader('', dol_string_nohtmltag($title));
|
||||
|
||||
$nom = $title;
|
||||
$nomlink = '';
|
||||
@ -569,8 +569,8 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td>".$langs->trans("AccountAccounting")."</td>";
|
||||
print "<td>".$langs->trans("SubledgerAccount")."</td>";
|
||||
print "<td>".$langs->trans("LabelOperation")."</td>";
|
||||
print '<td class="right">'.$langs->trans("Debit")."</td>";
|
||||
print '<td class="right">'.$langs->trans("Credit")."</td>";
|
||||
print '<td class="right">'.$langs->trans("AccountingDebit")."</td>";
|
||||
print '<td class="right">'.$langs->trans("AccountingCredit")."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$r = '';
|
||||
|
||||
@ -104,7 +104,7 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
|
||||
}
|
||||
|
||||
$sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlr, f.close_code,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code, fd.info_bits,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur,";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " spe.accountancy_code_customer as code_compta,";
|
||||
@ -200,8 +200,8 @@ if ($result) {
|
||||
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '')] = (vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''));
|
||||
}
|
||||
|
||||
$line = new SupplierInvoiceLine($db);
|
||||
$line->fetch($obj->fdid);
|
||||
//$line = new SupplierInvoiceLine($db);
|
||||
//$line->fetch($obj->fdid);
|
||||
|
||||
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
|
||||
$tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr);
|
||||
@ -233,7 +233,8 @@ if ($result) {
|
||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||
if (!empty($line->tva_npr)) { // Add an entry for counterpart
|
||||
$tva_npr = (($obj->info_bits & 1 == 1) ? 1 : 0);
|
||||
if ($tva_npr) { // If NPR, we add an entry for counterpartWe into tabother
|
||||
$tabother[$obj->rowid][$compta_counterpart_tva_npr] += $obj->total_tva;
|
||||
}
|
||||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
|
||||
@ -376,10 +377,16 @@ if ($action == 'writebookkeeping') {
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
|
||||
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
$lettering_static = new Lettering($db);
|
||||
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
|
||||
|
||||
if ($nb_lettering < 0) {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($lettering_static->error, $lettering_static->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -758,7 +765,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
if (empty($action) || $action == 'view') {
|
||||
$title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1);
|
||||
|
||||
llxHeader('', $title);
|
||||
llxHeader('', dol_string_nohtmltag($title));
|
||||
|
||||
$nom = $title;
|
||||
$nomlink = '';
|
||||
@ -824,7 +831,6 @@ if (empty($action) || $action == 'view') {
|
||||
*/
|
||||
print '<br>';
|
||||
|
||||
$i = 0;
|
||||
print '<div class="div-table-responsive">';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
@ -833,11 +839,11 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td>".$langs->trans("AccountAccounting")."</td>";
|
||||
print "<td>".$langs->trans("SubledgerAccount")."</td>";
|
||||
print "<td>".$langs->trans("LabelOperation")."</td>";
|
||||
print '<td class="center">'.$langs->trans("Debit")."</td>";
|
||||
print '<td class="center">'.$langs->trans("Credit")."</td>";
|
||||
print '<td class="center">'.$langs->trans("AccountingDebit")."</td>";
|
||||
print '<td class="center">'.$langs->trans("AccountingCredit")."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$r = '';
|
||||
$i = 0;
|
||||
|
||||
$invoicestatic = new FactureFournisseur($db);
|
||||
$companystatic = new Fournisseur($db);
|
||||
@ -887,6 +893,7 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right"></td>';
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
if ($errorforinvoice[$key] == 'somelinesarenotbound') {
|
||||
@ -906,6 +913,8 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right"></td>';
|
||||
print '<td class="right"></td>';
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Third party
|
||||
@ -936,6 +945,8 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Product / Service
|
||||
@ -972,6 +983,8 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// VAT
|
||||
@ -1009,6 +1022,8 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1037,11 +1052,17 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$i) {
|
||||
print '<tr class="oddeven"><td colspan="7"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
@ -106,8 +106,8 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
|
||||
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
||||
}
|
||||
|
||||
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
|
||||
$sql = "SELECT f.rowid, f.ref, f.type, f.situation_cycle_ref, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code, f.retained_warranty,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code, fd.info_bits,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur,";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " spe.accountancy_code_customer as code_compta,";
|
||||
@ -158,7 +158,7 @@ if ($in_bookkeeping == 'notyet') {
|
||||
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
|
||||
// $sql .= " AND fd.rowid NOT IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account
|
||||
}
|
||||
$sql .= " ORDER BY f.datef";
|
||||
$sql .= " ORDER BY f.datef, f.ref";
|
||||
//print $sql; exit;
|
||||
|
||||
dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG);
|
||||
@ -168,6 +168,7 @@ if ($result) {
|
||||
$tabht = array();
|
||||
$tabtva = array();
|
||||
$def_tva = array();
|
||||
$tabwarranty = array();
|
||||
$tabttc = array();
|
||||
$tablocaltax1 = array();
|
||||
$tablocaltax2 = array();
|
||||
@ -205,21 +206,23 @@ if ($result) {
|
||||
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '')] = (vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''));
|
||||
}
|
||||
|
||||
$line = new FactureLigne($db);
|
||||
$line->fetch($obj->fdid);
|
||||
// Create a compensation rate.
|
||||
$situation_ratio = 1;
|
||||
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
|
||||
if ($obj->situation_cycle_ref) {
|
||||
// Avoid divide by 0
|
||||
if ($obj->situation_percent == 0) {
|
||||
$situation_ratio = 0;
|
||||
} else {
|
||||
$line = new FactureLigne($db);
|
||||
$line->fetch($obj->fdid);
|
||||
|
||||
// Situation invoices handling
|
||||
$prev_progress = $line->get_prev_progress($obj->rowid);
|
||||
// Situation invoices handling
|
||||
$prev_progress = $line->get_prev_progress($obj->rowid);
|
||||
|
||||
if ($obj->type == Facture::TYPE_SITUATION) {
|
||||
// Avoid divide by 0
|
||||
if ($obj->situation_percent == 0) {
|
||||
$situation_ratio = 0;
|
||||
} else {
|
||||
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
|
||||
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$situation_ratio = 1;
|
||||
}
|
||||
|
||||
// Invoice lines
|
||||
@ -248,13 +251,27 @@ if ($result) {
|
||||
$tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
|
||||
}
|
||||
|
||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc * $situation_ratio;
|
||||
// Compensation of data for invoice situation by using $situation_ratio. This works (nearly) for invoice that was not correctly recorded
|
||||
// but it may introduces an error for situation invoices that were correctly saved. There is still rounding problem that differs between
|
||||
// real data we should have stored and result obtained with a compensation.
|
||||
// It also seems that credit notes on situation invoices are correctly saved (but it depends on the version used in fact).
|
||||
// For credit notes, we hope to have situation_ratio = 1 so the compensation has no effect to avoid introducing troubles with credit notes.
|
||||
$total_ttc = $obj->total_ttc * $situation_ratio;
|
||||
if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY) && $obj->retained_warranty > 0) {
|
||||
$retained_warranty = (double) price2num($total_ttc * $obj->retained_warranty / 100, 'MT');
|
||||
$tabwarranty[$obj->rowid][$compta_soc] += $retained_warranty;
|
||||
$total_ttc -= $retained_warranty;
|
||||
}
|
||||
$tabttc[$obj->rowid][$compta_soc] += $total_ttc;
|
||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
|
||||
if (empty($line->tva_npr)) {
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio; // We ignore line if VAT is a NPR
|
||||
$tva_npr = (($obj->info_bits & 1 == 1) ? 1 : 0);
|
||||
if (!$tva_npr) { // We ignore line if VAT is a NPR
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio;
|
||||
}
|
||||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1 * $situation_ratio;
|
||||
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2 * $situation_ratio;
|
||||
|
||||
|
||||
$tabcompany[$obj->rowid] = array(
|
||||
'id' => $obj->socid,
|
||||
'name' => $obj->name,
|
||||
@ -300,6 +317,10 @@ if ($action == 'writebookkeeping') {
|
||||
|
||||
$accountingaccountcustomer->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
|
||||
|
||||
$accountingaccountcustomerwarranty = new AccountingAccount($db);
|
||||
|
||||
$accountingaccountcustomerwarranty->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY, true);
|
||||
|
||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||
$errorforline = 0;
|
||||
|
||||
@ -344,6 +365,55 @@ if ($action == 'writebookkeeping') {
|
||||
setEventMessages($langs->trans('ErrorInvoiceContainsLinesNotYetBounded', $val['ref']), null, 'errors');
|
||||
}
|
||||
|
||||
// Warranty
|
||||
if (!$errorforline) {
|
||||
foreach ($tabwarranty[$key] as $k => $mt) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->date_creation = $now;
|
||||
$bookkeeping->doc_type = 'customer_invoice';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY;
|
||||
$bookkeeping->label_compte = $accountingaccountcustomerwarranty->label;
|
||||
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("Retainedwarranty");
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
|
||||
$bookkeeping->credit = ($mt < 0) ? -$mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $langs->transnoentities($journal_label);
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
$bookkeeping->entity = $conf->entity;
|
||||
|
||||
$totaldebit += $bookkeeping->debit;
|
||||
$totalcredit += $bookkeeping->credit;
|
||||
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { // Already exists
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'alreadyjournalized';
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
} else {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'other';
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Thirdparty
|
||||
if (!$errorforline) {
|
||||
foreach ($tabttc[$key] as $k => $mt) {
|
||||
@ -390,10 +460,18 @@ if ($action == 'writebookkeeping') {
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
|
||||
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
$lettering_static = new Lettering($db);
|
||||
|
||||
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
|
||||
|
||||
if ($nb_lettering < 0) {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'other';
|
||||
setEventMessages($lettering_static->error, $lettering_static->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -598,7 +676,8 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
foreach ($tabfac as $key => $val) {
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
|
||||
$companystatic->code_compta = $tabcompany[$key]['code_compta']; // deprecated
|
||||
$companystatic->code_compta_client = $tabcompany[$key]['code_compta'];
|
||||
$companystatic->code_client = $tabcompany[$key]['code_client'];
|
||||
$companystatic->client = 3;
|
||||
|
||||
@ -624,6 +703,25 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
continue;
|
||||
}
|
||||
|
||||
// Warranty
|
||||
foreach ($tabwarranty[$key] as $k => $mt) {
|
||||
//if ($mt) {
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["ref"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("Retainedwarranty").'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
//}
|
||||
}
|
||||
|
||||
// Third party
|
||||
foreach ($tabttc[$key] as $k => $mt) {
|
||||
//if ($mt) {
|
||||
@ -701,7 +799,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
if (empty($action) || $action == 'view') {
|
||||
$title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1);
|
||||
|
||||
llxHeader('', $title);
|
||||
llxHeader('', dol_string_nohtmltag($title));
|
||||
|
||||
$nom = $title;
|
||||
$nomlink = '';
|
||||
@ -767,7 +865,6 @@ if (empty($action) || $action == 'view') {
|
||||
*/
|
||||
print '<br>';
|
||||
|
||||
$i = 0;
|
||||
print '<div class="div-table-responsive">';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
@ -776,11 +873,11 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td>".$langs->trans("AccountAccounting")."</td>";
|
||||
print "<td>".$langs->trans("SubledgerAccount")."</td>";
|
||||
print "<td>".$langs->trans("LabelOperation")."</td>";
|
||||
print '<td class="center">'.$langs->trans("Debit")."</td>";
|
||||
print '<td class="center">'.$langs->trans("Credit")."</td>";
|
||||
print '<td class="center">'.$langs->trans("AccountingDebit")."</td>";
|
||||
print '<td class="center">'.$langs->trans("AccountingCredit")."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$r = '';
|
||||
$i = 0;
|
||||
|
||||
$companystatic = new Client($db);
|
||||
$invoicestatic = new Facture($db);
|
||||
@ -828,6 +925,7 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right"></td>';
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
if ($errorforinvoice[$key] == 'somelinesarenotbound') {
|
||||
@ -847,6 +945,38 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right"></td>';
|
||||
print '<td class="right"></td>';
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Warranty
|
||||
foreach ($tabwarranty[$key] as $k => $mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<!-- Thirdparty warranty -->";
|
||||
print "<td>".$date."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY);
|
||||
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
|
||||
} else {
|
||||
print $accountoshow;
|
||||
}
|
||||
print '</td>';
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
$accountoshow = length_accounta($k);
|
||||
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||
} else {
|
||||
print $accountoshow;
|
||||
}
|
||||
print '</td>';
|
||||
print "<td>".$companystatic->getNomUrl(0, 'customer', 16).' - '.$invoicestatic->ref.' - '.$langs->trans("Retainedwarranty")."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
// Third party
|
||||
@ -877,6 +1007,8 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Product / Service
|
||||
@ -913,6 +1045,8 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// VAT
|
||||
@ -949,11 +1083,17 @@ if (empty($action) || $action == 'view') {
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$i) {
|
||||
print '<tr class="oddeven"><td colspan="6"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -187,7 +187,7 @@ if ($object->nature == 2) {
|
||||
|
||||
$title = $langs->trans("GenerationOfAccountingEntries") . ' - ' . $object->getNomUrl(0, 2, 1, '', 1);
|
||||
|
||||
llxHeader('', $title);
|
||||
llxHeader('', dol_string_nohtmltag($title));
|
||||
|
||||
$nom = $title;
|
||||
$nomlink = '';
|
||||
@ -286,8 +286,8 @@ print '<td>' . $langs->trans("AccountAccounting") . '</td>';
|
||||
print '<td>' . $langs->trans("SubledgerAccount") . '</td>';
|
||||
print '<td>' . $langs->trans("LabelOperation") . '</td>';
|
||||
if ($object->nature == 4) print '<td class="center">' . $langs->trans("PaymentMode") . '</td>'; // bank
|
||||
print '<td class="right">' . $langs->trans("Debit") . '</td>';
|
||||
print '<td class="right">' . $langs->trans("Credit") . '</td>';
|
||||
print '<td class="right">' . $langs->trans("AccountingDebit") . '</td>';
|
||||
print '<td class="right">' . $langs->trans("AccountingCredit") . '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
if (is_array($journal_data) && !empty($journal_data)) {
|
||||
|
||||
@ -119,28 +119,14 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
|
||||
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 . "facture_fourn_det";
|
||||
$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 . "facture_fourn_det.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.$conf->entity;
|
||||
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
|
||||
$sql1 .= " AND " . MAIN_DB_PREFIX . "facture_fourn_det.fk_code_ventilation = 0";
|
||||
} else {
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det 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 = '.$conf->entity;
|
||||
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
|
||||
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
||||
}*/
|
||||
|
||||
// Supplier Invoice Lines (must be same request than into page list.php for manual binding)
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype, f.fk_facture_source,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
@ -233,7 +219,10 @@ if ($action == 'validatehistory') {
|
||||
$facture_static->ref = $objp->ref;
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
$facture_static->date = $objp->datef;
|
||||
$facture_static->ref_supplier = $objp->ref_supplier;
|
||||
$facture_static->label = $objp->invoice_label;
|
||||
$facture_static->date = $db->jdate($objp->datef);
|
||||
$facture_static->fk_facture_source = $objp->fk_facture_source;
|
||||
|
||||
$facture_static_det->id = $objp->rowid;
|
||||
$facture_static_det->total_ht = $objp->total_ht;
|
||||
@ -276,12 +265,14 @@ if ($action == 'validatehistory') {
|
||||
if (!$resqlupdate) {
|
||||
$error++;
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
$nbbindfailed++;
|
||||
break;
|
||||
} else {
|
||||
$nbbinddone++;
|
||||
}
|
||||
} else {
|
||||
$notpossible++;
|
||||
$nbbindfailed++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
@ -295,7 +286,10 @@ if ($action == 'validatehistory') {
|
||||
$db->rollback();
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs');
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
|
||||
if ($nbbindfailed) {
|
||||
setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -317,7 +311,7 @@ print '</span><br>';
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.$langs->trans("ValidateHistory").'</a>';
|
||||
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.img_picto('', 'link', 'class="paddingright fa-color-unset"').$langs->trans("ValidateHistory").'</a>';
|
||||
|
||||
|
||||
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
|
||||
@ -399,14 +393,37 @@ if ($resql) {
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("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/supplier/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"));
|
||||
} else {
|
||||
print $row[1];
|
||||
}
|
||||
print '</td>';
|
||||
for ($i = 2; $i <= 13; $i++) {
|
||||
$cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2);
|
||||
if ($cursormonth > 12) {
|
||||
$cursormonth -= 12;
|
||||
}
|
||||
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
|
||||
|
||||
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>';
|
||||
@ -538,7 +555,7 @@ print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange. Why showing a report that should rely on result of this step ?
|
||||
if (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 ?
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ $search_societe = GETPOST('search_societe', 'alpha');
|
||||
$search_lineid = GETPOST('search_lineid', 'int');
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
$search_invoice = GETPOST('search_invoice', 'alpha');
|
||||
$search_ref_supplier = GETPOST('search_ref_supplier', 'alpha');
|
||||
//$search_ref_supplier = GETPOST('search_ref_supplier', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
$search_desc = GETPOST('search_desc', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
@ -113,7 +113,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_lineid = '';
|
||||
$search_ref = '';
|
||||
$search_invoice = '';
|
||||
$search_ref_supplier = '';
|
||||
//$search_ref_supplier = '';
|
||||
$search_label = '';
|
||||
$search_desc = '';
|
||||
$search_amount = '';
|
||||
@ -194,9 +194,9 @@ print '<script type="text/javascript">
|
||||
/*
|
||||
* Supplier Invoice lines
|
||||
*/
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.fk_soc,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.ref_supplier, f.type as ftype, f.libelle as invoice_label, f.datef, f.fk_soc,";
|
||||
$sql .= " l.rowid, l.fk_product, l.product_type as line_type, l.description, l.total_ht , l.qty, l.tva_tx, l.vat_src_code,";
|
||||
$sql .= " aa.label as label_account, aa.labelshort as labelshort_account, aa.account_number,";
|
||||
$sql .= " aa.rowid as fk_compte, aa.label as label_account, aa.labelshort as labelshort_account, aa.account_number,";
|
||||
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tobuy, p.tosell,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,";
|
||||
@ -236,11 +236,11 @@ if ($search_lineid) {
|
||||
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
||||
}
|
||||
if (strlen(trim($search_invoice))) {
|
||||
$sql .= natural_search("f.ref", $search_invoice);
|
||||
$sql .= natural_search(array("f.ref", "f.ref_supplier"), $search_invoice);
|
||||
}
|
||||
if (strlen(trim($search_ref_supplier))) {
|
||||
/*if (strlen(trim($search_ref_supplier))) {
|
||||
$sql .= natural_search("f.ref_supplier", $search_ref_supplier);
|
||||
}
|
||||
}*/
|
||||
if (strlen(trim($search_label))) {
|
||||
$sql .= natural_search("f.libelle", $search_label);
|
||||
}
|
||||
@ -333,9 +333,9 @@ if ($result) {
|
||||
if ($search_ref) {
|
||||
$param .= "&search_ref=".urlencode($search_ref);
|
||||
}
|
||||
if ($search_ref_supplier) {
|
||||
/*if ($search_ref_supplier) {
|
||||
$param .= '&search_ref_supplier='.urlencode($search_ref_supplier);
|
||||
}
|
||||
}*/
|
||||
if ($search_label) {
|
||||
$param .= "&search_label=".urlencode($search_label);
|
||||
}
|
||||
@ -400,7 +400,7 @@ if ($result) {
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
@ -416,11 +416,11 @@ if ($result) {
|
||||
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth150', 'code2', 1, 0, 1);
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100', 'code2', 1, 0, 1);
|
||||
// print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
|
||||
print '<td class="liste_titre center"><input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).'"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
@ -429,7 +429,7 @@ if ($result) {
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
|
||||
//print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
@ -478,8 +478,8 @@ if ($result) {
|
||||
$productstatic->status = $objp->tosell;
|
||||
$productstatic->status_buy = $objp->tobuy;
|
||||
$productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
|
||||
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_sell_buy_intra;
|
||||
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_sell_buy_export;
|
||||
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_buy_intra;
|
||||
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export;
|
||||
|
||||
$accountingaccountstatic->rowid = $objp->fk_compte;
|
||||
$accountingaccountstatic->label = $objp->label_account;
|
||||
@ -492,12 +492,18 @@ if ($result) {
|
||||
print '<td>'.$objp->rowid.'</td>';
|
||||
|
||||
// Ref Invoice
|
||||
print '<td class="nowraponall">'.$facturefournisseur_static->getNomUrl(1).'</td>';
|
||||
print '<td class="nowraponall">'.$facturefournisseur_static->getNomUrl(1);
|
||||
if ($objp->ref_supplier) {
|
||||
print '<br><span class="opacitymedium small">'.dol_escape_htmltag($objp->ref_supplier).'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Ref supplier invoice
|
||||
/*
|
||||
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
|
||||
print $objp->ref_supplier;
|
||||
print '</td>';
|
||||
*/
|
||||
|
||||
// Supplier invoice label
|
||||
print '<td class="tdoverflowonsmartphone small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
|
||||
@ -552,6 +558,10 @@ if ($result) {
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
if ($num_lines == 0) {
|
||||
print '<tr><td colspan="13"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print "</div>";
|
||||
|
||||
|
||||
@ -44,10 +44,11 @@ $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other",
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancysupplierlist'; // To manage different context of search
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
$default_account = GETPOST('default_account', 'int');
|
||||
|
||||
// Select Box
|
||||
@ -75,8 +76,6 @@ $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_en
|
||||
$search_country = GETPOST('search_country', 'alpha');
|
||||
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||
|
||||
$btn_ventil = GETPOST('ventil', '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);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
@ -112,7 +111,7 @@ if (!isModEnabled('accounting')) {
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -171,7 +170,6 @@ if (empty($reshook)) {
|
||||
if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
$msg = '';
|
||||
|
||||
//print '<div><span style="color:red">' . $langs->trans("Processing") . '...</span></div>';
|
||||
if (!empty($mesCasesCochees)) {
|
||||
$msg = '<div>'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'</div>';
|
||||
$msg .= '<div class="detail">';
|
||||
@ -185,7 +183,7 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
$monCompte = GETPOST('codeventil'.$monId);
|
||||
|
||||
if ($monCompte <= 0) {
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</span></div>';
|
||||
$msg .= '<div><span class="error">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</span></div>';
|
||||
$ko++;
|
||||
} else {
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
|
||||
@ -197,10 +195,10 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
|
||||
dol_syslog('accountancy/supplier/list.php', LOG_DEBUG);
|
||||
if ($db->query($sql)) {
|
||||
$msg .= '<div><span style="color:green">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
|
||||
$msg .= '<div><span class="green">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
|
||||
$ok++;
|
||||
} else {
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br> <pre>'.$sql.'</pre></span></div>';
|
||||
$msg .= '<div><span class="error">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br> <pre>'.$sql.'</pre></span></div>';
|
||||
$ko++;
|
||||
}
|
||||
}
|
||||
@ -232,7 +230,7 @@ if (empty($chartaccountcode)) {
|
||||
}
|
||||
|
||||
// Supplier Invoice Lines
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype, f.fk_facture_source,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
@ -289,14 +287,14 @@ if ($search_lineid) {
|
||||
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
||||
}
|
||||
if (strlen(trim($search_invoice))) {
|
||||
$sql .= natural_search("f.ref", $search_invoice);
|
||||
$sql .= natural_search(array("f.ref", "f.ref_supplier"), $search_invoice);
|
||||
}
|
||||
if (strlen(trim($search_ref))) {
|
||||
$sql .= natural_search("p.ref", $search_ref);
|
||||
}
|
||||
if (strlen(trim($search_ref_supplier))) {
|
||||
/*if (strlen(trim($search_ref_supplier))) {
|
||||
$sql .= natural_search("f.ref_supplier", $search_ref_supplier);
|
||||
}
|
||||
}*/
|
||||
if (strlen(trim($search_label))) {
|
||||
$sql .= natural_search(array("p.label", "f.libelle"), $search_label);
|
||||
}
|
||||
@ -490,7 +488,7 @@ if ($result) {
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
@ -506,7 +504,7 @@ if ($result) {
|
||||
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth125', 'code2', 1, 0, 1, null, 1);
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100', 'code2', 1, 0, 1);
|
||||
//print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
|
||||
@ -521,7 +519,7 @@ if ($result) {
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
|
||||
//print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
@ -532,8 +530,8 @@ if ($result) {
|
||||
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall ');
|
||||
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center ');
|
||||
print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall ');
|
||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
|
||||
$checkpicto = '';
|
||||
if ($massactionbutton) {
|
||||
$checkpicto = $form->showCheckAddButtons('checkforselect', 1);
|
||||
@ -592,6 +590,7 @@ if ($result) {
|
||||
$facturefourn_static->ref_supplier = $objp->ref_supplier;
|
||||
$facturefourn_static->label = $objp->invoice_label;
|
||||
$facturefourn_static->date = $db->jdate($objp->datef);
|
||||
$facturefourn_static->fk_facture_source = $objp->fk_facture_source;
|
||||
|
||||
$facturefourn_static_det->id = $objp->rowid;
|
||||
$facturefourn_static_det->total_ht = $objp->total_ht;
|
||||
@ -647,16 +646,20 @@ if ($result) {
|
||||
print '<td>'.$facturefourn_static_det->id.'</td>';
|
||||
|
||||
// Ref Invoice
|
||||
print '<td class="nowraponall">'.$facturefourn_static->getNomUrl(1).'</td>';
|
||||
|
||||
// Ref supplier invoice
|
||||
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
|
||||
print $objp->ref_supplier;
|
||||
print '<td class="nowraponall">'.$facturefourn_static->getNomUrl(1);
|
||||
if ($objp->ref_supplier) {
|
||||
print '<br><span class="opacitymedium small">'.dol_escape_htmltag($objp->ref_supplier).'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Ref supplier invoice
|
||||
/*print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
|
||||
print $objp->ref_supplier;
|
||||
print '</td>';*/
|
||||
|
||||
// Supplier invoice label
|
||||
print '<td class="tdoverflowmax125 small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
|
||||
print $objp->invoice_label;
|
||||
print '<td class="tdoverflowmax100 small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
|
||||
print dol_escape_htmltag($objp->invoice_label);
|
||||
print '</td>';
|
||||
|
||||
// Date
|
||||
@ -668,11 +671,11 @@ if ($result) {
|
||||
print $product_static->getNomUrl(1);
|
||||
}
|
||||
if ($product_static->label) {
|
||||
print '<br><span class="opacitymedium small">'.$product_static->label.'</span>';
|
||||
print '<br><span class="opacitymedium small">'.dol_escape_htmltag($product_static->label).'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Description
|
||||
// Description of line
|
||||
print '<td class="tdoverflowonsmartphone small">';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facturefourn_static_det->desc, 1));
|
||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
@ -685,11 +688,11 @@ if ($result) {
|
||||
|
||||
// Vat rate
|
||||
$code_vat_differ = '';
|
||||
if ($objp->vat_tx_l != $objp->vat_tx_p && price2num($objp->vat_tx_p) && price2num($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
|
||||
$code_vat_differ = 'warning bold';
|
||||
}
|
||||
//if ($objp->vat_tx_l != $objp->vat_tx_p && price2num($objp->vat_tx_p) && price2num($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
|
||||
// $code_vat_differ = 'warning bold';
|
||||
//}
|
||||
print '<td class="right'.($code_vat_differ?' '.$code_vat_differ:'').'">';
|
||||
print vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''));
|
||||
print vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''), false, 0, 0, 1);
|
||||
print '</td>';
|
||||
|
||||
// Thirdparty
|
||||
@ -707,14 +710,19 @@ if ($result) {
|
||||
// Found accounts
|
||||
print '<td class="small">';
|
||||
$s = '1. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
|
||||
$shelp = '';
|
||||
$shelp = ''; $ttype = 'help';
|
||||
if ($suggestedaccountingaccountbydefaultfor == 'eec') {
|
||||
$shelp .= $langs->trans("SaleEEC");
|
||||
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') {
|
||||
$shelp = $langs->trans("SaleEECWithVAT");
|
||||
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithoutvatnumber') {
|
||||
$shelp = $langs->trans("SaleEECWithoutVATNumber");
|
||||
$ttype = 'warning';
|
||||
} elseif ($suggestedaccountingaccountbydefaultfor == 'export') {
|
||||
$shelp .= $langs->trans("SaleExport");
|
||||
}
|
||||
$s .= ($code_buy_l > 0 ? length_accountg($code_buy_l) : '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>');
|
||||
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
|
||||
print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
|
||||
if ($product_static->id > 0) {
|
||||
print '<br>';
|
||||
$s = '2. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
|
||||
@ -772,6 +780,9 @@ if ($result) {
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
if ($num_lines == 0) {
|
||||
print '<tr><td colspan="14"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print "</div>";
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2022 Lionel Vessiller <lvessiller@open-dsi.fr>
|
||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||
* 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
|
||||
@ -33,7 +35,9 @@ $siren = getDolGlobalString('MAIN_INFO_SIREN');
|
||||
$date_export = "_".dol_print_date(dol_now(), '%Y%m%d%H%M%S');
|
||||
$endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d');
|
||||
|
||||
header('Content-Type: text/csv');
|
||||
if (empty($withAttachment)) {
|
||||
header('Content-Type: text/csv');
|
||||
}
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
|
||||
$accountancyexport = new AccountancyExport($db);
|
||||
@ -66,4 +70,6 @@ if (($accountancyexport->getFormatCode($formatexportset) == 'fec' || $accountanc
|
||||
$completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format;
|
||||
}
|
||||
|
||||
header('Content-Disposition: attachment;filename='.$completefilename);
|
||||
if (empty($withAttachment)) {
|
||||
header('Content-Disposition: attachment;filename=' . $completefilename);
|
||||
}
|
||||
|
||||
@ -152,10 +152,13 @@ if ($action == 'set_default') {
|
||||
setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
|
||||
$db->commit();
|
||||
}
|
||||
}
|
||||
|
||||
// Action to update or add a constant
|
||||
if ($action == 'update' || $action == 'add') {
|
||||
} elseif ($action == 'setcodemember') {
|
||||
$result = dolibarr_set_const($db, "MEMBER_CODEMEMBER_ADDON", $value, 'chaine', 0, '', $conf->entity);
|
||||
if ($result <= 0) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
} elseif ($action == 'update' || $action == 'add') {
|
||||
// Action to update or add a constant
|
||||
$constname = GETPOST('constname', 'alpha');
|
||||
$constvalue = (GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue'));
|
||||
|
||||
@ -223,6 +226,97 @@ $head = member_admin_prepare_head();
|
||||
|
||||
print dol_get_fiche_head($head, 'general', $langs->trans("Members"), -1, 'user');
|
||||
|
||||
$dirModMember = array_merge(array('/core/modules/member/'), $conf->modules_parts['member']);
|
||||
foreach ($conf->modules_parts['models'] as $mo) {
|
||||
//Add more models
|
||||
$dirModMember[] = $mo.'core/modules/member/';
|
||||
}
|
||||
|
||||
// Module to manage customer/supplier code
|
||||
|
||||
print load_fiche_titre($langs->trans("MemberCodeChecker"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print ' <td>'.$langs->trans("Name").'</td>';
|
||||
print ' <td>'.$langs->trans("Description").'</td>';
|
||||
print ' <td>'.$langs->trans("Example").'</td>';
|
||||
print ' <td class="center" width="80">'.$langs->trans("Status").'</td>';
|
||||
print ' <td class="center" width="60">'.$langs->trans("ShortInfo").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$arrayofmodules = array();
|
||||
|
||||
foreach ($dirModMember as $dirroot) {
|
||||
$dir = dol_buildpath($dirroot, 0);
|
||||
|
||||
$handle = @opendir($dir);
|
||||
if (is_resource($handle)) {
|
||||
// Loop on each module find in opened directory
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
// module filename has to start with mod_member_
|
||||
if (substr($file, 0, 11) == 'mod_member_' && substr($file, -3) == 'php') {
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
try {
|
||||
dol_include_once($dirroot.$file.'.php');
|
||||
} catch (Exception $e) {
|
||||
dol_syslog($e->getMessage(), LOG_ERR);
|
||||
continue;
|
||||
}
|
||||
$modCodeMember = new $file;
|
||||
// Show modules according to features level
|
||||
if ($modCodeMember->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
|
||||
continue;
|
||||
}
|
||||
if ($modCodeMember->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$arrayofmodules[$file] = $modCodeMember;
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
|
||||
$arrayofmodules = dol_sort_array($arrayofmodules, 'position');
|
||||
|
||||
foreach ($arrayofmodules as $file => $modCodeMember) {
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td width="140">'.$modCodeMember->name.'</td>'."\n";
|
||||
print '<td>'.$modCodeMember->info($langs).'</td>'."\n";
|
||||
print '<td class="nowrap">'.$modCodeMember->getExample($langs).'</td>'."\n";
|
||||
|
||||
if (getDolGlobalString('MEMBER_CODEMEMBER_ADDON') == "$file") {
|
||||
print '<td class="center">'."\n";
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print "</td>\n";
|
||||
} else {
|
||||
$disabled = (isModEnabled('multicompany') && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity) ? true : false);
|
||||
print '<td class="center">';
|
||||
if (!$disabled) {
|
||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setcodemember&token='.newToken().'&value='.urlencode($file).'">';
|
||||
}
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
if (!$disabled) {
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td class="center">';
|
||||
$s = $modCodeMember->getToolTip($langs, null, -1);
|
||||
print $form->textwithpicto('', $s, 1);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print "<br>";
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="updatemainoptions">';
|
||||
@ -417,7 +511,7 @@ foreach ($dirmodels as $reldir) {
|
||||
|
||||
// Defaut
|
||||
print '<td class="center">';
|
||||
if (getDolGlobalString('MEMBER_ADDON_PDF') == $name) {
|
||||
if (getDolGlobalString('MEMBER_ADDON_PDF_ODT') == $name) {
|
||||
print img_picto($langs->trans("Default"), 'on');
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scandir='.(!empty($module->scandir) ? $module->scandir : '').'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
|
||||
@ -48,18 +48,23 @@ $action = GETPOST('action', 'aZ09');
|
||||
|
||||
$error = 0;
|
||||
|
||||
$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
|
||||
$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
|
||||
//$helptext.='__YEAR__, __MONTH__, __DAY__'; // Not supported
|
||||
|
||||
// Editing global variables not related to a specific theme
|
||||
$constantes = array(
|
||||
'MEMBER_REMINDER_EMAIL'=>array('type'=>'yesno', 'label'=>$langs->trans('MEMBER_REMINDER_EMAIL', $langs->transnoentities("Module2300Name"))),
|
||||
'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' =>'emailtemplate:member',
|
||||
'ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER' =>'emailtemplate:member', // until Dolibarr 7 it was ADHERENT_AUTOREGISTER_MAIL
|
||||
'ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION' =>'emailtemplate:member', // until Dolibarr 7 it was ADHERENT_MAIL_VALID
|
||||
'ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION' =>'emailtemplate:member', // until Dolibarr 7 it was ADHERENT_MAIL_COTIS
|
||||
'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>'emailtemplate:member', // until Dolibarr 7 it was ADHERENT_MAIL_RESIL
|
||||
'ADHERENT_EMAIL_TEMPLATE_EXCLUSION' =>'emailtemplate:member',
|
||||
'ADHERENT_MAIL_FROM' =>'string',
|
||||
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT' =>'string',
|
||||
'ADHERENT_AUTOREGISTER_NOTIF_MAIL' =>'html',
|
||||
'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' =>array('type'=>'emailtemplate:member'),
|
||||
'ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER' =>array('type'=>'emailtemplate:member'),
|
||||
'ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION' =>array('type'=>'emailtemplate:member'),
|
||||
'ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION' =>array('type'=>'emailtemplate:member'),
|
||||
'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>array('type'=>'emailtemplate:member'),
|
||||
'ADHERENT_EMAIL_TEMPLATE_EXCLUSION' =>array('type'=>'emailtemplate:member'),
|
||||
'ADHERENT_MAIL_FROM' =>array('type'=>'string'),
|
||||
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT' =>array('type'=>'string'),
|
||||
'ADHERENT_AUTOREGISTER_NOTIF_MAIL' =>array('type'=>'html', 'tooltip'=>$helptext)
|
||||
);
|
||||
|
||||
|
||||
@ -147,12 +152,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="updateall">';
|
||||
|
||||
$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
|
||||
$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
|
||||
//$helptext.='__YEAR__, __MONTH__, __DAY__'; // Not supported
|
||||
|
||||
form_constantes($constantes, 3, $helptext);
|
||||
form_constantes($constantes, 3, '');
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
|
||||
print '</form>';
|
||||
|
||||
@ -65,7 +65,7 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||
|
||||
$textobject = $langs->transnoentitiesnoconv("Members");
|
||||
|
||||
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
|
||||
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
|
||||
llxHeader('', $langs->trans("MembersSetup"), $help_url);
|
||||
|
||||
|
||||
|
||||
@ -58,16 +58,20 @@ if ($action == 'setMEMBER_ENABLE_PUBLIC') {
|
||||
if ($action == 'update') {
|
||||
$public = GETPOST('MEMBER_ENABLE_PUBLIC');
|
||||
$amount = price2num(GETPOST('MEMBER_NEWFORM_AMOUNT'), 'MT', 2);
|
||||
$editamount = GETPOST('MEMBER_NEWFORM_EDITAMOUNT');
|
||||
$minamount = GETPOST('MEMBER_MIN_AMOUNT');
|
||||
$publiccounters = GETPOST('MEMBER_COUNTERS_ARE_PUBLIC');
|
||||
$showtable = GETPOST('MEMBER_SHOW_TABLE');
|
||||
$showvoteallowed = GETPOST('MEMBER_SHOW_VOTE_ALLOWED');
|
||||
$payonline = GETPOST('MEMBER_NEWFORM_PAYONLINE');
|
||||
$forcetype = GETPOST('MEMBER_NEWFORM_FORCETYPE', 'int');
|
||||
$forcemorphy = GETPOST('MEMBER_NEWFORM_FORCEMORPHY', 'aZ09');
|
||||
|
||||
$res = dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC", $public, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT", $amount, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT", $editamount, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "MEMBER_MIN_AMOUNT", $minamount, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "MEMBER_COUNTERS_ARE_PUBLIC", $publiccounters, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "MEMBER_SKIP_TABLE", !$showtable, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "skip -> show"
|
||||
$res = dolibarr_set_const($db, "MEMBER_HIDE_VOTE_ALLOWED", !$showvoteallowed, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "hide -> show"
|
||||
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE", $payonline, 'chaine', 0, '', $conf->entity);
|
||||
if ($forcetype < 0) {
|
||||
$res = dolibarr_del_const($db, "MEMBER_NEWFORM_FORCETYPE", $conf->entity);
|
||||
@ -99,7 +103,7 @@ if ($action == 'update') {
|
||||
$form = new Form($db);
|
||||
|
||||
$title = $langs->trans("MembersSetup");
|
||||
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
|
||||
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
|
||||
@ -178,7 +182,7 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
|
||||
//print $langs->trans('FollowingLinksArePublic').'<br>';
|
||||
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>';
|
||||
if (isModEnabled('multicompany')) {
|
||||
$entity_qr = '?entity='.$conf->entity;
|
||||
$entity_qr = '?entity='.((int) $conf->entity);
|
||||
} else {
|
||||
$entity_qr = '';
|
||||
}
|
||||
@ -232,11 +236,11 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
|
||||
print '<input type="text" class="right width50" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" value="'.(!empty($conf->global->MEMBER_NEWFORM_AMOUNT) ? $conf->global->MEMBER_NEWFORM_AMOUNT : '').'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Can edit
|
||||
// Min amount
|
||||
print '<tr class="oddeven" id="tredit"><td>';
|
||||
print $langs->trans("CanEditAmount");
|
||||
print $langs->trans("MinimumAmount");
|
||||
print '</td><td>';
|
||||
print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT", (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) ? $conf->global->MEMBER_NEWFORM_EDITAMOUNT : 0), 1);
|
||||
print '<input type="text" class="right width50" id="MEMBER_MIN_AMOUNT" name="MEMBER_MIN_AMOUNT" value="'.(!empty($conf->global->MEMBER_MIN_AMOUNT) ? $conf->global->MEMBER_MIN_AMOUNT : '').'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// SHow counter of validated members publicly
|
||||
@ -246,6 +250,22 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
|
||||
print $form->selectyesno("MEMBER_COUNTERS_ARE_PUBLIC", (!empty($conf->global->MEMBER_COUNTERS_ARE_PUBLIC) ? $conf->global->MEMBER_COUNTERS_ARE_PUBLIC : 0), 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Show the table of all available membership types. If not, show a form (as the default was for Dolibarr <=16.0)
|
||||
$skiptable = (!empty($conf->global->MEMBER_SKIP_TABLE) ? $conf->global->MEMBER_SKIP_TABLE : 0);
|
||||
print '<tr class="oddeven" id="tredit"><td>';
|
||||
print $langs->trans("MembersShowMembershipTypesTable");
|
||||
print '</td><td>';
|
||||
print $form->selectyesno("MEMBER_SHOW_TABLE", !$skiptable, 1); // Reverse the logic "hide -> show" for retrocompatibility
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Show "vote allowed" setting for membership types
|
||||
$hidevoteallowed = (!empty($conf->global->MEMBER_HIDE_VOTE_ALLOWED) ? $conf->global->MEMBER_HIDE_VOTE_ALLOWED : 0);
|
||||
print '<tr class="oddeven" id="tredit"><td>';
|
||||
print $langs->trans("MembersShowVotesAllowed");
|
||||
print '</td><td>';
|
||||
print $form->selectyesno("MEMBER_SHOW_VOTE_ALLOWED", !$hidevoteallowed, 1); // Reverse the logic "hide -> show" for retrocompatibility
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Jump to an online payment page
|
||||
print '<tr class="oddeven" id="trpayment"><td>';
|
||||
print $langs->trans("MEMBER_NEWFORM_PAYONLINE");
|
||||
|
||||
@ -64,13 +64,17 @@ if (GETPOST('actioncode', 'array')) {
|
||||
$actioncode = '0';
|
||||
}
|
||||
} else {
|
||||
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
|
||||
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
|
||||
}
|
||||
$search_rowid = GETPOST('search_rowid');
|
||||
$search_agenda_label = GETPOST('search_agenda_label');
|
||||
|
||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||
$objcanvas = null;
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('memberagenda'));
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'adherent', $id);
|
||||
|
||||
@ -105,6 +109,7 @@ if (empty($reshook)) {
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
|
||||
$actioncode = '';
|
||||
$search_rowid = '';
|
||||
$search_agenda_label = '';
|
||||
}
|
||||
}
|
||||
@ -184,6 +189,7 @@ if ($object->id > 0) {
|
||||
// List of all actions
|
||||
$filters = array();
|
||||
$filters['search_agenda_label'] = $search_agenda_label;
|
||||
$filters['search_rowid'] = $search_rowid;
|
||||
|
||||
// TODO Replace this with same code than into list.php
|
||||
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
|
||||
|
||||
@ -61,20 +61,15 @@ abstract class ActionsAdherentCardCommon
|
||||
*/
|
||||
public function getObject($id)
|
||||
{
|
||||
//$ret = $this->getInstanceDao();
|
||||
$object = new Adherent($this->db);
|
||||
|
||||
/*if (is_object($this->object) && method_exists($this->object,'fetch'))
|
||||
{
|
||||
if (!empty($id)) $this->object->fetch($id);
|
||||
}
|
||||
else
|
||||
{*/
|
||||
$object = new Adherent($this->db);
|
||||
if (!empty($id)) {
|
||||
$object->fetch($id);
|
||||
}
|
||||
$this->object = $object;
|
||||
//}
|
||||
|
||||
$this->object = $object;
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
@ -83,7 +78,7 @@ abstract class ActionsAdherentCardCommon
|
||||
*
|
||||
* @param string $action Type of action
|
||||
* @param int $id Id
|
||||
* @return string HTML output
|
||||
* @return void
|
||||
*/
|
||||
public function assign_values(&$action, $id)
|
||||
{
|
||||
|
||||
@ -84,7 +84,6 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
|
||||
public function assign_values(&$action, $id)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $limit, $offset, $sortfield, $sortorder;
|
||||
global $conf, $db, $langs, $user;
|
||||
global $form;
|
||||
|
||||
@ -112,34 +111,9 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
|
||||
$this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1);
|
||||
} else {
|
||||
// Confirm delete contact
|
||||
if ($action == 'delete' && $user->rights->adherent->supprimer) {
|
||||
if ($action == 'delete' && $user->hasRight('adherent', 'supprimer')) {
|
||||
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteAdherent"), $langs->trans("ConfirmDeleteAdherent"), "confirm_delete", '', 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'list') {
|
||||
$this->LoadListDatas($limit, $offset, $sortfield, $sortorder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Fetch datas list and save into ->list_datas
|
||||
*
|
||||
* @param int $limit Limit number of responses
|
||||
* @param int $offset Offset for first response
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order ('ASC' or 'DESC')
|
||||
* @return void
|
||||
*/
|
||||
public function LoadListDatas($limit, $offset, $sortfield, $sortorder)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
|
||||
//$this->getFieldList();
|
||||
|
||||
$this->list_datas = array();
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,12 +128,12 @@ if (empty($user->socid)) {
|
||||
echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=edit&token='.newToken().'&canvas='.$canvas.'">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
|
||||
if (!$this->control->tpl['user_id'] && $user->rights->user->user->creer) {
|
||||
if (!$this->control->tpl['user_id'] && $user->hasRight('user', 'user', 'creer')) {
|
||||
echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=create_user&token='.newToken().'&canvas='.$canvas.'">'.$langs->trans("CreateDolibarrLogin").'</a>';
|
||||
}
|
||||
|
||||
if ($user->rights->adherent->supprimer) {
|
||||
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=delete&token='.newToken().'&canvas='.$canvas, 'delete', $user->rights->adherent->supprimer);
|
||||
if ($user->hasRight('adherent', 'supprimer')) {
|
||||
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=delete&token='.newToken().'&canvas='.$canvas, 'delete', $user->hasRight('adherent', 'supprimer'));
|
||||
}
|
||||
|
||||
echo '</div><br>';
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012-2020 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2015-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -98,14 +98,14 @@ if ($id > 0 || !empty($ref)) {
|
||||
$result = $object->fetch($id, $ref);
|
||||
|
||||
// Define variables to know what current user can do on users
|
||||
$canadduser = ($user->admin || $user->rights->user->user->creer);
|
||||
$canadduser = ($user->admin || $user->hasRight('user', 'user', 'creer'));
|
||||
// Define variables to know what current user can do on properties of user linked to edited member
|
||||
if ($object->user_id) {
|
||||
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
|
||||
$caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->creer));
|
||||
$caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
|
||||
|| (($user->id != $object->user_id) && $user->rights->user->user->password));
|
||||
$caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'creer'))
|
||||
|| (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer')));
|
||||
$caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'password'))
|
||||
|| (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password')));
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,9 +154,9 @@ if (empty($reshook)) {
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer)) {
|
||||
if ($action == 'setuserid' && ($user->hasRight('user', 'self', 'creer') || $user->hasRight('user', 'user', 'creer'))) {
|
||||
$error = 0;
|
||||
if (empty($user->rights->user->user->creer)) { // If can edit only itself user, we can link to itself only
|
||||
if (!$user->hasRight('user', 'user', 'creer')) { // If can edit only itself user, we can link to itself only
|
||||
if ($userid != $user->id && $userid != $object->user_id) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), null, 'errors');
|
||||
@ -206,7 +206,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// Create user from a member
|
||||
if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user->user->creer) {
|
||||
if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->hasRight('user', 'user', 'creer')) {
|
||||
if ($result > 0) {
|
||||
// Creation user
|
||||
$nuser = new User($db);
|
||||
@ -230,7 +230,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// Create third party from a member
|
||||
if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer) {
|
||||
if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->hasRight('societe', 'creer')) {
|
||||
if ($result > 0) {
|
||||
// User creation
|
||||
$company = new Societe($db);
|
||||
@ -305,23 +305,19 @@ if (empty($reshook)) {
|
||||
$object->phone = trim(GETPOST("phone", 'alpha'));
|
||||
$object->phone_perso = trim(GETPOST("phone_perso", 'alpha'));
|
||||
$object->phone_mobile = trim(GETPOST("phone_mobile", 'alpha'));
|
||||
$object->email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
|
||||
$object->url = trim(GETPOST('member_url', 'custom', 0, FILTER_SANITIZE_URL));
|
||||
$object->email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
|
||||
$object->url = trim(GETPOST('member_url', 'custom', 0, FILTER_SANITIZE_URL));
|
||||
$object->socialnetworks = array();
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') {
|
||||
$object->socialnetworks[$key] = trim(GETPOST($key, 'alphanohtml'));
|
||||
}
|
||||
}
|
||||
//$object->skype = trim(GETPOST("skype", 'alpha'));
|
||||
//$object->twitter = trim(GETPOST("twitter", 'alpha'));
|
||||
//$object->facebook = trim(GETPOST("facebook", 'alpha'));
|
||||
//$object->linkedin = trim(GETPOST("linkedin", 'alpha'));
|
||||
$object->birth = $birthdate;
|
||||
$object->birth = $birthdate;
|
||||
$object->default_lang = GETPOST('default_lang', 'alpha');
|
||||
$object->typeid = GETPOST("typeid", 'int');
|
||||
//$object->note = trim(GETPOST("comment","alpha"));
|
||||
$object->morphy = GETPOST("morphy", 'alpha');
|
||||
$object->typeid = GETPOST("typeid", 'int');
|
||||
//$object->note = trim(GETPOST("comment","alpha"));
|
||||
$object->morphy = GETPOST("morphy", 'alpha');
|
||||
|
||||
if (GETPOST('deletephoto', 'alpha')) {
|
||||
$object->photo = '';
|
||||
@ -330,8 +326,8 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// Get status and public property
|
||||
$object->statut = GETPOST("statut", 'alpha');
|
||||
$object->public = GETPOST("public", 'alpha');
|
||||
$object->statut = GETPOST("statut", 'alpha');
|
||||
$object->public = GETPOST("public", 'alpha');
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
@ -342,7 +338,7 @@ if (empty($reshook)) {
|
||||
// Check if we need to also synchronize user information
|
||||
$nosyncuser = 0;
|
||||
if ($object->user_id) { // If linked to a user
|
||||
if ($user->id != $object->user_id && empty($user->rights->user->user->creer)) {
|
||||
if ($user->id != $object->user_id && !$user->hasRight('user', 'user', 'creer')) {
|
||||
$nosyncuser = 1; // Disable synchronizing
|
||||
}
|
||||
}
|
||||
@ -350,7 +346,7 @@ if (empty($reshook)) {
|
||||
// Check if we need to also synchronize password information
|
||||
$nosyncuserpass = 0;
|
||||
if ($object->user_id) { // If linked to a user
|
||||
if ($user->id != $object->user_id && empty($user->rights->user->user->password)) {
|
||||
if ($user->id != $object->user_id && !$user->hasRight('user', 'user', 'password')) {
|
||||
$nosyncuserpass = 1; // Disable synchronizing
|
||||
}
|
||||
}
|
||||
@ -454,7 +450,7 @@ if (empty($reshook)) {
|
||||
// $facebook=GETPOST("member_facebook", 'alpha');
|
||||
// $linkedin=GETPOST("member_linkedin", 'alpha');
|
||||
$email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
|
||||
$url = trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL));
|
||||
$url = trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL));
|
||||
$login = GETPOST("member_login", 'alphanohtml');
|
||||
$pass = GETPOST("password", 'none'); // For password, we use 'none'
|
||||
$photo = GETPOST("photo", 'alphanohtml');
|
||||
@ -488,11 +484,6 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
// $object->skype = $skype;
|
||||
// $object->twitter = $twitter;
|
||||
// $object->facebook = $facebook;
|
||||
// $object->linkedin = $linkedin;
|
||||
|
||||
$object->email = $email;
|
||||
$object->url = $url;
|
||||
$object->login = $login;
|
||||
@ -565,7 +556,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
if (!empty($object->url) && !isValidUrl($object->url)) {
|
||||
$langs->load("errors");
|
||||
setEventMessages('', $langs->trans("ErrorBadUrl", $object->url), 'errors');
|
||||
setEventMessages($langs->trans("ErrorBadUrl", $object->url), null, 'errors');
|
||||
}
|
||||
$public = 0;
|
||||
if (isset($public)) {
|
||||
@ -617,10 +608,11 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes') {
|
||||
if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_delete' && $confirm == 'yes') {
|
||||
$result = $object->delete($id, $user);
|
||||
if ($result > 0) {
|
||||
if (!empty($backtopage)) {
|
||||
setEventMessages($langs->trans("RecordDeleted"), null, 'errors');
|
||||
if (!empty($backtopage) && !preg_match('/'.preg_quote($_SERVER["PHP_SELF"], '/').'/', $backtopage)) {
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
} else {
|
||||
@ -658,7 +650,7 @@ if (empty($reshook)) {
|
||||
$outputlangs->loadLangs(array("main", "members", "companies", "install", "other"));
|
||||
// Get email content from template
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION;
|
||||
$labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION');
|
||||
|
||||
if (!empty($labeltouse)) {
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
@ -682,7 +674,7 @@ if (empty($reshook)) {
|
||||
|
||||
$moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n";
|
||||
|
||||
$result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
|
||||
$result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@ -706,7 +698,7 @@ if (empty($reshook)) {
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($user->rights->adherent->supprimer && $action == 'confirm_resiliate') {
|
||||
if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_resiliate') {
|
||||
$error = 0;
|
||||
|
||||
if ($confirm == 'yes') {
|
||||
@ -730,7 +722,7 @@ if (empty($reshook)) {
|
||||
$outputlangs->loadLangs(array("main", "members", "companies", "install", "other"));
|
||||
// Get email content from template
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION;
|
||||
$labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_CANCELATION');
|
||||
|
||||
if (!empty($labeltouse)) {
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
@ -753,7 +745,7 @@ if (empty($reshook)) {
|
||||
|
||||
$moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n";
|
||||
|
||||
$result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
|
||||
$result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@ -777,7 +769,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->rights->adherent->supprimer && $action == 'confirm_exclude') {
|
||||
if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_exclude') {
|
||||
$error = 0;
|
||||
|
||||
if ($confirm == 'yes') {
|
||||
@ -801,7 +793,7 @@ if (empty($reshook)) {
|
||||
$outputlangs->loadLangs(array("main", "members", "companies", "install", "other"));
|
||||
// Get email content from template
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_EXCLUSION;
|
||||
$labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_EXCLUSION');
|
||||
|
||||
if (!empty($labeltouse)) {
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
@ -824,7 +816,7 @@ if (empty($reshook)) {
|
||||
|
||||
$moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n";
|
||||
|
||||
$result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
|
||||
$result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@ -849,7 +841,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// SPIP Management
|
||||
if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $confirm == 'yes') {
|
||||
if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_del_spip' && $confirm == 'yes') {
|
||||
if (!count($object->errors)) {
|
||||
if (!$mailmanspip->del_to_spip($object)) {
|
||||
setEventMessages($langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error, null, 'errors');
|
||||
@ -1045,7 +1037,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Website
|
||||
print '<tr><td>'.$form->editfieldkey('Web', 'member_url', GETPOST('member_url', 'alpha'), $object, 0).'</td>';
|
||||
print '<td>'.img_picto('', 'globe').' <input type="text" class="maxwidth500 widthcentpercentminusx" name="member_url" id="member_url" value="'.(GETPOSTISSET('member_url', 'alpha') ? GETPOST('member_url', 'alpha') : $object->url).'"></td></tr>';
|
||||
print '<td>'.img_picto('', 'globe').' <input type="text" class="maxwidth500 widthcentpercentminusx" name="member_url" id="member_url" value="'.(GETPOSTISSET('member_url') ? GETPOST('member_url', 'alpha') : $object->url).'"></td></tr>';
|
||||
|
||||
// Address
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>';
|
||||
@ -1118,7 +1110,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Categories
|
||||
if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
|
||||
if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
|
||||
print '<tr><td>'.$form->editfieldkey("Categories", 'memcats', '', $object, 0).'</td><td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, 'parent', null, null, 1);
|
||||
print img_picto('', 'category').$form->multiselectarray('memcats', $cate_arbo, GETPOST('memcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
|
||||
@ -1367,7 +1359,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Categories
|
||||
if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
|
||||
if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
|
||||
print '<tr><td>'.$form->editfieldkey("Categories", 'memcats', '', $object, 0).'</td>';
|
||||
print '<td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1);
|
||||
@ -1523,7 +1515,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
|
||||
$subject = $arraydefaultmessage->topic;
|
||||
$msg = $arraydefaultmessage->content;
|
||||
$msg = $arraydefaultmessage->content;
|
||||
}
|
||||
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
@ -1532,10 +1524,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
|
||||
|
||||
$tmp = $langs->trans("SendingAnEMailToMember");
|
||||
$tmp .= '<br>'.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
|
||||
$tmp .= '<br>'.$langs->trans("MailFrom").': <b>'.getDolGlobalString('ADHERENT_MAIL_FROM').'</b>, ';
|
||||
$tmp .= '<br>'.$langs->trans("MailRecipient").': <b>'.$object->email.'</b>';
|
||||
$helpcontent = '';
|
||||
$helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
|
||||
$helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.getDolGlobalString('ADHERENT_MAIL_FROM').'<br>'."\n";
|
||||
$helpcontent .= '<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
|
||||
$helpcontent .= '<b>'.$langs->trans("Subject").'</b>:<br>'."\n";
|
||||
$helpcontent .= $subjecttosend."\n";
|
||||
@ -1595,10 +1587,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs);
|
||||
|
||||
$tmp = $langs->trans("SendingAnEMailToMember");
|
||||
$tmp .= '<br>('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
|
||||
$tmp .= '<br>('.$langs->trans("MailFrom").': <b>'.getDolGlobalString('ADHERENT_MAIL_FROM').'</b>, ';
|
||||
$tmp .= $langs->trans("MailRecipient").': <b>'.$object->email.'</b>)';
|
||||
$helpcontent = '';
|
||||
$helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
|
||||
$helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.getDolGlobalString('ADHERENT_MAIL_FROM').'<br>'."\n";
|
||||
$helpcontent .= '<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
|
||||
$helpcontent .= '<b>'.$langs->trans("Subject").'</b>:<br>'."\n";
|
||||
$helpcontent .= $subjecttosend."\n";
|
||||
@ -1638,7 +1630,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$outputlangs->loadLangs(array("main", "members"));
|
||||
// Get email content from template
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_EXCLUSION;
|
||||
$labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_EXCLUSION');
|
||||
|
||||
if (!empty($labeltouse)) {
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
@ -1655,10 +1647,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnExclude()), $substitutionarray, $outputlangs);
|
||||
|
||||
$tmp = $langs->trans("SendingAnEMailToMember");
|
||||
$tmp .= '<br>('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
|
||||
$tmp .= '<br>('.$langs->trans("MailFrom").': <b>'.getDolGlobalString('ADHERENT_MAIL_FROM').'</b>, ';
|
||||
$tmp .= $langs->trans("MailRecipient").': <b>'.$object->email.'</b>)';
|
||||
$helpcontent = '';
|
||||
$helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
|
||||
$helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.getDolGlobalString('ADHERENT_MAIL_FROM').'<br>'."\n";
|
||||
$helpcontent .= '<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
|
||||
$helpcontent .= '<b>'.$langs->trans("Subject").'</b>:<br>'."\n";
|
||||
$helpcontent .= $subjecttosend."\n";
|
||||
@ -1793,7 +1785,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
// Tags / Categories
|
||||
if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
|
||||
if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
|
||||
@ -1862,7 +1854,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Login Dolibarr - Link to user
|
||||
print '<tr><td>';
|
||||
$editenable = $user->hasRight('adherent', 'creer') && $user->rights->user->user->creer;
|
||||
$editenable = $user->hasRight('adherent', 'creer') && $user->hasRight('user', 'user', 'creer');
|
||||
print $form->editfieldkey('LinkedToDolibarrUser', 'login', '', $object, $editenable);
|
||||
print '</td><td colspan="2" class="valeur">';
|
||||
if ($action == 'editlogin') {
|
||||
@ -1881,7 +1873,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print "</table>\n";
|
||||
|
||||
print "</div></div>\n";
|
||||
print '<div style="clear:both"></div>';
|
||||
print '<div class="clearboth"></div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
@ -1944,7 +1936,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Resiliate
|
||||
if (Adherent::STATUS_VALIDATED == $object->statut) {
|
||||
if ($user->rights->adherent->supprimer) {
|
||||
if ($user->hasRight('adherent', 'supprimer')) {
|
||||
print '<a class="butAction" href="card.php?rowid='.((int) $object->id).'&action=resiliate">'.$langs->trans("Resiliate")."</a></span>\n";
|
||||
} else {
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Resiliate").'</span>'."\n";
|
||||
@ -1953,7 +1945,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Exclude
|
||||
if (Adherent::STATUS_VALIDATED == $object->statut) {
|
||||
if ($user->rights->adherent->supprimer) {
|
||||
if ($user->hasRight('adherent', 'supprimer')) {
|
||||
print '<a class="butAction" href="card.php?rowid='.((int) $object->id).'&action=exclude">'.$langs->trans("Exclude")."</a></span>\n";
|
||||
} else {
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Exclude").'</span>'."\n";
|
||||
@ -1962,7 +1954,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Create third party
|
||||
if (isModEnabled('societe') && !$object->socid) {
|
||||
if ($user->rights->societe->creer) {
|
||||
if ($user->hasRight('societe', 'creer')) {
|
||||
if (Adherent::STATUS_DRAFT != $object->statut) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.((int) $object->id).'&action=create_thirdparty" title="'.dol_escape_htmltag($langs->trans("CreateDolibarrThirdPartyDesc")).'">'.$langs->trans("CreateDolibarrThirdParty").'</a>'."\n";
|
||||
} else {
|
||||
@ -1975,7 +1967,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Create user
|
||||
if (!$user->socid && !$object->user_id) {
|
||||
if ($user->rights->user->user->creer) {
|
||||
if ($user->hasRight('user', 'user', 'creer')) {
|
||||
if (Adherent::STATUS_DRAFT != $object->statut) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.((int) $object->id).'&action=create_user" title="'.dol_escape_htmltag($langs->trans("CreateDolibarrLoginDesc")).'">'.$langs->trans("CreateDolibarrLogin").'</a>'."\n";
|
||||
} else {
|
||||
@ -1999,7 +1991,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($user->rights->adherent->supprimer) {
|
||||
if ($user->hasRight('adherent', 'supprimer')) {
|
||||
print '<a class="butActionDelete" href="card.php?rowid='.((int) $object->id).'&action=delete&token='.newToken().'">'.$langs->trans("Delete").'</a>'."\n";
|
||||
} else {
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Delete").'</span>'."\n";
|
||||
@ -2026,7 +2018,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$filename = dol_sanitizeFileName($object->ref);
|
||||
$filedir = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member');
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?id='.$object->id;
|
||||
$genallowed = $user->rights->adherent->lire;
|
||||
$genallowed = $user->hasRight('adherent', 'lire');
|
||||
$delallowed = $user->hasRight('adherent', 'creer');
|
||||
|
||||
print $formfile->showdocuments('member', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', (empty($object->default_lang) ? '' : $object->default_lang), '', $object);
|
||||
|
||||
@ -307,7 +307,7 @@ foreach (array_keys($_Avery_Labels) as $codecards) {
|
||||
}
|
||||
asort($arrayoflabels);
|
||||
print $form->selectarray('model', $arrayoflabels, (GETPOST('model') ?GETPOST('model') : (empty($conf->global->ADHERENT_CARD_TYPE) ? '' : $conf->global->ADHERENT_CARD_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print '<br>'.$langs->trans("Login").': <input size="10" type="text" name="foruserlogin" value="'.GETPOST('foruserlogin').'">';
|
||||
print '<br>'.$langs->trans("Login").': <input class="with100" type="text" name="foruserlogin" value="'.GETPOST('foruserlogin').'">';
|
||||
print '<br><input type="submit" class="button small" value="'.$langs->trans("BuildDoc").'">';
|
||||
print '</form>';
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2014-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015-2022 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2015-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net>
|
||||
@ -89,9 +89,22 @@ class Adherent extends CommonObject
|
||||
*/
|
||||
public $pass_indatabase_crypted;
|
||||
|
||||
/**
|
||||
* @var string fullname
|
||||
*/
|
||||
public $fullname;
|
||||
|
||||
/**
|
||||
* @var string The civility code, not an integer
|
||||
*/
|
||||
public $civility_id;
|
||||
public $civility_code;
|
||||
public $civility;
|
||||
|
||||
/**
|
||||
* @var string company name
|
||||
* @deprecated
|
||||
* @see $company
|
||||
*/
|
||||
public $societe;
|
||||
|
||||
@ -102,8 +115,14 @@ class Adherent extends CommonObject
|
||||
|
||||
/**
|
||||
* @var int Thirdparty ID
|
||||
* @deprecated
|
||||
* @see $socid
|
||||
*/
|
||||
public $fk_soc;
|
||||
|
||||
/**
|
||||
* @var int socid
|
||||
*/
|
||||
public $socid;
|
||||
|
||||
/**
|
||||
@ -154,24 +173,28 @@ class Adherent extends CommonObject
|
||||
/**
|
||||
* @var string skype account
|
||||
* @deprecated
|
||||
* @see $socialnetworks
|
||||
*/
|
||||
public $skype;
|
||||
|
||||
/**
|
||||
* @var string twitter account
|
||||
* @deprecated
|
||||
* @see $socialnetworks
|
||||
*/
|
||||
public $twitter;
|
||||
|
||||
/**
|
||||
* @var string facebook account
|
||||
* @deprecated
|
||||
* @see $socialnetworks
|
||||
*/
|
||||
public $facebook;
|
||||
|
||||
/**
|
||||
* @var string linkedin account
|
||||
* @deprecated
|
||||
* @see $socialnetworks
|
||||
*/
|
||||
public $linkedin;
|
||||
|
||||
@ -259,10 +282,19 @@ class Adherent extends CommonObject
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* @var int need_subscription
|
||||
*/
|
||||
public $need_subscription;
|
||||
|
||||
/**
|
||||
* @var int user_id
|
||||
*/
|
||||
public $user_id;
|
||||
|
||||
/**
|
||||
* @var string user_login
|
||||
*/
|
||||
public $user_login;
|
||||
|
||||
public $datefin;
|
||||
@ -272,6 +304,10 @@ class Adherent extends CommonObject
|
||||
|
||||
public $first_subscription_date;
|
||||
|
||||
public $first_subscription_date_start;
|
||||
|
||||
public $first_subscription_date_end;
|
||||
|
||||
public $first_subscription_amount;
|
||||
|
||||
public $last_subscription_date;
|
||||
@ -284,6 +320,10 @@ class Adherent extends CommonObject
|
||||
|
||||
public $subscriptions = array();
|
||||
|
||||
/**
|
||||
* @var string ip
|
||||
*/
|
||||
public $ip;
|
||||
|
||||
// Fields loaded by fetchPartnerships() from partnership table
|
||||
|
||||
@ -400,11 +440,37 @@ class Adherent extends CommonObject
|
||||
* @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
|
||||
* @param string $errors_to erros to
|
||||
* @param string $moreinheader Add more html headers
|
||||
* @deprecated since V18
|
||||
* @see sendEmail()
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function send_an_email($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
dol_syslog('Warning using deprecated Adherent::send_an_email', LOG_WARNING);
|
||||
|
||||
return $this->sendEmail($text, $subject, $filename_list, $mimetype_list, $mimefilename_list, $addr_cc, $addr_bcc, $deliveryreceipt, $msgishtml, $errors_to, $moreinheader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function sending an email to the current member with the text supplied in parameter.
|
||||
*
|
||||
* @param string $text Content of message (not html entities encoded)
|
||||
* @param string $subject Subject of message
|
||||
* @param array $filename_list Array of attached files
|
||||
* @param array $mimetype_list Array of mime types of attached files
|
||||
* @param array $mimefilename_list Array of public names of attached files
|
||||
* @param string $addr_cc Email cc
|
||||
* @param string $addr_bcc Email bcc
|
||||
* @param int $deliveryreceipt Ask a delivery receipt
|
||||
* @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
|
||||
* @param string $errors_to erros to
|
||||
* @param string $moreinheader Add more html headers
|
||||
* @since V18
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function sendEmail($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '')
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
// Detect if message is HTML
|
||||
@ -425,8 +491,8 @@ class Adherent extends CommonObject
|
||||
|
||||
// Envoi mail confirmation
|
||||
$from = $conf->email_from;
|
||||
if (!empty($conf->global->ADHERENT_MAIL_FROM)) {
|
||||
$from = $conf->global->ADHERENT_MAIL_FROM;
|
||||
if (!empty(getDolGlobalString('ADHERENT_MAIL_FROM'))) {
|
||||
$from = getDolGlobalString('ADHERENT_MAIL_FROM');
|
||||
}
|
||||
|
||||
$trackid = 'mem'.$this->id;
|
||||
@ -576,7 +642,7 @@ class Adherent extends CommonObject
|
||||
*/
|
||||
public function create($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $conf, $langs, $mysoc;
|
||||
|
||||
$error = 0;
|
||||
|
||||
@ -605,7 +671,7 @@ class Adherent extends CommonObject
|
||||
|
||||
// Insert member
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent";
|
||||
$sql .= " (ref, datec,login,fk_user_author,fk_user_mod,fk_user_valid,morphy,fk_adherent_type,entity,import_key)";
|
||||
$sql .= " (ref, datec,login,fk_user_author,fk_user_mod,fk_user_valid,morphy,fk_adherent_type,entity,import_key, ip)";
|
||||
$sql .= " VALUES (";
|
||||
$sql .= " '(PROV)'";
|
||||
$sql .= ", '".$this->db->idate($this->datec)."'";
|
||||
@ -615,6 +681,7 @@ class Adherent extends CommonObject
|
||||
$sql .= ", ".((int) $this->typeid);
|
||||
$sql .= ", ".$conf->entity;
|
||||
$sql .= ", ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null");
|
||||
$sql .= ", ".(!empty($this->ip) ? "'".$this->db->escape($this->ip)."'" : "null");
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
@ -623,7 +690,22 @@ class Adherent extends CommonObject
|
||||
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent");
|
||||
if ($id > 0) {
|
||||
$this->id = $id;
|
||||
$this->ref = (string) $id;
|
||||
if (getDolGlobalString('MEMBER_CODEMEMBER_ADDON') == '') {
|
||||
// keep old numbering
|
||||
$this->ref = (string) $id;
|
||||
} else {
|
||||
// auto code
|
||||
$modfile = dol_buildpath('core/modules/member/'.getDolGlobalString('MEMBER_CODEMEMBER_ADDON').'.php', 0);
|
||||
try {
|
||||
require_once $modfile;
|
||||
$modname = getDolGlobalString('MEMBER_CODEMEMBER_ADDON');
|
||||
$modCodeMember = new $modname;
|
||||
$this->ref = $modCodeMember->getNextValue($mysoc, $this);
|
||||
} catch (Exception $e) {
|
||||
dol_syslog($e->getMessage(), LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// Update minor fields
|
||||
$result = $this->update($user, 1, 1, 0, 0, 'add'); // nosync is 1 to avoid update data of user
|
||||
@ -740,7 +822,7 @@ class Adherent extends CommonObject
|
||||
$sql .= ", state_id = ".($this->state_id > 0 ? $this->db->escape($this->state_id) : "null");
|
||||
$sql .= ", email = '".$this->db->escape($this->email)."'";
|
||||
$sql .= ", url = ".(!empty($this->url) ? "'".$this->db->escape($this->url)."'" : "null");
|
||||
$sql .= ", socialnetworks = '".$this->db->escape(json_encode($this->socialnetworks))."'";
|
||||
$sql .= ", socialnetworks = ".($this->socialnetworks ? "'".$this->db->escape(json_encode($this->socialnetworks))."'" : "null");
|
||||
$sql .= ", phone = ".($this->phone ? "'".$this->db->escape($this->phone)."'" : "null");
|
||||
$sql .= ", phone_perso = ".($this->phone_perso ? "'".$this->db->escape($this->phone_perso)."'" : "null");
|
||||
$sql .= ", phone_mobile = ".($this->phone_mobile ? "'".$this->db->escape($this->phone_mobile)."'" : "null");
|
||||
@ -1504,7 +1586,7 @@ class Adherent extends CommonObject
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||
|
||||
$sql = "SELECT c.rowid, c.fk_adherent, c.fk_type, c.subscription, c.note, c.fk_bank,";
|
||||
$sql = "SELECT c.rowid, c.fk_adherent, c.fk_type, c.subscription, c.note as note_public, c.fk_bank,";
|
||||
$sql .= " c.tms as datem,";
|
||||
$sql .= " c.datec as datec,";
|
||||
$sql .= " c.dateadh as dateh,";
|
||||
@ -1536,7 +1618,8 @@ class Adherent extends CommonObject
|
||||
$subscription->fk_adherent = $obj->fk_adherent;
|
||||
$subscription->fk_type = $obj->fk_type;
|
||||
$subscription->amount = $obj->subscription;
|
||||
$subscription->note = $obj->note;
|
||||
$subscription->note = $obj->note_public;
|
||||
$subscription->note_public = $obj->note_public;
|
||||
$subscription->fk_bank = $obj->fk_bank;
|
||||
$subscription->datem = $this->db->jdate($obj->datem);
|
||||
$subscription->datec = $this->db->jdate($obj->datec);
|
||||
@ -1643,8 +1726,7 @@ class Adherent extends CommonObject
|
||||
return -2;
|
||||
}
|
||||
} else {
|
||||
$this->error = $subscription->error;
|
||||
$this->errors = $subscription->errors;
|
||||
$this->setErrorsFromObject($subscription);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -1707,13 +1789,11 @@ class Adherent extends CommonObject
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
$this->error = $acct->error;
|
||||
$this->errors = $acct->errors;
|
||||
$this->setErrorsFromObject($acct);
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
$this->error = $acct->error;
|
||||
$this->errors = $acct->errors;
|
||||
$this->setErrorsFromObject($acct);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2193,6 +2273,64 @@ class Adherent extends CommonObject
|
||||
return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civility", "code", "label", $code);
|
||||
}
|
||||
|
||||
/**
|
||||
* getTooltipContentArray
|
||||
* @param array $params params to construct tooltip data
|
||||
* @since v18
|
||||
* @return array
|
||||
*/
|
||||
public function getTooltipContentArray($params)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->loadLangs(['members', 'companies']);
|
||||
$nofetch = !empty($params['nofetch']);
|
||||
|
||||
$datas = array();
|
||||
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
$langs->load("users");
|
||||
return ['optimize' => $langs->trans("ShowUser")];
|
||||
}
|
||||
if (!empty($this->photo)) {
|
||||
$photo = '<div class="photointooltip floatright">';
|
||||
$photo .= Form::showphoto('memberphoto', $this, 80, 0, 0, 'photoref photowithmargin photologintooltip', 'small', 0, 1);
|
||||
$photo .= '</div>';
|
||||
$datas['photo'] = $photo;
|
||||
}
|
||||
|
||||
$datas['divopen'] = '<div class="centpercent">';
|
||||
$datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Member").'</u> '.$this->getLibStatut(4);
|
||||
if (!empty($this->morphy)) {
|
||||
$datas['picto'] .= ' ' . $this->getmorphylib('', 1);
|
||||
}
|
||||
if (!empty($this->ref)) {
|
||||
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
}
|
||||
if (!empty($this->login)) {
|
||||
$datas['login'] = '<br><b>'.$langs->trans('Login').':</b> '.$this->login;
|
||||
}
|
||||
if (!empty($this->firstname) || !empty($this->lastname)) {
|
||||
$datas['name'] = '<br><b>'.$langs->trans('Name').':</b> '.$this->getFullName($langs);
|
||||
}
|
||||
if (!empty($this->company)) {
|
||||
$datas['company'] = '<br><b>'.$langs->trans('Company').':</b> '.$this->company;
|
||||
}
|
||||
if (!empty($this->email)) {
|
||||
$datas['email'] = '<br><b>'.$langs->trans("EMail").':</b> '.$this->email;
|
||||
}
|
||||
$datas['address'] = '<br><b>'.$langs->trans("Address").':</b> '.dol_format_address($this, 1, ' ', $langs);
|
||||
// show categories for this record only in ajax to not overload lists
|
||||
if (isModEnabled('categorie') && !$nofetch) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||
$form = new Form($this->db);
|
||||
$datas['categories'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_MEMBER, 1);
|
||||
}
|
||||
$datas['divclose'] = '</div>';
|
||||
|
||||
return $datas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
@ -2215,34 +2353,24 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
$result = '';
|
||||
$label = '';
|
||||
$linkstart = '';
|
||||
$linkend = '';
|
||||
|
||||
if (!empty($this->photo)) {
|
||||
$label .= '<div class="photointooltip floatright">';
|
||||
$label .= Form::showphoto('memberphoto', $this, 80, 0, 0, 'photoref photowithmargin photologintooltip', 'small', 0, 1);
|
||||
$label .= '</div>';
|
||||
//$label .= '<div style="clear: both;"></div>';
|
||||
$classfortooltip = 'classfortooltip';
|
||||
$dataparams = '';
|
||||
$params = [
|
||||
'id' => $this->id,
|
||||
'objecttype' => $this->element,
|
||||
'option' => $option,
|
||||
'nofetch' => 1,
|
||||
];
|
||||
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
|
||||
$classfortooltip = 'classforajaxtooltip';
|
||||
$dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"';
|
||||
$label = '';
|
||||
} else {
|
||||
$label = implode($this->getTooltipContentArray($params));
|
||||
}
|
||||
|
||||
$label .= '<div class="centpercent">';
|
||||
$label .= img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Member").'</u>';
|
||||
$label .= ' '.$this->getLibStatut(4);
|
||||
if (!empty($this->ref)) {
|
||||
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
}
|
||||
if (!empty($this->login)) {
|
||||
$label .= '<br><b>'.$langs->trans('Login').':</b> '.$this->login;
|
||||
}
|
||||
if (!empty($this->firstname) || !empty($this->lastname)) {
|
||||
$label .= '<br><b>'.$langs->trans('Name').':</b> '.$this->getFullName($langs);
|
||||
}
|
||||
if (!empty($this->company)) {
|
||||
$label .= '<br><b>'.$langs->trans('Company').':</b> '.$this->company;
|
||||
}
|
||||
$label .= '</div>';
|
||||
|
||||
$url = DOL_URL_ROOT.'/adherents/card.php?rowid='.((int) $this->id);
|
||||
if ($option == 'subscription') {
|
||||
$url = DOL_URL_ROOT.'/adherents/subscription.php?rowid='.((int) $this->id);
|
||||
@ -2267,8 +2395,8 @@ class Adherent extends CommonObject
|
||||
$label = $langs->trans("ShowUser");
|
||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
|
||||
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
|
||||
}
|
||||
|
||||
$linkstart .= $linkclose.'>';
|
||||
@ -2281,12 +2409,12 @@ class Adherent extends CommonObject
|
||||
if ($withpictoimg) {
|
||||
$paddafterimage = '';
|
||||
if (abs($withpictoimg) == 1) {
|
||||
$paddafterimage = 'style="margin-right: 3px;"';
|
||||
$morecss .= ' paddingrightonly';
|
||||
}
|
||||
// Only picto
|
||||
if ($withpictoimg > 0) {
|
||||
$picto = '<span class="nopadding'.($morecss ? ' userimg'.$morecss : '').'">'.
|
||||
img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : 'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1).'</span>';
|
||||
img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : $dataparams.' class="'.$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1).'</span>';
|
||||
} else {
|
||||
// Picto must be a photo
|
||||
$picto = '<span class="nopadding'.($morecss ? ' userimg'.$morecss : '').'"'.($paddafterimage ? ' '.$paddafterimage : '').'>';
|
||||
@ -2374,7 +2502,7 @@ class Adherent extends CommonObject
|
||||
$labelStatus = $langs->trans("MemberStatusDraft");
|
||||
$labelStatusShort = $langs->trans("MemberStatusDraftShort");
|
||||
} elseif ($status >= self::STATUS_VALIDATED) {
|
||||
if ($need_subscription == 0) {
|
||||
if ($need_subscription === 0) {
|
||||
$statusType = 'status4';
|
||||
$labelStatus = $langs->trans("MemberStatusNoSubscription");
|
||||
$labelStatusShort = $langs->trans("MemberStatusNoSubscriptionShort");
|
||||
@ -2870,8 +2998,8 @@ class Adherent extends CommonObject
|
||||
* Adds it to non existing supplied categories.
|
||||
* Existing categories are left untouch.
|
||||
*
|
||||
* @param int[]|int $categories Category or categories IDs
|
||||
* @return void
|
||||
* @param int[]|int $categories Category or categories IDs
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setCategories($categories)
|
||||
{
|
||||
@ -2957,17 +3085,18 @@ class Adherent extends CommonObject
|
||||
dol_syslog(__METHOD__.' - Process delta = '.$daysbeforeend, LOG_DEBUG);
|
||||
|
||||
if (!is_numeric($daysbeforeend)) {
|
||||
$blockingerrormsg = "Value for delta is not a positive or negative numeric";
|
||||
$blockingerrormsg = "Value for delta is not a numeric value";
|
||||
$nbko++;
|
||||
break;
|
||||
}
|
||||
|
||||
$tmp = dol_getdate($now);
|
||||
$datetosearchfor = dol_time_plus_duree(dol_mktime(0, 0, 0, $tmp['mon'], $tmp['mday'], $tmp['year']), $daysbeforeend, 'd');
|
||||
$datetosearchfor = dol_time_plus_duree(dol_mktime(0, 0, 0, $tmp['mon'], $tmp['mday'], $tmp['year'], 'tzserver'), $daysbeforeend, 'd');
|
||||
|
||||
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'adherent';
|
||||
$sql .= " WHERE entity = ".$conf->entity; // Do not use getEntity('adherent').")" here, we want the batch to be on its entity only;
|
||||
$sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity('adherent').")" here, we want the batch to be on its entity only;
|
||||
$sql .= " AND datefin = '".$this->db->idate($datetosearchfor)."'";
|
||||
//$sql .= " LIMIT 10000";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -3000,7 +3129,7 @@ class Adherent extends CommonObject
|
||||
dol_syslog("sendReminderForExpiredSubscription Language for member id ".$adherent->id." set to ".$outputlangs->defaultlang." mysoc->default_lang=".$mysoc->default_lang);
|
||||
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION;
|
||||
$labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION');
|
||||
|
||||
if (!empty($labeltouse)) {
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
@ -3013,7 +3142,7 @@ class Adherent extends CommonObject
|
||||
|
||||
$subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs);
|
||||
$msg = make_substitutions($arraydefaultmessage->content, $substitutionarray, $outputlangs);
|
||||
$from = $conf->global->ADHERENT_MAIL_FROM;
|
||||
$from = getDolGlobalString('ADHERENT_MAIL_FROM');
|
||||
$to = $adherent->email;
|
||||
|
||||
$trackid = 'mem'.$adherent->id;
|
||||
@ -3024,7 +3153,7 @@ class Adherent extends CommonObject
|
||||
$result = $cmail->sendfile();
|
||||
if (!$result) {
|
||||
$error++;
|
||||
$this->error = $cmail->error;
|
||||
$this->error .= $cmail->error.' ';
|
||||
if (!is_null($cmail->errors)) {
|
||||
$this->errors += $cmail->errors;
|
||||
}
|
||||
@ -3042,8 +3171,7 @@ class Adherent extends CommonObject
|
||||
$extraparams = '';
|
||||
|
||||
$actionmsg = '';
|
||||
$actionmsg2 = $langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from, 4, 0, 1).' '.$langs->transnoentities('To').' '.
|
||||
CMailFile::getValidAddress($sendto, 4, 0, 1);
|
||||
$actionmsg2 = $langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from, 4, 0, 1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto, 4, 0, 1);
|
||||
if ($message) {
|
||||
$actionmsg = $langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto));
|
||||
@ -3090,7 +3218,10 @@ class Adherent extends CommonObject
|
||||
$actioncomm->create($user);
|
||||
}
|
||||
} else {
|
||||
$blockingerrormsg = "Can't find email template, defined into member module setup, to use for reminding";
|
||||
//$blockingerrormsg = "Can't find email template with label=".$labeltouse.", to use for the reminding email";
|
||||
|
||||
$error++;
|
||||
$this->error .= "Can't find email template with label=".$labeltouse.", to use for the reminding email ";
|
||||
|
||||
$nbko++;
|
||||
$listofmembersko[$adherent->id] = $adherent->id;
|
||||
@ -3132,7 +3263,8 @@ class Adherent extends CommonObject
|
||||
if ($listofids) {
|
||||
$listofids .= ']';
|
||||
}
|
||||
$this->output .= $listofids;
|
||||
|
||||
$this->output .= ($listofids ? ' ids='.$listofids : '');
|
||||
}
|
||||
if ($nbko) {
|
||||
$this->output .= ' - Canceled for '.$nbko.' member (no email or email sending error)';
|
||||
@ -3155,11 +3287,49 @@ class Adherent extends CommonObject
|
||||
if ($listofids) {
|
||||
$listofids .= ']';
|
||||
}
|
||||
$this->output .= $listofids;
|
||||
$this->output .= ($listofids ? ' ids='.$listofids : '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return $nbko;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return clicable link of object (with eventually picto)
|
||||
*
|
||||
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
|
||||
* @param array $arraydata Array of data
|
||||
* @return string HTML Code for Kanban thumb.
|
||||
*/
|
||||
public function getKanbanView($option = '', $arraydata = null)
|
||||
{
|
||||
global $selected;
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
if (property_exists($this, 'photo') || !empty($this->photo)) {
|
||||
$return.= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1);
|
||||
} else {
|
||||
$return .= img_picto('', 'user');
|
||||
}
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
|
||||
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
if (property_exists($this, 'type')) {
|
||||
$return .= '<br><span class="info-box-label opacitymedium">'.$this->type.'</span>';
|
||||
}
|
||||
if (method_exists($this, 'getmorphylib')) {
|
||||
$return .= '<br><span class="info-box-label">'.$this->getmorphylib('', 2).'</span>';
|
||||
}
|
||||
if (method_exists($this, 'getLibStatut')) {
|
||||
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(3).'</div>';
|
||||
}
|
||||
$return .= '</div>';
|
||||
$return .= '</div>';
|
||||
$return .= '</div>';
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,6 +129,19 @@ class AdherentType extends CommonObject
|
||||
/** @var string string other */
|
||||
public $other = array();
|
||||
|
||||
/**
|
||||
* @var string description
|
||||
*/
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* @var string email
|
||||
*/
|
||||
public $email;
|
||||
|
||||
/**
|
||||
* @var array multilangs
|
||||
*/
|
||||
public $multilangs = array();
|
||||
|
||||
|
||||
@ -319,7 +332,7 @@ class AdherentType extends CommonObject
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'".$this->db->escape($this->morphy)."'";
|
||||
$sql .= ", '".$this->db->escape($this->label)."'";
|
||||
$sql .= ", ".$conf->entity;
|
||||
$sql .= ", ".((int) $conf->entity);
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog("Adherent_type::create", LOG_DEBUG);
|
||||
@ -472,7 +485,7 @@ class AdherentType extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that retrieves the status of the member
|
||||
* Function that retrieves the properties of a membership type
|
||||
*
|
||||
* @param int $rowid Id of member type to load
|
||||
* @return int <0 if KO, >0 if OK
|
||||
@ -626,7 +639,7 @@ class AdherentType extends CommonObject
|
||||
$sql .= ' AND ('.$excludefilter.')';
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::listUsersForGroup", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::listMembersForMemberType", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
@ -675,6 +688,40 @@ class AdherentType extends CommonObject
|
||||
//return $morphy;
|
||||
}
|
||||
|
||||
/**
|
||||
* getTooltipContentArray
|
||||
* @param array $params params to construct tooltip data
|
||||
* @since v18
|
||||
* @return array
|
||||
*/
|
||||
public function getTooltipContentArray($params)
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
|
||||
$langs->load('members');
|
||||
|
||||
$datas = [];
|
||||
$datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("MemberType").'</u> '.$this->getLibStatut(4);
|
||||
$datas['label'] = '<br>'.$langs->trans("Label").': '.$this->label;
|
||||
if (isset($this->subscription)) {
|
||||
$datas['subscription'] = '<br>'.$langs->trans("SubscriptionRequired").': '.yn($this->subscription);
|
||||
}
|
||||
if (isset($this->vote)) {
|
||||
$datas['vote'] = '<br>'.$langs->trans("VoteAllowed").': '.yn($this->vote);
|
||||
}
|
||||
if (isset($this->duration)) {
|
||||
$datas['duration'] = '<br>'.$langs->trans("Duration").': '.$this->duration_value;
|
||||
if ($this->duration_value > 1) {
|
||||
$dur = array("i"=>$langs->trans("Minutes"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years"));
|
||||
} elseif ($this->duration_value > 0) {
|
||||
$dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year"));
|
||||
}
|
||||
$datas['duration'] .= " " . (!empty($this->duration_unit) && isset($dur[$this->duration_unit]) ? $langs->trans($dur[$this->duration_unit]) : '');
|
||||
}
|
||||
|
||||
return $datas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
@ -690,18 +737,25 @@ class AdherentType extends CommonObject
|
||||
global $langs;
|
||||
|
||||
$result = '';
|
||||
|
||||
$label = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("MemberType").'</u>';
|
||||
$label .= ' '.$this->getLibStatut(4);
|
||||
$label .= '<br>'.$langs->trans("Label").': '.$this->label;
|
||||
if (isset($this->subscription)) {
|
||||
$label .= '<br>'.$langs->trans("SubscriptionRequired").': '.yn($this->subscription);
|
||||
}
|
||||
|
||||
$option = '';
|
||||
|
||||
$url = DOL_URL_ROOT.'/adherents/type.php?rowid='.((int) $this->id);
|
||||
$classfortooltip = 'classfortooltip';
|
||||
$dataparams = '';
|
||||
$params = [
|
||||
'id' => $this->id,
|
||||
'objecttype' => $this->element,
|
||||
'option' => $option,
|
||||
'nofetch' => 1,
|
||||
];
|
||||
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
|
||||
$classfortooltip = 'classforajaxtooltip';
|
||||
$dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"';
|
||||
$label = '';
|
||||
} else {
|
||||
$label = implode($this->getTooltipContentArray($params));
|
||||
}
|
||||
|
||||
$url = DOL_URL_ROOT.'/adherents/type.php?rowid='.((int) $this->id);
|
||||
if ($option != 'nolink') {
|
||||
// Add param to save lastsearch_values or not
|
||||
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
|
||||
@ -712,13 +766,15 @@ class AdherentType extends CommonObject
|
||||
$url .= '&save_lastsearch_values=1';
|
||||
}
|
||||
}
|
||||
$linkstart = '<a href="'.$url.'"';
|
||||
$linkstart .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
|
||||
$linkstart .= $dataparams.' class="'.$classfortooltip.'">';
|
||||
|
||||
$linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend = '</a>';
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) {
|
||||
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
|
||||
}
|
||||
if ($withpicto != 2) {
|
||||
$result .= ($maxlen ?dol_trunc($this->label, $maxlen) : $this->label);
|
||||
@ -728,7 +784,6 @@ class AdherentType extends CommonObject
|
||||
return $result;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return label of status (activity, closed)
|
||||
*
|
||||
@ -740,6 +795,7 @@ class AdherentType extends CommonObject
|
||||
return $this->LibStatut($this->status, $mode);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return the label of a given status
|
||||
*
|
||||
@ -927,4 +983,51 @@ class AdherentType extends CommonObject
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return clicable link of object (with eventually picto)
|
||||
*
|
||||
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
|
||||
* @param array $arraydata Array of data
|
||||
* @return string HTML Code for Kanban thumb.
|
||||
*/
|
||||
public function getKanbanView($option = '', $arraydata = null)
|
||||
{
|
||||
global $langs, $user;
|
||||
|
||||
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
|
||||
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
$return .= img_picto('', $this->picto);
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
|
||||
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
if ($user->rights->adherent->configurer) {
|
||||
$return .= '<span class="right paddingleft"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$this->ref.'">'.img_edit().'</a></span>';
|
||||
} else {
|
||||
$return .= '<span class="right"> </span>';
|
||||
}
|
||||
if (property_exists($this, 'vote')) {
|
||||
$return .= '<br><span class="info-box-label opacitymedium">'.$langs->trans("VoteAllowed").' : '.yn($this->vote).'</span>';
|
||||
}
|
||||
if (property_exists($this, 'amount')) {
|
||||
if (is_null($this->amount) || $this->amount === '') {
|
||||
$return .= '<br>';
|
||||
} else {
|
||||
$return .= '<br><span class="info-box-label opacitymedium">'.$langs->trans("Amount").'</span>';
|
||||
$return .= '<span class="amount"> : '.price($this->amount).'</span>';
|
||||
}
|
||||
}
|
||||
if (method_exists($this, 'getLibStatut')) {
|
||||
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(3).'</div>';
|
||||
}
|
||||
$return .= '</div>';
|
||||
$return .= '</div>';
|
||||
$return .= '</div>';
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ class AdherentStats extends Stats
|
||||
*/
|
||||
public function __construct($db, $socid = 0, $userid = 0)
|
||||
{
|
||||
global $user, $conf;
|
||||
global $conf;
|
||||
|
||||
$this->db = $db;
|
||||
$this->socid = $socid;
|
||||
@ -87,8 +87,6 @@ class AdherentStats extends Stats
|
||||
*/
|
||||
public function getNbByMonth($year, $format = 0)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//if (empty($user->rights->societe->client->voir) && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -107,8 +105,6 @@ class AdherentStats extends Stats
|
||||
*/
|
||||
public function getNbByYear()
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.dateadh,'%Y') as dm, count(*)";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//if (empty($user->rights->societe->client->voir) && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -128,8 +124,6 @@ class AdherentStats extends Stats
|
||||
*/
|
||||
public function getAmountByMonth($year, $format = 0)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//if (empty($user->rights->societe->client->voir) && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -149,8 +143,6 @@ class AdherentStats extends Stats
|
||||
*/
|
||||
public function getAverageByMonth($year)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//if (empty($user->rights->societe->client->voir) && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -170,8 +162,6 @@ class AdherentStats extends Stats
|
||||
*/
|
||||
public function getAllByYear()
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.dateadh,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//if (empty($user->rights->societe->client->voir) && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -181,4 +171,82 @@ class AdherentStats extends Stats
|
||||
|
||||
return $this->_getAllByYear($sql);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return count of member by status group by adh type, total and average
|
||||
*
|
||||
* @param int $numberYears Years to scan
|
||||
* @return array Array with total of draft, pending, uptodate, expired, resiliated for each member tag
|
||||
*/
|
||||
public function countMembersByTagAndStatus($numberYears = 2)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$now = dol_now();
|
||||
$endYear = date('Y');
|
||||
$startYear = $endYear - $numberYears;
|
||||
|
||||
$sql = "SELECT c.rowid as fk_categorie, c.label as label";
|
||||
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_DRAFT, "'members_draft'", 'NULL').") as members_draft";
|
||||
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin IS NULL AND t.subscription = '1')", "'members_pending'", 'NULL').") as members_pending";
|
||||
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin >= '".$this->db->idate($now)."' OR t.subscription = 0)", "'members_uptodate'", 'NULL').") as members_uptodate";
|
||||
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin < '".$this->db->idate($now)."' AND t.subscription = 1)", "'members_expired'", 'NULL').") as members_expired";
|
||||
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_EXCLUDED, "'members_excluded'", 'NULL').") as members_excluded";
|
||||
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_RESILIATED, "'members_resiliated'", 'NULL').") as members_resiliated";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."categorie as c";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_member as ct ON c.rowid = ct.fk_categorie";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d ON d.rowid = ct.fk_member";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_type as t ON t.rowid = d.fk_adherent_type";
|
||||
$sql .= " WHERE c.entity IN (".getEntity('member_type').")";
|
||||
$sql .= " AND d.entity IN (" . getEntity('adherent') . ")";
|
||||
$sql .= " AND t.entity IN (" . getEntity('adherent') . ")";
|
||||
$sql .= " AND d.datefin > '".$this->db->idate(dol_get_first_day($startYear))."'";
|
||||
$sql .= " AND c.fk_parent = 0";
|
||||
$sql .= " GROUP BY c.rowid";
|
||||
|
||||
dol_syslog("box_members_by_type::select nb of members per type", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
$MembersCountArray = [];
|
||||
$totalstatus = array(
|
||||
'label' => 'Total',
|
||||
'members_draft' => 0,
|
||||
'members_pending' => 0,
|
||||
'members_uptodate' => 0,
|
||||
'members_expired' => 0,
|
||||
'members_excluded' => 0,
|
||||
'members_resiliated' => 0
|
||||
);
|
||||
while ($i < $num) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$MembersCountArray[$objp->fk_categorie] = array(
|
||||
'label' => $objp->label,
|
||||
'members_draft' => (int) $objp->members_draft,
|
||||
'members_pending' => (int) $objp->members_pending,
|
||||
'members_uptodate' => (int) $objp->members_uptodate,
|
||||
'members_expired' => (int) $objp->members_expired,
|
||||
'members_excluded' => (int) $objp->members_excluded,
|
||||
'members_resiliated' => (int) $objp->members_resiliated
|
||||
);
|
||||
$totalrow = 0;
|
||||
foreach ($MembersCountArray[$objp->fk_categorie] as $key=>$nb) {
|
||||
if ($key!='label') {
|
||||
$totalrow += $nb;
|
||||
$totalstatus[$key] += $nb;
|
||||
}
|
||||
}
|
||||
$MembersCountArray[$objp->fk_categorie]['total_adhtype'] = $totalrow;
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($result);
|
||||
$MembersCountArray['total'] = $totalstatus;
|
||||
$MembersCountArray['total']['all'] = array_sum($totalstatus);
|
||||
}
|
||||
return $MembersCountArray;
|
||||
}
|
||||
}
|
||||
|
||||