Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into new_develop_expense_report
This commit is contained in:
commit
b8865c425f
54
.travis.yml
54
.travis.yml
@ -2,6 +2,7 @@
|
|||||||
# from Dolibarr GitHub repository.
|
# from Dolibarr GitHub repository.
|
||||||
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
|
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
|
||||||
|
|
||||||
|
dist: precise
|
||||||
sudo: required
|
sudo: required
|
||||||
|
|
||||||
language: php
|
language: php
|
||||||
@ -10,22 +11,28 @@ php:
|
|||||||
- '5.3'
|
- '5.3'
|
||||||
- '5.4'
|
- '5.4'
|
||||||
- '5.5'
|
- '5.5'
|
||||||
- '5.6'
|
- '5.6.29'
|
||||||
- '7.0'
|
- '7.0'
|
||||||
- '7.1'
|
- '7.1'
|
||||||
- nightly
|
- nightly
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
mariadb: '10.0'
|
mariadb: '10.0'
|
||||||
# FIXME: find a way to import a MySQL dump into PostgreSQL
|
postgresql: '9.3'
|
||||||
#postgresql: '9.3'
|
|
||||||
apt:
|
apt:
|
||||||
|
sources:
|
||||||
|
# To use the last version of pgloader, we add repo of postgresql
|
||||||
|
- postgresql
|
||||||
|
- sourceline: 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main'
|
||||||
|
- key_url: 'https://www.postgresql.org/media/keys/ACCC4CF8.asc'
|
||||||
packages:
|
packages:
|
||||||
# We need a webserver to test the webservices
|
# We need a webserver to test the webservices
|
||||||
# Let's install Apache with.
|
# Let's install Apache with.
|
||||||
- apache2
|
- apache2
|
||||||
# mod_php is not supported by Travis. Add fcgi. We install FPM later on.
|
# mod_php is not supported by Travis. Add fcgi. We install FPM later on.
|
||||||
- libapache2-mod-fastcgi
|
- libapache2-mod-fastcgi
|
||||||
|
# We need pgloader for import mysql database into pgsql
|
||||||
|
- pgloader
|
||||||
|
|
||||||
# Start on every boot
|
# Start on every boot
|
||||||
services:
|
services:
|
||||||
@ -39,8 +46,7 @@ env:
|
|||||||
# MariaDB overrides MySQL installation so it's not possible to test both yet
|
# MariaDB overrides MySQL installation so it's not possible to test both yet
|
||||||
#- DB=mysql
|
#- DB=mysql
|
||||||
- DB=mariadb
|
- DB=mariadb
|
||||||
# FIXME: find a way to import a MySQL dump into PostgreSQL
|
- DB=postgresql
|
||||||
#- DB=postgresql
|
|
||||||
# TODO
|
# TODO
|
||||||
#- DB=sqlite
|
#- DB=sqlite
|
||||||
# See https://docs.travis-ci.com/user/languages/php/#Apache-%2B-PHP
|
# See https://docs.travis-ci.com/user/languages/php/#Apache-%2B-PHP
|
||||||
@ -53,7 +59,6 @@ matrix:
|
|||||||
allow_failures:
|
allow_failures:
|
||||||
- php: 7.1
|
- php: 7.1
|
||||||
- php: nightly
|
- php: nightly
|
||||||
# FIXME
|
|
||||||
#- env: DB=postgresql
|
#- env: DB=postgresql
|
||||||
# TODO
|
# TODO
|
||||||
#- env: DB=sqlite
|
#- env: DB=sqlite
|
||||||
@ -77,6 +82,13 @@ before_install:
|
|||||||
phpenv config-rm xdebug.ini
|
phpenv config-rm xdebug.ini
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
- |
|
||||||
|
if [ "$DB" = 'postgresql' ]; then
|
||||||
|
echo "Check pgloader version"
|
||||||
|
pgloader --version
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- |
|
- |
|
||||||
echo "Updating Composer"
|
echo "Updating Composer"
|
||||||
@ -132,10 +144,10 @@ before_script:
|
|||||||
echo "Set timezone"
|
echo "Set timezone"
|
||||||
echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
||||||
if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ]; then
|
if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ]; then
|
||||||
echo
|
#echo
|
||||||
echo "Enabling APC for PHP <= 5.4"
|
#echo "Enabling APC for PHP <= 5.4"
|
||||||
# Documentation says it should be available for PHP <= 5.6 but it's not for 5.5 and 5.6!
|
# Documentation says it should be available for PHP <= 5.6 but it's not for 5.5 and 5.6!
|
||||||
echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
#echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
||||||
echo
|
echo
|
||||||
echo "Enabling Memcached for PHP <= 5.4"
|
echo "Enabling Memcached for PHP <= 5.4"
|
||||||
# Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0, 7.1 and nightly!
|
# Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0, 7.1 and nightly!
|
||||||
@ -164,16 +176,19 @@ before_script:
|
|||||||
|
|
||||||
- |
|
- |
|
||||||
echo "Setting up database"
|
echo "Setting up database"
|
||||||
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then
|
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then
|
||||||
echo "MySQL"
|
echo "MySQL"
|
||||||
mysql -e 'DROP DATABASE IF EXISTS travis;'
|
mysql -e 'DROP DATABASE IF EXISTS travis;'
|
||||||
mysql -e 'CREATE DATABASE IF NOT EXISTS travis;'
|
mysql -e 'CREATE DATABASE IF NOT EXISTS travis;'
|
||||||
|
mysql -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;'
|
||||||
|
mysql -e 'FLUSH PRIVILEGES;'
|
||||||
mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||||
fi
|
fi
|
||||||
# FIXME: find a way to import a MySQL dump into PostgreSQL
|
if [ "$DB" = 'postgresql' ]; then
|
||||||
#if [ "$DB" = 'postgresql' ]; then
|
#pgsql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||||
# pgsql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
#pgloader mysql://root:pass@127.0.0.1/base postgresql://dolibarrowner@127.0.0.1/dolibarr
|
||||||
#fi
|
pgloader mysql://root@127.0.0.1/travis postgresql:///travis
|
||||||
|
fi
|
||||||
# TODO: SQLite
|
# TODO: SQLite
|
||||||
echo
|
echo
|
||||||
|
|
||||||
@ -190,10 +205,9 @@ before_script:
|
|||||||
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then
|
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then
|
||||||
echo '$'dolibarr_main_db_type=\'mysqli\'';' >> $CONF_FILE
|
echo '$'dolibarr_main_db_type=\'mysqli\'';' >> $CONF_FILE
|
||||||
fi
|
fi
|
||||||
# FIXME
|
if [ "$DB" = 'postgresql' ]; then
|
||||||
#if [ "$DB" = 'postgresql' ]; then
|
echo '$'dolibarr_main_db_type=\'pgsql\'';' >> $CONF_FILE
|
||||||
# echo '$'dolibarr_main_db_type=\'pgsql\'';' >> $CONF_FILE
|
fi
|
||||||
#fi
|
|
||||||
# TODO: SQLite
|
# TODO: SQLite
|
||||||
echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> $CONF_FILE
|
echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> $CONF_FILE
|
||||||
cat $CONF_FILE
|
cat $CONF_FILE
|
||||||
@ -252,8 +266,6 @@ script:
|
|||||||
set +e
|
set +e
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# TODO: dev/* checks
|
|
||||||
|
|
||||||
- |
|
- |
|
||||||
echo "Checking coding style"
|
echo "Checking coding style"
|
||||||
# Ensure we catch errors
|
# Ensure we catch errors
|
||||||
@ -267,8 +279,6 @@ script:
|
|||||||
|
|
||||||
# TODO: Check CSS (csslint?)
|
# TODO: Check CSS (csslint?)
|
||||||
|
|
||||||
# TODO: check SQL syntax (pgsanity?)
|
|
||||||
|
|
||||||
- |
|
- |
|
||||||
echo "Upgrading Dolibarr"
|
echo "Upgrading Dolibarr"
|
||||||
# Ensure we catch errors
|
# Ensure we catch errors
|
||||||
|
|||||||
25
ChangeLog
25
ChangeLog
@ -31,6 +31,31 @@ Following changes may create regression for some external modules, but were nece
|
|||||||
content by doing a print into function, sometimes by returning content into "resprint". This has been fixed to follow
|
content by doing a print into function, sometimes by returning content into "resprint". This has been fixed to follow
|
||||||
hook specifications so you must return output into "resprint".
|
hook specifications so you must return output into "resprint".
|
||||||
|
|
||||||
|
|
||||||
|
***** ChangeLog for 5.0.4 compared to 5.0.3 *****
|
||||||
|
FIX: #5640 Prices of a predefined product/service were incorrect under certain circumstances
|
||||||
|
FIX: #6541 since 4.0.4 to 5.0.0 autofill zip/town not working
|
||||||
|
FIX: #6880 #6925
|
||||||
|
FIX: #6885
|
||||||
|
FIX: #6926
|
||||||
|
FIX: #7003
|
||||||
|
FIX: #7012
|
||||||
|
FIX: #7040
|
||||||
|
FIX: #7048 #6075
|
||||||
|
FIX: Can set supplier invoice to billed.
|
||||||
|
FIX: Can't create invoice if PO disapproved
|
||||||
|
FIX: contratligne update
|
||||||
|
FIX: CVE-2017-7886
|
||||||
|
FIX: default param
|
||||||
|
FIX: Line of invoices not inserted when using POS module and VAT NPR.
|
||||||
|
FIX: origin & originid on supplierproposal
|
||||||
|
FIX: Redirect to payment page from member subscription page failed if a unique security key was defined.
|
||||||
|
FIX: REST api to get project when user has permission to read all.
|
||||||
|
FIX: situation_progress param default value must be 100 and not 0
|
||||||
|
FIX: SQL injection on user/index.php parameter search_statut.
|
||||||
|
FIX: vat code not saved during product creation.
|
||||||
|
FIX: Warnings
|
||||||
|
|
||||||
***** ChangeLog for 5.0.3 compared to 5.0.2 *****
|
***** ChangeLog for 5.0.3 compared to 5.0.2 *****
|
||||||
FIX: #6677 Expired contracts dashboard box does not show the name of the thirdparty
|
FIX: #6677 Expired contracts dashboard box does not show the name of the thirdparty
|
||||||
FIX: #6813
|
FIX: #6813
|
||||||
|
|||||||
31
README-FR.md
31
README-FR.md
@ -98,7 +98,10 @@ Voir fichier ChangeLog.
|
|||||||
- Rapports
|
- Rapports
|
||||||
- Imports/Exports des données
|
- Imports/Exports des données
|
||||||
- Connectivité LDAP
|
- Connectivité LDAP
|
||||||
- De nombreuses autres fonctionnalités issues de modules officiels ou non (AWStats, Bittorrent, Gravatar, Google, Webcalendar...)
|
- Intégratn de ClickToDial
|
||||||
|
- Intégration RSS
|
||||||
|
- Intégation Skype
|
||||||
|
- Intégration de système de paiements (Paypal, Strip, Paybox...)
|
||||||
- …
|
- …
|
||||||
|
|
||||||
### Divers:
|
### Divers:
|
||||||
@ -114,17 +117,39 @@ Voir fichier ChangeLog.
|
|||||||
- Code simple et facilement personnalisable (pas de framework lourd; mécanisme de hook et triggers).
|
- Code simple et facilement personnalisable (pas de framework lourd; mécanisme de hook et triggers).
|
||||||
- APIs.
|
- APIs.
|
||||||
- Génération PDF et ODT des éléments (factures, propositions commerciales, commandes, bons expéditions, etc...)
|
- Génération PDF et ODT des éléments (factures, propositions commerciales, commandes, bons expéditions, etc...)
|
||||||
|
- …
|
||||||
|
|
||||||
|
### Extension
|
||||||
|
|
||||||
|
Dolibarr peut aussi être étendu à volonté avec l'ajout de module/applications externes développées par des développeus tiers, disponible sur [DoliStore](https://www.dolistore.com).
|
||||||
|
|
||||||
|
|
||||||
## CE QUE DOLIBARR NE PEUT PAS FAIRE (TACHES A FAIRE)
|
## CE QUE DOLIBARR NE PEUT PAS (ENCORE) FAIRE
|
||||||
|
|
||||||
Voici un liste de fonctionnalites pas encore gérées par Dolibarr:
|
Voici un liste de fonctionnalites pas encore gérées par Dolibarr:
|
||||||
- Dolibarr ne contient pas de module de Gestion de la paie.
|
- Dolibarr ne contient pas de module de Gestion de la paie.
|
||||||
- Les tâches du module de gestion de projets n'ont pas de dépendances entre elle.
|
- Les tâches du module de gestion de projets n'ont pas de dépendances entre elle.
|
||||||
- Dolibarr ne contient pas de Webmail.
|
- Dolibarr n'embarque pas de Webmail intégré nativement.
|
||||||
- Dolibarr ne fait pas le café (pas encore).
|
- Dolibarr ne fait pas le café (pas encore).
|
||||||
|
|
||||||
|
|
||||||
|
## DOCUMENTATION
|
||||||
|
|
||||||
|
Les documentations utilisateur, développeur et traducteur sont disponible sous forme de ressources de la communautés via la site [Wiki](https://wiki.dolibarr.org).
|
||||||
|
|
||||||
|
|
||||||
|
## CONTRIBUTING
|
||||||
|
|
||||||
|
Voir le fichier [CONTRIBUTING](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)
|
||||||
|
|
||||||
|
|
||||||
|
## CREDITS
|
||||||
|
|
||||||
|
Dolibarr est le résultat du travail de nombreux contributeurs depuis des années et utilise des librairies d'autres contributeurs.
|
||||||
|
|
||||||
|
Voir le fichier [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT)
|
||||||
|
|
||||||
|
|
||||||
## ACTUALITES ET RESEAUX SOCIAUX
|
## ACTUALITES ET RESEAUX SOCIAUX
|
||||||
|
|
||||||
Suivez le projet Dolibarr project sur les réseaux francophones
|
Suivez le projet Dolibarr project sur les réseaux francophones
|
||||||
|
|||||||
14
README.md
14
README.md
@ -12,6 +12,7 @@ You can use it as a standalone application or as a web application to be able to
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
## LICENSE
|
## LICENSE
|
||||||
|
|
||||||
Dolibarr is released under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version (GPL-3+).
|
Dolibarr is released under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version (GPL-3+).
|
||||||
@ -20,6 +21,7 @@ See the [COPYING](https://github.com/Dolibarr/dolibarr/blob/develop/COPYING) fil
|
|||||||
|
|
||||||
Other licenses apply for some included dependencies. See [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) for a full list.
|
Other licenses apply for some included dependencies. See [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) for a full list.
|
||||||
|
|
||||||
|
|
||||||
## INSTALLING
|
## INSTALLING
|
||||||
|
|
||||||
### Download
|
### Download
|
||||||
@ -67,6 +69,7 @@ You can use a Web server and a supported database (MariaDb, MySql or Postgresql)
|
|||||||
|
|
||||||
- Follow the installer instructions
|
- Follow the installer instructions
|
||||||
|
|
||||||
|
|
||||||
## UPGRADING
|
## UPGRADING
|
||||||
|
|
||||||
- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
|
- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
|
||||||
@ -75,10 +78,12 @@ You can use a Web server and a supported database (MariaDb, MySql or Postgresql)
|
|||||||
|
|
||||||
*Note: migration process can safely be done multiple times by calling the page /install/index.php*
|
*Note: migration process can safely be done multiple times by calling the page /install/index.php*
|
||||||
|
|
||||||
|
|
||||||
## WHAT'S NEW
|
## WHAT'S NEW
|
||||||
|
|
||||||
See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file.
|
See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file.
|
||||||
|
|
||||||
|
|
||||||
## FEATURES
|
## FEATURES
|
||||||
|
|
||||||
### Main application/modules (all optional)
|
### Main application/modules (all optional)
|
||||||
@ -120,7 +125,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
|||||||
- ClickToDial integration
|
- ClickToDial integration
|
||||||
- RSS integration
|
- RSS integration
|
||||||
- Skype integration
|
- Skype integration
|
||||||
- Payment platforms integration (PayBox, PayPal)
|
- Payment platforms integration (PayPal, Stripe, Paybox...)
|
||||||
- …
|
- …
|
||||||
|
|
||||||
### Other general features
|
### Other general features
|
||||||
@ -149,29 +154,34 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
|||||||
|
|
||||||
Dolibarr can be extended with a lot of other external application or modules from third party developers available at the [DoliStore](https://www.dolistore.com).
|
Dolibarr can be extended with a lot of other external application or modules from third party developers available at the [DoliStore](https://www.dolistore.com).
|
||||||
|
|
||||||
|
|
||||||
## FUTURE
|
## FUTURE
|
||||||
|
|
||||||
These are features that Dolibarr does **not** yet fully support:
|
These are features that Dolibarr does **not** yet fully support:
|
||||||
|
|
||||||
- Tasks dependencies in projects
|
- Tasks dependencies in projects
|
||||||
- Payroll module
|
- Payroll module
|
||||||
- Webmail
|
- No native embedded Webmail
|
||||||
- Dolibarr can't do coffee (yet)
|
- Dolibarr can't do coffee (yet)
|
||||||
|
|
||||||
|
|
||||||
## DOCUMENTATION
|
## DOCUMENTATION
|
||||||
|
|
||||||
Administrator, user, developer and translator's documentations are available along with other community resources on the [Wiki](https://wiki.dolibarr.org).
|
Administrator, user, developer and translator's documentations are available along with other community resources on the [Wiki](https://wiki.dolibarr.org).
|
||||||
|
|
||||||
|
|
||||||
## CONTRIBUTING
|
## CONTRIBUTING
|
||||||
|
|
||||||
See file [CONTRIBUTING](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)
|
See file [CONTRIBUTING](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)
|
||||||
|
|
||||||
|
|
||||||
## CREDITS
|
## CREDITS
|
||||||
|
|
||||||
Dolibarr is the work of many contributors over the years and uses some fine libraries.
|
Dolibarr is the work of many contributors over the years and uses some fine libraries.
|
||||||
|
|
||||||
See [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) file.
|
See [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) file.
|
||||||
|
|
||||||
|
|
||||||
## NEWS AND SOCIAL NETWORKS
|
## NEWS AND SOCIAL NETWORKS
|
||||||
|
|
||||||
Follow Dolibarr project on:
|
Follow Dolibarr project on:
|
||||||
|
|||||||
@ -174,7 +174,7 @@ or
|
|||||||
Puis pour se connecter et préparer l'environnement
|
Puis pour se connecter et préparer l'environnement
|
||||||
> schroot -c name_of_chroot (exemple schroot -c unstable-amd64-sbuild)
|
> schroot -c name_of_chroot (exemple schroot -c unstable-amd64-sbuild)
|
||||||
> cat /etc/debian_chroot to check which debian branch we are into
|
> cat /etc/debian_chroot to check which debian branch we are into
|
||||||
> apt-get install vi dialog
|
> apt-get install vim dialog
|
||||||
> vi /usr/sbin/policy-rc.d and replace return code 101 (not allowed) into 0 (ok)
|
> vi /usr/sbin/policy-rc.d and replace return code 101 (not allowed) into 0 (ok)
|
||||||
> apt-get update
|
> apt-get update
|
||||||
> apt-get upgrade
|
> apt-get upgrade
|
||||||
|
|||||||
@ -10,6 +10,8 @@ source-is-missing htdocs/includes/ckeditor/ckeditor/lang/*.js
|
|||||||
source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/*/dialogs/*.js
|
source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/*/dialogs/*.js
|
||||||
source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/*/filter/*.js
|
source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/*/filter/*.js
|
||||||
source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/templates/templates/default.js
|
source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/templates/templates/default.js
|
||||||
source-is-missing htdocs/includes/mobiledetect/mobiledetectlib/Mobile_Detect.json
|
|
||||||
source-is-missing htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/*.js
|
source-is-missing htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/*.js
|
||||||
|
# Those are false positives, the files are their own sources since
|
||||||
|
# they are data files
|
||||||
|
source-is-missing htdocs/includes/mobiledetect/mobiledetectlib/Mobile_Detect.json
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
// during install process to be used.
|
// during install process to be used.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
$force_install_noedit=2;
|
$force_install_noedit=2; // 1=To block vars specific to distrib, 2 to block all technical parameters
|
||||||
$force_install_message='KeepDefaultValuesWamp';
|
$force_install_message='KeepDefaultValuesWamp';
|
||||||
$force_install_main_data_root='WAMPROOT/dolibarr_documents';
|
$force_install_main_data_root='WAMPROOT/dolibarr_documents';
|
||||||
$force_install_type='mysqli';
|
$force_install_type='mysqli';
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$force_install_packager='rpmfedora';
|
$force_install_packager='rpmfedora';
|
||||||
$force_install_noedit=1; # 1 to block var specific to distrib, 2 to block every technical parameters
|
$force_install_noedit=1; // 1 to block var specific to distrib, 2 to block every technical parameters
|
||||||
$force_install_message='KeepDefaultValuesDeb';
|
$force_install_message='KeepDefaultValuesDeb';
|
||||||
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
||||||
$force_install_type='mysqli';
|
$force_install_type='mysqli';
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$force_install_packager='rpmgeneric';
|
$force_install_packager='rpmgeneric';
|
||||||
$force_install_noedit=1; # 1 to block var specific to distrib, 2 to block every technical parameters
|
$force_install_noedit=1; // 1 to block var specific to distrib, 2 to block every technical parameters
|
||||||
$force_install_message='KeepDefaultValuesDeb';
|
$force_install_message='KeepDefaultValuesDeb';
|
||||||
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
||||||
$force_install_type='mysqli';
|
$force_install_type='mysqli';
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$force_install_packager='rpmmandriva';
|
$force_install_packager='rpmmandriva';
|
||||||
$force_install_noedit=1; # 1 to block var specific to distrib, 2 to block every technical parameters
|
$force_install_noedit=1; // 1 to block var specific to distrib, 2 to block every technical parameters
|
||||||
$force_install_message='KeepDefaultValuesDeb';
|
$force_install_message='KeepDefaultValuesDeb';
|
||||||
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
||||||
$force_install_type='mysqli';
|
$force_install_type='mysqli';
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$force_install_packager='rpmopensuse';
|
$force_install_packager='rpmopensuse';
|
||||||
$force_install_noedit=1; # 1 to block var specific to distrib, 2 to block every technical parameters
|
$force_install_noedit=1; // 1 to block var specific to distrib, 2 to block every technical parameters
|
||||||
$force_install_message='KeepDefaultValuesDeb';
|
$force_install_message='KeepDefaultValuesDeb';
|
||||||
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
||||||
$force_install_type='mysqli';
|
$force_install_type='mysqli';
|
||||||
|
|||||||
@ -155,7 +155,7 @@ fi
|
|||||||
#echo "mysql -P$port -u$admin $passwd $base < $mydir/$dumpfile"
|
#echo "mysql -P$port -u$admin $passwd $base < $mydir/$dumpfile"
|
||||||
#mysql -P$port -u$admin $passwd $base < $mydir/$dumpfile
|
#mysql -P$port -u$admin $passwd $base < $mydir/$dumpfile
|
||||||
#echo "drop old table"
|
#echo "drop old table"
|
||||||
echo "drop table llx_accounting_account;" | mysql -P$port -u$admin $passwd $base
|
echo "drop table if exists llx_accounting_account;" | mysql -P$port -u$admin $passwd $base
|
||||||
echo "mysql -P$port -u$admin -p***** $base < $mydir/$dumpfile"
|
echo "mysql -P$port -u$admin -p***** $base < $mydir/$dumpfile"
|
||||||
mysql -P$port -u$admin $passwd $base < $mydir/$dumpfile
|
mysql -P$port -u$admin $passwd $base < $mydir/$dumpfile
|
||||||
export res=$?
|
export res=$?
|
||||||
|
|||||||
@ -528,7 +528,7 @@ CREATE TABLE `llx_bank` (
|
|||||||
|
|
||||||
LOCK TABLES `llx_bank` WRITE;
|
LOCK TABLES `llx_bank` WRITE;
|
||||||
/*!40000 ALTER TABLE `llx_bank` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `llx_bank` DISABLE KEYS */;
|
||||||
INSERT INTO `llx_bank` VALUES (1,'2010-07-08 23:56:14','2013-03-07 21:28:51','2010-07-08','2010-07-08',2000.00000000,'(Initial balance)',1,NULL,1,'SOLD','201210',NULL,1,NULL,0,NULL,NULL,NULL),(2,'2010-07-09 00:00:24','0000-00-00 00:00:00','2010-07-09','2010-07-09',500.00000000,'(Initial balance)',2,NULL,NULL,'SOLD',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(3,'2010-07-10 13:33:42','0000-00-00 00:00:00','2010-07-10','2010-07-10',0.00000000,'(Solde initial)',3,NULL,NULL,'SOLD',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(4,'2010-07-10 14:59:41','0000-00-00 00:00:00','2010-07-10','2010-07-10',0.02000000,'(CustomerInvoicePayment)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,'Client salon invidivdu',NULL),(5,'2011-07-18 20:50:24','0000-00-00 00:00:00','2011-07-08','2011-07-08',20.00000000,'(CustomerInvoicePayment)',1,1,NULL,'CB','201107',NULL,1,NULL,0,NULL,NULL,NULL),(6,'2011-07-18 20:50:47','0000-00-00 00:00:00','2011-07-08','2011-07-08',10.00000000,'(CustomerInvoicePayment)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(8,'2011-08-01 03:34:11','2013-03-07 21:28:51','2011-08-01','2011-08-01',5.63000000,'(CustomerInvoicePayment)',1,1,1,'CB','201210',NULL,1,NULL,0,NULL,NULL,NULL),(12,'2011-08-05 23:11:37','2013-03-07 21:33:57','2011-08-05','2011-08-05',-10.00000000,'(SocialContributionPayment)',1,1,1,'VIR','201210',NULL,1,NULL,0,NULL,NULL,NULL),(13,'2011-08-06 20:33:54','0000-00-00 00:00:00','2011-08-06','2011-08-06',5.98000000,'(CustomerInvoicePayment)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(14,'2011-08-08 02:53:40','0000-00-00 00:00:00','2011-08-08','2011-08-08',26.10000000,'(CustomerInvoicePayment)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(15,'2011-08-08 02:55:58','2013-03-07 21:39:20','2011-08-08','2011-08-08',26.96000000,'(CustomerInvoicePayment)',1,1,1,'TIP','201211',NULL,1,NULL,0,NULL,NULL,NULL),(16,'2012-12-09 15:28:44','2012-12-09 14:28:44','2012-12-09','2012-12-09',2.00000000,'(CustomerInvoicePayment)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(17,'2012-12-09 15:28:53','2012-12-09 14:33:07','2012-12-09','2012-12-09',-2.00000000,'(CustomerInvoicePaymentBack)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(18,'2012-12-09 17:35:55','2012-12-09 16:35:55','2012-12-09','2012-12-09',-2.00000000,'(CustomerInvoicePaymentBack)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(19,'2012-12-09 17:37:02','2012-12-09 16:37:02','2012-12-09','2012-12-09',2.00000000,'(CustomerInvoicePayment)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(20,'2012-12-09 18:35:07','2012-12-09 17:35:07','2012-12-09','2012-12-09',-2.00000000,'(CustomerInvoicePaymentBack)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(21,'2012-12-12 18:54:33','2013-03-07 21:28:51','2012-12-12','2012-12-12',1.00000000,'(CustomerInvoicePayment)',1,1,1,'TIP','201210',NULL,1,NULL,0,NULL,NULL,NULL),(22,'2013-03-06 16:48:16','2013-03-06 15:48:16','2013-03-06','2013-03-06',20.00000000,'(SubscriptionPayment)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(23,'2013-03-20 14:30:11','2013-03-20 13:30:11','2013-03-20','2013-03-20',10.00000000,'(SubscriptionPayment)',1,1,NULL,'VIR',NULL,NULL,0,NULL,0,NULL,NULL,NULL);
|
INSERT INTO `llx_bank` VALUES (1,'2010-07-08 23:56:14','2013-03-07 21:28:51','2010-07-08','2010-07-08',2000.00000000,'(Initial balance)',1,NULL,1,'SOLD','201210',NULL,1,NULL,0,NULL,NULL,NULL),(2,'2010-07-09 00:00:24','2010-07-09 00:00:24','2010-07-09','2010-07-09',500.00000000,'(Initial balance)',2,NULL,NULL,'SOLD',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(3,'2010-07-10 13:33:42','2010-07-10 13:33:42','2010-07-10','2010-07-10',0.00000000,'(Solde initial)',3,NULL,NULL,'SOLD',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(4,'2010-07-10 14:59:41','2010-07-10 14:59:41','2010-07-10','2010-07-10',0.02000000,'(CustomerInvoicePayment)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,'Client salon invidivdu',NULL),(5,'2011-07-18 20:50:24','2011-07-18 20:50:24','2011-07-08','2011-07-08',20.00000000,'(CustomerInvoicePayment)',1,1,NULL,'CB','201107',NULL,1,NULL,0,NULL,NULL,NULL),(6,'2011-07-18 20:50:47','2011-07-18 20:50:47','2011-07-08','2011-07-08',10.00000000,'(CustomerInvoicePayment)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(8,'2011-08-01 03:34:11','2013-03-07 21:28:51','2011-08-01','2011-08-01',5.63000000,'(CustomerInvoicePayment)',1,1,1,'CB','201210',NULL,1,NULL,0,NULL,NULL,NULL),(12,'2011-08-05 23:11:37','2013-03-07 21:33:57','2011-08-05','2011-08-05',-10.00000000,'(SocialContributionPayment)',1,1,1,'VIR','201210',NULL,1,NULL,0,NULL,NULL,NULL),(13,'2011-08-06 20:33:54','2011-08-06 20:33:54','2011-08-06','2011-08-06',5.98000000,'(CustomerInvoicePayment)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(14,'2011-08-08 02:53:40','2011-08-08 02:53:40','2011-08-08','2011-08-08',26.10000000,'(CustomerInvoicePayment)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(15,'2011-08-08 02:55:58','2013-03-07 21:39:20','2011-08-08','2011-08-08',26.96000000,'(CustomerInvoicePayment)',1,1,1,'TIP','201211',NULL,1,NULL,0,NULL,NULL,NULL),(16,'2012-12-09 15:28:44','2012-12-09 14:28:44','2012-12-09','2012-12-09',2.00000000,'(CustomerInvoicePayment)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(17,'2012-12-09 15:28:53','2012-12-09 14:33:07','2012-12-09','2012-12-09',-2.00000000,'(CustomerInvoicePaymentBack)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(18,'2012-12-09 17:35:55','2012-12-09 16:35:55','2012-12-09','2012-12-09',-2.00000000,'(CustomerInvoicePaymentBack)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(19,'2012-12-09 17:37:02','2012-12-09 16:37:02','2012-12-09','2012-12-09',2.00000000,'(CustomerInvoicePayment)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(20,'2012-12-09 18:35:07','2012-12-09 17:35:07','2012-12-09','2012-12-09',-2.00000000,'(CustomerInvoicePaymentBack)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(21,'2012-12-12 18:54:33','2013-03-07 21:28:51','2012-12-12','2012-12-12',1.00000000,'(CustomerInvoicePayment)',1,1,1,'TIP','201210',NULL,1,NULL,0,NULL,NULL,NULL),(22,'2013-03-06 16:48:16','2013-03-06 15:48:16','2013-03-06','2013-03-06',20.00000000,'(SubscriptionPayment)',3,1,NULL,'LIQ',NULL,NULL,0,NULL,0,NULL,NULL,NULL),(23,'2013-03-20 14:30:11','2013-03-20 13:30:11','2013-03-20','2013-03-20',10.00000000,'(SubscriptionPayment)',1,1,NULL,'VIR',NULL,NULL,0,NULL,0,NULL,NULL,NULL);
|
||||||
/*!40000 ALTER TABLE `llx_bank` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `llx_bank` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
@ -4844,7 +4844,7 @@ CREATE TABLE `llx_opensurvey_sondage` (
|
|||||||
|
|
||||||
LOCK TABLES `llx_opensurvey_sondage` WRITE;
|
LOCK TABLES `llx_opensurvey_sondage` WRITE;
|
||||||
/*!40000 ALTER TABLE `llx_opensurvey_sondage` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `llx_opensurvey_sondage` DISABLE KEYS */;
|
||||||
INSERT INTO `llx_opensurvey_sondage` VALUES ('m4467s2mtk6khmxc','m4467s2mtk6khmxci2ysw682','fdffdshfghfj jhgjgh','aaa@aaa.com','fdfds','fdffds','2013-03-06 23:00:00','D+','1',1,'dolibarr','0000-00-00 00:00:00');
|
INSERT INTO `llx_opensurvey_sondage` VALUES ('m4467s2mtk6khmxc','m4467s2mtk6khmxci2ysw682','fdffdshfghfj jhgjgh','aaa@aaa.com','fdfds','fdffds','2013-03-06 23:00:00','D+','1',1,'dolibarr','2000-01-01 00:00:00');
|
||||||
/*!40000 ALTER TABLE `llx_opensurvey_sondage` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `llx_opensurvey_sondage` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ Contact/address Contact person Partner/Contact (individual)
|
|||||||
Financial ?? Invoicing
|
Financial ?? Invoicing
|
||||||
|
|
||||||
Income / Expense ?? Profit / Loss
|
Income / Expense ?? Profit / Loss
|
||||||
Balance Net profit
|
Balance ?? Net profit
|
||||||
|
Subledger account Subledger account ??
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
||||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
|
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
|
||||||
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
*
|
*
|
||||||
@ -54,6 +54,7 @@ $action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
|||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
$id=GETPOST('id','int');
|
$id=GETPOST('id','int');
|
||||||
$rowid=GETPOST('rowid','alpha');
|
$rowid=GETPOST('rowid','alpha');
|
||||||
|
$code=GETPOST('code','alpha');
|
||||||
|
|
||||||
$acts[0] = "activate";
|
$acts[0] = "activate";
|
||||||
$acts[1] = "disable";
|
$acts[1] = "disable";
|
||||||
@ -67,7 +68,7 @@ $active = 1;
|
|||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if ($page == -1) { $page = 0 ; }
|
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||||
$offset = $listlimit * $page ;
|
$offset = $listlimit * $page ;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
@ -459,8 +460,8 @@ if ($action == $acts[0])
|
|||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
}
|
||||||
elseif ($_GET["code"]) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$_GET["code"]."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -479,8 +480,8 @@ if ($action == $acts[1])
|
|||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
}
|
||||||
elseif ($_GET["code"]) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$_GET["code"]."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -499,8 +500,8 @@ if ($action == 'activate_favorite')
|
|||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
}
|
||||||
elseif ($_GET["code"]) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".$_GET["code"]."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".$code."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -519,8 +520,8 @@ if ($action == 'disable_favorite')
|
|||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
}
|
||||||
elseif ($_GET["code"]) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".$_GET["code"]."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".$code."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -556,7 +557,7 @@ print "<br>\n";
|
|||||||
// Confirmation de la suppression de la ligne
|
// Confirmation de la suppression de la ligne
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$_GET["code"].'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
||||||
}
|
}
|
||||||
//var_dump($elementList);
|
//var_dump($elementList);
|
||||||
|
|
||||||
@ -1147,7 +1148,6 @@ else
|
|||||||
* Show list of dictionary to show
|
* Show list of dictionary to show
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$var=true;
|
|
||||||
$lastlineisempty=false;
|
$lastlineisempty=false;
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
||||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
|
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
|
||||||
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
*
|
*
|
||||||
@ -54,6 +54,7 @@ $action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
|||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
$id=GETPOST('id','int');
|
$id=GETPOST('id','int');
|
||||||
$rowid=GETPOST('rowid','alpha');
|
$rowid=GETPOST('rowid','alpha');
|
||||||
|
$code=GETPOST('code','alpha');
|
||||||
|
|
||||||
// Security access
|
// Security access
|
||||||
if (! empty($user->rights->accountancy->chartofaccount))
|
if (! empty($user->rights->accountancy->chartofaccount))
|
||||||
@ -73,7 +74,7 @@ $active = 1;
|
|||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if ($page == -1) { $page = 0 ; }
|
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||||
$offset = $listlimit * $page ;
|
$offset = $listlimit * $page ;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
@ -370,8 +371,8 @@ if ($action == $acts[0])
|
|||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
}
|
||||||
elseif ($_GET["code"]) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$_GET["code"]."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -390,8 +391,8 @@ if ($action == $acts[1])
|
|||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
}
|
||||||
elseif ($_GET["code"]) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$_GET["code"]."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -410,8 +411,8 @@ if ($action == 'activate_favorite')
|
|||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
}
|
||||||
elseif ($_GET["code"]) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".$_GET["code"]."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".$code."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -430,8 +431,8 @@ if ($action == 'disable_favorite')
|
|||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
}
|
||||||
elseif ($_GET["code"]) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".$_GET["code"]."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".$code."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -461,7 +462,7 @@ print load_fiche_titre($titre,$linkback,$titlepicto);
|
|||||||
// Confirmation de la suppression de la ligne
|
// Confirmation de la suppression de la ligne
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$_GET["code"].'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
||||||
}
|
}
|
||||||
//var_dump($elementList);
|
//var_dump($elementList);
|
||||||
|
|
||||||
@ -546,7 +547,7 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); }
|
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); }
|
||||||
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
|
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
|
||||||
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
|
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
|
||||||
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
|
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Direction"); }
|
||||||
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
||||||
|
|
||||||
if ($valuetoshow != '')
|
if ($valuetoshow != '')
|
||||||
@ -700,7 +701,7 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
|
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
|
||||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||||
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
|
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
|
||||||
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
|
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Direction"); }
|
||||||
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
||||||
// Affiche nom du champ
|
// Affiche nom du champ
|
||||||
if ($showfield)
|
if ($showfield)
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/admin/index.php
|
* \file htdocs/accountancy/admin/defaultaccounts.php
|
||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Setup page to configure accounting expert module
|
* \brief Setup page to configure accounting expert module
|
||||||
*/
|
*/
|
||||||
@ -50,23 +50,26 @@ if (! empty($user->rights->accountancy->chartofaccount))
|
|||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
|
||||||
|
|
||||||
|
$list_account_main = array (
|
||||||
|
'ACCOUNTING_ACCOUNT_CUSTOMER',
|
||||||
|
'ACCOUNTING_ACCOUNT_SUPPLIER',
|
||||||
|
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
|
||||||
|
);
|
||||||
|
|
||||||
$list_account = array (
|
$list_account = array (
|
||||||
'ACCOUNTING_ACCOUNT_SUPPLIER',
|
'ACCOUNTING_PRODUCT_BUY_ACCOUNT',
|
||||||
'ACCOUNTING_ACCOUNT_CUSTOMER',
|
'ACCOUNTING_PRODUCT_SOLD_ACCOUNT',
|
||||||
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
|
'ACCOUNTING_SERVICE_BUY_ACCOUNT',
|
||||||
'ACCOUNTING_PRODUCT_BUY_ACCOUNT',
|
'ACCOUNTING_SERVICE_SOLD_ACCOUNT',
|
||||||
'ACCOUNTING_PRODUCT_SOLD_ACCOUNT',
|
'ACCOUNTING_VAT_BUY_ACCOUNT',
|
||||||
'ACCOUNTING_SERVICE_BUY_ACCOUNT',
|
'ACCOUNTING_VAT_SOLD_ACCOUNT',
|
||||||
'ACCOUNTING_SERVICE_SOLD_ACCOUNT',
|
'ACCOUNTING_VAT_PAY_ACCOUNT',
|
||||||
'ACCOUNTING_VAT_BUY_ACCOUNT',
|
'ACCOUNTING_ACCOUNT_SUSPENSE',
|
||||||
'ACCOUNTING_VAT_SOLD_ACCOUNT',
|
'ACCOUNTING_ACCOUNT_TRANSFER_CASH',
|
||||||
'ACCOUNTING_VAT_PAY_ACCOUNT',
|
'DONATION_ACCOUNTINGACCOUNT',
|
||||||
'ACCOUNTING_ACCOUNT_SUSPENSE',
|
'LOAN_ACCOUNTING_ACCOUNT_CAPITAL',
|
||||||
'ACCOUNTING_ACCOUNT_TRANSFER_CASH',
|
'LOAN_ACCOUNTING_ACCOUNT_INTEREST',
|
||||||
'DONATION_ACCOUNTINGACCOUNT',
|
'LOAN_ACCOUNTING_ACCOUNT_INSURANCE'
|
||||||
'LOAN_ACCOUNTING_ACCOUNT_CAPITAL',
|
|
||||||
'LOAN_ACCOUNTING_ACCOUNT_INTEREST',
|
|
||||||
'LOAN_ACCOUNTING_ACCOUNT_INSURANCE'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -94,7 +97,7 @@ if (GETPOST('change_chart'))
|
|||||||
if ($action == 'update') {
|
if ($action == 'update') {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
foreach ( $list_account as $constname ) {
|
foreach ( $list_account_main as $constname ) {
|
||||||
$constvalue = GETPOST($constname, 'alpha');
|
$constvalue = GETPOST($constname, 'alpha');
|
||||||
|
|
||||||
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||||
@ -102,6 +105,14 @@ if ($action == 'update') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ( $list_account as $constname ) {
|
||||||
|
$constvalue = GETPOST($constname, 'alpha');
|
||||||
|
|
||||||
|
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||||
|
$error ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
@ -114,11 +125,11 @@ if ($action == 'update') {
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader();
|
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
|
|
||||||
|
llxHeader();
|
||||||
|
|
||||||
$linkback = '';
|
$linkback = '';
|
||||||
print load_fiche_titre($langs->trans('MenuDefaultAccounts'), $linkback, 'title_accountancy');
|
print load_fiche_titre($langs->trans('MenuDefaultAccounts'), $linkback, 'title_accountancy');
|
||||||
|
|
||||||
@ -129,16 +140,45 @@ print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
|||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
|
|
||||||
// Define Chart of accounts
|
|
||||||
|
// Define main accounts for thirdparty
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
foreach ( $list_account as $key ) {
|
foreach ($list_account_main as $key) {
|
||||||
|
|
||||||
|
print '<tr class="oddeven value">';
|
||||||
|
// Param
|
||||||
|
$label = $langs->trans($key);
|
||||||
|
$keydesc=$key.'_Desc';
|
||||||
|
|
||||||
|
$htmltext = $langs->trans($keydesc);
|
||||||
|
print '<td class="fieldrequired" width="50%">';
|
||||||
|
print $form->textwithpicto($label, $htmltext);
|
||||||
|
print '</td>';
|
||||||
|
// Value
|
||||||
|
print '<td>'; // Do not force align=right, or it align also the content of the select box
|
||||||
|
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
print "</table>\n";
|
||||||
|
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
// Define default accounts
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
|
foreach ($list_account as $key) {
|
||||||
|
|
||||||
print '<tr class="oddeven value">';
|
print '<tr class="oddeven value">';
|
||||||
// Param
|
// Param
|
||||||
$label = $langs->trans($key);
|
$label = $langs->trans($key);
|
||||||
print '<td>' . $label . '</td>';
|
print '<td width="50%">' . $label . '</td>';
|
||||||
// Value
|
// Value
|
||||||
print '<td>'; // Do not force align=right, or it align also the content of the select box
|
print '<td>'; // Do not force align=right, or it align also the content of the select box
|
||||||
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
@ -206,7 +206,7 @@ if ($num2) {
|
|||||||
print '<td colspan="3">' . $langs->trans('OtherOptions') . '</td>';
|
print '<td colspan="3">' . $langs->trans('OtherOptions') . '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > 1)
|
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > AccountancyExport::$EXPORT_TYPE_NORMAL)
|
||||||
{
|
{
|
||||||
print '<tr><td colspan="2" bgcolor="red"><b>' . $langs->trans('OptionsDeactivatedForThisExportModel') . '</b></td></tr>';
|
print '<tr><td colspan="2" bgcolor="red"><b>' . $langs->trans('OptionsDeactivatedForThisExportModel') . '</b></td></tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
/* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
|||||||
@ -31,6 +31,7 @@ require '../../main.inc.php';
|
|||||||
|
|
||||||
// Class
|
// Class
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
@ -50,8 +51,8 @@ $action = GETPOST('action', 'alpha');
|
|||||||
$list = array (
|
$list = array (
|
||||||
'ACCOUNTING_LENGTH_GACCOUNT',
|
'ACCOUNTING_LENGTH_GACCOUNT',
|
||||||
'ACCOUNTING_LENGTH_AACCOUNT' ,
|
'ACCOUNTING_LENGTH_AACCOUNT' ,
|
||||||
'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc
|
// 'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc
|
||||||
'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc
|
// 'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -38,6 +38,7 @@ $action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
|||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
$id=GETPOST('id','int');
|
$id=GETPOST('id','int');
|
||||||
$rowid=GETPOST('rowid','alpha');
|
$rowid=GETPOST('rowid','alpha');
|
||||||
|
$code=GETPOST('code','alpha');
|
||||||
|
|
||||||
// Security access
|
// Security access
|
||||||
if (! empty($user->rights->accountancy->chartofaccount))
|
if (! empty($user->rights->accountancy->chartofaccount))
|
||||||
@ -57,7 +58,7 @@ $active = 1;
|
|||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if ($page == -1) { $page = 0 ; }
|
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||||
$offset = $listlimit * $page ;
|
$offset = $listlimit * $page ;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
@ -321,8 +322,8 @@ if ($action == $acts[0])
|
|||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
}
|
||||||
elseif ($_GET["code"]) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$_GET["code"]."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -341,8 +342,8 @@ if ($action == $acts[1])
|
|||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
}
|
||||||
elseif ($_GET["code"]) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$_GET["code"]."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -371,18 +372,11 @@ if ($id)
|
|||||||
|
|
||||||
print load_fiche_titre($titre,$linkback,$titlepicto);
|
print load_fiche_titre($titre,$linkback,$titlepicto);
|
||||||
|
|
||||||
if (empty($id))
|
|
||||||
{
|
|
||||||
print $langs->trans("DictionaryDesc");
|
|
||||||
print " ".$langs->trans("OnlyActiveElementsAreShown")."<br>\n";
|
|
||||||
}
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
|
|
||||||
// Confirmation de la suppression de la ligne
|
// Confirmation de la suppression de la ligne
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$_GET["code"].'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
||||||
}
|
}
|
||||||
//var_dump($elementList);
|
//var_dump($elementList);
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
@ -397,7 +397,7 @@ if ($result)
|
|||||||
// TODO ADJUST DESCRIPTION SIZE
|
// TODO ADJUST DESCRIPTION SIZE
|
||||||
// print '<td align="left">' . $obj->description . '</td>';
|
// print '<td align="left">' . $obj->description . '</td>';
|
||||||
// TODO: we shoul set a user defined value to adjust user square / wide screen size
|
// TODO: we shoul set a user defined value to adjust user square / wide screen size
|
||||||
$trunclengh = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 64;
|
$trunclengh = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||||
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>';
|
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -51,7 +51,7 @@ if ($search_accountancy_code_end == - 1) {
|
|||||||
$search_accountancy_code_end = '';
|
$search_accountancy_code_end = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST("button_export_csv_x") || GETPOST("button_export_csv")) {
|
if (GETPOST("button_export_csv_x") || GETPOST("button_export_csv.x") || GETPOST("button_export_csv")) {
|
||||||
$action = 'export_csv';
|
$action = 'export_csv';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,10 +100,10 @@ if (! empty($search_accountancy_code_end)) {
|
|||||||
|
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_accountancy_code_start = '';
|
$search_accountancy_code_start = '';
|
||||||
$search_accountancy_code_end = '';
|
$search_accountancy_code_end = '';
|
||||||
$search_date_start = '';
|
$search_date_start = '';
|
||||||
$search_date_end = '';
|
$search_date_end = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -112,7 +112,10 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'export_csv') {
|
if ($action == 'export_csv') {
|
||||||
|
|
||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
|
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == AccountancyExport::$EXPORT_TYPE_CEGID) $sep = ";"; // For CEGID, we force separator.
|
||||||
|
|
||||||
$journal = 'bookkepping';
|
$journal = 'bookkepping';
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||||
@ -122,11 +125,7 @@ if ($action == 'export_csv') {
|
|||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ( $object->lines as $line ) {
|
foreach ($object->lines as $line) {
|
||||||
|
|
||||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
|
|
||||||
$sep = ";";
|
|
||||||
}
|
|
||||||
print length_accountg($line->numero_compte) . $sep;
|
print length_accountg($line->numero_compte) . $sep;
|
||||||
print $line->debit . $sep;
|
print $line->debit . $sep;
|
||||||
print $line->credit . $sep;
|
print $line->credit . $sep;
|
||||||
@ -137,140 +136,137 @@ if ($action == 'export_csv') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
$title_page = $langs->trans("AccountBalance") . (($search_date_start || $search_date_end) ? ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end) : '');
|
$title_page = $langs->trans("AccountBalance") . (($search_date_start || $search_date_end) ? ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end) : '');
|
||||||
|
|
||||||
llxHeader('', $title_page);
|
llxHeader('', $title_page);
|
||||||
|
|
||||||
// List
|
// List
|
||||||
|
$nbtotalofrecords = '';
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||||
|
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
|
||||||
|
if ($nbtotalofrecords < 0) {
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$nbtotalofrecords = '';
|
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter);
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
if ($result < 0) {
|
||||||
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
if ($nbtotalofrecords < 0) {
|
}
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter);
|
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
if ($result < 0) {
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$button = '<input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . ' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
||||||
|
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $result, 'title_accountancy', 0, $button);
|
||||||
|
|
||||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
$moreforfilter = '';
|
||||||
|
|
||||||
$button = '<input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" />';
|
$moreforfilter .= '<div class="divsearchfield">';
|
||||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $result, 'title_accountancy', 0, $button);
|
$moreforfilter .= $langs->trans('DateStart') . ': ';
|
||||||
|
$moreforfilter .= $form->select_date($search_date_start, 'date_start', 0, 0, 1, '', 1, 0, 1);
|
||||||
|
$moreforfilter .= $langs->trans('DateEnd') . ': ';
|
||||||
|
$moreforfilter .= $form->select_date($search_date_end, 'date_end', 0, 0, 1, '', 1, 0, 1);
|
||||||
|
$moreforfilter .= '</div>';
|
||||||
|
|
||||||
|
if (! empty($moreforfilter)) {
|
||||||
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||||
|
print $moreforfilter;
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
print '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
$moreforfilter = '';
|
print '<table class="liste ' . ($moreforfilter ? "listwithfilterbefore" : "") . '">';
|
||||||
|
|
||||||
$moreforfilter .= '<div class="divsearchfield">';
|
print '<tr class="liste_titre_filter">';
|
||||||
$moreforfilter .= $langs->trans('DateStart') . ': ';
|
print '<td class="liste_titre" colspan="5">';
|
||||||
$moreforfilter .= $form->select_date($search_date_start, 'date_start', 0, 0, 1, '', 1, 0, 1);
|
print $langs->trans('From');
|
||||||
$moreforfilter .= $langs->trans('DateEnd') . ': ';
|
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, '');
|
||||||
$moreforfilter .= $form->select_date($search_date_end, 'date_end', 0, 0, 1, '', 1, 0, 1);
|
print ' ';
|
||||||
$moreforfilter .= '</div>';
|
print $langs->trans('to');
|
||||||
|
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, '');
|
||||||
if (! empty($moreforfilter)) {
|
print '</td>';
|
||||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
print '<td align="right" class="liste_titre">';
|
||||||
print $moreforfilter;
|
|
||||||
$parameters = array();
|
|
||||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
|
||||||
print $hookmanager->resPrint;
|
|
||||||
print '</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<table class="liste ' . ($moreforfilter ? "listwithfilterbefore" : "") . '">';
|
|
||||||
|
|
||||||
print '<tr class="liste_titre_filter">';
|
|
||||||
print '<td class="liste_titre" colspan="5">';
|
|
||||||
print $langs->trans('From');
|
|
||||||
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, '');
|
|
||||||
print ' ';
|
|
||||||
print $langs->trans('to');
|
|
||||||
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, '');
|
|
||||||
print '</td>';
|
|
||||||
print '<td align="right" class="liste_titre">';
|
|
||||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||||
print $searchpicto;
|
print $searchpicto;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$total_debit = 0;
|
$total_debit = 0;
|
||||||
$total_credit = 0;
|
$total_credit = 0;
|
||||||
$sous_total_debit = 0;
|
$sous_total_debit = 0;
|
||||||
$sous_total_credit = 0;
|
$sous_total_credit = 0;
|
||||||
$displayed_account = "";
|
$displayed_account = "";
|
||||||
|
|
||||||
foreach ($object->lines as $line) {
|
foreach ($object->lines as $line) {
|
||||||
$link = '';
|
$link = '';
|
||||||
$total_debit += $line->debit;
|
$total_debit += $line->debit;
|
||||||
$total_credit += $line->credit;
|
$total_credit += $line->credit;
|
||||||
$description = $object->get_compte_desc($line->numero_compte); // Search description of the account
|
$description = $object->get_compte_desc($line->numero_compte); // Search description of the account
|
||||||
$root_account_description = $object->get_compte_racine($line->numero_compte);
|
$root_account_description = $object->get_compte_racine($line->numero_compte);
|
||||||
if (empty($description)) {
|
if (empty($description)) {
|
||||||
$link = '<a href="../admin/card.php?action=create&compte=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>';
|
$link = '<a href="../admin/card.php?action=create&compte=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>';
|
||||||
}
|
}
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
// Permet d'afficher le compte comptable
|
// Permet d'afficher le compte comptable
|
||||||
if ($root_account_description != $displayed_account) {
|
if ($root_account_description != $displayed_account) {
|
||||||
|
|
||||||
// Affiche un Sous-Total par compte comptable
|
// Affiche un Sous-Total par compte comptable
|
||||||
if ($displayed_account != "") {
|
if ($displayed_account != "") {
|
||||||
print '<tr class="liste_total"><td align="right" colspan="2">' . $langs->trans("SubTotal") . ':</td><td class="nowrap" align="right">' . price($sous_total_debit) . '</td><td class="nowrap" align="right">' . price($sous_total_credit) . '</td><td class="nowrap" align="right">' . price($sous_total_credit - $sous_total_debit) . '</td>';
|
print '<tr class="liste_total"><td align="right" colspan="2">' . $langs->trans("SubTotal") . ':</td><td class="nowrap" align="right">' . price($sous_total_debit) . '</td><td class="nowrap" align="right">' . price($sous_total_credit) . '</td><td class="nowrap" align="right">' . price($sous_total_credit - $sous_total_debit) . '</td>';
|
||||||
print "<td> </td>\n";
|
print "<td> </td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affiche le compte comptable en d<>but de ligne
|
// Affiche le compte comptable en d<>but de ligne
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td colspan="6" style="font-weight:bold; border-bottom: 1pt solid black;">' . $root_account_description . '</td>';
|
print '<td colspan="6" style="font-weight:bold; border-bottom: 1pt solid black;">' . $root_account_description . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$displayed_account = $root_account_description;
|
$displayed_account = $root_account_description;
|
||||||
$sous_total_debit = 0;
|
$sous_total_debit = 0;
|
||||||
$sous_total_credit = 0;
|
$sous_total_credit = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// $object->get_compte_racine($line->numero_compte);
|
// $object->get_compte_racine($line->numero_compte);
|
||||||
|
|
||||||
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
||||||
print '<td>' . $description . '</td>';
|
print '<td>' . $description . '</td>';
|
||||||
print '<td align="right">' . price($line->debit) . '</td>';
|
print '<td align="right">' . price($line->debit) . '</td>';
|
||||||
print '<td align="right">' . price($line->credit) . '</td>';
|
print '<td align="right">' . price($line->credit) . '</td>';
|
||||||
print '<td align="right">' . price($line->credit - $line->debit) . '</td>';
|
print '<td align="right">' . price($line->credit - $line->debit) . '</td>';
|
||||||
print '<td align="center">' . $link;
|
print '<td align="center">' . $link;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Comptabilise le sous-total
|
// Comptabilise le sous-total
|
||||||
$sous_total_debit += $line->debit;
|
$sous_total_debit += $line->debit;
|
||||||
$sous_total_credit += $line->credit;
|
$sous_total_credit += $line->credit;
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="liste_total"><td align="right" colspan="2">' . $langs->trans("SubTotal") . ':</td><td class="nowrap" align="right">' . price($sous_total_debit) . '</td><td class="nowrap" align="right">' . price($sous_total_credit) . '</td><td class="nowrap" align="right">' . price($sous_total_credit - $sous_total_debit) . '</td>';
|
print '<tr class="liste_total"><td align="right" colspan="2">' . $langs->trans("SubTotal") . ':</td><td class="nowrap" align="right">' . price($sous_total_debit) . '</td><td class="nowrap" align="right">' . price($sous_total_credit) . '</td><td class="nowrap" align="right">' . price($sous_total_credit - $sous_total_debit) . '</td>';
|
||||||
print "<td> </td>\n";
|
print "<td> </td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr class="liste_total"><td align="right" colspan="2">' . $langs->trans("AccountBalance") . ':</td><td class="nowrap" align="right">' . price($total_debit) . '</td><td class="nowrap" align="right">' . price($total_credit) . '</td><td class="nowrap" align="right">' . price($total_credit - $total_debit) . '</td>';
|
print '<tr class="liste_total"><td align="right" colspan="2">' . $langs->trans("AccountBalance") . ':</td><td class="nowrap" align="right">' . price($total_debit) . '</td><td class="nowrap" align="right">' . price($total_credit) . '</td><td class="nowrap" align="right">' . price($total_credit - $total_debit) . '</td>';
|
||||||
print "<td> </td>\n";
|
print "<td> </td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
}
|
}
|
||||||
$db->close();
|
$db->close();
|
||||||
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -16,43 +16,40 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/bookkeeping/card.php
|
* \file htdocs/accountancy/bookkeeping/card.php
|
||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Page to show book-entry
|
* \brief Page to show book-entry
|
||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
// Class
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||||
|
|
||||||
// Langs
|
|
||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
$langs->load("bank");
|
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("trips");
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
if ($user->societe_id > 0) {
|
if ($user->societe_id > 0) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
|
$mode = GETPOST('mode');
|
||||||
$piece_num = GETPOST("piece_num");
|
$piece_num = GETPOST("piece_num");
|
||||||
|
|
||||||
$mesg = '';
|
$mesg = '';
|
||||||
|
|
||||||
$account_number = GETPOST('account_number');
|
$account_number = GETPOST('account_number');
|
||||||
$code_tiers = GETPOST('code_tiers');
|
$subledger_account = GETPOST('subledger_account');
|
||||||
if ($code_tiers == - 1) {
|
if ($subledger_account == - 1) {
|
||||||
$code_tiers = null;
|
$subledger_account = null;
|
||||||
}
|
}
|
||||||
$label_compte = GETPOST('label_compte');
|
$label_compte = GETPOST('label_compte');
|
||||||
|
$label_operation= GETPOST('label_operation');
|
||||||
$debit = price2num(GETPOST('debit'));
|
$debit = price2num(GETPOST('debit'));
|
||||||
$credit = price2num(GETPOST('credit'));
|
$credit = price2num(GETPOST('credit'));
|
||||||
|
|
||||||
@ -64,7 +61,7 @@ $update = GETPOST('update');
|
|||||||
if (! empty($update)) {
|
if (! empty($update)) {
|
||||||
$action = 'confirm_update';
|
$action = 'confirm_update';
|
||||||
}
|
}
|
||||||
|
$object = new BookKeeping($db);
|
||||||
if ($action == "confirm_update") {
|
if ($action == "confirm_update") {
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -77,13 +74,14 @@ if ($action == "confirm_update") {
|
|||||||
if (empty($error)) {
|
if (empty($error)) {
|
||||||
$book = new BookKeeping($db);
|
$book = new BookKeeping($db);
|
||||||
|
|
||||||
$result = $book->fetch($id);
|
$result = $book->fetch($id, null, $mode);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
$book->numero_compte = $account_number;
|
$book->numero_compte = $account_number;
|
||||||
$book->code_tiers = $code_tiers;
|
$book->subledger_account = $subledger_account;
|
||||||
$book->label_compte = $label_compte;
|
$book->label_compte = $label_compte;
|
||||||
|
$book->label_operation= $label_operation;
|
||||||
$book->debit = $debit;
|
$book->debit = $debit;
|
||||||
$book->credit = $credit;
|
$book->credit = $credit;
|
||||||
|
|
||||||
@ -96,7 +94,7 @@ if ($action == "confirm_update") {
|
|||||||
$book->sens = 'C';
|
$book->sens = 'C';
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $book->update($user);
|
$result = $book->update($user, false, $mode);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
@ -119,8 +117,9 @@ else if ($action == "add") {
|
|||||||
$book = new BookKeeping($db);
|
$book = new BookKeeping($db);
|
||||||
|
|
||||||
$book->numero_compte = $account_number;
|
$book->numero_compte = $account_number;
|
||||||
$book->code_tiers = $code_tiers;
|
$book->subledger_account = $subledger_account;
|
||||||
$book->label_compte = $label_compte;
|
$book->label_compte = $label_compte;
|
||||||
|
$book->label_operation= $label_operation;
|
||||||
$book->debit = $debit;
|
$book->debit = $debit;
|
||||||
$book->credit = $credit;
|
$book->credit = $credit;
|
||||||
$book->doc_date = GETPOST('doc_date');
|
$book->doc_date = GETPOST('doc_date');
|
||||||
@ -141,7 +140,7 @@ else if ($action == "add") {
|
|||||||
$book->sens = 'C';
|
$book->sens = 'C';
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $book->createStd($user);
|
$result = $book->createStd($user, false, $mode);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
@ -154,14 +153,13 @@ else if ($action == "add") {
|
|||||||
else if ($action == "confirm_delete") {
|
else if ($action == "confirm_delete") {
|
||||||
$book = new BookKeeping($db);
|
$book = new BookKeeping($db);
|
||||||
|
|
||||||
$result = $book->fetch($id);
|
$result = $book->fetch($id, null, $mode);
|
||||||
|
|
||||||
$piece_num = $book->piece_num;
|
$piece_num = $book->piece_num;
|
||||||
|
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
$result = $book->delete($user);
|
$result = $book->delete($user, false, $mode);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
}
|
}
|
||||||
@ -170,57 +168,102 @@ else if ($action == "confirm_delete") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == "confirm_create") {
|
else if ($action == "confirm_create") {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$book = new BookKeeping($db);
|
$book = new BookKeeping($db);
|
||||||
|
|
||||||
if (! GETPOST('next_num_mvt'))
|
if (! GETPOST('next_num_mvt'))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumPiece")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumPiece")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$book->label_compte = '';
|
$book->label_compte = '';
|
||||||
$book->debit = 0;
|
$book->debit = 0;
|
||||||
$book->credit = 0;
|
$book->credit = 0;
|
||||||
$book->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth'), GETPOST('doc_dateday'), GETPOST('doc_dateyear'));
|
$book->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth'), GETPOST('doc_dateday'), GETPOST('doc_dateyear'));
|
||||||
$book->doc_type = GETPOST('doc_type');
|
$book->doc_type = GETPOST('doc_type');
|
||||||
$book->piece_num = GETPOST('next_num_mvt');
|
$book->piece_num = GETPOST('next_num_mvt');
|
||||||
$book->doc_ref = GETPOST('doc_ref');
|
$book->doc_ref = GETPOST('doc_ref');
|
||||||
$book->code_journal = GETPOST('code_journal');
|
$book->code_journal = GETPOST('code_journal');
|
||||||
$book->fk_doc = 0;
|
$book->fk_doc = 0;
|
||||||
$book->fk_docdet = 0;
|
$book->fk_docdet = 0;
|
||||||
|
$book->montant = 0;
|
||||||
|
|
||||||
$book->montant = 0;
|
$result = $book->createStd($user,0, $mode);
|
||||||
|
if ($result < 0) {
|
||||||
$result = $book->createStd($user);
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
if ($result < 0) {
|
} else {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||||
} else {
|
$action = 'update';
|
||||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
$id=$book->id;
|
||||||
$action = '';
|
$piece_num = $book->piece_num;
|
||||||
$piece_num = $book->piece_num;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($action == 'setdate') {
|
||||||
|
$datedoc = dol_mktime(0, 0, 0, GETPOST('doc_datemonth'), GETPOST('doc_dateday'), GETPOST('doc_dateyear'));
|
||||||
|
$result = $object->updateByMvt($piece_num,'doc_date',$db->idate($datedoc),$mode);
|
||||||
|
if ($result < 0) {
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||||
|
$action = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == 'setjournal') {
|
||||||
|
$journaldoc = trim(GETPOST('code_journal'));
|
||||||
|
if (!empty($journaldoc)) {
|
||||||
|
$journaldoc='\''.$journaldoc.'\'';
|
||||||
|
}
|
||||||
|
$result = $object->updateByMvt($piece_num,'code_journal',$journaldoc,$mode);
|
||||||
|
if ($result < 0) {
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||||
|
$action = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == 'setdocref') {
|
||||||
|
$refdoc = trim(GETPOST('doc_ref'));
|
||||||
|
if (!empty($refdoc)) {
|
||||||
|
$refdoc='\''.$refdoc.'\'';
|
||||||
|
}
|
||||||
|
$result = $object->updateByMvt(doc_ref,'code_journal',$refdoc,$mode);
|
||||||
|
if ($result < 0) {
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||||
|
$action = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == 'valid') {
|
||||||
|
$result = $object->transformTransaction(0,$piece_num);
|
||||||
|
if ($result < 0) {
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
} else {
|
||||||
|
header("Location: list.php?sortfield=t.piece_num&sortorder=asc");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
$formaccountancy = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
|
$accountjournal = new AccountingJournal($db);
|
||||||
|
|
||||||
/*
|
// Confirmation to delete the command
|
||||||
* Confirmation to delete the command
|
|
||||||
*/
|
|
||||||
if ($action == 'delete') {
|
if ($action == 'delete') {
|
||||||
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1);
|
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id.'&mode='. $mode, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1);
|
||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,15 +271,17 @@ if ($action == 'create') {
|
|||||||
print load_fiche_titre($langs->trans("CreateMvts"));
|
print load_fiche_titre($langs->trans("CreateMvts"));
|
||||||
|
|
||||||
$book = new BookKeeping($db);
|
$book = new BookKeeping($db);
|
||||||
$next_num_mvt = $book->getNextNumMvt();
|
$next_num_mvt = $book->getNextNumMvt('_tmp');
|
||||||
if (empty($next_num_mvt))
|
|
||||||
{
|
if (empty($next_num_mvt))
|
||||||
dol_print_error('', 'Failed to get next piece number');
|
{
|
||||||
}
|
dol_print_error('', 'Failed to get next piece number');
|
||||||
|
}
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" name="create_mvt" method="POST">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" name="create_mvt" method="POST">';
|
||||||
print '<input type="hidden" name="action" value="confirm_create">' . "\n";
|
print '<input type="hidden" name="action" value="confirm_create">' . "\n";
|
||||||
print '<input type="hidden" name="next_num_mvt" value="' . $next_num_mvt . '">' . "\n";
|
print '<input type="hidden" name="next_num_mvt" value="' . $next_num_mvt . '">' . "\n";
|
||||||
|
print '<input type="hidden" name="mode" value="_tmp">' . "\n";
|
||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
@ -254,10 +299,9 @@ if ($action == 'create') {
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="fieldrequired">'.$langs->trans("AccountancyJournal").'</td>';
|
print '<td class="fieldrequired">' . $langs->trans("Codejournal") . '</td>';
|
||||||
print '<td>';
|
print '<td>' . $formaccounting->select_journal(GETPOST('code_journal'),'code_journal',0,0,array(),1,1) . '</td>';
|
||||||
print $formaccountancy->select_journal('', 'code_journal', '', 0, '', 1, 1, 1, 1);
|
print '</tr>';
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>' . $langs->trans("Docref") . '</td>';
|
print '<td>' . $langs->trans("Docref") . '</td>';
|
||||||
@ -266,7 +310,7 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>' . $langs->trans("Doctype") . '</td>';
|
print '<td>' . $langs->trans("Doctype") . '</td>';
|
||||||
print '<td><input type="text" class="minwidth200" name="doc_type" value=""/></td>';
|
print '<td><input type="text" class="minwidth200 name="doc_type" value=""/></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -280,7 +324,7 @@ if ($action == 'create') {
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
} else {
|
} else {
|
||||||
$book = new BookKeeping($db);
|
$book = new BookKeeping($db);
|
||||||
$result = $book->fetchPerMvt($piece_num);
|
$result = $book->fetchPerMvt($piece_num, $mode);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
}
|
}
|
||||||
@ -290,59 +334,138 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichehalfleft">';
|
||||||
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
// account movement
|
||||||
print '<tr class="pair">';
|
print '<tr class="pair">';
|
||||||
print '<td class="titlefield">' . $langs->trans("NumMvts") . '</td>';
|
print '<td class="titlefield">' . $langs->trans("NumMvts") . '</td>';
|
||||||
print '<td>' . $book->piece_num . '</td>';
|
print '<td>' . $book->piece_num . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr class="impair">';
|
// date
|
||||||
print '<td>' . $langs->trans("Docdate") . '</td>';
|
print '<tr class="impair"><td>';
|
||||||
print '<td>' . dol_print_date($book->doc_date, 'daytextshort') . '</td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
|
print $langs->trans('Docdate');
|
||||||
|
print '</td>';
|
||||||
|
if ($action != 'editdate')
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=editdate&piece_num='. $book->piece_num .'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('SetDate'),1).'</a></td>';
|
||||||
|
print '</tr></table>';
|
||||||
|
print '</td><td colspan="3">';
|
||||||
|
if ($action == 'editdate') {
|
||||||
|
print '<form name="setdate" action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
|
||||||
|
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||||
|
print '<input type="hidden" name="action" value="setdate">';
|
||||||
|
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||||
|
$form->select_date($book->doc_date ? $book->doc_date : - 1, 'doc_date', '', '', '', "setdate");
|
||||||
|
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
||||||
|
print '</form>';
|
||||||
|
} else {
|
||||||
|
print $book->doc_date ? dol_print_date($book->doc_date, 'daytext') : ' ';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
//journal
|
||||||
print '<tr class="pair">';
|
print '<tr class="pair"><td>';
|
||||||
print '<td>' . $langs->trans("Codejournal") . '</td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print '<td>';
|
print $langs->trans('Codejournal');
|
||||||
$accountingjournal = new AccountingJournal($db);
|
print '</td>';
|
||||||
$accountingjournal->fetch('',$book->code_journal);
|
if ($action != 'editjournal')
|
||||||
print $accountingjournal->getNomUrl(0,1,1,'',1);
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=editjournal&piece_num='.$book->piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</a></td>';
|
||||||
print '</td></tr>';
|
print '</tr></table>';
|
||||||
|
print '</td><td>';
|
||||||
print '<tr class="impair">';
|
if ($action == 'editjournal') {
|
||||||
print '<td>' . $langs->trans("Docref") . '</td>';
|
print '<form name="setjournal" action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
|
||||||
print '<td>' . $book->doc_ref . '</td>';
|
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||||
|
print '<input type="hidden" name="action" value="setjournal">';
|
||||||
|
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||||
|
print $formaccounting->select_journal($book->code_journal,'code_journal',0,0,array(),1,1);
|
||||||
|
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
||||||
|
print '</form>';
|
||||||
|
} else {
|
||||||
|
print $book->code_journal ;
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
//docref
|
||||||
$typelabel = $book->doc_type;
|
print '<tr class="impair"><td>';
|
||||||
if ($typelabel == 'bank') {
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
$typelabel = $langs->trans('Bank');
|
print $langs->trans('Docref');
|
||||||
}
|
print '</td>';
|
||||||
if ($typelabel == 'customer_invoice') {
|
if ($action != 'editdocref')
|
||||||
$typelabel = $langs->trans('CustomerInvoice');
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=editdocref&piece_num='.$book->piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'</a></td>';
|
||||||
}
|
print '</tr></table>';
|
||||||
if ($typelabel == 'supplier_invoice') {
|
print '</td><td>';
|
||||||
$typelabel = $langs->trans('SupplierInvoice');
|
if ($action == 'editdocref') {
|
||||||
}
|
print '<form name="setdocref" action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
|
||||||
if ($typelabel == 'expense_report') {
|
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||||
$typelabel = $langs->trans('ExpenseReport');
|
print '<input type="hidden" name="action" value="setdocref">';
|
||||||
|
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||||
|
print '<input type="text" size="20" name="doc_ref" value="'.$book->doc_ref.'">';
|
||||||
|
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
||||||
|
print '</form>';
|
||||||
|
} else {
|
||||||
|
print $book->doc_ref ;
|
||||||
}
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
//doctype
|
||||||
print '<tr class="pair">';
|
print '<tr class="pair">';
|
||||||
print '<td>' . $langs->trans("Doctype") . '</td>';
|
print '<td>' . $langs->trans("Doctype") . '</td>';
|
||||||
print '<td>' . $typelabel . '</td>';
|
print '<td>' . $book->doc_type . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
dol_fiche_end();
|
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
|
// Validate
|
||||||
|
print '<tr class="pair">';
|
||||||
|
print '<td class="titlefield">' . $langs->trans("Status") . '</td>';
|
||||||
|
print '<td>';
|
||||||
|
if (empty($book->validated)) {
|
||||||
|
print '<a href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $line->rowid . '&action=enable">';
|
||||||
|
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||||
|
print '</a>';
|
||||||
|
} else {
|
||||||
|
print '<a href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $line->rowid . '&action=disable">';
|
||||||
|
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||||
|
print '</a>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
// check data
|
||||||
|
print '<tr class="impair">';
|
||||||
|
print '<td class="titlefield">' . $langs->trans("Control") . '</td>';
|
||||||
|
/*
|
||||||
|
if ($book->doc_type == 'customer_invoice')
|
||||||
|
{
|
||||||
|
$sqlmid = 'SELECT rowid as ref';
|
||||||
|
$sqlmid .= " FROM ".MAIN_DB_PREFIX."facture as fac";
|
||||||
|
$sqlmid .= " WHERE fac.rowid=" . $book->fk_doc;
|
||||||
|
dol_syslog("accountancy/bookkeeping/card.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||||
|
$resultmid = $db->query($sqlmid);
|
||||||
|
if ($resultmid) {
|
||||||
|
$objmid = $db->fetch_object($resultmid);
|
||||||
|
$invoicestatic = new Facture($db);
|
||||||
|
$invoicestatic->fetch($objmid->ref);
|
||||||
|
$ref=$langs->trans("Invoice").' '.$invoicestatic->getNomUrl(1);
|
||||||
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
print '<td>' . $ref .'</td>';
|
||||||
|
print "</table>\n";
|
||||||
|
print '</div>';
|
||||||
|
print '</div></div>';
|
||||||
|
print '<div style="clear:both"></div>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
$result = $book->fetch_all_per_mvt($piece_num);
|
$result = $book->fetchAllPerMvt($piece_num, $mode);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
@ -356,8 +479,7 @@ if ($action == 'create') {
|
|||||||
print '<input type="hidden" name="code_journal" value="' . $book->code_journal . '">' . "\n";
|
print '<input type="hidden" name="code_journal" value="' . $book->code_journal . '">' . "\n";
|
||||||
print '<input type="hidden" name="fk_doc" value="' . $book->fk_doc . '">' . "\n";
|
print '<input type="hidden" name="fk_doc" value="' . $book->fk_doc . '">' . "\n";
|
||||||
print '<input type="hidden" name="fk_docdet" value="' . $book->fk_docdet . '">' . "\n";
|
print '<input type="hidden" name="fk_docdet" value="' . $book->fk_docdet . '">' . "\n";
|
||||||
|
print '<input type="hidden" name="mode" value="' . $mode . '">' . "\n";
|
||||||
$var=False;
|
|
||||||
|
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
if (count($book->linesmvt) > 0) {
|
if (count($book->linesmvt) > 0) {
|
||||||
@ -368,56 +490,51 @@ if ($action == 'create') {
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|
||||||
print_liste_field_titre($langs->trans("AccountAccountingShort"));
|
print_liste_field_titre($langs->trans("AccountAccountingShort"));
|
||||||
print_liste_field_titre($langs->trans("Code_tiers"));
|
print_liste_field_titre($langs->trans("Subledger_account"));
|
||||||
print_liste_field_titre($langs->trans("Labelcompte"));
|
print_liste_field_titre($langs->trans("Labelcompte"));
|
||||||
print_liste_field_titre($langs->trans("Debit"), "", "", "", "", 'align="right"');
|
print_liste_field_titre($langs->trans("Labeloperation"));
|
||||||
print_liste_field_titre($langs->trans("Credit"), "", "", "", "", 'align="right"');
|
print_liste_field_titre($langs->trans("Debit"), "", "", "", "", 'align="center"');
|
||||||
print_liste_field_titre($langs->trans("Amount"), "", "", "", "", 'align="right"');
|
print_liste_field_titre($langs->trans("Credit"), "", "", "", "", 'align="center"');
|
||||||
print_liste_field_titre($langs->trans("Sens"), "", "", "", "", 'align="center"');
|
|
||||||
print_liste_field_titre($langs->trans("Action"), "", "", "", "", 'width="60" align="center"');
|
print_liste_field_titre($langs->trans("Action"), "", "", "", "", 'width="60" align="center"');
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
foreach ($book->linesmvt as $line) {
|
foreach ( $book->linesmvt as $line ) {
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
$total_debit += $line->debit;
|
$total_debit += $line->debit;
|
||||||
$total_credit += $line->credit;
|
$total_credit += $line->credit;
|
||||||
|
|
||||||
if ($action == 'update' && $line->id == $id) {
|
if ($action == 'update' && $line->id == $id) {
|
||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $formaccounting->select_account($line->numero_compte, 'account_number', 0, array (), 1, 1, '');
|
print $formaccounting->select_account($line->numero_compte, 'account_number', 0, array (), 1, 1, '');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $formaccounting->select_auxaccount($line->code_tiers, 'code_tiers', 1);
|
print $formaccounting->select_auxaccount($line->subledger_account, 'subledger_account', 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
|
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
|
||||||
|
print '<td><input type="text" size="15" name="label_operation" value="' . $line->label_operation. '"/></td>';
|
||||||
print '<td align="right"><input type="text" size="6" name="debit" value="' . price($line->debit) . '"/></td>';
|
print '<td align="right"><input type="text" size="6" name="debit" value="' . price($line->debit) . '"/></td>';
|
||||||
print '<td align="right"><input type="text" size="6" name="credit" value="' . price($line->credit) . '"/></td>';
|
print '<td align="right"><input type="text" size="6" name="credit" value="' . price($line->credit) . '"/></td>';
|
||||||
print '<td align="right">' . price($line->montant) . '</td>';
|
|
||||||
print '<td align="center">' . $line->sens . '</td>';
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="hidden" name="id" value="' . $line->id . '">' . "\n";
|
print '<input type="hidden" name="id" value="' . $line->id . '">' . "\n";
|
||||||
print '<input type="submit" class="button" name="update" value="' . $langs->trans("Update") . '">';
|
print '<input type="submit" class="button" name="update" value="' . $langs->trans("Update") . '">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
} else {
|
} else {
|
||||||
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
||||||
print '<td>' . length_accounta($line->code_tiers) . '</td>';
|
print '<td>' . length_accounta($line->subledger_account) . '</td>';
|
||||||
print '<td>' . $line->label_compte . '</td>';
|
print '<td>' . $line->label_compte . '</td>';
|
||||||
|
print '<td>' . $line->label_operation. '</td>';
|
||||||
print '<td align="right">' . price($line->debit) . '</td>';
|
print '<td align="right">' . price($line->debit) . '</td>';
|
||||||
print '<td align="right">' . price($line->credit) . '</td>';
|
print '<td align="right">' . price($line->credit) . '</td>';
|
||||||
print '<td align="right">' . price($line->montant) . '</td>';
|
|
||||||
print '<td align="center">' . $line->sens . '</td>';
|
|
||||||
|
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<a href="./card.php?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '">';
|
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a> ';
|
print '</a> ';
|
||||||
print '<a href="./card.php?action=delete&id=' . $line->id . '&piece_num=' . $line->piece_num . '">';
|
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
|
||||||
print img_delete();
|
print img_delete();
|
||||||
print '</a>';
|
|
||||||
|
|
||||||
|
print '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -434,17 +551,21 @@ if ($action == 'create') {
|
|||||||
print $formaccounting->select_account($account_number, 'account_number', 0, array (), 1, 1, '');
|
print $formaccounting->select_account($account_number, 'account_number', 0, array (), 1, 1, '');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $formaccounting->select_auxaccount($code_tiers, 'code_tiers', 1);
|
print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td><input type="text" size="15" name="label_compte" value="' . $label_compte . '"/></td>';
|
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
|
||||||
print '<td align="right"><input type="text" class="right maxwidth50" name="debit" value="' . price($debit) . '"/></td>';
|
print '<td><input type="text" size="15" name="label_operation" value="' . $line->label_operation. '"/></td>';
|
||||||
print '<td align="right"><input type="text" class="right maxwidth50" name="credit" value="' . price($credit) . '"/></td>';
|
print '<td align="right"><input type="text" size="6" name="debit" value="' . price($debit) . '"/></td>';
|
||||||
print '<td></td>';
|
print '<td align="right"><input type="text" size="6" name="credit" value="' . price($credit) . '"/></td>';
|
||||||
print '<td></td>';
|
|
||||||
print '<td><input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '"></td>';
|
print '<td><input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
if ($mode=='_tmp' && $total_debit == $total_credit && $action=='') {
|
||||||
|
print '<div class="tabsAction">';
|
||||||
|
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '&action=valid">'.$langs->trans("ValidTransaction").'</a>';
|
||||||
|
print "</div>";
|
||||||
|
}
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -453,5 +574,6 @@ if ($action == 'create') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -25,8 +25,7 @@
|
|||||||
* \brief List operation of book keeping
|
* \brief List operation of book keeping
|
||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php';
|
||||||
// Class
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||||
@ -47,11 +46,11 @@ $search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETP
|
|||||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||||
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
|
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
|
||||||
|
|
||||||
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt")) {
|
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
|
||||||
$action = 'delbookkeepingyear';
|
$action = 'delbookkeepingyear';
|
||||||
}
|
}
|
||||||
if (GETPOST("button_export_csv_x") || GETPOST("button_export_csv")) {
|
if (GETPOST("button_export_file_x") || GETPOST("button_export_file.x") || GETPOST("button_export_file")) {
|
||||||
$action = 'export_csv';
|
$action = 'export_file';
|
||||||
}
|
}
|
||||||
|
|
||||||
$search_accountancy_code = GETPOST("search_accountancy_code");
|
$search_accountancy_code = GETPOST("search_accountancy_code");
|
||||||
@ -99,7 +98,7 @@ $formother = new FormOther($db);
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
|
|
||||||
if ($action != 'export_csv' && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction'])) {
|
if ($action != 'export_file' && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && empty($page)) {
|
||||||
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
||||||
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
||||||
}
|
}
|
||||||
@ -171,19 +170,19 @@ if (! empty($search_accountancy_code_end)) {
|
|||||||
$param .= '&search_accountancy_code_end=' . $search_accountancy_code_end;
|
$param .= '&search_accountancy_code_end=' . $search_accountancy_code_end;
|
||||||
}
|
}
|
||||||
if (! empty($search_accountancy_aux_code)) {
|
if (! empty($search_accountancy_aux_code)) {
|
||||||
$filter['t.code_tiers'] = $search_accountancy_aux_code;
|
$filter['t.subledger_account'] = $search_accountancy_aux_code;
|
||||||
$param .= '&search_accountancy_aux_code=' . $search_accountancy_aux_code;
|
$param .= '&search_accountancy_aux_code=' . $search_accountancy_aux_code;
|
||||||
}
|
}
|
||||||
if (! empty($search_accountancy_aux_code_start)) {
|
if (! empty($search_accountancy_aux_code_start)) {
|
||||||
$filter['t.code_tiers>='] = $search_accountancy_aux_code_start;
|
$filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
|
||||||
$param .= '&search_accountancy_aux_code_start=' . $search_accountancy_aux_code_start;
|
$param .= '&search_accountancy_aux_code_start=' . $search_accountancy_aux_code_start;
|
||||||
}
|
}
|
||||||
if (! empty($search_accountancy_aux_code_end)) {
|
if (! empty($search_accountancy_aux_code_end)) {
|
||||||
$filter['t.code_tiers<='] = $search_accountancy_aux_code_end;
|
$filter['t.subledger_account<='] = $search_accountancy_aux_code_end;
|
||||||
$param .= '&search_accountancy_aux_code_end=' . $search_accountancy_aux_code_end;
|
$param .= '&search_accountancy_aux_code_end=' . $search_accountancy_aux_code_end;
|
||||||
}
|
}
|
||||||
if (! empty($search_mvt_label)) {
|
if (! empty($search_mvt_label)) {
|
||||||
$filter['t.label_compte'] = $search_mvt_label;
|
$filter['t.label_operation'] = $search_mvt_label;
|
||||||
$param .= '&search_mvt_label=' . $search_mvt_label;
|
$param .= '&search_mvt_label=' . $search_mvt_label;
|
||||||
}
|
}
|
||||||
if (! empty($search_direction)) {
|
if (! empty($search_direction)) {
|
||||||
@ -261,9 +260,8 @@ if ($action == 'delmouvconfirm') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'export_csv') {
|
// Export into a file with format defined into setup
|
||||||
|
if ($action == 'export_file') {
|
||||||
include DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php';
|
|
||||||
|
|
||||||
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
|
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
|
||||||
|
|
||||||
@ -322,7 +320,7 @@ if ($action == 'delbookkeepingyear') {
|
|||||||
$delyear = dol_print_date(dol_now(), '%Y');
|
$delyear = dol_print_date(dol_now(), '%Y');
|
||||||
}
|
}
|
||||||
$year_array = $formaccounting->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
|
$year_array = $formaccounting->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
|
||||||
$journal_array = $formaccounting->selectjournal($deljournal, 'deljournal', '', 1, 'array', 1, 1);
|
$journal_array = $formaccounting->select_journal($deljournal, 'deljournal', '', 1, 1, 1, '', 0, 1);
|
||||||
|
|
||||||
$form_question['delyear'] = array (
|
$form_question['delyear'] = array (
|
||||||
'name' => 'delyear',
|
'name' => 'delyear',
|
||||||
@ -333,9 +331,9 @@ if ($action == 'delbookkeepingyear') {
|
|||||||
);
|
);
|
||||||
$form_question['deljournal'] = array (
|
$form_question['deljournal'] = array (
|
||||||
'name' => 'deljournal',
|
'name' => 'deljournal',
|
||||||
'type' => 'select',
|
'type' => 'other', // We don't use select here, the journal_array is already a select html component
|
||||||
'label' => $langs->trans('DelJournal'),
|
'label' => $langs->trans('DelJournal'),
|
||||||
'values' => $journal_array,
|
'value' => $journal_array,
|
||||||
'default' => $deljournal
|
'default' => $deljournal
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -356,16 +354,18 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
|||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
|
|
||||||
$button = '<a class="butAction" name="button_export_csv" href="'.$_SERVER["PHP_SELF"].'?action=export_csv'.($param?'&'.$param:'').'">';
|
$listofformat=AccountancyExport::getType();
|
||||||
|
$button = '<a class="butAction" name="button_export_file" href="'.$_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:'').'">';
|
||||||
if (count($filter)) $button.= $langs->trans("ExportFilteredList");
|
if (count($filter)) $button.= $langs->trans("ExportFilteredList");
|
||||||
else $button.= $langs->trans("ExportList");
|
else $button.= $langs->trans("ExportList");
|
||||||
|
$button.=' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')';
|
||||||
$button.= '</a>';
|
$button.= '</a>';
|
||||||
|
|
||||||
$groupby = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php"">' . $langs->trans("GroupByAccountAccounting") . '</a>';
|
$groupby = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php"">' . $langs->trans("GroupByAccountAccounting") . '</a>';
|
||||||
|
|
||||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, $groupby, '', $limit);
|
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, $groupby, '', $limit);
|
||||||
|
|
||||||
print '<div class="tabsAction">' . "\n";
|
print '<div class="tabsAction tabsActionNoBottom">' . "\n";
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
|
||||||
print '<div class="inline-block divButAction"><a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear'.($param?'&'.$param:'').'">' . $langs->trans("DelBookKeeping") . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear'.($param?'&'.$param:'').'">' . $langs->trans("DelBookKeeping") . '</a></div>';
|
||||||
|
|
||||||
@ -376,26 +376,35 @@ print '<table class="noborder" width="100%">';
|
|||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="' . dol_escape_htmltag($search_mvt_num) . '"></td>';
|
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="' . dol_escape_htmltag($search_mvt_num) . '"></td>';
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('From') . ': ';
|
print $langs->trans('From') . ': ';
|
||||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
||||||
print '<br>';
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('to') . ': ';
|
print $langs->trans('to') . ': ';
|
||||||
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="' . dol_escape_htmltag($search_doc_ref) . '"></td>';
|
print '<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="' . dol_escape_htmltag($search_doc_ref) . '"></td>';
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('From');
|
print $langs->trans('From');
|
||||||
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
|
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, 'maxwidth200');
|
||||||
print '<br>';
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('to');
|
print $langs->trans('to');
|
||||||
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
|
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, 'maxwidth200');
|
||||||
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('From');
|
print $langs->trans('From');
|
||||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||||
print '<br>';
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('to');
|
print $langs->trans('to');
|
||||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
||||||
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
|
print '<input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
|
||||||
@ -414,8 +423,8 @@ print_liste_field_titre($langs->trans("TransactionNumShort"), $_SERVER['PHP_SELF
|
|||||||
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $param, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("SubledgerAccount"), $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_compte", "", $param, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
@ -429,7 +438,6 @@ $total_debit = 0;
|
|||||||
$total_credit = 0;
|
$total_credit = 0;
|
||||||
|
|
||||||
foreach ($object->lines as $line ) {
|
foreach ($object->lines as $line ) {
|
||||||
$var = ! $var;
|
|
||||||
|
|
||||||
$total_debit += $line->debit;
|
$total_debit += $line->debit;
|
||||||
$total_credit += $line->credit;
|
$total_credit += $line->credit;
|
||||||
@ -440,14 +448,15 @@ foreach ($object->lines as $line ) {
|
|||||||
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
|
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
|
||||||
print '<td class="nowrap">' . $line->doc_ref . '</td>';
|
print '<td class="nowrap">' . $line->doc_ref . '</td>';
|
||||||
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
||||||
print '<td>' . length_accounta($line->code_tiers) . '</td>';
|
print '<td>' . length_accounta($line->subledger_account) . '</td>';
|
||||||
print '<td>' . $line->label_compte . '</td>';
|
print '<td>' . $line->label_operation . '</td>';
|
||||||
print '<td align="right">' . price($line->debit) . '</td>';
|
print '<td align="right">' . ($line->debit ? price($line->debit) : ''). '</td>';
|
||||||
print '<td align="right">' . price($line->credit) . '</td>';
|
print '<td align="right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
||||||
|
|
||||||
$accountingjournal = new AccountingJournal($db);
|
$accountingjournal = new AccountingJournal($db);
|
||||||
$accountingjournal->fetch('',$line->code_journal);
|
$result = $accountingjournal->fetch('',$line->code_journal);
|
||||||
print '<td align="center">' . $accountingjournal->getNomUrl(0,0,0,'',0) . '</td>';
|
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0,0,0,'',0) : $line->code_journal);
|
||||||
|
print '<td align="center">' . $journaltoshow . '</td>';
|
||||||
|
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a> ';
|
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a> ';
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/* Copyright (C) 2016 Neil Orley <neil.orley@oeris.fr>
|
||||||
* Copyright (C) 2016 Neil Orley <neil.orley@oeris.fr> largely based on the great work of :
|
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* - Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* - Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* - Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -75,10 +74,6 @@ if (empty($search_date_end)) $search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_
|
|||||||
|
|
||||||
$object = new BookKeeping($db);
|
$object = new BookKeeping($db);
|
||||||
|
|
||||||
$formaccounting = new FormAccounting($db);
|
|
||||||
$formother = new FormOther($db);
|
|
||||||
$form = new Form($db);
|
|
||||||
|
|
||||||
|
|
||||||
$options = '';
|
$options = '';
|
||||||
$filter = array ();
|
$filter = array ();
|
||||||
@ -104,11 +99,11 @@ if (!GETPOST("button_removefilter_x") && !GETPOST("button_removefilter")) // Bot
|
|||||||
$options .= '&search_accountancy_code_start=' . $search_accountancy_code_start;
|
$options .= '&search_accountancy_code_start=' . $search_accountancy_code_start;
|
||||||
}
|
}
|
||||||
if (! empty($search_label_account)) {
|
if (! empty($search_label_account)) {
|
||||||
$filter['t.label_compte'] = $search_label_account;
|
$filter['t.label_operation'] = $search_label_account;
|
||||||
$options .= '&search_label_account=' . $search_label_account;
|
$options .= '&search_label_account=' . $search_label_account;
|
||||||
}
|
}
|
||||||
if (! empty($search_mvt_label)) {
|
if (! empty($search_mvt_label)) {
|
||||||
$filter['t.label_compte'] = $search_mvt_label;
|
$filter['t.label_operation'] = $search_mvt_label;
|
||||||
$options .= '&search_mvt_label=' . $search_mvt_label;
|
$options .= '&search_mvt_label=' . $search_mvt_label;
|
||||||
}
|
}
|
||||||
if (! empty($search_direction)) {
|
if (! empty($search_direction)) {
|
||||||
@ -126,7 +121,7 @@ if (!GETPOST("button_removefilter_x") && !GETPOST("button_removefilter")) // Bot
|
|||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_doc_date = '';
|
$search_doc_date = '';
|
||||||
$search_accountancy_code = '';
|
$search_accountancy_code = '';
|
||||||
@ -156,6 +151,10 @@ if ($action == 'delmouvconfirm') {
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$formaccounting = new FormAccounting($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
$title_page = $langs->trans("Bookkeeping") . ' ' . strtolower($langs->trans("By")) . ' ' . $langs->trans("AccountAccounting");
|
$title_page = $langs->trans("Bookkeeping") . ' ' . strtolower($langs->trans("By")) . ' ' . $langs->trans("AccountAccounting");
|
||||||
|
|
||||||
llxHeader('', $title_page);
|
llxHeader('', $title_page);
|
||||||
@ -217,7 +216,7 @@ if ( preg_match('/^asc/i', $sortorder) )
|
|||||||
else
|
else
|
||||||
$sortorder = "desc";
|
$sortorder = "desc";
|
||||||
|
|
||||||
print '<div class="tabsAction">' . "\n";
|
print '<div class="tabsAction tabsActionNoBottom">' . "\n";
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
@ -257,7 +256,6 @@ print "</tr>\n";
|
|||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$var = True;
|
|
||||||
|
|
||||||
$total_debit = 0;
|
$total_debit = 0;
|
||||||
$total_credit = 0;
|
$total_credit = 0;
|
||||||
@ -313,14 +311,14 @@ foreach ( $object->lines as $line ) {
|
|||||||
|
|
||||||
// Affiche un lien vers la facture client/fournisseur
|
// Affiche un lien vers la facture client/fournisseur
|
||||||
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
|
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
|
||||||
print strlen(length_accounta($line->code_tiers)) == 0 ? '<td>' . $line->label_compte . '</td>' : '<td>' . $line->label_compte . '<br /><span style="font-size:0.8em">(' . length_accounta($line->code_tiers) . ')</span></td>';
|
print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>' . $line->label_operation . '</td>' : '<td>' . $line->label_operation . '<br /><span style="font-size:0.8em">(' . length_accounta($line->subledger_account) . ')</span></td>';
|
||||||
|
|
||||||
|
|
||||||
print '<td align="right">' . price($line->debit) . '</td>';
|
print '<td align="right">' . ($line->debit ? price($line->debit) :''). '</td>';
|
||||||
print '<td align="right">' . price($line->credit) . '</td>';
|
print '<td align="right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
||||||
print '<td align="center">' . $line->code_journal . '</td>';
|
print '<td align="center">' . $line->code_journal . '</td>';
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a> ';
|
print '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a> ';
|
||||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $options . '&page=' . $page . '">' . img_delete() . '</a>';
|
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $options . '&page=' . $page . '">' . img_delete() . '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -355,6 +353,4 @@ print "</table>";
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -52,16 +52,16 @@ $search_numero_compte_end = GETPOST('search_numero_compte_end', 'alpha');
|
|||||||
if ($search_numero_compte_end == - 1) {
|
if ($search_numero_compte_end == - 1) {
|
||||||
$search_numero_compte_end = '';
|
$search_numero_compte_end = '';
|
||||||
}
|
}
|
||||||
$search_code_tiers = GETPOST('search_code_tiers', 'alpha');
|
$search_subledger_account = GETPOST('search_subledger_account', 'alpha');
|
||||||
$search_code_tiers_start = GETPOST('search_code_tiers_start', 'alpha');
|
$search_subledger_account_start = GETPOST('search_subledger_account_start', 'alpha');
|
||||||
if ($search_code_tiers_start == - 1) {
|
if ($search_subledger_account_start == - 1) {
|
||||||
$search_code_tiers_start = '';
|
$search_subledger_account_start = '';
|
||||||
}
|
}
|
||||||
$search_code_tiers_end = GETPOST('search_code_tiers_end', 'alpha');
|
$search_subledger_account_end = GETPOST('search_subledger_account_end', 'alpha');
|
||||||
if ($search_code_tiers_end == - 1) {
|
if ($search_subledger_account_end == - 1) {
|
||||||
$search_code_tiers_end = '';
|
$search_subledger_account_end = '';
|
||||||
}
|
}
|
||||||
$search_label_compte = GETPOST('search_label_compte', 'alpha');
|
$search_label_operation = GETPOST('search_label_operation', 'alpha');
|
||||||
$search_sens = GETPOST('search_sens', 'alpha');
|
$search_sens = GETPOST('search_sens', 'alpha');
|
||||||
$search_code_journal = GETPOST('search_code_journal', 'alpha');
|
$search_code_journal = GETPOST('search_code_journal', 'alpha');
|
||||||
|
|
||||||
@ -81,16 +81,19 @@ if ($sortfield == "")
|
|||||||
|
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
|
|
||||||
llxHeader('', $langs->trans("Bookkeeping"));
|
|
||||||
|
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_doc_type = "";
|
$search_doc_type = "";
|
||||||
$search_doc_date = "";
|
$search_doc_date = "";
|
||||||
$search_doc_ref = "";
|
$search_doc_ref = "";
|
||||||
$search_numero_compte = "";
|
$search_numero_compte = "";
|
||||||
$search_code_tiers = "";
|
$search_subledger_account = "";
|
||||||
$search_label_compte = "";
|
$search_label_operation = "";
|
||||||
$search_sens = "";
|
$search_sens = "";
|
||||||
$search_code_journal = "";
|
$search_code_journal = "";
|
||||||
}
|
}
|
||||||
@ -129,21 +132,21 @@ if (! empty($search_numero_compte_end)) {
|
|||||||
$filter['t.numero_compte<='] = $search_numero_compte_end;
|
$filter['t.numero_compte<='] = $search_numero_compte_end;
|
||||||
$options .= '&search_numero_compte_end=' . $search_numero_compte_end;
|
$options .= '&search_numero_compte_end=' . $search_numero_compte_end;
|
||||||
}
|
}
|
||||||
if (! empty($search_code_tiers)) {
|
if (! empty($search_subledger_account)) {
|
||||||
$filter['t.code_tiers'] = $search_code_tiers;
|
$filter['t.subledger_account'] = $search_subledger_account;
|
||||||
$options .= '&search_code_tiers=' . $search_code_tiers;
|
$options .= '&search_subledger_account=' . $search_subledger_account;
|
||||||
}
|
}
|
||||||
if (! empty($search_code_tiers_start)) {
|
if (! empty($search_subledger_account_start)) {
|
||||||
$filter['t.code_tiers>='] = $search_code_tiers_start;
|
$filter['t.subledger_account>='] = $search_subledger_account_start;
|
||||||
$options .= '&search_code_tiers_start=' . $search_code_tiers_start;
|
$options .= '&search_subledger_account_start=' . $search_subledger_account_start;
|
||||||
}
|
}
|
||||||
if (! empty($search_code_tiers_end)) {
|
if (! empty($search_subledger_account_end)) {
|
||||||
$filter['t.code_tiers<='] = $search_code_tiers_end;
|
$filter['t.subledger_account<='] = $search_subledger_account_end;
|
||||||
$options .= '&search_code_tiers_end=' . $search_code_tiers_end;
|
$options .= '&search_subledger_account_end=' . $search_subledger_account_end;
|
||||||
}
|
}
|
||||||
if (! empty($search_label_compte)) {
|
if (! empty($search_label_operation)) {
|
||||||
$filter['t.label_compte'] = $search_label_compte;
|
$filter['t.label_operation'] = $search_label_operation;
|
||||||
$options .= '&search_label_compte=' . $search_label_compte;
|
$options .= '&search_label_operation=' . $search_label_operation;
|
||||||
}
|
}
|
||||||
if (! empty($search_sens)) {
|
if (! empty($search_sens)) {
|
||||||
$filter['t.sens'] = $search_sens;
|
$filter['t.sens'] = $search_sens;
|
||||||
@ -154,10 +157,13 @@ if (! empty($search_code_journal)) {
|
|||||||
$options .= '&search_code_journal=' . $search_code_journal;
|
$options .= '&search_code_journal=' . $search_code_journal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mode List
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
llxHeader('', $langs->trans("Bookkeeping"));
|
||||||
|
|
||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||||
$nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0);
|
$nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0);
|
||||||
@ -188,9 +194,9 @@ print $formaccounting->select_account($search_numero_compte_end, 'search_numero_
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="liste_titre">';
|
print '<div class="liste_titre">';
|
||||||
print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
|
print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
|
||||||
print $formaccounting->select_auxaccount($search_code_tiers_start, 'search_code_tiers_start', 1);
|
print $formaccounting->select_auxaccount($search_subledger_account_start, 'search_subledger_account_start', 1);
|
||||||
print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
|
print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
|
||||||
print $formaccounting->select_auxaccount($search_code_tiers_end, 'searchcode_tiers_end', 1);
|
print $formaccounting->select_auxaccount($search_subledger_account_end, 'search_subledger_account_end', 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
|
|
||||||
@ -200,8 +206,8 @@ print_liste_field_titre($langs->trans("Doctype"), $_SERVER['PHP_SELF'], "t.doc_t
|
|||||||
print_liste_field_titre($langs->trans("Date"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Date"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("ThirdPartyAccount"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $options, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("ThirdPartyAccount"), $_SERVER['PHP_SELF'], "t.subledger_account", "", $options, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, "", $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "t.montant", "", $options, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "t.montant", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||||
@ -232,11 +238,11 @@ print '<input type="text" size=6 class="flat" name="search_numero_compte" value=
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input type="text" size=6 class="flat" name="search_code_tiers" value="' . $search_code_tiers . '"/>';
|
print '<input type="text" size=6 class="flat" name="search_subledger_account" value="' . $search_subledger_account . '"/>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input type="text" size=6 class="flat" name="search_label_compte" value="' . $search_label_compte . '"/>';
|
print '<input type="text" size=6 class="flat" name="search_label_operation" value="' . $search_label_operation . '"/>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
@ -264,8 +270,6 @@ print '</td>';
|
|||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$var = True;
|
|
||||||
|
|
||||||
foreach ( $object->lines as $line ) {
|
foreach ( $object->lines as $line ) {
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
@ -274,8 +278,8 @@ foreach ( $object->lines as $line ) {
|
|||||||
print '<td align="center">' . dol_print_date($line->doc_date) . '</td>';
|
print '<td align="center">' . dol_print_date($line->doc_date) . '</td>';
|
||||||
print '<td>' . $line->doc_ref . '</td>';
|
print '<td>' . $line->doc_ref . '</td>';
|
||||||
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
||||||
print '<td>' . length_accounta($line->code_tiers) . '</td>';
|
print '<td>' . length_accounta($line->subledger_account) . '</td>';
|
||||||
print '<td>' . $line->label_compte . '</td>';
|
print '<td>' . $line->label_operation . '</td>';
|
||||||
print '<td align="right">' . price($line->debit) . '</td>';
|
print '<td align="right">' . price($line->debit) . '</td>';
|
||||||
print '<td align="right">' . price($line->credit) . '</td>';
|
print '<td align="right">' . price($line->credit) . '</td>';
|
||||||
print '<td align="right">' . price($line->montant) . '</td>';
|
print '<td align="right">' . price($line->montant) . '</td>';
|
||||||
|
|||||||
@ -92,7 +92,7 @@ class AccountancyCategory
|
|||||||
public function getCptBK($id) {
|
public function getCptBK($id) {
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT t.numero_compte, t.label_compte, t.doc_ref";
|
$sql = "SELECT t.numero_compte, t.label_operation, t.doc_ref";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
|
||||||
$sql .= " WHERE t.numero_compte NOT IN (";
|
$sql .= " WHERE t.numero_compte NOT IN (";
|
||||||
$sql .= " SELECT t.account_number";
|
$sql .= " SELECT t.account_number";
|
||||||
@ -104,7 +104,7 @@ class AccountancyCategory
|
|||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||||
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||||
$sql .= " AND aa.active = 1)";
|
$sql .= " AND aa.active = 1)";
|
||||||
$sql .= " GROUP BY t.numero_compte, t.label_compte, t.doc_ref";
|
$sql .= " GROUP BY t.numero_compte, t.label_operation, t.doc_ref";
|
||||||
$sql .= " ORDER BY t.numero_compte";
|
$sql .= " ORDER BY t.numero_compte";
|
||||||
|
|
||||||
$this->lines_CptBk = array ();
|
$this->lines_CptBk = array ();
|
||||||
@ -332,7 +332,7 @@ class AccountancyCategory
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to show result of an accounting account from the general ledger with a sens and a period
|
* Function to show result of an accounting account from the ledger with a direction and a period
|
||||||
*
|
*
|
||||||
* @param int $cpt Id accounting account
|
* @param int $cpt Id accounting account
|
||||||
* @param string $month Specifig month - Can be empty
|
* @param string $month Specifig month - Can be empty
|
||||||
@ -429,4 +429,159 @@ class AccountancyCategory
|
|||||||
return - 1;
|
return - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCats() {
|
||||||
|
global $db, $langs, $user, $mysoc;
|
||||||
|
|
||||||
|
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
|
||||||
|
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($mysoc->country_id)) {
|
||||||
|
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
|
||||||
|
$sql .= " WHERE c.active = 1 ";
|
||||||
|
$sql .= " AND c.fk_country = " . $mysoc->country_id;
|
||||||
|
$sql .= " ORDER BY c.position ASC";
|
||||||
|
} else {
|
||||||
|
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co";
|
||||||
|
$sql .= " WHERE c.active = 1 AND c.fk_country = co.rowid";
|
||||||
|
$sql .= " AND co.code = '" . $mysoc->country_code . "'";
|
||||||
|
$sql .= " ORDER BY c.position ASC";
|
||||||
|
}
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$i = 0;
|
||||||
|
$obj = '';
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
$data = array ();
|
||||||
|
if ($num) {
|
||||||
|
while ( $i < $num ) {
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
|
$data[] = array (
|
||||||
|
'rowid' => $obj->rowid,
|
||||||
|
'code' => $obj->code,
|
||||||
|
'position' => $obj->position,
|
||||||
|
'label' => $obj->label,
|
||||||
|
'formula' => $obj->formula,
|
||||||
|
'category_type' => $obj->category_type
|
||||||
|
);
|
||||||
|
$i ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
} else {
|
||||||
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
|
$this->errors[] = $this->error;
|
||||||
|
dol_syslog(__METHOD__ . " " . implode(',', $this->errors), LOG_ERR);
|
||||||
|
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// calcule
|
||||||
|
|
||||||
|
const PATTERN = '/(?:\-?\d+(?:\.?\d+)?[\+\-\*\/])+\-?\d+(?:\.?\d+)?/';
|
||||||
|
|
||||||
|
const PARENTHESIS_DEPTH = 10;
|
||||||
|
|
||||||
|
public function calculate($input){
|
||||||
|
if(strpos($input, '+') != null || strpos($input, '-') != null || strpos($input, '/') != null || strpos($input, '*') != null){
|
||||||
|
// Remove white spaces and invalid math chars
|
||||||
|
$input = str_replace(',', '.', $input);
|
||||||
|
$input = preg_replace('[^0-9\.\+\-\*\/\(\)]', '', $input);
|
||||||
|
|
||||||
|
// Calculate each of the parenthesis from the top
|
||||||
|
$i = 0;
|
||||||
|
while(strpos($input, '(') || strpos($input, ')')){
|
||||||
|
$input = preg_replace_callback('/\(([^\(\)]+)\)/', 'self::callback', $input);
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
if($i > self::PARENTHESIS_DEPTH){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate the result
|
||||||
|
if(preg_match(self::PATTERN, $input, $match)){
|
||||||
|
return $this->compute($match[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $input;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function compute($input){
|
||||||
|
$compute = create_function('', 'return '.$input.';');
|
||||||
|
|
||||||
|
return 0 + $compute();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function callback($input){
|
||||||
|
if(is_numeric($input[1])){
|
||||||
|
return $input[1];
|
||||||
|
}
|
||||||
|
elseif(preg_match(self::PATTERN, $input[1], $match)){
|
||||||
|
return $this->compute($match[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get cpts of category
|
||||||
|
*
|
||||||
|
* @param int $cat_id Category id
|
||||||
|
* @return array Result in table
|
||||||
|
*/
|
||||||
|
public function getCptsCat($cat_id) {
|
||||||
|
global $mysoc;
|
||||||
|
$sql = "";
|
||||||
|
|
||||||
|
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
|
||||||
|
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 name_cpt";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
||||||
|
$sql .= " WHERE t.fk_accounting_category = ".$cat_id;
|
||||||
|
$sql .= " ORDER BY t.account_number ";
|
||||||
|
|
||||||
|
//echo $sql;
|
||||||
|
|
||||||
|
$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[] = array (
|
||||||
|
'id' => $obj->rowid,
|
||||||
|
'account_number' => $obj->account_number,
|
||||||
|
'name_cpt' => $obj->name_cpt,
|
||||||
|
);
|
||||||
|
$i ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
} else {
|
||||||
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
|
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
|
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||||
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -32,14 +32,15 @@
|
|||||||
*
|
*
|
||||||
* Manage the different format accountancy export
|
* Manage the different format accountancy export
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
|
||||||
|
|
||||||
class AccountancyExport
|
class AccountancyExport
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
* @var Type of export. Defined by $conf->global->ACCOUNTING_EXPORT_MODELCSV
|
||||||
* @var Type of export
|
|
||||||
*/
|
*/
|
||||||
public static $EXPORT_TYPE_NORMAL = 1;
|
public static $EXPORT_TYPE_NORMAL = 1; // Classic CSV
|
||||||
public static $EXPORT_TYPE_CEGID = 2;
|
public static $EXPORT_TYPE_CEGID = 2;
|
||||||
public static $EXPORT_TYPE_COALA = 3;
|
public static $EXPORT_TYPE_COALA = 3;
|
||||||
public static $EXPORT_TYPE_BOB50 = 4;
|
public static $EXPORT_TYPE_BOB50 = 4;
|
||||||
@ -81,7 +82,7 @@ class AccountancyExport
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all export type are available
|
* Array wit all export type available (key + label)
|
||||||
*
|
*
|
||||||
* @return array of type
|
* @return array of type
|
||||||
*/
|
*/
|
||||||
@ -172,7 +173,7 @@ class AccountancyExport
|
|||||||
print $date . $this->separator;
|
print $date . $this->separator;
|
||||||
print $line->doc_ref . $this->separator;
|
print $line->doc_ref . $this->separator;
|
||||||
print length_accountg($line->numero_compte) . $this->separator;
|
print length_accountg($line->numero_compte) . $this->separator;
|
||||||
print length_accounta($line->code_tiers) . $this->separator;
|
print length_accounta($line->subledger_account) . $this->separator;
|
||||||
print price($line->debit) . $this->separator;
|
print price($line->debit) . $this->separator;
|
||||||
print price($line->credit) . $this->separator;
|
print price($line->credit) . $this->separator;
|
||||||
print $line->code_journal . $this->separator;
|
print $line->code_journal . $this->separator;
|
||||||
@ -195,10 +196,10 @@ class AccountancyExport
|
|||||||
print $date . $separator;
|
print $date . $separator;
|
||||||
print $line->code_journal . $separator;
|
print $line->code_journal . $separator;
|
||||||
print length_accountg($line->numero_compte) . $separator;
|
print length_accountg($line->numero_compte) . $separator;
|
||||||
print length_accounta($line->code_tiers) . $separator;
|
print length_accounta($line->subledger_account) . $separator;
|
||||||
print $line->sens . $separator;
|
print $line->sens . $separator;
|
||||||
print price($line->montant) . $separator;
|
print price($line->montant) . $separator;
|
||||||
print $line->label_compte . $separator;
|
print $line->label_operation . $separator;
|
||||||
print $line->doc_ref;
|
print $line->doc_ref;
|
||||||
print $this->end_line;
|
print $this->end_line;
|
||||||
}
|
}
|
||||||
@ -220,7 +221,7 @@ class AccountancyExport
|
|||||||
print $line->piece_num . $this->separator;
|
print $line->piece_num . $this->separator;
|
||||||
print length_accountg($line->numero_compte) . $this->separator;
|
print length_accountg($line->numero_compte) . $this->separator;
|
||||||
print '' . $this->separator;
|
print '' . $this->separator;
|
||||||
print $line->label_compte . $this->separator;
|
print $line->label_operation . $this->separator;
|
||||||
print $date . $this->separator;
|
print $date . $this->separator;
|
||||||
if ($line->sens=='D') {
|
if ($line->sens=='D') {
|
||||||
print price($line->montant) . $this->separator;
|
print price($line->montant) . $this->separator;
|
||||||
@ -230,7 +231,7 @@ class AccountancyExport
|
|||||||
print price($line->montant) . $this->separator;
|
print price($line->montant) . $this->separator;
|
||||||
}
|
}
|
||||||
print $line->doc_ref . $this->separator;
|
print $line->doc_ref . $this->separator;
|
||||||
print $line->label_compte . $this->separator;
|
print $line->label_operation . $this->separator;
|
||||||
print $this->end_line;
|
print $this->end_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -254,7 +255,7 @@ class AccountancyExport
|
|||||||
print price($line->debit) . $this->separator;
|
print price($line->debit) . $this->separator;
|
||||||
print price($line->credit) . $this->separator;
|
print price($line->credit) . $this->separator;
|
||||||
print 'E' . $this->separator;
|
print 'E' . $this->separator;
|
||||||
print length_accountg($line->code_tiers) . $this->separator;
|
print length_accountg($line->subledger_account) . $this->separator;
|
||||||
print $this->end_line;
|
print $this->end_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -274,7 +275,7 @@ class AccountancyExport
|
|||||||
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
||||||
print $date . $this->separator;
|
print $date . $this->separator;
|
||||||
|
|
||||||
if (empty($line->code_tiers)) {
|
if (empty($line->subledger_account)) {
|
||||||
print 'G' . $this->separator;
|
print 'G' . $this->separator;
|
||||||
print length_accounta($line->numero_compte) . $this->separator;
|
print length_accounta($line->numero_compte) . $this->separator;
|
||||||
} else {
|
} else {
|
||||||
@ -284,12 +285,12 @@ class AccountancyExport
|
|||||||
if (substr($line->numero_compte, 0, 3) == '401') {
|
if (substr($line->numero_compte, 0, 3) == '401') {
|
||||||
print 'F' . $this->separator;
|
print 'F' . $this->separator;
|
||||||
}
|
}
|
||||||
print length_accountg($line->code_tiers) . $this->separator;
|
print length_accountg($line->subledger_account) . $this->separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
print price($line->debit) . $this->separator;
|
print price($line->debit) . $this->separator;
|
||||||
print price($line->credit) . $this->separator;
|
print price($line->credit) . $this->separator;
|
||||||
print dol_trunc($line->label_compte, 32) . $this->separator;
|
print dol_trunc($line->label_operation, 32) . $this->separator;
|
||||||
print $this->end_line;
|
print $this->end_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -307,11 +308,11 @@ class AccountancyExport
|
|||||||
$this->end_line ="\r\n";
|
$this->end_line ="\r\n";
|
||||||
|
|
||||||
$i = 1;
|
$i = 1;
|
||||||
$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be yyyymmdd
|
$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be yyyymmdd
|
||||||
foreach ( $TData as $data ) {
|
foreach ( $TData as $data ) {
|
||||||
$code_compta = $data->numero_compte;
|
$code_compta = $data->numero_compte;
|
||||||
if (! empty($data->code_tiers))
|
if (! empty($data->subledger_account))
|
||||||
$code_compta = $data->code_tiers;
|
$code_compta = $data->subledger_account;
|
||||||
|
|
||||||
$Tab = array ();
|
$Tab = array ();
|
||||||
$Tab['num_ecriture'] = str_pad($i, 5);
|
$Tab['num_ecriture'] = str_pad($i, 5);
|
||||||
@ -320,11 +321,11 @@ class AccountancyExport
|
|||||||
$Tab['date_ope'] = dol_print_date($data->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
|
$Tab['date_ope'] = dol_print_date($data->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||||
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 12), 12);
|
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 12), 12);
|
||||||
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 11), 11);
|
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 11), 11);
|
||||||
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . $data->label_compte, 25), 25);
|
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . $data->label_operation, 25), 25);
|
||||||
$Tab['montant'] = str_pad(abs($data->montant), 13, ' ', STR_PAD_LEFT);
|
$Tab['montant'] = str_pad(abs($data->montant), 13, ' ', STR_PAD_LEFT);
|
||||||
$Tab['type_montant'] = str_pad($data->sens, 1);
|
$Tab['type_montant'] = str_pad($data->sens, 1);
|
||||||
$Tab['vide'] = str_repeat(' ', 18);
|
$Tab['vide'] = str_repeat(' ', 18);
|
||||||
$Tab['intitule_compte'] = str_pad(self::trunc($data->label_compte, 34), 34);
|
$Tab['intitule_compte'] = str_pad(self::trunc($data->label_operation, 34), 34);
|
||||||
$Tab['end'] = 'O2003';
|
$Tab['end'] = 'O2003';
|
||||||
|
|
||||||
$Tab['end_line'] = $this->end_line;
|
$Tab['end_line'] = $this->end_line;
|
||||||
@ -349,8 +350,8 @@ class AccountancyExport
|
|||||||
$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||||
foreach ( $TData as $data ) {
|
foreach ( $TData as $data ) {
|
||||||
$code_compta = $data->numero_compte;
|
$code_compta = $data->numero_compte;
|
||||||
if (! empty($data->code_tiers))
|
if (! empty($data->subledger_account))
|
||||||
$code_compta = $data->code_tiers;
|
$code_compta = $data->subledger_account;
|
||||||
|
|
||||||
$Tab = array ();
|
$Tab = array ();
|
||||||
$Tab['type_ligne'] = 'M';
|
$Tab['type_ligne'] = 'M';
|
||||||
@ -359,7 +360,7 @@ class AccountancyExport
|
|||||||
$Tab['folio'] = '000';
|
$Tab['folio'] = '000';
|
||||||
$Tab['date_ecriture'] = $date_ecriture;
|
$Tab['date_ecriture'] = $date_ecriture;
|
||||||
$Tab['filler'] = ' ';
|
$Tab['filler'] = ' ';
|
||||||
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_compte, 20), 20);
|
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_operation, 20), 20);
|
||||||
$Tab['sens'] = $data->sens; // C or D
|
$Tab['sens'] = $data->sens; // C or D
|
||||||
$Tab['signe_montant'] = '+';
|
$Tab['signe_montant'] = '+';
|
||||||
$Tab['montant'] = str_pad(abs($data->montant), 12, '0', STR_PAD_LEFT); // TODO manage negative amount
|
$Tab['montant'] = str_pad(abs($data->montant), 12, '0', STR_PAD_LEFT); // TODO manage negative amount
|
||||||
@ -375,7 +376,7 @@ class AccountancyExport
|
|||||||
$Tab['devis'] = str_pad($conf->currency, 3);
|
$Tab['devis'] = str_pad($conf->currency, 3);
|
||||||
$Tab['code_journal2'] = str_pad(self::trunc($data->code_journal, 3), 3);
|
$Tab['code_journal2'] = str_pad(self::trunc($data->code_journal, 3), 3);
|
||||||
$Tab['filler3'] = str_repeat(' ', 3);
|
$Tab['filler3'] = str_repeat(' ', 3);
|
||||||
$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_compte, 32), 32);
|
$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_operation, 32), 32);
|
||||||
$Tab['num_piece3'] = str_pad(self::trunc($data->piece_num, 10), 10);
|
$Tab['num_piece3'] = str_pad(self::trunc($data->piece_num, 10), 10);
|
||||||
$Tab['filler4'] = str_repeat(' ', 73);
|
$Tab['filler4'] = str_repeat(' ', 73);
|
||||||
|
|
||||||
@ -406,7 +407,7 @@ class AccountancyExport
|
|||||||
print $line->code_journal . $this->separator;
|
print $line->code_journal . $this->separator;
|
||||||
print length_accountg($line->numero_compte) . $this->separator;
|
print length_accountg($line->numero_compte) . $this->separator;
|
||||||
print substr(length_accountg($line->numero_compte),0,2) . $this->separator;
|
print substr(length_accountg($line->numero_compte),0,2) . $this->separator;
|
||||||
print '"'.dol_trunc($line->label_compte,40,'right','UTF-8',1).'"' . $this->separator;
|
print '"'.dol_trunc($line->label_operation,40,'right','UTF-8',1).'"' . $this->separator;
|
||||||
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator;
|
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator;
|
||||||
print price2num($line->montant).$this->separator;
|
print price2num($line->montant).$this->separator;
|
||||||
print $line->sens.$this->separator;
|
print $line->sens.$this->separator;
|
||||||
@ -437,18 +438,20 @@ class AccountancyExport
|
|||||||
print $date . $this->separator;
|
print $date . $this->separator;
|
||||||
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator;
|
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator;
|
||||||
|
|
||||||
if (empty($line->code_tiers)) {
|
if (empty($line->subledger_account)) {
|
||||||
print length_accountg($line->numero_compte) . $this->separator;
|
print length_accountg($line->numero_compte) . $this->separator;
|
||||||
} else {
|
} else {
|
||||||
|
// FIXME Because the subledger_account is already an accounting account, does we really need
|
||||||
|
// to concat 4011 or 401 to it ?
|
||||||
if (substr($line->numero_compte, 0, 1) == 'C' || substr($line->numero_compte, 0, 1) == '9') {
|
if (substr($line->numero_compte, 0, 1) == 'C' || substr($line->numero_compte, 0, 1) == '9') {
|
||||||
print '411' . substr(str_replace(" ", "", $line->code_tiers), 0, 5) . $this->separator;
|
print '411' . substr(str_replace(" ", "", $line->subledger_account), 0, 5) . $this->separator;
|
||||||
}
|
}
|
||||||
if (substr($line->numero_compte, 0, 1) == 'F' || substr($line->numero_compte, 0, 1) == '0') {
|
if (substr($line->numero_compte, 0, 1) == 'F' || substr($line->numero_compte, 0, 1) == '0') {
|
||||||
print '401' . substr(str_replace(" ", "", $line->code_tiers), 0, 5) . $this->separator;
|
print '401' . substr(str_replace(" ", "", $line->subledger_account), 0, 5) . $this->separator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print length_accounta($line->code_tiers) . $this->separator;
|
print length_accounta($line->subledger_account) . $this->separator;
|
||||||
print price($line->debit) . $this->separator;
|
print price($line->debit) . $this->separator;
|
||||||
print price($line->credit) . $this->separator;
|
print price($line->credit) . $this->separator;
|
||||||
print price($line->montant).$this->separator;
|
print price($line->montant).$this->separator;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
|
|||||||
@ -33,10 +33,12 @@ class AccountingJournal extends CommonObject
|
|||||||
|
|
||||||
var $rowid;
|
var $rowid;
|
||||||
|
|
||||||
var $code;
|
public $code;
|
||||||
var $label;
|
public $label;
|
||||||
var $nature; // 0:various operations, 1:sale, 2:purchase, 3:bank, 9: has-new
|
public $nature; // 0:various operations, 1:sale, 2:purchase, 3:bank, 4:expense-report, 9: has-new
|
||||||
var $active;
|
public $active;
|
||||||
|
|
||||||
|
public $lines;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -62,9 +64,9 @@ class AccountingJournal extends CommonObject
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal";
|
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal";
|
||||||
$sql .= " WHERE";
|
$sql .= " WHERE";
|
||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql .= " rowid = '" . $rowid . "'";
|
$sql .= " rowid = " . (int) $rowid;
|
||||||
} elseif ($journal_code) {
|
} elseif ($journal_code) {
|
||||||
$sql .= " code = '" . $journal_code . "'";
|
$sql .= " code = '" . $this->db->escape($journal_code) . "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch sql=" . $sql, LOG_DEBUG);
|
||||||
@ -80,7 +82,7 @@ class AccountingJournal extends CommonObject
|
|||||||
$this->code = $obj->code;
|
$this->code = $obj->code;
|
||||||
$this->ref = $obj->code;
|
$this->ref = $obj->code;
|
||||||
$this->label = $obj->label;
|
$this->label = $obj->label;
|
||||||
$this->nature = $obj->nature;
|
$this->nature = $obj->nature;
|
||||||
$this->active = $obj->active;
|
$this->active = $obj->active;
|
||||||
|
|
||||||
return $this->id;
|
return $this->id;
|
||||||
@ -97,6 +99,74 @@ class AccountingJournal extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load object in memory from the database
|
||||||
|
*
|
||||||
|
* @param string $sortorder Sort Order
|
||||||
|
* @param string $sortfield Sort field
|
||||||
|
* @param int $limit offset limit
|
||||||
|
* @param int $offset offset limit
|
||||||
|
* @param array $filter filter array
|
||||||
|
* @param string $filtermode filter mode (AND or OR)
|
||||||
|
*
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') {
|
||||||
|
$sql = "SELECT rowid, code, label, nature, active";
|
||||||
|
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||||
|
// Manage filter
|
||||||
|
$sqlwhere = array();
|
||||||
|
if (count($filter) > 0) {
|
||||||
|
foreach ( $filter as $key => $value ) {
|
||||||
|
if ($key == 't.code' || $key == 't.label' || $key == 't.nature') {
|
||||||
|
$sqlwhere[] = $key . '\'' . $this->db->escape($value) . '\'';
|
||||||
|
} elseif ($key == 't.rowid' || $key == 't.active') {
|
||||||
|
$sqlwhere[] = $key . '=' . $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sql .= ' WHERE 1 = 1';
|
||||||
|
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
||||||
|
if (count($sqlwhere) > 0) {
|
||||||
|
$sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($sortfield)) {
|
||||||
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
}
|
||||||
|
if (! empty($limit)) {
|
||||||
|
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||||
|
}
|
||||||
|
$this->lines = array();
|
||||||
|
|
||||||
|
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
|
||||||
|
while ( $obj = $this->db->fetch_object($resql) ) {
|
||||||
|
$line = new self($this->db);
|
||||||
|
|
||||||
|
$line->id = $obj->rowid;
|
||||||
|
$line->code = $obj->code;
|
||||||
|
$line->label = $obj->label;
|
||||||
|
$line->nature = $obj->nature;
|
||||||
|
$line->active = $obj->active;
|
||||||
|
|
||||||
|
$this->lines[] = $line;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->free($resql);
|
||||||
|
|
||||||
|
return $num;
|
||||||
|
} else {
|
||||||
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
|
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return clicable name (with picto eventually)
|
* Return clicable name (with picto eventually)
|
||||||
*
|
*
|
||||||
@ -130,17 +200,17 @@ class AccountingJournal extends CommonObject
|
|||||||
$linkclose='';
|
$linkclose='';
|
||||||
if (empty($notooltip))
|
if (empty($notooltip))
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||||
{
|
{
|
||||||
$label=$langs->trans("ShowAccoutingJournal");
|
$label=$langs->trans("ShowAccoutingJournal");
|
||||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
}
|
}
|
||||||
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
$linkclose.=' class="classfortooltip"';
|
$linkclose.=' class="classfortooltip"';
|
||||||
}
|
}
|
||||||
|
|
||||||
$linkstart='<a href="'.$url.'"';
|
$linkstart='<a href="'.$url.'"';
|
||||||
$linkstart.=$linkclose.'>';
|
$linkstart.=$linkclose.'>';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
if ($nourl)
|
if ($nourl)
|
||||||
@ -162,43 +232,45 @@ class AccountingJournal extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Retourne le libelle du statut d'un user (actif, inactif)
|
* Retourne le libelle du statut d'un user (actif, inactif)
|
||||||
*
|
*
|
||||||
* @param int $mode 0=libelle long, 1=libelle court
|
* @param int $mode 0=libelle long, 1=libelle court
|
||||||
* @return string Label of type
|
* @return string Label of type
|
||||||
*/
|
*/
|
||||||
function getLibType($mode=0)
|
function getLibType($mode=0)
|
||||||
{
|
{
|
||||||
return $this->LibType($this->nature,$mode);
|
return $this->LibType($this->nature,$mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return type of an accounting journal
|
* Return type of an accounting journal
|
||||||
*
|
*
|
||||||
* @param int $nature Id type
|
* @param int $nature Id type
|
||||||
* @param int $mode 0=libelle long, 1=libelle court
|
* @param int $mode 0=libelle long, 1=libelle court
|
||||||
* @return string Label of type
|
* @return string Label of type
|
||||||
*/
|
*/
|
||||||
function LibType($nature,$mode=0)
|
function LibType($nature,$mode=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
|
|
||||||
if ($mode == 0)
|
if ($mode == 0)
|
||||||
{
|
{
|
||||||
$prefix='';
|
$prefix='';
|
||||||
if ($nature == 9) return $langs->trans('AccountingJournalType9');
|
if ($nature == 9) return $langs->trans('AccountingJournalType9');
|
||||||
|
if ($nature == 5) return $langs->trans('AccountingJournalType5');
|
||||||
if ($nature == 4) return $langs->trans('AccountingJournalType4');
|
if ($nature == 4) return $langs->trans('AccountingJournalType4');
|
||||||
if ($nature == 3) return $langs->trans('AccountingJournalType3');
|
if ($nature == 3) return $langs->trans('AccountingJournalType3');
|
||||||
if ($nature == 2) return $langs->trans('AccountingJournalType2');
|
if ($nature == 2) return $langs->trans('AccountingJournalType2');
|
||||||
if ($nature == 1) return $langs->trans('AccountingJournalType1');
|
if ($nature == 1) return $langs->trans('AccountingJournalType1');
|
||||||
}
|
}
|
||||||
if ($mode == 1)
|
if ($mode == 1)
|
||||||
{
|
{
|
||||||
if ($nature == 9) return $langs->trans('AccountingJournalType9');
|
if ($nature == 9) return $langs->trans('AccountingJournalType9');
|
||||||
|
if ($nature == 5) return $langs->trans('AccountingJournalType5');
|
||||||
if ($nature == 4) return $langs->trans('AccountingJournalType4');
|
if ($nature == 4) return $langs->trans('AccountingJournalType4');
|
||||||
if ($nature == 3) return $langs->trans('AccountingJournalType3');
|
if ($nature == 3) return $langs->trans('AccountingJournalType3');
|
||||||
if ($nature == 2) return $langs->trans('AccountingJournalType2');
|
if ($nature == 2) return $langs->trans('AccountingJournalType2');
|
||||||
if ($nature == 1) return $langs->trans('AccountingJournalType1');
|
if ($nature == 1) return $langs->trans('AccountingJournalType1');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -23,7 +23,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/customer/index.php
|
* \file htdocs/accountancy/customer/index.php
|
||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Home customer ventilation
|
* \brief Home customer journalization page
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
@ -40,7 +40,7 @@ $langs->load("accountancy");
|
|||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (empty($conf->accounting->enabled)) {
|
if (empty($conf->accounting->enabled)) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
@ -58,7 +58,7 @@ if ($year == 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate History
|
// Validate History
|
||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','aZ09');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ if ($action == 'validatehistory') {
|
|||||||
|
|
||||||
// First clean corrupted data
|
// First clean corrupted data
|
||||||
$sqlclean = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
$sqlclean = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||||
$sqlclean .= " SET fd.fk_code_ventilation = 0";
|
$sqlclean .= " SET fk_code_ventilation = 0";
|
||||||
$sqlclean .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
$sqlclean .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||||
$sqlclean .= ' (SELECT accnt.rowid ';
|
$sqlclean .= ' (SELECT accnt.rowid ';
|
||||||
$sqlclean .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
$sqlclean .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||||
@ -91,13 +91,13 @@ if ($action == 'validatehistory') {
|
|||||||
$sql1 .= " AND " . MAIN_DB_PREFIX . "facturedet.fk_code_ventilation = 0";
|
$sql1 .= " AND " . MAIN_DB_PREFIX . "facturedet.fk_code_ventilation = 0";
|
||||||
} else {
|
} 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 = "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 fd.fk_code_ventilation = accnt.rowid";
|
$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=" . $conf->global->CHARTOFACCOUNTS;
|
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS;
|
||||||
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
|
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
|
||||||
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
|
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||||
|
|
||||||
$resql1 = $db->query($sql1);
|
$resql1 = $db->query($sql1);
|
||||||
if (! $resql1) {
|
if (! $resql1) {
|
||||||
@ -113,7 +113,7 @@ if ($action == 'validatehistory') {
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||||
$sql1 .= " SET fd.fk_code_ventilation = 0";
|
$sql1 .= " SET fk_code_ventilation = 0";
|
||||||
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||||
$sql1 .= ' (SELECT accnt.rowid ';
|
$sql1 .= ' (SELECT accnt.rowid ';
|
||||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||||
@ -137,7 +137,7 @@ if ($action == 'validatehistory') {
|
|||||||
|
|
||||||
// Now clean
|
// Now clean
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||||
$sql1.= " SET fd.fk_code_ventilation = 0";
|
$sql1.= " SET fk_code_ventilation = 0";
|
||||||
$sql1.= " WHERE fd.fk_facture IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture as f";
|
$sql1.= " WHERE fd.fk_facture IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture as f";
|
||||||
$sql1.= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
|
$sql1.= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
|
||||||
$sql1.= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
|
$sql1.= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
|
||||||
@ -173,7 +173,7 @@ print $langs->trans("DescVentilCustomer") . '<br>';
|
|||||||
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
//print '<div class="inline-block divButAction">';
|
//print '<div class="inline-block divButAction">';
|
||||||
// TODO Remove this. Should be done into the repair.php script
|
// TODO Remove this. Should be done always or into the repair.php script.
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
||||||
//print '</div>';
|
//print '</div>';
|
||||||
|
|
||||||
@ -187,9 +187,9 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
|||||||
} else {
|
} else {
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||||
}
|
}
|
||||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||||
|
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
|
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$row = $db->fetch_row($result);
|
$row = $db->fetch_row($result);
|
||||||
@ -203,10 +203,6 @@ $buttonbind = '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' .
|
|||||||
$buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
|
$buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$var = true;
|
|
||||||
|
|
||||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
@ -237,7 +233,7 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
|||||||
}
|
}
|
||||||
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
|
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
|
||||||
|
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
|
dol_syslog('htdocs/accountancy/customer/index.php sql=' . $sql, LOG_DEBUG);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
@ -269,14 +265,14 @@ print '<table class="noborder" width="100%">';
|
|||||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||||
}
|
}
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') . " AS codecomptable,";
|
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') . " AS codecomptable,";
|
||||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
$sql .= " SUM(fd.total_ht) as total";
|
$sql .= " SUM(fd.total_ht) as total";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||||
@ -293,25 +289,25 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
|||||||
$sql .= " AND aa.account_number IS NOT NULL";
|
$sql .= " AND aa.account_number IS NOT NULL";
|
||||||
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
|
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
|
||||||
|
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
|
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
||||||
print '<td align="left">' . $row[1] . '</td>';
|
print '<td align="left">' . $row[1] . '</td>';
|
||||||
for($i = 2; $i <= 12; $i ++) {
|
for($i = 2; $i <= 12; $i ++) {
|
||||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||||
}
|
}
|
||||||
print '<td align="right">' . price($row[13]) . '</td>';
|
print '<td align="right">' . price($row[13]) . '</td>';
|
||||||
print '<td align="right"><b>' . price($row[14]) . '</b></td>';
|
print '<td align="right"><b>' . price($row[14]) . '</b></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
} else {
|
} else {
|
||||||
print $db->lasterror(); // Show last sql error
|
print $db->lasterror(); // Show last sql error
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
@ -319,101 +315,100 @@ print "</table>\n";
|
|||||||
|
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ?
|
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ?
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||||
|
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
|
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||||
}
|
}
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT '" . $langs->trans("TotalVente") . "' AS total,";
|
$sql = "SELECT '" . $langs->trans("TotalVente") . "' AS total,";
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
$sql .= " SUM(fd.total_ht) as total";
|
$sql .= " SUM(fd.total_ht) as total";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||||
} else {
|
} else {
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog('htdocs/accountancy/customer/index.php');
|
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$i = 0;
|
$num = $db->num_rows($resql);
|
||||||
$num = $db->num_rows($resql);
|
|
||||||
|
|
||||||
while ($row = $db->fetch_row($resql)) {
|
while ($row = $db->fetch_row($resql)) {
|
||||||
print '<tr><td>' . $row[0] . '</td>';
|
print '<tr><td>' . $row[0] . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||||
}
|
}
|
||||||
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
|
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$i ++;
|
}
|
||||||
}
|
$db->free($resql);
|
||||||
$db->free($resql);
|
} else {
|
||||||
} else {
|
print $db->lasterror(); // Show last sql error
|
||||||
print $db->lasterror(); // Show last sql error
|
}
|
||||||
}
|
print "</table>\n";
|
||||||
print "</table>\n";
|
|
||||||
|
|
||||||
if (! empty($conf->margin->enabled)) {
|
|
||||||
print "<br>\n";
|
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>';
|
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
|
||||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
|
||||||
}
|
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
|
||||||
|
|
||||||
$sql = "SELECT '" . $langs->trans("Vide") . "' AS marge,";
|
if (! empty($conf->margin->enabled)) {
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
print "<br>\n";
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, '(fd.total_ht-(fd.qty * fd.buy_price_ht))', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
print '<table class="noborder" width="100%">';
|
||||||
}
|
print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>';
|
||||||
$sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total";
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
}
|
||||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
|
||||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
|
||||||
} else {
|
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
dol_syslog('htdocs/accountancy/customer/index.php:: $sql=' . $sql);
|
$sql = "SELECT '" . $langs->trans("Vide") . "' AS marge,";
|
||||||
$resql = $db->query($sql);
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
if ($resql) {
|
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, '(fd.total_ht-(fd.qty * fd.buy_price_ht))', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
$num = $db->num_rows($resql);
|
}
|
||||||
|
$sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) 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(dol_get_first_day($y, 1, false)) . "'";
|
||||||
|
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||||
|
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||||
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
|
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||||
|
} else {
|
||||||
|
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||||
|
}
|
||||||
|
|
||||||
while ($row = $db->fetch_row($resql)) {
|
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
print '<tr><td>' . $row[0] . '</td>';
|
while ($row = $db->fetch_row($resql)) {
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
|
||||||
print '<td align="right">' . price(price2num($row[$i])) . '</td>';
|
print '<tr><td>' . $row[0] . '</td>';
|
||||||
}
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
print '<td align="right"><b>' . price(price2num($row[13])) . '</b></td>';
|
print '<td align="right">' . price(price2num($row[$i])) . '</td>';
|
||||||
print '</tr>';
|
}
|
||||||
}
|
print '<td align="right"><b>' . price(price2num($row[13])) . '</b></td>';
|
||||||
$db->free($resql);
|
print '</tr>';
|
||||||
} else {
|
}
|
||||||
print $db->lasterror(); // Show last sql error
|
$db->free($resql);
|
||||||
}
|
} else {
|
||||||
print "</table>\n";
|
print $db->lasterror(); // Show last sql error
|
||||||
}
|
}
|
||||||
|
print "</table>\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
* Copyright (C) 2014-2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2014-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
@ -327,7 +327,7 @@ if ($result) {
|
|||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
||||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||||
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
|
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
@ -375,7 +375,7 @@ if ($result) {
|
|||||||
|
|
||||||
print '<td class="tdoverflowonsmartphone">';
|
print '<td class="tdoverflowonsmartphone">';
|
||||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
||||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||||
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
|
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -69,7 +69,7 @@ if ($action == 'validatehistory') {
|
|||||||
|
|
||||||
// First clean corrupted data
|
// First clean corrupted data
|
||||||
$sqlclean = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
$sqlclean = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||||
$sqlclean .= " SET erd.fk_code_ventilation = 0";
|
$sqlclean .= " SET fk_code_ventilation = 0";
|
||||||
$sqlclean .= ' WHERE erd.fk_code_ventilation NOT IN ';
|
$sqlclean .= ' WHERE erd.fk_code_ventilation NOT IN ';
|
||||||
$sqlclean .= ' (SELECT accnt.rowid ';
|
$sqlclean .= ' (SELECT accnt.rowid ';
|
||||||
$sqlclean .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
$sqlclean .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||||
@ -93,6 +93,8 @@ if ($action == 'validatehistory') {
|
|||||||
$sql1 .= " AND erd.fk_code_ventilation = 0";
|
$sql1 .= " AND erd.fk_code_ventilation = 0";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dol_syslog('htdocs/accountancy/expensereport/index.php');
|
||||||
|
|
||||||
$resql1 = $db->query($sql1);
|
$resql1 = $db->query($sql1);
|
||||||
if (! $resql1) {
|
if (! $resql1) {
|
||||||
$error ++;
|
$error ++;
|
||||||
@ -107,7 +109,7 @@ if ($action == 'validatehistory') {
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||||
$sql1 .= " SET erd.fk_code_ventilation = 0";
|
$sql1 .= " SET fk_code_ventilation = 0";
|
||||||
$sql1 .= ' WHERE erd.fk_code_ventilation NOT IN ';
|
$sql1 .= ' WHERE erd.fk_code_ventilation NOT IN ';
|
||||||
$sql1 .= ' (SELECT accnt.rowid ';
|
$sql1 .= ' (SELECT accnt.rowid ';
|
||||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||||
@ -129,8 +131,9 @@ if ($action == 'validatehistory') {
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
|
// Now clean
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||||
$sql1.= " SET erd.fk_code_ventilation = 0";
|
$sql1.= " SET fk_code_ventilation = 0";
|
||||||
$sql1.= " WHERE erd.fk_expensereport IN ( SELECT er.rowid FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
$sql1.= " WHERE erd.fk_expensereport IN ( SELECT er.rowid FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
||||||
$sql1.= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
|
$sql1.= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
|
||||||
$sql1.= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
|
$sql1.= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
|
||||||
@ -166,28 +169,25 @@ print $langs->trans("DescVentilExpenseReportMore", $langs->transnoentitiesnoconv
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
//print '<div class="inline-block divButAction">';
|
//print '<div class="inline-block divButAction">';
|
||||||
// TODO Remove this. Should be done always.
|
// TODO Remove this. Should be done always or into the repair.php script.
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
||||||
//print '</div>';
|
//print '</div>';
|
||||||
|
|
||||||
|
|
||||||
$buttonbind = '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
|
|
||||||
$buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$y = $year_current;
|
$y = $year_current;
|
||||||
|
|
||||||
$var = true;
|
$buttonbind = '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
|
||||||
|
$buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
|
||||||
|
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||||
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="200" align="left">' . $langs->trans("Account") . '</td>';
|
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||||
@ -199,7 +199,7 @@ $sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'",
|
|||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
$sql .= " ROUND(SUM(erd.total_ht),2) as total";
|
$sql .= " SUM(erd.total_ht) as total";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
|
||||||
@ -240,7 +240,7 @@ print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '
|
|||||||
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="200" align="left">' . $langs->trans("Account") . '</td>';
|
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||||
@ -263,7 +263,7 @@ $sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We d
|
|||||||
$sql .= " AND aa.account_number IS NOT NULL";
|
$sql .= " AND aa.account_number IS NOT NULL";
|
||||||
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
||||||
|
|
||||||
dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql);
|
dol_syslog('htdocs/accountancy/expensereport/index.php');
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
@ -307,7 +307,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_create)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_create)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
$sql .= " ROUND(SUM(erd.total_ht),2) as total";
|
$sql .= " SUM(erd.total_ht) as total";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
|
||||||
$sql .= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
$sql .= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||||
@ -315,14 +315,12 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
$sql .= " AND er.fk_statut > 0 ";
|
$sql .= " AND er.fk_statut > 0 ";
|
||||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||||
|
|
||||||
dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql);
|
dol_syslog('htdocs/accountancy/expensereport/index.php');
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
|
|
||||||
print '<tr><td>' . $row[0] . '</td>';
|
print '<tr><td>' . $row[0] . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||||
|
|||||||
@ -287,7 +287,7 @@ if ($result) {
|
|||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
|
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
|
||||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||||
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->comments);
|
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->comments);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -323,7 +323,7 @@ if ($result) {
|
|||||||
// Fees description -- Can be null
|
// Fees description -- Can be null
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
|
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
|
||||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||||
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->comments);
|
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->comments);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -63,8 +63,6 @@ print load_fiche_titre($langs->trans("AccountancyArea"), '', 'title_accountancy'
|
|||||||
|
|
||||||
$step = 0;
|
$step = 0;
|
||||||
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
print $langs->trans("AccountancyAreaDescIntro")."<br>\n";
|
print $langs->trans("AccountancyAreaDescIntro")."<br>\n";
|
||||||
print "<br>\n";print "<br>\n";
|
print "<br>\n";print "<br>\n";
|
||||||
|
|
||||||
|
|||||||
@ -50,6 +50,7 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/paymentexpensereport.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/paymentexpensereport.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/paymentvarious.class.php';
|
||||||
|
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
@ -60,6 +61,7 @@ $langs->load('donations');
|
|||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
$langs->load("trips");
|
$langs->load("trips");
|
||||||
$langs->load("salaries");
|
$langs->load("salaries");
|
||||||
|
$langs->load("hrm");
|
||||||
|
|
||||||
// Multi journal
|
// Multi journal
|
||||||
$id_journal = GETPOST('id_journal', 'int');
|
$id_journal = GETPOST('id_journal', 'int');
|
||||||
@ -70,10 +72,10 @@ $date_startyear = GETPOST('date_startyear');
|
|||||||
$date_endmonth = GETPOST('date_endmonth');
|
$date_endmonth = GETPOST('date_endmonth');
|
||||||
$date_endday = GETPOST('date_endday');
|
$date_endday = GETPOST('date_endday');
|
||||||
$date_endyear = GETPOST('date_endyear');
|
$date_endyear = GETPOST('date_endyear');
|
||||||
$action = GETPOST('action','aZ09');
|
$in_bookkeeping = GETPOST('in_bookkeeping');
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','alpha');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0 && empty($id_journal))
|
if ($user->societe_id > 0 && empty($id_journal))
|
||||||
@ -103,8 +105,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
|||||||
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
|
$idpays = $mysoc->country_id;
|
||||||
$idpays = $p[0];
|
|
||||||
|
|
||||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,";
|
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,";
|
||||||
$sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,";
|
$sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,";
|
||||||
@ -120,6 +121,8 @@ $sql .= " WHERE ba.fk_accountancy_journal=" . $id_journal;
|
|||||||
$sql .= ' AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
|
$sql .= ' AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
|
||||||
if ($date_start && $date_end)
|
if ($date_start && $date_end)
|
||||||
$sql .= " AND b.dateo >= '" . $db->idate($date_start) . "' AND b.dateo <= '" . $db->idate($date_end) . "'";
|
$sql .= " AND b.dateo >= '" . $db->idate($date_start) . "' AND b.dateo <= '" . $db->idate($date_end) . "'";
|
||||||
|
if ($in_bookkeeping == 'yes')
|
||||||
|
$sql .= " AND (b.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='bank') )";
|
||||||
$sql .= " ORDER BY b.datev";
|
$sql .= " ORDER BY b.datev";
|
||||||
|
|
||||||
$object = new Account($db);
|
$object = new Account($db);
|
||||||
@ -132,6 +135,7 @@ $paymentdonstatic = new PaymentDonation($db);
|
|||||||
$paymentvatstatic = new TVA($db);
|
$paymentvatstatic = new TVA($db);
|
||||||
$paymentsalstatic = new PaymentSalary($db);
|
$paymentsalstatic = new PaymentSalary($db);
|
||||||
$paymentexpensereportstatic = new PaymentExpenseReport($db);
|
$paymentexpensereportstatic = new PaymentExpenseReport($db);
|
||||||
|
$paymentvariousstatic = new PaymentVarious($db);
|
||||||
|
|
||||||
// Get code of finance journal
|
// Get code of finance journal
|
||||||
$accountingjournalstatic = new AccountingJournal($db);
|
$accountingjournalstatic = new AccountingJournal($db);
|
||||||
@ -144,6 +148,7 @@ $result = $db->query($sql);
|
|||||||
if ($result) {
|
if ($result) {
|
||||||
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
$account_supplier = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef"));
|
$account_supplier = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef"));
|
||||||
$account_customer = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef"));
|
$account_customer = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef"));
|
||||||
@ -208,7 +213,7 @@ if ($result) {
|
|||||||
// Now loop on each link of record in bank.
|
// Now loop on each link of record in bank.
|
||||||
foreach ( $links as $key => $val ) {
|
foreach ( $links as $key => $val ) {
|
||||||
|
|
||||||
if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'payment_salary'))) // So we excluded 'company' here
|
if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'payment_salary', 'payment_various'))) // So we excluded 'company' here
|
||||||
{
|
{
|
||||||
// We save tabtype for a future use, to remember what kind of payment it is
|
// We save tabtype for a future use, to remember what kind of payment it is
|
||||||
$tabtype[$obj->rowid] = $links[$key]['type'];
|
$tabtype[$obj->rowid] = $links[$key]['type'];
|
||||||
@ -250,9 +255,9 @@ if ($result) {
|
|||||||
|
|
||||||
$sqlmid = 'SELECT cchgsoc.accountancy_code';
|
$sqlmid = 'SELECT cchgsoc.accountancy_code';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
|
||||||
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id";
|
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id";
|
||||||
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid";
|
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid";
|
||||||
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid";
|
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid";
|
||||||
$sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid;
|
$sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid;
|
||||||
|
|
||||||
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
|
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||||
@ -285,6 +290,15 @@ if ($result) {
|
|||||||
$paymentexpensereportstatic->fk_expensereport = $links[$key]['url_id'];
|
$paymentexpensereportstatic->fk_expensereport = $links[$key]['url_id'];
|
||||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentexpensereportstatic->getNomUrl(2);
|
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentexpensereportstatic->getNomUrl(2);
|
||||||
$tabpay[$obj->rowid]["fk_expensereport"] = $paymentexpensereportstatic->id;
|
$tabpay[$obj->rowid]["fk_expensereport"] = $paymentexpensereportstatic->id;
|
||||||
|
} else if ($links[$key]['type'] == 'payment_various') {
|
||||||
|
$paymentvariousstatic->id = $links[$key]['url_id'];
|
||||||
|
$paymentvariousstatic->ref = $links[$key]['url_id'];
|
||||||
|
$paymentvariousstatic->label = $links[$key]['label'];
|
||||||
|
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvariousstatic->getNomUrl(2);
|
||||||
|
$tabpay[$obj->rowid]["paymentvariousid"] = $paymentvariousstatic->id;
|
||||||
|
$paymentvariousstatic->fetch($paymentvariousstatic->id);
|
||||||
|
$account_various = (! empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : $langs->trans("CodeNotDef"));
|
||||||
|
$tabtp[$obj->rowid][$account_various] += $obj->amount;
|
||||||
} else if ($links[$key]['type'] == 'banktransfert') {
|
} else if ($links[$key]['type'] == 'banktransfert') {
|
||||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("BankTransfer");
|
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("BankTransfer");
|
||||||
$tabtp[$obj->rowid][$account_transfer] += $obj->amount;
|
$tabtp[$obj->rowid][$account_transfer] += $obj->amount;
|
||||||
@ -353,7 +367,8 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = $val["fk_bank"];
|
$bookkeeping->fk_docdet = $val["fk_bank"];
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_compte = $compte->label;
|
$bookkeeping->label_operation = $val["label"];
|
||||||
|
$bookkeeping->label_compte = $langs->trans("Bank");
|
||||||
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt);
|
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt);
|
||||||
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
||||||
$bookkeeping->debit = ($mt >= 0 ? $mt : 0);
|
$bookkeeping->debit = ($mt >= 0 ? $mt : 0);
|
||||||
@ -364,7 +379,7 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->date_create = $now;
|
||||||
|
|
||||||
if ($tabtype[$key] == 'payment') {
|
if ($tabtype[$key] == 'payment') {
|
||||||
$bookkeeping->code_tiers = $tabcompany[$key]['code_compta'];
|
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||||
|
|
||||||
$sqlmid = 'SELECT fac.facnumber';
|
$sqlmid = 'SELECT fac.facnumber';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac";
|
||||||
@ -378,7 +393,7 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$bookkeeping->doc_ref = $objmid->facnumber; // Ref of invoice
|
$bookkeeping->doc_ref = $objmid->facnumber; // Ref of invoice
|
||||||
}
|
}
|
||||||
} else if ($tabtype[$key] == 'payment_supplier') {
|
} else if ($tabtype[$key] == 'payment_supplier') {
|
||||||
$bookkeeping->code_tiers = $tabcompany[$key]['code_compta'];
|
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||||
|
|
||||||
$sqlmid = 'SELECT facf.ref_supplier, facf.ref';
|
$sqlmid = 'SELECT facf.ref_supplier, facf.ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf";
|
||||||
@ -392,7 +407,7 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')'; // Ref on invoice
|
$bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')'; // Ref on invoice
|
||||||
}
|
}
|
||||||
} else if ($tabtype[$key] == 'payment_expensereport') {
|
} else if ($tabtype[$key] == 'payment_expensereport') {
|
||||||
$bookkeeping->code_tiers = $tabuser[$key]['accountancy_code'];
|
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
||||||
|
|
||||||
$sqlmid = 'SELECT e.ref';
|
$sqlmid = 'SELECT e.ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "expensereport as e";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "expensereport as e";
|
||||||
@ -405,15 +420,18 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$bookkeeping->doc_ref = $objmid->ref; // Ref of expensereport
|
$bookkeeping->doc_ref = $objmid->ref; // Ref of expensereport
|
||||||
}
|
}
|
||||||
} else if ($tabtype[$key] == 'payment_vat') {
|
} else if ($tabtype[$key] == 'payment_vat') {
|
||||||
$bookkeeping->code_tiers = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->doc_ref = $langs->trans("PaymentVat") . ' (' . $val["paymentvatid"] . ')'; // Rowid of vat payment
|
$bookkeeping->doc_ref = $langs->trans("PaymentVat") . ' (' . $val["paymentvatid"] . ')'; // Rowid of vat payment
|
||||||
} else if ($tabtype[$key] == 'payment_donation') {
|
} else if ($tabtype[$key] == 'payment_donation') {
|
||||||
$bookkeeping->code_tiers = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->doc_ref = $langs->trans("Donation") . ' (' . $val["paymentdonationid"] . ')'; // Rowid of donation
|
$bookkeeping->doc_ref = $langs->trans("Donation") . ' (' . $val["paymentdonationid"] . ')'; // Rowid of donation
|
||||||
} else if ($tabtype[$key] == 'payment_salary') {
|
} else if ($tabtype[$key] == 'payment_salary') {
|
||||||
$bookkeeping->code_tiers = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->label_compte = $tabuser[$key]['name'];
|
$bookkeeping->label_operation = $tabuser[$key]['name'];
|
||||||
$bookkeeping->doc_ref = $langs->trans("SalaryPayment") . ' (' . $val["paymentsalid"] . ')'; // Ref of salary payment
|
$bookkeeping->doc_ref = $langs->trans("SalaryPayment") . ' (' . $val["paymentsalid"] . ')'; // Ref of salary payment
|
||||||
|
} else if ($tabtype[$key] == 'payment_various') {
|
||||||
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->doc_ref = $langs->trans("VariousPayment") . ' (' . $val["paymentvariousid"] . ')'; // Ref of various payment
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
@ -447,7 +465,7 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$bookkeeping->doc_type = 'bank';
|
$bookkeeping->doc_type = 'bank';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = $val["fk_bank"];
|
$bookkeeping->fk_docdet = $val["fk_bank"];
|
||||||
$bookkeeping->label_compte = $tabcompany[$key]['name'];
|
$bookkeeping->label_operation = $tabcompany[$key]['name'];
|
||||||
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt);
|
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt);
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||||
$bookkeeping->debit = ($mt < 0 ? - $mt : 0);
|
$bookkeeping->debit = ($mt < 0 ? - $mt : 0);
|
||||||
@ -458,7 +476,19 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->date_create = $now;
|
||||||
|
|
||||||
if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
|
if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
|
||||||
$bookkeeping->code_tiers = '';
|
$sqlmid = 'SELECT ch.libelle, t.libelle as labelc';
|
||||||
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "chargesociales ch ";
|
||||||
|
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paych ON paych.fk_charge=ch.rowid";
|
||||||
|
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "c_chargesociales as t ON ch.fk_type=t.id";
|
||||||
|
$sqlmid .= " WHERE paych.fk_bank=" . $key;
|
||||||
|
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||||
|
$resultmid = $db->query($sqlmid);
|
||||||
|
if ($resultmid) {
|
||||||
|
$objmid = $db->fetch_object($resultmid);
|
||||||
|
$bookkeeping->label_compte = $objmid->labelc;
|
||||||
|
$bookkeeping->doc_ref = $objmid->libelle ;
|
||||||
|
}
|
||||||
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
} else if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
|
} else if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
|
||||||
$sqlmid = 'SELECT fac.facnumber';
|
$sqlmid = 'SELECT fac.facnumber';
|
||||||
@ -472,8 +502,9 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$objmid = $db->fetch_object($resultmid);
|
$objmid = $db->fetch_object($resultmid);
|
||||||
$bookkeeping->doc_ref = $objmid->facnumber;
|
$bookkeeping->doc_ref = $objmid->facnumber;
|
||||||
}
|
}
|
||||||
$bookkeeping->code_tiers = $tabcompany[$key]['code_compta'];
|
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||||
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||||
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
|
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
|
||||||
$sqlmid = 'SELECT facf.ref_supplier,facf.ref';
|
$sqlmid = 'SELECT facf.ref_supplier,facf.ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
|
||||||
@ -486,29 +517,48 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$objmid = $db->fetch_object($resultmid);
|
$objmid = $db->fetch_object($resultmid);
|
||||||
$bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')';
|
$bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')';
|
||||||
}
|
}
|
||||||
$bookkeeping->code_tiers = $tabcompany[$key]['code_compta'];
|
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||||
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||||
|
} else if ($tabtype[$key] == 'payment_expensereport') {
|
||||||
|
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
||||||
|
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
||||||
|
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||||
|
$bookkeeping->label_operation = $tabuser[$key]['name'];
|
||||||
|
$sqlmid = 'SELECT e.ref';
|
||||||
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "expensereport as e";
|
||||||
|
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "payment_expensereport as payer ON payer.fk_expensereport=e.rowid";
|
||||||
|
$sqlmid .= " WHERE payer.fk_expensereport=" . $val["fk_expensereport"];
|
||||||
|
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||||
|
$resultmid = $db->query($sqlmid);
|
||||||
|
if ($resultmid) {
|
||||||
|
$objmid = $db->fetch_object($resultmid);
|
||||||
|
$bookkeeping->doc_ref = $objmid->ref; // Ref of expensereport
|
||||||
|
}
|
||||||
} else if ($tabtype[$key] == 'payment_vat') {
|
} else if ($tabtype[$key] == 'payment_vat') {
|
||||||
$bookkeeping->code_tiers = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->doc_ref = $langs->trans("PaymentVat") . ' (' . $val["paymentvatid"] . ')'; // Rowid of vat
|
$bookkeeping->doc_ref = $langs->trans("PaymentVat") . ' (' . $val["paymentvatid"] . ')'; // Rowid of vat
|
||||||
} else if ($tabtype[$key] == 'payment_donation') {
|
} else if ($tabtype[$key] == 'payment_donation') {
|
||||||
$bookkeeping->code_tiers = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->doc_ref = $langs->trans("Donation") . ' (' . $val["paymentdonationid"] . ')'; // Rowid of donation
|
$bookkeeping->doc_ref = $langs->trans("Donation") . ' (' . $val["paymentdonationid"] . ')'; // Rowid of donation
|
||||||
} else if ($tabtype[$key] == 'payment_salary') {
|
} else if ($tabtype[$key] == 'payment_salary') {
|
||||||
$bookkeeping->code_tiers = $tabuser[$key]['accountancy_code'];
|
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
||||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||||
$bookkeeping->label_compte = $tabuser[$key]['name'];
|
$bookkeeping->label_operation = $tabuser[$key]['name'];
|
||||||
$bookkeeping->doc_ref = $langs->trans("SalaryPayment") . ' (' . $val["paymentsalid"] . ')'; // Rowid of salary payment
|
$bookkeeping->doc_ref = $langs->trans("SalaryPayment") . ' (' . $val["paymentsalid"] . ')'; // Rowid of salary payment
|
||||||
|
} else if ($tabtype[$key] == 'payment_various') {
|
||||||
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->numero_compte = $k;
|
||||||
|
$bookkeeping->doc_ref = $langs->trans("VariousPayment") . ' (' . $val["paymentvariousid"] . ')'; // Rowid of various payment
|
||||||
} else if ($tabtype[$key] == 'banktransfert') {
|
} else if ($tabtype[$key] == 'banktransfert') {
|
||||||
$bookkeeping->code_tiers = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
} else {
|
} else {
|
||||||
// FIXME Should be a temporary account ???
|
// Temporary account
|
||||||
$bookkeeping->doc_ref = $k;
|
$bookkeeping->doc_ref = $k;
|
||||||
//$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE;
|
||||||
$bookkeeping->numero_compte = 'CodeNotDef';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
@ -537,6 +587,12 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|
||||||
|
if ($error >= 10)
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped"), null, 'errors');
|
||||||
|
break; // Break in the foreach
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -556,7 +612,6 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Export
|
// Export
|
||||||
/*
|
|
||||||
if ($action == 'export_csv') {
|
if ($action == 'export_csv') {
|
||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
|
|
||||||
@ -565,165 +620,101 @@ if ($action == 'export_csv') {
|
|||||||
$companystatic = new Client($db);
|
$companystatic = new Client($db);
|
||||||
$userstatic = new User($db);
|
$userstatic = new User($db);
|
||||||
|
|
||||||
// Model Cegid Expert Export
|
// Bank
|
||||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
|
foreach ( $tabpay as $key => $val ) {
|
||||||
{
|
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||||
$sep = ";";
|
|
||||||
|
|
||||||
foreach ( $tabpay as $key => $val ) {
|
$reflabel = $val["ref"];
|
||||||
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
|
if ($reflabel == '(SupplierInvoicePayment)') {
|
||||||
|
$reflabel = $langs->trans('Supplier');
|
||||||
$reflabel = $val["ref"];
|
}
|
||||||
if ($reflabel == '(SupplierInvoicePayment)') {
|
if ($reflabel == '(CustomerInvoicePayment)') {
|
||||||
$reflabel = $langs->trans('Supplier');
|
$reflabel = $langs->trans('Customer');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(CustomerInvoicePayment)') {
|
if ($reflabel == '(SocialContributionPayment)') {
|
||||||
$reflabel = $langs->trans('Customer');
|
$reflabel = $langs->trans('SocialContribution');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(SocialContributionPayment)') {
|
if ($reflabel == '(DonationPayment)') {
|
||||||
$reflabel = $langs->trans('SocialContribution');
|
$reflabel = $langs->trans('Donation');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(DonationPayment)') {
|
if ($reflabel == '(SubscriptionPayment)') {
|
||||||
$reflabel = $langs->trans('Donation');
|
$reflabel = $langs->trans('Subscription');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(SubscriptionPayment)') {
|
if ($reflabel == '(ExpenseReportPayment)') {
|
||||||
$reflabel = $langs->trans('Subscription');
|
$reflabel = $langs->trans('Employee');
|
||||||
}
|
|
||||||
if ($reflabel == '(ExpenseReportPayment)') {
|
|
||||||
$reflabel = $langs->trans('Employee');
|
|
||||||
}
|
|
||||||
|
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
|
||||||
|
|
||||||
$userstatic->id = $tabuser[$key]['id'];
|
|
||||||
$userstatic->lastname = $tabuser[$key]['lastname'];
|
|
||||||
$userstatic->firstname = $tabuser[$key]['firstname'];
|
|
||||||
|
|
||||||
// Bank
|
|
||||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
|
||||||
print $date . $sep;
|
|
||||||
print $journal . $sep;
|
|
||||||
print length_accountg(html_entity_decode($k)) . $sep;
|
|
||||||
print $sep;
|
|
||||||
print ($mt < 0 ? 'C' : 'D') . $sep;
|
|
||||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
|
||||||
if ($companystatic->name == '') {
|
|
||||||
print $langs->trans('Bank')." - ". utf8_decode($val["ref"]) . $sep;
|
|
||||||
} else {
|
|
||||||
print $langs->trans("Bank") .' - '.utf8_decode($companystatic->name) . $sep;
|
|
||||||
}
|
|
||||||
print utf8_decode($reflabel) . $sep;
|
|
||||||
print "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Third party
|
|
||||||
if (is_array($tabtp[$key])) {
|
|
||||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
|
||||||
if ($mt) {
|
|
||||||
print $date . $sep;
|
|
||||||
print $journal . $sep;
|
|
||||||
if ($tabtype[$key] == 'payment') {
|
|
||||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep;
|
|
||||||
print length_accounta(html_entity_decode($k)) . $sep;
|
|
||||||
} else if ($tabtype[$key] == 'payment_supplier') {
|
|
||||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
|
|
||||||
print length_accounta(html_entity_decode($k)) . $sep;
|
|
||||||
} else {
|
|
||||||
print length_accountg(html_entity_decode($k)) . $sep;
|
|
||||||
print $sep;
|
|
||||||
}
|
|
||||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
|
||||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
|
||||||
if ($companystatic->name == '') {
|
|
||||||
print $langs->trans('ThirdParty')." - ". utf8_decode($val["ref"]) . $sep;
|
|
||||||
} else {
|
|
||||||
print $langs->trans('ThirdParty')." - ". utf8_decode($companystatic->name) . $sep;
|
|
||||||
}
|
|
||||||
print utf8_decode($reflabel) . $sep;
|
|
||||||
print "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
|
||||||
print $date . $sep;
|
|
||||||
print $journal . $sep;
|
|
||||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . $sep;
|
|
||||||
print $sep;
|
|
||||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
|
||||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
|
||||||
if ($companystatic->name == '') {
|
|
||||||
print $langs->trans('ThirdParty')." - ". utf8_decode($val["ref"]) . $sep;
|
|
||||||
} else {
|
|
||||||
print $langs->trans('ThirdParty')." - ". utf8_decode($companystatic->name) . $sep;
|
|
||||||
}
|
|
||||||
print utf8_decode($reflabel) . $sep;
|
|
||||||
print "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// Model Classic Export
|
|
||||||
foreach ( $tabpay as $key => $val ) {
|
|
||||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
|
||||||
|
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
|
|
||||||
// Bank
|
// Bank
|
||||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||||
print '"' . $journal . '"' . $sep;
|
print '"' . $journal . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["type_payment"] . '"' . $sep;
|
print '"' . $val["type_payment"] . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
if ($companystatic->name == '') {
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . $langs->trans('Bank') . " - " . utf8_decode($val["ref"]) . '"' . $sep;
|
print " " . $sep;
|
||||||
} else {
|
if ($companystatic->name == '') {
|
||||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
print '"' . $langs->trans('Bank') . " - " . utf8_decode($reflabel) . '"' . $sep;
|
||||||
}
|
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
|
||||||
print "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Third party
|
|
||||||
if (is_array($tabtp[$key])) {
|
|
||||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
|
||||||
if ($mt) {
|
|
||||||
print '"' . $journal . '"' . $sep;
|
|
||||||
print '"' . $date . '"' . $sep;
|
|
||||||
print '"' . $val["type_payment"] . '"' . $sep;
|
|
||||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
|
||||||
if ($companystatic->name == '') {
|
|
||||||
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($val["ref"]) . '"' . $sep;
|
|
||||||
} else {
|
|
||||||
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($companystatic->name) . '"' . $sep;
|
|
||||||
}
|
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
|
||||||
print "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||||
|
}
|
||||||
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||||
|
print "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Third party
|
||||||
|
if (is_array($tabtp[$key])) {
|
||||||
|
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||||
|
if ($mt) {
|
||||||
print '"' . $journal . '"' . $sep;
|
print '"' . $journal . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["ref"] . '"' . $sep;
|
print '"' . $val["type_payment"] . '"' . $sep;
|
||||||
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
if ($companystatic->name == '') {
|
|
||||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($val["ref"]) . '"' . $sep;
|
if ($tabtype[$key] == 'payment_supplier') {
|
||||||
|
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
||||||
|
} else if($tabtype[$key] == 'payment') {
|
||||||
|
print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
|
||||||
} else {
|
} else {
|
||||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
|
if ($companystatic->name == '') {
|
||||||
|
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($reflabel) . '"' . $sep;
|
||||||
|
} else {
|
||||||
|
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($companystatic->name) . '"' . $sep;
|
||||||
}
|
}
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||||
|
print '"' . $journal . '"' . $sep;
|
||||||
|
print '"' . $date . '"' . $sep;
|
||||||
|
print '"' . $val["ref"] . '"' . $sep;
|
||||||
|
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
||||||
|
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
||||||
|
print " " . $sep;
|
||||||
|
if ($companystatic->name == '') {
|
||||||
|
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($reflabel) . '"' . $sep;
|
||||||
|
} else {
|
||||||
|
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||||
|
}
|
||||||
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||||
|
print "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -739,6 +730,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$vatstatic = new Tva($db);
|
$vatstatic = new Tva($db);
|
||||||
$donationstatic = new Don($db);
|
$donationstatic = new Don($db);
|
||||||
$salarystatic = new PaymentSalary($db);
|
$salarystatic = new PaymentSalary($db);
|
||||||
|
$variousstatic = new PaymentVarious($db);
|
||||||
|
|
||||||
llxHeader('', $langs->trans("FinanceJournal"));
|
llxHeader('', $langs->trans("FinanceJournal"));
|
||||||
|
|
||||||
@ -746,7 +738,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$builddate = time();
|
$builddate = time();
|
||||||
//$description = $langs->trans("DescFinanceJournal") . '<br>';
|
//$description = $langs->trans("DescFinanceJournal") . '<br>';
|
||||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
|
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
|
||||||
|
|
||||||
$varlink = 'id_journal=' . $id_journal;
|
$varlink = 'id_journal=' . $id_journal;
|
||||||
|
|
||||||
@ -758,8 +750,9 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction tabsActionNoBottom">';
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
|
print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
// TODO Avoid using js. We can use a direct link with $param
|
// TODO Avoid using js. We can use a direct link with $param
|
||||||
@ -821,6 +814,9 @@ if (empty($action) || $action == 'view') {
|
|||||||
if ($reflabel == '(ExpenseReportPayment)') {
|
if ($reflabel == '(ExpenseReportPayment)') {
|
||||||
$reflabel = $langs->trans('Employee');
|
$reflabel = $langs->trans('Employee');
|
||||||
}
|
}
|
||||||
|
if ($reflabel == '(payment_salary)') {
|
||||||
|
$reflabel = $langs->trans('Employee');
|
||||||
|
}
|
||||||
|
|
||||||
$ref=$reflabel;
|
$ref=$reflabel;
|
||||||
if ($tabtype[$key] == 'payment')
|
if ($tabtype[$key] == 'payment')
|
||||||
@ -907,7 +903,20 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
else dol_print_error($db);
|
else dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
elseif ($tabtype[$key] == 'payment_various')
|
||||||
|
{
|
||||||
|
$sqlmid = 'SELECT v.rowid as id';
|
||||||
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_various as v";
|
||||||
|
$sqlmid .= " WHERE v.rowid=" . $val["paymentvariousid"];
|
||||||
|
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||||
|
$resultmid = $db->query($sqlmid);
|
||||||
|
if ($resultmid) {
|
||||||
|
$objmid = $db->fetch_object($resultmid);
|
||||||
|
$variousstatic->fetch($objmid->id);
|
||||||
|
$ref=$variousstatic->getNomUrl(1);
|
||||||
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
/*$invoicestatic->id = $key;
|
/*$invoicestatic->id = $key;
|
||||||
$invoicestatic->ref = $val["ref"];
|
$invoicestatic->ref = $val["ref"];
|
||||||
|
|||||||
@ -52,6 +52,7 @@ $date_startyear = GETPOST('date_startyear');
|
|||||||
$date_endmonth = GETPOST('date_endmonth');
|
$date_endmonth = GETPOST('date_endmonth');
|
||||||
$date_endday = GETPOST('date_endday');
|
$date_endday = GETPOST('date_endday');
|
||||||
$date_endyear = GETPOST('date_endyear');
|
$date_endyear = GETPOST('date_endyear');
|
||||||
|
$in_bookkeeping = GETPOST('in_bookkeeping');
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
@ -86,31 +87,34 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
|||||||
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
|
$idpays = $mysoc->country_id;
|
||||||
$idpays = $p[0];
|
|
||||||
|
|
||||||
$sql = "SELECT er.rowid, er.ref, er.date_debut as de,";
|
$sql = "SELECT er.rowid, er.ref, er.date_debut as de,";
|
||||||
$sql .= " erd.rowid as erdid, erd.comments, erd.total_ttc, erd.tva_tx, erd.total_ht, erd.total_tva, erd.fk_code_ventilation,";
|
$sql .= " erd.rowid as erdid, erd.comments, erd.total_ttc, erd.tva_tx, erd.total_ht, erd.total_tva, erd.fk_code_ventilation, erd.vat_src_code, ";
|
||||||
$sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_account,";
|
$sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_account,";
|
||||||
$sql .= " f.accountancy_code, ct.accountancy_code_buy as account_tva, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
$sql .= " f.accountancy_code, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||||
|
//$sql .= " ct.accountancy_code_buy as account_tva";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON erd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
|
//$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON erd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
|
||||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
|
$sql .= " JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
|
||||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "user as u ON u.rowid = er.fk_user_author";
|
$sql .= " JOIN " . MAIN_DB_PREFIX . "user as u ON u.rowid = er.fk_user_author";
|
||||||
$sql .= " WHERE er.fk_statut > 0 ";
|
$sql .= " WHERE er.fk_statut > 0";
|
||||||
$sql .= " AND erd.fk_code_ventilation > 0 ";
|
$sql .= " AND erd.fk_code_ventilation > 0";
|
||||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||||
if ($date_start && $date_end)
|
if ($date_start && $date_end)
|
||||||
$sql .= " AND er.date_debut >= '" . $db->idate($date_start) . "' AND er.date_debut <= '" . $db->idate($date_end) . "'";
|
$sql .= " AND er.date_debut >= '" . $db->idate($date_start) . "' AND er.date_debut <= '" . $db->idate($date_end) . "'";
|
||||||
|
if ($in_bookkeeping == 'yes')
|
||||||
|
$sql .= " AND (er.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report') )";
|
||||||
$sql .= " ORDER BY er.date_debut";
|
$sql .= " ORDER BY er.date_debut";
|
||||||
|
|
||||||
dol_syslog('accountancy/journal/expensereportsjournal.php:: $sql=' . $sql);
|
dol_syslog('accountancy/journal/expensereportsjournal.php:: $sql=' . $sql);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
// les variables
|
|
||||||
|
// Variables
|
||||||
$account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT)) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef");
|
$account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT)) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef");
|
||||||
$account_vat = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
$account_vat = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
||||||
|
|
||||||
@ -128,10 +132,15 @@ if ($result) {
|
|||||||
// Controls
|
// Controls
|
||||||
$compta_user = (! empty($obj->user_accountancy_account)) ? $obj->user_accountancy_account : $account_salary;
|
$compta_user = (! empty($obj->user_accountancy_account)) ? $obj->user_accountancy_account : $account_salary;
|
||||||
$compta_fees = $obj->compte;
|
$compta_fees = $obj->compte;
|
||||||
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $account_vat);
|
|
||||||
|
|
||||||
// Define array for display vat tx
|
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||||
$def_tva[$obj->rowid]=price($obj->tva_tx);
|
$compta_tva = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $account_vat);
|
||||||
|
|
||||||
|
// Define array to display all VAT rates that use this accounting account $compta_tva
|
||||||
|
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
||||||
|
{
|
||||||
|
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':''));
|
||||||
|
}
|
||||||
|
|
||||||
$taber[$obj->rowid]["date"] = $db->jdate($obj->de);
|
$taber[$obj->rowid]["date"] = $db->jdate($obj->de);
|
||||||
$taber[$obj->rowid]["ref"] = $obj->ref;
|
$taber[$obj->rowid]["ref"] = $obj->ref;
|
||||||
@ -142,7 +151,7 @@ if ($result) {
|
|||||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||||
$tabuser[$obj->rowid] = array (
|
$tabuser[$obj->rowid] = array (
|
||||||
'id' => $obj->uid,
|
'id' => $obj->uid,
|
||||||
'name' => $obj->firstname.' '.$obj->lastname,
|
'name' => dolGetFirstLastname($obj->firstname, $obj->lastname),
|
||||||
'user_accountancy_code' => $obj->user_accountancy_account
|
'user_accountancy_code' => $obj->user_accountancy_account
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -163,6 +172,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
|
// Thirdparty
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
@ -175,8 +185,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->doc_type = 'expense_report';
|
$bookkeeping->doc_type = 'expense_report';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||||
$bookkeeping->code_tiers = $tabuser[$key]['user_accountancy_code'];
|
$bookkeeping->subledger_account = $tabuser[$key]['user_accountancy_code'];
|
||||||
$bookkeeping->label_compte = $tabuser[$key]['name'];
|
$bookkeeping->subledger_label = $tabuser[$key]['user_accountancy_code'];
|
||||||
|
$bookkeeping->label_operation = $tabuser[$key]['name'];
|
||||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
||||||
@ -205,9 +216,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fees
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
// Fees
|
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
$accountingaccount->fetch(null, $k, true);
|
$accountingaccount->fetch(null, $k, true);
|
||||||
@ -222,8 +233,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->doc_type = 'expense_report';
|
$bookkeeping->doc_type = 'expense_report';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||||
$bookkeeping->code_tiers = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->label_compte = $accountingaccount->label;
|
$bookkeeping->subledger_label = '';
|
||||||
|
$bookkeeping->label_operation = $accountingaccount->label;
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
@ -253,9 +265,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VAT
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
// VAT
|
|
||||||
// var_dump($tabtva);
|
// var_dump($tabtva);
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
@ -267,8 +279,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->doc_type = 'expense_report';
|
$bookkeeping->doc_type = 'expense_report';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||||
$bookkeeping->code_tiers = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->label_compte = $langs->trans("VAT"). ' '.$def_tva[$key];
|
$bookkeeping->subledger_label = '';
|
||||||
|
$bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
@ -304,6 +317,12 @@ if ($action == 'writebookkeeping') {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|
||||||
|
if ($error >= 10)
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped"), null, 'errors');
|
||||||
|
break; // Break in the foreach
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -450,7 +469,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$builddate = time();
|
$builddate = time();
|
||||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||||
|
|
||||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
|
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
|
||||||
|
|
||||||
$varlink = 'id_journal=' . $id_journal;
|
$varlink = 'id_journal=' . $id_journal;
|
||||||
|
|
||||||
@ -462,7 +481,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction tabsActionNoBottom">';
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
@ -553,7 +572,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key]. "</td>";
|
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]). "</td>";
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
@ -576,7 +595,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("Code_tiers") . "</td>";
|
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("subledger_account") . "</td>";
|
||||||
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
*
|
*
|
||||||
@ -51,6 +51,7 @@ $date_startyear = GETPOST('date_startyear');
|
|||||||
$date_endmonth = GETPOST('date_endmonth');
|
$date_endmonth = GETPOST('date_endmonth');
|
||||||
$date_endday = GETPOST('date_endday');
|
$date_endday = GETPOST('date_endday');
|
||||||
$date_endyear = GETPOST('date_endyear');
|
$date_endyear = GETPOST('date_endyear');
|
||||||
|
$in_bookkeeping = GETPOST('in_bookkeeping');
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
@ -85,28 +86,31 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
|||||||
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
|
$idpays = $mysoc->country_id;
|
||||||
$idpays = $p[0];
|
|
||||||
|
|
||||||
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier,";
|
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier,";
|
||||||
$sql .= " fd.rowid as fdid, fd.description, fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type,";
|
$sql .= " fd.rowid as fdid, fd.description, fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type, fd.vat_src_code,";
|
||||||
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
||||||
$sql .= " p.accountancy_code_buy , ct.accountancy_code_buy as account_tva, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
$sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||||
|
//$sql .= " ct.accountancy_code_buy as account_tva";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
|
//$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = fd.fk_facture_fourn";
|
$sql .= " JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = fd.fk_facture_fourn";
|
||||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||||
$sql .= " WHERE f.fk_statut > 0 ";
|
$sql .= " WHERE f.fk_statut > 0"; // TODO Facture annulée ?
|
||||||
$sql .= " AND fd.fk_code_ventilation > 0 ";
|
$sql .= " AND fd.fk_code_ventilation > 0";
|
||||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$sql .= " AND f.type IN (0,1,2)";
|
$sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_SITUATION . ")";
|
||||||
else
|
} else {
|
||||||
$sql .= " AND f.type IN (0,1,2,3)";
|
$sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_DEPOSIT . "," . FactureFournisseur::TYPE_SITUATION . ")";
|
||||||
|
}
|
||||||
if ($date_start && $date_end)
|
if ($date_start && $date_end)
|
||||||
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
||||||
|
if ($in_bookkeeping == 'yes')
|
||||||
|
$sql .= " AND (f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice') )";
|
||||||
$sql .= " ORDER BY f.datef";
|
$sql .= " ORDER BY f.datef";
|
||||||
|
|
||||||
dol_syslog('accountancy/journal/purchasesjournal.php:: $sql=' . $sql);
|
dol_syslog('accountancy/journal/purchasesjournal.php:: $sql=' . $sql);
|
||||||
@ -114,7 +118,7 @@ $result = $db->query($sql);
|
|||||||
if ($result) {
|
if ($result) {
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
// les variables
|
// Variables
|
||||||
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef");
|
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef");
|
||||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
||||||
|
|
||||||
@ -129,7 +133,7 @@ if ($result) {
|
|||||||
while ( $i < $num ) {
|
while ( $i < $num ) {
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
|
|
||||||
// contrôles
|
// Controls
|
||||||
$compta_soc = (! empty($obj->code_compta_fournisseur)) ? $obj->code_compta_fournisseur : $cptfour;
|
$compta_soc = (! empty($obj->code_compta_fournisseur)) ? $obj->code_compta_fournisseur : $cptfour;
|
||||||
|
|
||||||
$compta_prod = $obj->compte;
|
$compta_prod = $obj->compte;
|
||||||
@ -139,10 +143,15 @@ if ($result) {
|
|||||||
else
|
else
|
||||||
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
||||||
}
|
}
|
||||||
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva);
|
|
||||||
|
|
||||||
//Define array for display vat tx
|
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||||
$def_tva[$obj->rowid]=price($obj->tva_tx);
|
$compta_tva = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||||
|
|
||||||
|
// Define array to display all VAT rates that use this accounting account $compta_tva
|
||||||
|
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
||||||
|
{
|
||||||
|
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':''));
|
||||||
|
}
|
||||||
|
|
||||||
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
|
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
|
||||||
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')';
|
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')';
|
||||||
@ -202,10 +211,10 @@ if ($action == 'writebookkeeping') {
|
|||||||
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
||||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||||
|
|
||||||
|
// Thirdparty
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
// get compte id and label
|
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
@ -214,9 +223,11 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->doc_type = 'supplier_invoice';
|
$bookkeeping->doc_type = 'supplier_invoice';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||||
$bookkeeping->code_tiers = $tabcompany[$key]['code_fournisseur'];
|
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||||
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("Code_tiers");
|
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
|
||||||
$bookkeeping->numero_compte = $tabcompany[$key]['code_compta_fournisseur'];
|
$bookkeeping->subledger_label = ''; // TODO To complete
|
||||||
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("subledger_account");
|
||||||
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
||||||
$bookkeeping->debit = ($mt <= 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt <= 0) ? $mt : 0;
|
||||||
@ -261,8 +272,10 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->doc_type = 'supplier_invoice';
|
$bookkeeping->doc_type = 'supplier_invoice';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||||
$bookkeeping->code_tiers = '';
|
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||||
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label;
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->subledger_label = '';
|
||||||
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label;
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
@ -306,8 +319,10 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->doc_type = 'supplier_invoice';
|
$bookkeeping->doc_type = 'supplier_invoice';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||||
$bookkeeping->code_tiers = '';
|
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||||
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key];
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->subledger_label = '';
|
||||||
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
@ -343,6 +358,12 @@ if ($action == 'writebookkeeping') {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|
||||||
|
if ($error >= 10)
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped"), null, 'errors');
|
||||||
|
break; // Break in the foreach
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,69 +388,15 @@ if ($action == 'writebookkeeping') {
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$companystatic = new Fournisseur($db);
|
$companystatic = new Fournisseur($db);
|
||||||
|
$invoicestatic = new FactureFournisseur($db);
|
||||||
|
|
||||||
// Export
|
// Export
|
||||||
/*if ($action == 'export_csv') {
|
if ($action == 'export_csv') {
|
||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
$journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
$journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||||
|
|
||||||
// Model Cegid Expert Export
|
|
||||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
|
|
||||||
$sep = ";";
|
|
||||||
|
|
||||||
foreach ( $tabfac as $key => $val ) {
|
|
||||||
$date = dol_print_date($val["date"], '%d%m%Y');
|
|
||||||
|
|
||||||
// Product / Service
|
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
|
||||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
|
||||||
|
|
||||||
if ($mt) {
|
|
||||||
print $date . $sep;
|
|
||||||
print $purchase_journal . $sep;
|
|
||||||
print length_accountg(html_entity_decode($k)) . $sep;
|
|
||||||
print $sep;
|
|
||||||
print ($mt < 0 ? 'C' : 'D') . $sep;
|
|
||||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
|
||||||
print dol_trunc($val["description"], 32) . $sep;
|
|
||||||
print $val["ref"];
|
|
||||||
print "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// VAT
|
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
|
||||||
if ($mt) {
|
|
||||||
print $date . $sep;
|
|
||||||
print $purchase_journal . $sep;
|
|
||||||
print length_accountg(html_entity_decode($k)) . $sep;
|
|
||||||
print $sep;
|
|
||||||
print ($mt < 0 ? 'C' : 'D') . $sep;
|
|
||||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
|
||||||
print $langs->trans("VAT") . $sep;
|
|
||||||
print $val["ref"];
|
|
||||||
print "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
|
||||||
print $date . $sep;
|
|
||||||
print $purchase_journal . $sep;
|
|
||||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
|
|
||||||
print length_accounta(html_entity_decode($k)) . $sep;
|
|
||||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
|
||||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
|
||||||
print $companystatic->name . $sep;
|
|
||||||
print $val["ref"];
|
|
||||||
print "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
|
|
||||||
// Model Classic Export
|
|
||||||
foreach ( $tabfac as $key => $val ) {
|
foreach ( $tabfac as $key => $val ) {
|
||||||
|
|
||||||
$invoicestatic->id = $key;
|
$invoicestatic->id = $key;
|
||||||
@ -450,44 +417,60 @@ $companystatic = new Fournisseur($db);
|
|||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
$accountingaccount->fetch(null, $k, true);
|
$accountingaccount->fetch(null, $k, true);
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["ref"] . '"' . $sep;
|
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
||||||
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
// print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
print " " . $sep;
|
||||||
|
print '"' . utf8_decode ( dol_trunc($accountingaccount->label, 32) ) . '"' . $sep;
|
||||||
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
||||||
|
print '"' . $journal_label . '"' ;
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// VAT
|
// VAT
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["ref"] . '"' . $sep;
|
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
||||||
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
// print '"' . $langs->trans("VAT") . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $sep;
|
print " " . $sep;
|
||||||
|
print '"' . $langs->trans("VAT") . '"' . $sep;
|
||||||
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
||||||
|
print '"' . $journal_label . '"' ;
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["ref"] . '"' . $sep;
|
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
||||||
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
||||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
||||||
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
|
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||||
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep;
|
||||||
|
print '"' . $journal_label . '"' ;
|
||||||
|
print "\n";
|
||||||
}
|
}
|
||||||
print "\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (empty($action) || $action == 'view') {
|
if (empty($action) || $action == 'view') {
|
||||||
|
|
||||||
@ -506,7 +489,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$description .= $langs->trans("DepositsAreIncluded");
|
$description .= $langs->trans("DepositsAreIncluded");
|
||||||
}
|
}
|
||||||
|
|
||||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
|
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
|
||||||
|
|
||||||
$varlink = 'id_journal=' . $id_journal;
|
$varlink = 'id_journal=' . $id_journal;
|
||||||
|
|
||||||
@ -518,8 +501,19 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
print '<div class="tabsAction">';
|
// Button to write into Ledger
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
||||||
|
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||||
|
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||||
|
}
|
||||||
|
print '<div class="tabsAction tabsActionNoBottom">';
|
||||||
|
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||||
|
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
|
}
|
||||||
|
print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '
|
print '
|
||||||
@ -612,7 +606,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key]. "</td>";
|
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]). "</td>";
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
@ -635,7 +629,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("Code_tiers") . "</td>";
|
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("subledger_account") . "</td>";
|
||||||
// print "</td><td>" . $langs->trans("ThirdParty");
|
// print "</td><td>" . $langs->trans("ThirdParty");
|
||||||
// print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')';
|
// print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')';
|
||||||
// print "</td>";
|
// print "</td>";
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -46,7 +46,7 @@ $langs->load("main");
|
|||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
|
|
||||||
$id_journal = GETPOST('id_journal', 'int');
|
$id_journal = GETPOST('id_journal', 'int');
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','alpha');
|
||||||
|
|
||||||
$date_startmonth = GETPOST('date_startmonth');
|
$date_startmonth = GETPOST('date_startmonth');
|
||||||
$date_startday = GETPOST('date_startday');
|
$date_startday = GETPOST('date_startday');
|
||||||
@ -54,6 +54,7 @@ $date_startyear = GETPOST('date_startyear');
|
|||||||
$date_endmonth = GETPOST('date_endmonth');
|
$date_endmonth = GETPOST('date_endmonth');
|
||||||
$date_endday = GETPOST('date_endday');
|
$date_endday = GETPOST('date_endday');
|
||||||
$date_endyear = GETPOST('date_endyear');
|
$date_endyear = GETPOST('date_endyear');
|
||||||
|
$in_bookkeeping = GETPOST('in_bookkeeping');
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
@ -89,31 +90,32 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
|||||||
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
|
$idpays = $mysoc->country_id;
|
||||||
$idpays = $p[0];
|
|
||||||
|
|
||||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client,";
|
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client,";
|
||||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,";
|
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
|
||||||
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
||||||
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte,";
|
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||||
$sql .= " fd.situation_percent,ct.accountancy_code_sell as account_tva";
|
//$sql .= " ct.accountancy_code_sell as account_tva";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
$sql .= " JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
|
//$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON ((fd.vat_src_code <> '' AND fd.vat_src_code = ct.code) OR (fd.vat_src_code = '' AND fd.tva_tx = ct.taux)) AND ct.fk_pays = '" . $idpays . "'";
|
||||||
$sql .= " WHERE fd.fk_code_ventilation > 0";
|
$sql .= " WHERE fd.fk_code_ventilation > 0";
|
||||||
$sql .= " AND f.entity IN (".getEntity('facture', 0).')'; // We don't share object for accountancy
|
$sql .= " AND f.entity IN (".getEntity('facture', 0).')'; // We don't share object for accountancy
|
||||||
$sql .= " AND f.fk_statut > 0"; // TODO Facture annulée ?
|
$sql .= " AND f.fk_statut > 0"; // TODO Facture annulée ?
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||||
} else {
|
} else {
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_STANDARD . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||||
}
|
}
|
||||||
$sql .= " AND fd.product_type IN (0,1)";
|
$sql .= " AND fd.product_type IN (0,1)";
|
||||||
if ($date_start && $date_end)
|
if ($date_start && $date_end)
|
||||||
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
||||||
|
if ($in_bookkeeping == 'yes')
|
||||||
|
$sql .= " AND (f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice') )";
|
||||||
$sql .= " ORDER BY f.datef";
|
$sql .= " ORDER BY f.datef";
|
||||||
|
|
||||||
dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG);
|
dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG);
|
||||||
@ -127,29 +129,34 @@ if ($result) {
|
|||||||
$tabcompany = array ();
|
$tabcompany = array ();
|
||||||
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
|
// Variables
|
||||||
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef");
|
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef");
|
||||||
|
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
while ( $i < $num ) {
|
while ( $i < $num ) {
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
|
|
||||||
// les variables
|
// Controls
|
||||||
$compta_soc = (! empty($obj->code_compta)) ? $obj->code_compta : $cptcli;
|
$compta_soc = (! empty($obj->code_compta)) ? $obj->code_compta : $cptcli;
|
||||||
|
|
||||||
$compta_prod = $obj->compte;
|
$compta_prod = $obj->compte;
|
||||||
if (empty($compta_prod)) {
|
if (empty($compta_prod)) {
|
||||||
if ($obj->product_type == 0)
|
if ($obj->product_type == 0)
|
||||||
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
||||||
else
|
else
|
||||||
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
||||||
}
|
}
|
||||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
|
||||||
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva);
|
|
||||||
|
|
||||||
|
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||||
|
$compta_tva = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||||
|
|
||||||
//Define array for display vat tx
|
// Define array to display all VAT rates that use this accounting account $compta_tva
|
||||||
$def_tva[$obj->rowid]=price($obj->tva_tx);
|
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
||||||
|
{
|
||||||
|
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':''));
|
||||||
|
}
|
||||||
|
|
||||||
// Situation invoices handling
|
// Situation invoices handling
|
||||||
$line = new FactureLigne($db);
|
$line = new FactureLigne($db);
|
||||||
@ -231,10 +238,11 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->doc_type = 'customer_invoice';
|
$bookkeeping->doc_type = 'customer_invoice';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||||
$bookkeeping->code_tiers = $tabcompany[$key]['code_client'];
|
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||||
$bookkeeping->numero_compte = $tabcompany[$key]['code_compta'];
|
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||||
// $bookkeeping->label_compte = $tabcompany[$key]['name'];
|
$bookkeeping->subledger_label = ''; // TODO To complete
|
||||||
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers");
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||||
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account");
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
||||||
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
|
||||||
@ -277,9 +285,11 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->doc_type = 'customer_invoice';
|
$bookkeeping->doc_type = 'customer_invoice';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add;
|
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add;
|
||||||
$bookkeeping->code_tiers = '';
|
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||||
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label;
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label;
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||||
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
|
||||||
@ -321,9 +331,11 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->doc_type = 'customer_invoice';
|
$bookkeeping->doc_type = 'customer_invoice';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||||
$bookkeeping->code_tiers = '';
|
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||||
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.$def_tva[$key];
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]);
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||||
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
|
||||||
@ -358,6 +370,12 @@ if ($action == 'writebookkeeping') {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|
||||||
|
if ($error >= 10)
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped"), null, 'errors');
|
||||||
|
break; // Break in the foreach
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -386,76 +404,18 @@ if ($action == 'writebookkeeping') {
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
// Export
|
// Export
|
||||||
/*if ($action == 'export_csv') {
|
if ($action == 'export_csv') {
|
||||||
|
|
||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
||||||
|
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||||
|
|
||||||
$companystatic = new Client($db);
|
$companystatic = new Client($db);
|
||||||
|
$invoicestatic = new Facture($db);
|
||||||
|
|
||||||
// Model Cegid Expert Export
|
foreach ( $tabfac as $key => $val ) {
|
||||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
|
|
||||||
$sep = ";";
|
|
||||||
|
|
||||||
foreach ( $tabfac as $key => $val ) {
|
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
|
||||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
|
||||||
|
|
||||||
$invoicestatic->id = $key;
|
|
||||||
$invoicestatic->ref = $val["ref"];
|
|
||||||
|
|
||||||
$date = dol_print_date($val["date"], '%d%m%Y');
|
|
||||||
|
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
|
||||||
print $date . $sep;
|
|
||||||
print $sell_journal . $sep;
|
|
||||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep;
|
|
||||||
print length_accounta(html_entity_decode($k)) . $sep;
|
|
||||||
print ($mt < 0 ? 'C' : 'D') . $sep;
|
|
||||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
|
||||||
print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . $sep;
|
|
||||||
print $val["ref"];
|
|
||||||
print "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Product / Service
|
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
|
||||||
$accountingaccount_static = new AccountingAccount($db);
|
|
||||||
if ($accountingaccount_static->fetch(null, $k, true)) {
|
|
||||||
print $date . $sep;
|
|
||||||
print $sell_journal . $sep;
|
|
||||||
print length_accountg(html_entity_decode($k)) . $sep;
|
|
||||||
print $sep;
|
|
||||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
|
||||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
|
||||||
print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount_static->label . $sep;
|
|
||||||
print $val["ref"];
|
|
||||||
print "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TVA
|
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
|
||||||
if ($mt) {
|
|
||||||
print $date . $sep;
|
|
||||||
print $sell_journal . $sep;
|
|
||||||
print length_accountg(html_entity_decode($k)) . $sep;
|
|
||||||
print $sep;
|
|
||||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
|
||||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
|
||||||
print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . $sep;
|
|
||||||
// print $langs->trans("VAT") . $sep;
|
|
||||||
print $val["ref"];
|
|
||||||
print "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
|
|
||||||
// Model Classic Export
|
|
||||||
foreach ( $tabfac as $key => $val ) {
|
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||||
@ -466,13 +426,19 @@ $form = new Form($db);
|
|||||||
$date = dol_print_date($val["date"], 'day');
|
$date = dol_print_date($val["date"], 'day');
|
||||||
|
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $val["ref"] . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
print '"' . $val["ref"] . '"' . $sep;
|
||||||
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
|
||||||
print "\n";
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
|
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||||
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||||
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
|
print '"' . $sell_journal . '"' ;
|
||||||
|
print "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Product / Service
|
// Product / Service
|
||||||
@ -480,33 +446,48 @@ $form = new Form($db);
|
|||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
$accountingaccount->fetch(null, $k, true);
|
$accountingaccount->fetch(null, $k, true);
|
||||||
|
|
||||||
|
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $val["ref"] . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . $val["ref"] . '"' . $sep;
|
||||||
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print "\n";
|
print " " . $sep;
|
||||||
|
print '"' . utf8_decode ( dol_trunc($accountingaccount->label, 32) ) . '"' . $sep;
|
||||||
|
print '"' . utf8_decode (dol_trunc($companystatic->name, 16) ) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||||
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
|
print '"' . $sell_journal . '"' ;
|
||||||
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $val["ref"] . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . $val["ref"] . '"' . $sep;
|
||||||
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . '"' . $sep;
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print "\n";
|
print " " . $sep;
|
||||||
|
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key]. '"' . $sep;
|
||||||
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ). ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . '"' . $sep;
|
||||||
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
|
print '"' . $sell_journal . '"' ;
|
||||||
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
if (empty($action) || $action == 'view') {
|
if (empty($action) || $action == 'view') {
|
||||||
@ -524,19 +505,25 @@ if (empty($action) || $action == 'view') {
|
|||||||
$description .= $langs->trans("DepositsAreNotIncluded");
|
$description .= $langs->trans("DepositsAreNotIncluded");
|
||||||
else
|
else
|
||||||
$description .= $langs->trans("DepositsAreIncluded");
|
$description .= $langs->trans("DepositsAreIncluded");
|
||||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
|
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
|
||||||
|
|
||||||
$varlink = 'id_journal=' . $id_journal;
|
$varlink = 'id_journal=' . $id_journal;
|
||||||
|
|
||||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||||
|
|
||||||
/*if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
// Button to write into Ledger
|
||||||
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||||
} else {
|
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||||
}*/
|
}
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction tabsActionNoBottom">';
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||||
|
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
|
}
|
||||||
|
print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '
|
print '
|
||||||
@ -565,7 +552,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $langs->trans("Date") . "</td>";
|
print "<td>" . $langs->trans("Date") . "</td>";
|
||||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
||||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||||
print "<td>" . $langs->trans("Type") . "</td>";
|
print "<td>" . $langs->trans("Label") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -591,7 +578,6 @@ if (empty($action) || $action == 'view') {
|
|||||||
$companystatic->id = $tabcompany[$key]['id'];
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accounta($k);
|
$accountoshow = length_accounta($k);
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
@ -602,7 +588,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
// print "</td><td>" . $langs->trans("ThirdParty");
|
// print "</td><td>" . $langs->trans("ThirdParty");
|
||||||
// print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')';
|
// print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . "</td>";
|
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account") . "</td>";
|
||||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
@ -649,7 +635,8 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . ' '.$def_tva[$key]. "</td>";
|
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
||||||
|
print "</td>";
|
||||||
// print "<td>" . $langs->trans("VAT") . "</td>";
|
// print "<td>" . $langs->trans("VAT") . "</td>";
|
||||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
|
/* Copyright (C) 2016/17 Jamal Elbaz <jamelbaz@gmail.com>
|
||||||
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -25,6 +25,7 @@ require '../../main.inc.php';
|
|||||||
|
|
||||||
// Class
|
// Class
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancycategory.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancycategory.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
|
|
||||||
@ -41,6 +42,8 @@ $selectcpt = GETPOST('cpt_bk');
|
|||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$rowid = GETPOST('rowid', 'int');
|
$rowid = GETPOST('rowid', 'int');
|
||||||
$cancel = GETPOST('cancel');
|
$cancel = GETPOST('cancel');
|
||||||
|
$simple_report = GETPOST('simple_report');
|
||||||
|
|
||||||
|
|
||||||
// Filter
|
// Filter
|
||||||
$year = GETPOST('year','int');
|
$year = GETPOST('year','int');
|
||||||
@ -77,7 +80,14 @@ $form = new Form($db);
|
|||||||
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
|
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
|
||||||
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
|
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans('ReportInOut'), $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, 'title_accountancy');
|
$nom = $langs->trans("ReportInOut").', '.$langs->trans("ByAccounts");
|
||||||
|
$nomlink = '';
|
||||||
|
$periodlink = '';
|
||||||
|
$exportlink = '';
|
||||||
|
$builddate = time();
|
||||||
|
$description = '';
|
||||||
|
$period = $langs->trans("Detail").' '. $form->selectyesno('simple_report',$simple_report,0) . " " .$textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear ;
|
||||||
|
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
|
||||||
|
|
||||||
$moreforfilter='';
|
$moreforfilter='';
|
||||||
|
|
||||||
@ -108,30 +118,89 @@ foreach($months as $k => $v){
|
|||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$cats = $AccCat->getCatsCpts();
|
|
||||||
if ($cats < 0) dol_print_error($db, $AccCat->error, $AccCat->errors);
|
|
||||||
|
|
||||||
$catsCalcule = $AccCat->getCatsCal();
|
|
||||||
|
//All categories
|
||||||
|
$cats = $AccCat->getCats();
|
||||||
if ($catsCalcule < 0) dol_print_error($db, $AccCat->error, $AccCat->errors);
|
if ($catsCalcule < 0) dol_print_error($db, $AccCat->error, $AccCat->errors);
|
||||||
|
|
||||||
$j=1;
|
$j=1;
|
||||||
$sommes = array();
|
$sommes = array();
|
||||||
|
|
||||||
if (!empty($cats))
|
foreach($cats as $cat ){
|
||||||
{
|
if(!empty($cat['category_type'])){ // category calculed
|
||||||
foreach ($cats as $name_cat => $cpts)
|
|
||||||
{
|
$formula = $cat['formula'];
|
||||||
|
|
||||||
print "<tr class='liste_titre'>";
|
print "<tr class='liste_titre'>";
|
||||||
print '<td colspan="17">' . $name_cat . '</td>';
|
print '<td colspan="2">' . $cat['label'] . '</td>';
|
||||||
|
|
||||||
|
$vars = array();
|
||||||
|
|
||||||
|
// Previous Fiscal year (N-1)
|
||||||
|
foreach($sommes as $code => $det){
|
||||||
|
$vars[$code] = $det['NP'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$result = strtr($formula, $vars);
|
||||||
|
|
||||||
|
|
||||||
|
$r = $AccCat->calculate($result);
|
||||||
|
|
||||||
|
print '<td align="right"><font color="blue">' . price($r) . '</td>';
|
||||||
|
$code = $cat['code']; // code categorie de calcule
|
||||||
|
$sommes[$code]['NP'] += $r;
|
||||||
|
|
||||||
|
// Current fiscal year (N)
|
||||||
|
if (is_array($sommes) && ! empty($sommes)){
|
||||||
|
foreach($sommes as $code => $det){
|
||||||
|
$vars[$code] = $det['N'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = strtr($formula, $vars);
|
||||||
|
|
||||||
|
$r = $AccCat->calculate($result);
|
||||||
|
|
||||||
|
print '<td align="right"><font color="blue">' . price($r) . '</td>';
|
||||||
|
$sommes[$code]['N'] += $r;
|
||||||
|
|
||||||
|
// Detail by month
|
||||||
|
foreach($months as $k => $v){
|
||||||
|
foreach($sommes as $code => $det){
|
||||||
|
$vars[$code] = $det['M'][$k];
|
||||||
|
}
|
||||||
|
$result = strtr($formula, $vars);
|
||||||
|
$r = $AccCat->calculate($result);
|
||||||
|
print '<td align="right"><font color="blue">' . price($r) . '</td>';
|
||||||
|
$sommes[$code]['M'][$k] += $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$position = -1;
|
|
||||||
$code = -1;
|
|
||||||
|
}else{ // normal category
|
||||||
|
|
||||||
|
$totCat = array();
|
||||||
|
$totCat['M'] = array();
|
||||||
|
|
||||||
|
// get cpts of category
|
||||||
|
$cpts = $AccCat->getCptsCat($cat['rowid']);
|
||||||
|
|
||||||
|
|
||||||
|
print "<tr class='liste_titre'>";
|
||||||
|
print '<td colspan="2">' . $cat['label'] . '</td>';
|
||||||
|
|
||||||
foreach($cpts as $i => $cpt){
|
foreach($cpts as $i => $cpt){
|
||||||
|
$var = ! $var;
|
||||||
|
|
||||||
$position = $cpt['position'];
|
$code = $cat['code'];
|
||||||
$code = $cpt['code'];
|
|
||||||
|
|
||||||
|
// N-1
|
||||||
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
|
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
|
||||||
|
|
||||||
if ($return < 0) {
|
if ($return < 0) {
|
||||||
setEventMessages(null, $AccCat->errors, 'errors');
|
setEventMessages(null, $AccCat->errors, 'errors');
|
||||||
$resultNP=0;
|
$resultNP=0;
|
||||||
@ -139,6 +208,7 @@ if (!empty($cats))
|
|||||||
$resultNP=$AccCat->sdc;
|
$resultNP=$AccCat->sdc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//N
|
||||||
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
|
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
|
||||||
if ($return < 0) {
|
if ($return < 0) {
|
||||||
setEventMessages(null, $AccCat->errors, 'errors');
|
setEventMessages(null, $AccCat->errors, 'errors');
|
||||||
@ -146,13 +216,64 @@ if (!empty($cats))
|
|||||||
} else {
|
} else {
|
||||||
$resultN=$AccCat->sdc;
|
$resultN=$AccCat->sdc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$totCat['NP'] += $resultNP;
|
||||||
|
$totCat['N'] += $resultN;
|
||||||
|
|
||||||
|
foreach($months as $k => $v){
|
||||||
|
$return = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
|
||||||
|
if ($return < 0) {
|
||||||
|
setEventMessages(null, $AccCat->errors, 'errors');
|
||||||
|
$resultM=0;
|
||||||
|
} else {
|
||||||
|
$resultM=$AccCat->sdc;
|
||||||
|
}
|
||||||
|
$totCat['M'][$k] += $resultM;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<td align="right">' . price($totCat['NP']) . '</td>';
|
||||||
|
print '<td align="right">' . price($totCat['N']) . '</td>';
|
||||||
|
|
||||||
|
foreach($totCat['M'] as $k => $v){
|
||||||
|
print '<td align="right">' . price($v) . '</td>';
|
||||||
|
}
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
foreach($cpts as $i => $cpt){
|
||||||
|
$var = ! $var;
|
||||||
|
|
||||||
|
$code = $cat['code'];
|
||||||
|
|
||||||
|
// N-1
|
||||||
|
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
|
||||||
|
|
||||||
|
if ($return < 0) {
|
||||||
|
setEventMessages(null, $AccCat->errors, 'errors');
|
||||||
|
$resultNP=0;
|
||||||
|
} else {
|
||||||
|
$resultNP=$AccCat->sdc;
|
||||||
|
}
|
||||||
|
|
||||||
|
//N
|
||||||
|
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
|
||||||
|
if ($return < 0) {
|
||||||
|
setEventMessages(null, $AccCat->errors, 'errors');
|
||||||
|
$resultN=0;
|
||||||
|
} else {
|
||||||
|
$resultN=$AccCat->sdc;
|
||||||
|
}
|
||||||
|
|
||||||
$sommes[$code]['NP'] += $resultNP;
|
$sommes[$code]['NP'] += $resultNP;
|
||||||
$sommes[$code]['N'] += $resultN;
|
$sommes[$code]['N'] += $resultN;
|
||||||
print '<tr class="oddeven">';
|
print '<tr'. $bc[$var].'>';
|
||||||
print '<td>' . $cpt['account_number'] . '</td>';
|
if ($simple_report == 'yes') {
|
||||||
|
print '<td>' . length_accountg($cpt['account_number']) . '</td>';
|
||||||
print '<td>' . $cpt['name_cpt'] . '</td>';
|
print '<td>' . $cpt['name_cpt'] . '</td>';
|
||||||
print '<td>' . price($resultNP) . '</td>';
|
print '<td align="right">' . price($resultNP) . '</td>';
|
||||||
print '<td>' . price($resultN) . '</td>';
|
print '<td align="right">' . price($resultN) . '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
foreach($months as $k => $v){
|
foreach($months as $k => $v){
|
||||||
$return = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
|
$return = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
|
||||||
@ -163,102 +284,15 @@ if (!empty($cats))
|
|||||||
$resultM=$AccCat->sdc;
|
$resultM=$AccCat->sdc;
|
||||||
}
|
}
|
||||||
$sommes[$code]['M'][$k] += $resultM;
|
$sommes[$code]['M'][$k] += $resultM;
|
||||||
|
if ($simple_report == 'yes') {
|
||||||
print '<td align="right">' . price($resultM) . '</td>';
|
print '<td align="right">' . price($resultM) . '</td>';
|
||||||
}
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// If it's a calculated catgory
|
|
||||||
$p = $position + 1;
|
|
||||||
if(array_key_exists($p, $catsCalcule)){
|
|
||||||
$formula = $catsCalcule[$p]['formula'];
|
|
||||||
|
|
||||||
print "<tr class='liste_titre'>";
|
|
||||||
print '<td colspan="2">' . $catsCalcule[$p]['label'] . '</td>';
|
|
||||||
|
|
||||||
$vars = array();
|
|
||||||
|
|
||||||
// Previous Fiscal year (N-1)
|
|
||||||
foreach($sommes as $code => $det){
|
|
||||||
$vars[$code] = $det['NP'];
|
|
||||||
}
|
|
||||||
$result = strtr($formula, $vars);
|
|
||||||
eval( '$result = (' . $result . ');' );
|
|
||||||
print '<td align="right">' . price($result) . '</td>';
|
|
||||||
$code = $catsCalcule[$p]['code']; // code categorie de calcule
|
|
||||||
$sommes[$code]['NP'] += $result;
|
|
||||||
|
|
||||||
// Current fiscal year (N)
|
|
||||||
foreach($sommes as $code => $det){
|
|
||||||
$vars[$code] = $det['N'];
|
|
||||||
}
|
|
||||||
$result = strtr($formula, $vars);
|
|
||||||
eval( '$result = (' . $result . ');' );
|
|
||||||
print '<td align="right">' . price($result) . '</td>';
|
|
||||||
$sommes[$code]['N'] += $result;
|
|
||||||
|
|
||||||
// Detail by month
|
|
||||||
foreach($months as $k => $v){
|
|
||||||
foreach($sommes as $code => $det){
|
|
||||||
$vars[$code] = $det['M'][$k];
|
|
||||||
}
|
}
|
||||||
$result = strtr($formula, $vars);
|
|
||||||
eval( '$result = (' . $result . ');' );
|
|
||||||
print '<td align="right">' . price($result) . '</td>';
|
|
||||||
$sommes[$code]['M'][$k] += $result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//print '<td colspan="15">' . $catsCalcule[$p]['formula'] . '</td>';
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
unset($catsCalcule[$p]); // j'élimine la catégorie calculée après affichage
|
|
||||||
}
|
}
|
||||||
$j++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Others calculed category
|
|
||||||
foreach($catsCalcule as $p => $catc)
|
|
||||||
{
|
|
||||||
$formula = $catsCalcule[$p]['formula'];
|
|
||||||
|
|
||||||
print "<tr class='liste_titre'>";
|
|
||||||
print '<td colspan="2">' . $catsCalcule[$p]['label'] . '</td>';
|
|
||||||
|
|
||||||
$vars = array();
|
|
||||||
|
|
||||||
// Previous Fiscal year (N-1)
|
|
||||||
foreach($sommes as $code => $det){
|
|
||||||
$vars[$code] = $det['NP'];
|
|
||||||
}
|
|
||||||
$result = strtr($formula, $vars);
|
|
||||||
eval( '$result = (' . $result . ');' );
|
|
||||||
print '<td align="right">' . price($result) . '</td>';
|
|
||||||
$code = $catsCalcule[$p]['code']; // code categorie de calcule
|
|
||||||
$sommes[$code]['NP'] += $result;
|
|
||||||
|
|
||||||
// Current fiscal year (N)
|
|
||||||
foreach($sommes as $code => $det){
|
|
||||||
$vars[$code] = $det['N'];
|
|
||||||
}
|
|
||||||
$result = strtr($formula, $vars);
|
|
||||||
eval( '$result = (' . $result . ');' );
|
|
||||||
print '<td align="right">' . price($result) . '</td>';
|
|
||||||
$sommes[$code]['N'] += $result;
|
|
||||||
|
|
||||||
// Detail by month
|
|
||||||
foreach($months as $k => $v){
|
|
||||||
foreach($sommes as $code => $det){
|
|
||||||
$vars[$code] = $det['M'][$k];
|
|
||||||
}
|
|
||||||
$result = strtr($formula, $vars);
|
|
||||||
eval( '$result = (' . $result . ');' );
|
|
||||||
print '<td align="right">' . price($result) . '</td>';
|
|
||||||
$sommes[$code]['M'][$k] += $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//print '<td colspan="15">' . $catsCalcule[$p]['formula'] . '</td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -21,12 +21,13 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/supplier/index.php
|
* \file htdocs/accountancy/supplier/index.php
|
||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Home supplier ventilation
|
* \brief Home supplier journalization page
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
@ -55,7 +56,7 @@ if ($year == 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate History
|
// Validate History
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'aZ09');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -69,7 +70,7 @@ if ($action == 'validatehistory') {
|
|||||||
|
|
||||||
// First clean corrupted data
|
// First clean corrupted data
|
||||||
$sqlclean = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
$sqlclean = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||||
$sqlclean .= " SET fd.fk_code_ventilation = 0";
|
$sqlclean .= " SET fk_code_ventilation = 0";
|
||||||
$sqlclean .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
$sqlclean .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||||
$sqlclean .= ' (SELECT accnt.rowid ';
|
$sqlclean .= ' (SELECT accnt.rowid ';
|
||||||
$sqlclean .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
$sqlclean .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||||
@ -87,12 +88,14 @@ if ($action == 'validatehistory') {
|
|||||||
$sql1 .= " AND " . MAIN_DB_PREFIX . "facture_fourn_det.fk_code_ventilation = 0";
|
$sql1 .= " AND " . MAIN_DB_PREFIX . "facture_fourn_det.fk_code_ventilation = 0";
|
||||||
} else {
|
} 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 = "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 fd.fk_code_ventilation = accnt.rowid";
|
$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=" . $conf->global->CHARTOFACCOUNTS;
|
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS;
|
||||||
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
|
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
|
||||||
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dol_syslog('htdocs/accountancy/supplier/index.php');
|
||||||
|
|
||||||
$resql1 = $db->query($sql1);
|
$resql1 = $db->query($sql1);
|
||||||
if (! $resql1) {
|
if (! $resql1) {
|
||||||
$error ++;
|
$error ++;
|
||||||
@ -107,7 +110,7 @@ if ($action == 'validatehistory') {
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
||||||
$sql1 .= " SET fd.fk_code_ventilation = 0";
|
$sql1 .= " SET fk_code_ventilation = 0";
|
||||||
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||||
$sql1 .= ' (SELECT accnt.rowid ';
|
$sql1 .= ' (SELECT accnt.rowid ';
|
||||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||||
@ -130,7 +133,7 @@ if ($action == 'validatehistory') {
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
||||||
$sql1.= " SET fd.fk_code_ventilation = 0";
|
$sql1.= " SET fk_code_ventilation = 0";
|
||||||
$sql1.= " WHERE fd.fk_facture_fourn IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
$sql1.= " WHERE fd.fk_facture_fourn IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||||
$sql1.= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
|
$sql1.= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
|
||||||
$sql1.= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
|
$sql1.= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
|
||||||
@ -159,33 +162,28 @@ llxHeader('', $langs->trans("SuppliersVentilation"));
|
|||||||
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
|
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
|
||||||
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
|
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
|
print load_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
|
||||||
|
|
||||||
print $langs->trans("DescVentilSupplier") . '<br>';
|
print $langs->trans("DescVentilSupplier") . '<br>';
|
||||||
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
//print '<div class="inline-block divButAction">';
|
//print '<div class="inline-block divButAction">';
|
||||||
// TODO Remove this. Should be done always.
|
// TODO Remove this. Should be done always or into the repair.php script.
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
||||||
//print '</div>';
|
//print '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
$y = $year_current;
|
||||||
|
|
||||||
$buttonbind = '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
|
$buttonbind = '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
|
||||||
$buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
|
$buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$y = $year_current;
|
|
||||||
|
|
||||||
$var = true;
|
|
||||||
|
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="200" align="left">' . $langs->trans("Account") . '</td>';
|
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||||
@ -197,7 +195,7 @@ $sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'",
|
|||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
$sql .= " ROUND(SUM(ffd.total_ht),2) as total";
|
$sql .= " SUM(ffd.total_ht) as total";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
|
||||||
@ -208,7 +206,7 @@ $sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We d
|
|||||||
$sql .= " AND aa.account_number IS NULL";
|
$sql .= " AND aa.account_number IS NULL";
|
||||||
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
|
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
|
||||||
|
|
||||||
dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql);
|
dol_syslog('htdocs/accountancy/supplier/index.php');
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
@ -239,7 +237,7 @@ print '<br>';
|
|||||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="200" align="left">' . $langs->trans("Account") . '</td>';
|
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||||
@ -251,7 +249,7 @@ $sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'",
|
|||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
$sql .= " ROUND(SUM(ffd.total_ht),2) as total";
|
$sql .= " SUM(ffd.total_ht) as total";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
|
||||||
@ -262,7 +260,7 @@ $sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We d
|
|||||||
$sql .= " AND aa.account_number IS NOT NULL";
|
$sql .= " AND aa.account_number IS NOT NULL";
|
||||||
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
|
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
|
||||||
|
|
||||||
dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql);
|
dol_syslog('htdocs/accountancy/supplier/index.php');
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
@ -306,7 +304,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
$sql .= " ROUND(SUM(ffd.total_ht),2) as total";
|
$sql .= " SUM(ffd.total_ht) as total";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
||||||
$sql .= " WHERE ff.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
$sql .= " WHERE ff.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||||
@ -314,7 +312,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
$sql .= " AND ff.fk_statut > 0 ";
|
$sql .= " AND ff.fk_statut > 0 ";
|
||||||
$sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||||
|
|
||||||
dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql);
|
dol_syslog('htdocs/accountancy/supplier/index.php');
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
@ -52,6 +52,8 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
|||||||
$search_amount = GETPOST('search_amount', 'alpha');
|
$search_amount = GETPOST('search_amount', 'alpha');
|
||||||
$search_account = GETPOST('search_account', 'alpha');
|
$search_account = GETPOST('search_account', 'alpha');
|
||||||
$search_vat = GETPOST('search_vat', 'alpha');
|
$search_vat = GETPOST('search_vat', 'alpha');
|
||||||
|
$search_country = GETPOST('search_country', 'alpha');
|
||||||
|
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||||
@ -94,6 +96,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
|||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
$search_account = '';
|
$search_account = '';
|
||||||
$search_vat = '';
|
$search_vat = '';
|
||||||
|
$search_country = '';
|
||||||
|
$search_tvaintra = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||||
@ -149,13 +153,15 @@ print '<script type="text/javascript">
|
|||||||
/*
|
/*
|
||||||
* Supplier Invoice lines
|
* Supplier Invoice lines
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT f.rowid as facid, f.ref as facnumber, f.ref_supplier, f.libelle as invoice_label, f.datef,";
|
$sql = "SELECT f.rowid as facid, f.ref as facnumber, f.ref_supplier, f.libelle as invoice_label, f.datef, f.fk_soc,";
|
||||||
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht , l.qty, l.tva_tx, aa.label, aa.account_number, ";
|
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht , l.qty, l.tva_tx, aa.label, aa.account_number, ";
|
||||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
|
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, co.label as country, s.tva_intra";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
||||||
$sql.= " , " . MAIN_DB_PREFIX . "accounting_account as aa";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||||
$sql.= " , " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = l.fk_code_ventilation";
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = l.fk_facture_fourn";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||||
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
||||||
$sql.= " WHERE f.rowid = l.fk_facture_fourn and f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 ";
|
$sql.= " WHERE f.rowid = l.fk_facture_fourn and f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 ";
|
||||||
$sql.= " AND aa.rowid = l.fk_code_ventilation";
|
$sql.= " AND aa.rowid = l.fk_code_ventilation";
|
||||||
if ($search_lineid) {
|
if ($search_lineid) {
|
||||||
@ -182,6 +188,12 @@ if (strlen(trim($search_account))) {
|
|||||||
if (strlen(trim($search_vat))) {
|
if (strlen(trim($search_vat))) {
|
||||||
$sql .= natural_search("l.tva_tx", $search_vat, 1);
|
$sql .= natural_search("l.tva_tx", $search_vat, 1);
|
||||||
}
|
}
|
||||||
|
if (strlen(trim($search_country))) {
|
||||||
|
$sql .= " AND (co.label like'" . $search_country . "%')";
|
||||||
|
}
|
||||||
|
if (strlen(trim($search_tvaintra))) {
|
||||||
|
$sql .= " AND (s.tva_intra like'" . $search_tvaintra . "%')";
|
||||||
|
}
|
||||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||||
|
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
@ -256,6 +268,8 @@ if ($result) {
|
|||||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||||
print '<td class="liste_titre" align="center"><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" align="center"><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 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"><input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '"></td>';
|
||||||
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tavintra" value="' . dol_escape_htmltag($search_tavintra) . '"></td>';
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
$searchpicto=$form->showFilterButtons();
|
$searchpicto=$form->showFilterButtons();
|
||||||
print $searchpicto;
|
print $searchpicto;
|
||||||
@ -273,6 +287,8 @@ if ($result) {
|
|||||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
$checkpicto=$form->showCheckAddButtons();
|
$checkpicto=$form->showCheckAddButtons();
|
||||||
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -315,7 +331,7 @@ if ($result) {
|
|||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
||||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||||
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
|
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
@ -325,7 +341,8 @@ if ($result) {
|
|||||||
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
|
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a></td>';
|
print '</a></td>';
|
||||||
|
print '<td align="right">' . $objp->country .'</td>';
|
||||||
|
print '<td align="center">' . $objp->tva_intra . '</td>';
|
||||||
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="' . $objp->rowid . '"/></td>';
|
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="' . $objp->rowid . '"/></td>';
|
||||||
|
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
|
||||||
@ -381,7 +381,7 @@ if ($result) {
|
|||||||
// Description
|
// Description
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
||||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||||
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
|
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
|||||||
@ -274,7 +274,6 @@ class MembersTypes extends DolibarrApi
|
|||||||
unset($object->cotisation);
|
unset($object->cotisation);
|
||||||
unset($object->libelle);
|
unset($object->libelle);
|
||||||
|
|
||||||
unset($object->import_key);
|
|
||||||
unset($object->array_options);
|
unset($object->array_options);
|
||||||
unset($object->linkedObjectsIds);
|
unset($object->linkedObjectsIds);
|
||||||
unset($object->context);
|
unset($object->context);
|
||||||
|
|||||||
@ -52,7 +52,7 @@ $result=restrictedArea($user,'adherent',$id);
|
|||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if ($page == -1) { $page = 0 ; }
|
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||||
$offset = $conf->liste_limit * $page ;
|
$offset = $conf->liste_limit * $page ;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|||||||
@ -609,7 +609,9 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||||
{
|
{
|
||||||
$align=$extrafields->getAlignFlag($key);
|
$align=$extrafields->getAlignFlag($key);
|
||||||
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
$sortonfield = "ef.".$key;
|
||||||
|
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
|
||||||
|
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,7 +101,7 @@ else
|
|||||||
|
|
||||||
$head = member_stats_prepare_head($adh);
|
$head = member_stats_prepare_head($adh);
|
||||||
|
|
||||||
dol_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), 0, 'user');
|
dol_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), -1, 'user');
|
||||||
|
|
||||||
|
|
||||||
// Print title
|
// Print title
|
||||||
|
|||||||
@ -198,7 +198,7 @@ if ($mode)
|
|||||||
|
|
||||||
$head = member_stats_prepare_head($adh);
|
$head = member_stats_prepare_head($adh);
|
||||||
|
|
||||||
dol_fiche_head($head, $tab, $langs->trans("Statistics"), 0, 'user');
|
dol_fiche_head($head, $tab, $langs->trans("Statistics"), -1, 'user');
|
||||||
|
|
||||||
|
|
||||||
// Print title
|
// Print title
|
||||||
|
|||||||
@ -46,7 +46,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
|||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if ($page == -1) { $page = 0 ; }
|
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||||
$offset = $limit * $page ;
|
$offset = $limit * $page ;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|||||||
@ -33,6 +33,7 @@ if (!$user->admin)
|
|||||||
|
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
|
$langs->load("agenda");
|
||||||
|
|
||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$cancel = GETPOST('cancel','alpha');
|
$cancel = GETPOST('cancel','alpha');
|
||||||
|
|||||||
@ -36,6 +36,7 @@ if (!$user->admin)
|
|||||||
|
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
|
$langs->load("agenda");
|
||||||
|
|
||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$value = GETPOST('value','alpha');
|
$value = GETPOST('value','alpha');
|
||||||
|
|||||||
@ -174,8 +174,8 @@ $message.='<br>';
|
|||||||
print $message;
|
print $message;
|
||||||
|
|
||||||
$message=$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'<br>';
|
$message=$langs->trans("AgendaUrlOptions1",$user->login,$user->login).'<br>';
|
||||||
//$message.=$langs->trans("AgendaUrlOptions2",$user->login,$user->login).'<br>';
|
|
||||||
$message.=$langs->trans("AgendaUrlOptions3",$user->login,$user->login).'<br>';
|
$message.=$langs->trans("AgendaUrlOptions3",$user->login,$user->login).'<br>';
|
||||||
|
$message.=$langs->trans("AgendaUrlOptionsNotAdmin",$user->login,$user->login).'<br>';
|
||||||
$message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>';
|
$message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>';
|
||||||
$message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login);
|
$message.=$langs->trans("AgendaUrlOptionsProject",$user->login,$user->login);
|
||||||
|
|
||||||
|
|||||||
@ -274,7 +274,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
|
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes');
|
||||||
print $doleditor->Create();
|
print $doleditor->Create();
|
||||||
}
|
}
|
||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
|
|||||||
@ -559,7 +559,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
|
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes');
|
||||||
print $doleditor->Create();
|
print $doleditor->Create();
|
||||||
}
|
}
|
||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
|
|||||||
@ -493,7 +493,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
|
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes');
|
||||||
print $doleditor->Create();
|
print $doleditor->Create();
|
||||||
}
|
}
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -60,6 +61,9 @@ $urlpage = GETPOST('urlpage');
|
|||||||
$key = GETPOST('key');
|
$key = GETPOST('key');
|
||||||
$value = GETPOST('value');
|
$value = GETPOST('value');
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
|
$hookmanager->initHooks(array('admindefaultvalues','globaladmin'));
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
|
|||||||
@ -165,7 +165,7 @@ if ($action == 'edit')
|
|||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
foreach($modules as $module => $delays)
|
foreach($modules as $module => $delays)
|
||||||
{
|
{
|
||||||
@ -178,7 +178,7 @@ if ($action == 'edit')
|
|||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td width="20px">'.img_object('',$delay['img']).'</td>';
|
print '<td width="20px">'.img_object('',$delay['img']).'</td>';
|
||||||
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td><td>';
|
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td><td>';
|
||||||
print '<input size="5" name="'.$delay['code'].'" value="'.$value.'"> '.$langs->trans("days").'</td></tr>';
|
print '<input class="right maxwidth75" type="number" name="'.$delay['code'].'" value="'.$value.'"> '.$langs->trans("days").'</td></tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -189,11 +189,11 @@ if ($action == 'edit')
|
|||||||
|
|
||||||
// Show if meteo is enabled
|
// Show if meteo is enabled
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
$var=false;
|
$var=false;
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td>' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '</td></tr>';
|
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ else
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
foreach($modules as $module => $delays)
|
foreach($modules as $module => $delays)
|
||||||
@ -225,7 +225,7 @@ else
|
|||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td width="20px">'.img_object('',$delay['img']).'</td>';
|
print '<td width="20px">'.img_object('',$delay['img']).'</td>';
|
||||||
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td>';
|
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td>';
|
||||||
print '<td>'.$value.' '.$langs->trans("days").'</td></tr>';
|
print '<td class="right">'.$value.' '.$langs->trans("days").'</td></tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -236,11 +236,11 @@ else
|
|||||||
|
|
||||||
// Show if meteo is enabled
|
// Show if meteo is enabled
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
$var=false;
|
$var=false;
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td>' . yn($conf->global->MAIN_DISABLE_METEO) . '</td></tr>';
|
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">' . yn($conf->global->MAIN_DISABLE_METEO) . '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|||||||
@ -54,6 +54,7 @@ $action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
|||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
$id=GETPOST('id','int');
|
$id=GETPOST('id','int');
|
||||||
$rowid=GETPOST('rowid','alpha');
|
$rowid=GETPOST('rowid','alpha');
|
||||||
|
$code=GETPOST('code','alpha');
|
||||||
|
|
||||||
$allowed=$user->admin;
|
$allowed=$user->admin;
|
||||||
if ($id == 7 && ! empty($user->rights->accounting->chartofaccount)) $allowed=1; // Tax page allowed to manager of chart account
|
if ($id == 7 && ! empty($user->rights->accounting->chartofaccount)) $allowed=1; // Tax page allowed to manager of chart account
|
||||||
@ -72,7 +73,7 @@ $active = 1;
|
|||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if ($page == -1) { $page = 0 ; }
|
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||||
$offset = $listlimit * $page ;
|
$offset = $listlimit * $page ;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
@ -836,8 +837,8 @@ if ($action == $acts[0])
|
|||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
}
|
||||||
elseif ($_GET["code"]) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($_GET["code"])."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -856,8 +857,8 @@ if ($action == $acts[1])
|
|||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
}
|
||||||
elseif ($_GET["code"]) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($_GET["code"])."'";
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -876,8 +877,8 @@ if ($action == 'activate_favorite')
|
|||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
}
|
||||||
elseif ($_GET["code"]) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($_GET["code"])."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -896,8 +897,8 @@ if ($action == 'disable_favorite')
|
|||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
}
|
||||||
elseif ($_GET["code"]) {
|
elseif ($code) {
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($_GET["code"])."'";
|
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -958,7 +959,7 @@ if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
|
|||||||
// Confirmation de la suppression de la ligne
|
// Confirmation de la suppression de la ligne
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'rowid='.$rowid.'&code='.urlencode($_GET["code"]).$paramwithsearch, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'rowid='.$rowid.'&code='.urlencode($code).$paramwithsearch, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
||||||
}
|
}
|
||||||
//var_dump($elementList);
|
//var_dump($elementList);
|
||||||
|
|
||||||
@ -1544,9 +1545,12 @@ if ($id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$class='tddict';
|
$class='tddict';
|
||||||
|
if ($fieldlist[$field] == 'note' && $id == 10) $class.=' tdoverflowmax200';
|
||||||
if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto';
|
if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto';
|
||||||
if ($fieldlist[$field] == 'code') $class.=' width100';
|
if ($fieldlist[$field] == 'code') $class.=' width100';
|
||||||
if ($fieldlist[$field] == 'position') $class.=' right';
|
if ($fieldlist[$field] == 'position') $class.=' right';
|
||||||
|
if ($fieldlist[$field] == 'localtax1_type') $class.=' nowrap';
|
||||||
|
if ($fieldlist[$field] == 'localtax2_type') $class.=' nowrap';
|
||||||
// Show value for field
|
// Show value for field
|
||||||
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
||||||
}
|
}
|
||||||
@ -1736,7 +1740,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
|||||||
} // For state page, we do not show the country input (we link to region, not country)
|
} // For state page, we do not show the country input (we link to region, not country)
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$fieldname='country';
|
$fieldname='country';
|
||||||
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28, 'maxwidth150 maxwidthonsmartphone');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
elseif ($fieldlist[$field] == 'country_id')
|
elseif ($fieldlist[$field] == 'country_id')
|
||||||
@ -1862,7 +1866,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
|||||||
{
|
{
|
||||||
$fieldname = $fieldlist[$field];
|
$fieldname = $fieldlist[$field];
|
||||||
$accountancy_account = (! empty($obj->$fieldname) ? $obj->$fieldname : 0);
|
$accountancy_account = (! empty($obj->$fieldname) ? $obj->$fieldname : 0);
|
||||||
print $formaccounting->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone');
|
print $formaccounting->select_account($accountancy_account, '.'.$fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -493,7 +493,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
|
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes');
|
||||||
print $doleditor->Create();
|
print $doleditor->Create();
|
||||||
}
|
}
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|||||||
@ -497,7 +497,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
|
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes');
|
||||||
print $doleditor->Create();
|
print $doleditor->Create();
|
||||||
}
|
}
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|||||||
@ -731,7 +731,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
|
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes');
|
||||||
print $doleditor->Create();
|
print $doleditor->Create();
|
||||||
}
|
}
|
||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
|
|||||||
@ -525,7 +525,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
|
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes');
|
||||||
print $doleditor->Create();
|
print $doleditor->Create();
|
||||||
}
|
}
|
||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
@ -559,6 +559,7 @@ print '/>';
|
|||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
print '</form>';
|
||||||
// Use services duration
|
// Use services duration
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
|
|||||||
@ -70,13 +70,13 @@ if (! empty($conf->global->MAIN_MOTD_SETUPPAGE))
|
|||||||
|
|
||||||
print $langs->trans("SetupDescription1").' ';
|
print $langs->trans("SetupDescription1").' ';
|
||||||
print $langs->trans("AreaForAdminOnly").' ';
|
print $langs->trans("AreaForAdminOnly").' ';
|
||||||
print $langs->trans("SetupDescription2")."<br><br>";
|
print $langs->trans("SetupDescription2", $langs->trans("MenuCompanySetup"), $langs->trans("Modules"))."<br><br>";
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
// Show info setup company
|
// Show info setup company
|
||||||
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1;
|
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1;
|
||||||
print img_picto('','puce').' '.$langs->trans("SetupDescription3",DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit'));
|
print img_picto('','puce').' '.$langs->trans("SetupDescription3", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit'), $langs->trans("Setup"), $langs->trans("MenuCompanySetup"));
|
||||||
if (! empty($setupcompanynotcomplete))
|
if (! empty($setupcompanynotcomplete))
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
@ -88,7 +88,7 @@ print '<br>';
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
// Show info setup module
|
// Show info setup module
|
||||||
print img_picto('','puce').' '.$langs->trans("SetupDescription4",DOL_URL_ROOT.'/admin/modules.php?mainmenu=home');
|
print img_picto('','puce').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->trans("Setup"), $langs->trans("Modules"));
|
||||||
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled
|
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
|
|||||||
@ -474,7 +474,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
|
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes');
|
||||||
print $doleditor->Create();
|
print $doleditor->Create();
|
||||||
}
|
}
|
||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
|
|||||||
@ -50,6 +50,7 @@ $action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
|||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
$id=GETPOST('id','int');
|
$id=GETPOST('id','int');
|
||||||
$rowid=GETPOST('rowid','alpha');
|
$rowid=GETPOST('rowid','alpha');
|
||||||
|
$search_label=GETPOST('search_label','alpha');
|
||||||
|
|
||||||
$allowed=$user->admin;
|
$allowed=$user->admin;
|
||||||
if (! $allowed) accessforbidden();
|
if (! $allowed) accessforbidden();
|
||||||
@ -66,7 +67,7 @@ $active = 1;
|
|||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if ($page == -1) { $page = 0 ; }
|
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||||
$offset = $listlimit * $page ;
|
$offset = $listlimit * $page ;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
@ -78,10 +79,6 @@ $hookmanager->initHooks(array('emailtemplates'));
|
|||||||
$tabname=array();
|
$tabname=array();
|
||||||
$tabname[25]= MAIN_DB_PREFIX."c_email_templates";
|
$tabname[25]= MAIN_DB_PREFIX."c_email_templates";
|
||||||
|
|
||||||
// Requests to extract data
|
|
||||||
$tabsql=array();
|
|
||||||
$tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content_lines, content, active FROM ".MAIN_DB_PREFIX."c_email_templates WHERE entity IN (".getEntity('email_template').")";
|
|
||||||
|
|
||||||
// Criteria to sort dictionaries
|
// Criteria to sort dictionaries
|
||||||
$tabsqlsort=array();
|
$tabsqlsort=array();
|
||||||
$tabsqlsort[25]="label ASC";
|
$tabsqlsort[25]="label ASC";
|
||||||
@ -173,211 +170,223 @@ $id = 25;
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('button_removefilter') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter_x'))
|
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||||
{
|
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
//$search_country_id = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Actions add or modify an entry into a dictionary
|
$parameters=array();
|
||||||
if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
$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');
|
||||||
$listfield=explode(',', str_replace(' ', '',$tabfield[$id]));
|
|
||||||
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
|
|
||||||
$listfieldmodify=explode(',',$tabfieldinsert[$id]);
|
|
||||||
$listfieldvalue=explode(',',$tabfieldvalue[$id]);
|
|
||||||
|
|
||||||
// Check that all fields are filled
|
if (empty($reshook))
|
||||||
$ok=1;
|
{
|
||||||
foreach ($listfield as $f => $value)
|
// Purge search criteria
|
||||||
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
if ($value == 'content') continue;
|
$search_label='';
|
||||||
if ($value == 'content_lines') continue;
|
$toselect='';
|
||||||
if ($value == 'content') $value='content-'.$rowid;
|
$search_array_options=array();
|
||||||
if ($value == 'content_lines') $value='content_lines-'.$rowid;
|
|
||||||
|
|
||||||
if (! isset($_POST[$value]) || $_POST[$value]=='')
|
|
||||||
{
|
|
||||||
$ok=0;
|
|
||||||
$fieldnamekey=$listfield[$f];
|
|
||||||
// We take translate key of field
|
|
||||||
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
|
|
||||||
if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
|
|
||||||
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
|
|
||||||
if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
|
|
||||||
if ($fieldnamekey == 'type') $fieldnamekey = 'Type';
|
|
||||||
|
|
||||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si verif ok et action add, on ajoute la ligne
|
// Actions add or modify an entry into a dictionary
|
||||||
if ($ok && GETPOST('actionadd'))
|
if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id])
|
$listfield=explode(',', str_replace(' ', '',$tabfield[$id]));
|
||||||
|
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
|
||||||
|
$listfieldmodify=explode(',',$tabfieldinsert[$id]);
|
||||||
|
$listfieldvalue=explode(',',$tabfieldvalue[$id]);
|
||||||
|
|
||||||
|
// Check that all fields are filled
|
||||||
|
$ok=1;
|
||||||
|
foreach ($listfield as $f => $value)
|
||||||
{
|
{
|
||||||
// Recupere id libre pour insertion
|
if ($value == 'content') continue;
|
||||||
$newid=0;
|
if ($value == 'content_lines') continue;
|
||||||
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
|
if ($value == 'content') $value='content-'.$rowid;
|
||||||
$result = $db->query($sql);
|
if ($value == 'content_lines') $value='content_lines-'.$rowid;
|
||||||
if ($result)
|
|
||||||
|
if (! isset($_POST[$value]) || $_POST[$value]=='')
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$ok=0;
|
||||||
$newid=($obj->newid + 1);
|
$fieldnamekey=$listfield[$f];
|
||||||
|
// We take translate key of field
|
||||||
|
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
|
||||||
|
if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
|
||||||
|
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
|
||||||
|
if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
|
||||||
|
if ($fieldnamekey == 'type') $fieldnamekey = 'Type';
|
||||||
|
|
||||||
} else {
|
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||||
dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add new entry
|
// Si verif ok et action add, on ajoute la ligne
|
||||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
if ($ok && GETPOST('actionadd'))
|
||||||
// List of fields
|
{
|
||||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
if ($tabrowid[$id])
|
||||||
$sql.= $tabrowid[$id].",";
|
{
|
||||||
$sql.= $tabfieldinsert[$id];
|
// Recupere id libre pour insertion
|
||||||
$sql.=",active)";
|
$newid=0;
|
||||||
$sql.= " VALUES(";
|
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
|
||||||
|
$result = $db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($result);
|
||||||
|
$newid=($obj->newid + 1);
|
||||||
|
|
||||||
// List of values
|
} else {
|
||||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
dol_print_error($db);
|
||||||
$sql.= $newid.",";
|
}
|
||||||
$i=0;
|
|
||||||
foreach ($listfieldinsert as $f => $value)
|
|
||||||
{
|
|
||||||
//var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value);
|
|
||||||
if ($value == 'entity') {
|
|
||||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
|
||||||
}
|
}
|
||||||
if ($i) $sql.=",";
|
|
||||||
if ($value == 'private' && ! is_numeric($_POST[$listfieldvalue[$i]])) $_POST[$listfieldvalue[$i]]='0';
|
|
||||||
if ($value == 'position' && ! is_numeric($_POST[$listfieldvalue[$i]])) $_POST[$listfieldvalue[$i]]='1';
|
|
||||||
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = ''
|
|
||||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
$sql.=",1)";
|
|
||||||
|
|
||||||
dol_syslog("actionadd", LOG_DEBUG);
|
// Add new entry
|
||||||
$result = $db->query($sql);
|
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||||
if ($result) // Add is ok
|
// List of fields
|
||||||
{
|
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
||||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
$sql.= $tabrowid[$id].",";
|
||||||
$_POST=array('id'=>$id); // Clean $_POST array, we keep only
|
$sql.= $tabfieldinsert[$id];
|
||||||
}
|
$sql.=",active)";
|
||||||
else
|
$sql.= " VALUES(";
|
||||||
{
|
|
||||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
// List of values
|
||||||
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
|
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
||||||
|
$sql.= $newid.",";
|
||||||
|
$i=0;
|
||||||
|
foreach ($listfieldinsert as $f => $value)
|
||||||
|
{
|
||||||
|
//var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value);
|
||||||
|
if ($value == 'entity') {
|
||||||
|
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||||
|
}
|
||||||
|
if ($i) $sql.=",";
|
||||||
|
if ($value == 'private' && ! is_numeric($_POST[$listfieldvalue[$i]])) $_POST[$listfieldvalue[$i]]='0';
|
||||||
|
if ($value == 'position' && ! is_numeric($_POST[$listfieldvalue[$i]])) $_POST[$listfieldvalue[$i]]='1';
|
||||||
|
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = ''
|
||||||
|
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
else {
|
$sql.=",1)";
|
||||||
dol_print_error($db);
|
|
||||||
|
dol_syslog("actionadd", LOG_DEBUG);
|
||||||
|
$result = $db->query($sql);
|
||||||
|
if ($result) // Add is ok
|
||||||
|
{
|
||||||
|
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||||
|
$_POST=array('id'=>$id); // Clean $_POST array, we keep only
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||||
|
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Si verif ok et action modify, on modifie la ligne
|
||||||
|
if ($ok && GETPOST('actionmodify'))
|
||||||
|
{
|
||||||
|
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||||
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
|
// Modify entry
|
||||||
|
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||||
|
// Modifie valeur des champs
|
||||||
|
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldmodify))
|
||||||
|
{
|
||||||
|
$sql.= $tabrowid[$id]."=";
|
||||||
|
$sql.= "'".$db->escape($rowid)."', ";
|
||||||
|
}
|
||||||
|
$i = 0;
|
||||||
|
foreach ($listfieldmodify as $field)
|
||||||
|
{
|
||||||
|
if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid];
|
||||||
|
if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid];
|
||||||
|
if ($field == 'entity') {
|
||||||
|
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||||
|
}
|
||||||
|
if ($i) $sql.=",";
|
||||||
|
$sql.= $field."=";
|
||||||
|
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = ''
|
||||||
|
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
||||||
|
|
||||||
|
dol_syslog("actionmodify", LOG_DEBUG);
|
||||||
|
//print $sql;
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if (! $resql)
|
||||||
|
{
|
||||||
|
setEventMessages($db->error(), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si verif ok et action modify, on modifie la ligne
|
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||||
if ($ok && GETPOST('actionmodify'))
|
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
// Modify entry
|
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
|
||||||
// Modifie valeur des champs
|
|
||||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldmodify))
|
|
||||||
{
|
|
||||||
$sql.= $tabrowid[$id]."=";
|
|
||||||
$sql.= "'".$db->escape($rowid)."', ";
|
|
||||||
}
|
|
||||||
$i = 0;
|
|
||||||
foreach ($listfieldmodify as $field)
|
|
||||||
{
|
|
||||||
if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid];
|
|
||||||
if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid];
|
|
||||||
if ($field == 'entity') {
|
|
||||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
|
||||||
}
|
|
||||||
if ($i) $sql.=",";
|
|
||||||
$sql.= $field."=";
|
|
||||||
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = ''
|
|
||||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
|
||||||
|
|
||||||
dol_syslog("actionmodify", LOG_DEBUG);
|
dol_syslog("delete", LOG_DEBUG);
|
||||||
//print $sql;
|
$result = $db->query($sql);
|
||||||
$resql = $db->query($sql);
|
if (! $result)
|
||||||
if (! $resql)
|
|
||||||
{
|
{
|
||||||
setEventMessages($db->error(), null, 'errors');
|
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
||||||
|
{
|
||||||
|
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
// activate
|
||||||
{
|
if ($action == $acts[0])
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
|
||||||
else { $rowidcol="rowid"; }
|
|
||||||
|
|
||||||
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
|
|
||||||
|
|
||||||
dol_syslog("delete", LOG_DEBUG);
|
|
||||||
$result = $db->query($sql);
|
|
||||||
if (! $result)
|
|
||||||
{
|
{
|
||||||
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||||
{
|
else { $rowidcol="rowid"; }
|
||||||
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
|
|
||||||
|
if ($rowid) {
|
||||||
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
}
|
}
|
||||||
else
|
elseif ($code) {
|
||||||
|
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'";
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $db->query($sql);
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// disable
|
||||||
|
if ($action == $acts[1])
|
||||||
|
{
|
||||||
|
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||||
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
|
if ($rowid) {
|
||||||
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||||
|
}
|
||||||
|
elseif ($code) {
|
||||||
|
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'";
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $db->query($sql);
|
||||||
|
if (!$result)
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// activate
|
|
||||||
if ($action == $acts[0])
|
|
||||||
{
|
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
|
||||||
else { $rowidcol="rowid"; }
|
|
||||||
|
|
||||||
if ($rowid) {
|
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
|
||||||
}
|
|
||||||
elseif ($_GET["code"]) {
|
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$_GET["code"]."'";
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
|
||||||
if (!$result)
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// disable
|
|
||||||
if ($action == $acts[1])
|
|
||||||
{
|
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
|
||||||
else { $rowidcol="rowid"; }
|
|
||||||
|
|
||||||
if ($rowid) {
|
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
|
||||||
}
|
|
||||||
elseif ($_GET["code"]) {
|
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$_GET["code"]."'";
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
|
||||||
if (!$result)
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -412,12 +421,15 @@ dol_fiche_head($head, 'templates', '', -1);
|
|||||||
// Confirmation de la suppression de la ligne
|
// Confirmation de la suppression de la ligne
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$_GET["code"].'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
||||||
}
|
}
|
||||||
//var_dump($elementList);
|
//var_dump($elementList);
|
||||||
|
|
||||||
// Complete requete recherche valeurs avec critere de tri
|
|
||||||
$sql=$tabsql[$id];
|
$sql="SELECT rowid as rowid, label, type_template, private, position, topic, content_lines, content, active";
|
||||||
|
$sql.=" FROM ".MAIN_DB_PREFIX."c_email_templates";
|
||||||
|
$sql.=" WHERE entity IN (".getEntity('email_template').")";
|
||||||
|
if ($search_label) $sql.=natural_search('label', $search_label);
|
||||||
|
|
||||||
if ($search_country_id > 0)
|
if ($search_country_id > 0)
|
||||||
{
|
{
|
||||||
@ -572,9 +584,19 @@ if ($action != 'edit')
|
|||||||
|
|
||||||
|
|
||||||
$colspan=count($fieldlist)+1;
|
$colspan=count($fieldlist)+1;
|
||||||
print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
//print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
// List of available record in database
|
// List of available record in database
|
||||||
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
|
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
|
||||||
@ -599,8 +621,26 @@ if ($resql)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Title line with search boxes
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
$filterfound=0;
|
||||||
|
foreach ($fieldlist as $field => $value)
|
||||||
|
{
|
||||||
|
if ($value == 'label') print '<td class="liste_titre"><input type="text" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||||
|
elseif (! in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>';
|
||||||
|
}
|
||||||
|
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>';
|
||||||
|
print '<td class="liste_titre"></td>';
|
||||||
|
// Action column
|
||||||
|
print '<td class="liste_titre" align="right">';
|
||||||
|
$searchpicto=$form->showFilterButtons();
|
||||||
|
print $searchpicto;
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Title of lines
|
// Title of lines
|
||||||
print '<tr class="liste_titre'.($action != 'edit' ? ' liste_titre_add' : '').'">';
|
print '<tr class="liste_titre">';
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
// Determine le nom du champ par rapport aux noms possibles
|
// Determine le nom du champ par rapport aux noms possibles
|
||||||
@ -642,18 +682,6 @@ if ($resql)
|
|||||||
print getTitleFieldOfList('');
|
print getTitleFieldOfList('');
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Title line with search boxes
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
$filterfound=0;
|
|
||||||
foreach ($fieldlist as $field => $value)
|
|
||||||
{
|
|
||||||
if (! in_array($field, array('content', 'content_lines'))) print '<td class="liste_titre"></td>';
|
|
||||||
}
|
|
||||||
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>';
|
|
||||||
print '<td class="liste_titre"></td>';
|
|
||||||
print '<td class="liste_titre"></td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
// Lines with values
|
// Lines with values
|
||||||
|
|||||||
@ -313,6 +313,7 @@ if ($conf->use_javascript_ajax)
|
|||||||
{
|
{
|
||||||
if (! empty($menu['langs'])) $langs->load($menu['langs']);
|
if (! empty($menu['langs'])) $langs->load($menu['langs']);
|
||||||
$titre = $langs->trans($menu['titre']);
|
$titre = $langs->trans($menu['titre']);
|
||||||
|
|
||||||
$data[] = array(
|
$data[] = array(
|
||||||
'rowid'=>$menu['rowid'],
|
'rowid'=>$menu['rowid'],
|
||||||
'module'=>$menu['module'],
|
'module'=>$menu['module'],
|
||||||
@ -329,8 +330,13 @@ if ($conf->use_javascript_ajax)
|
|||||||
'<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> '.
|
'<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> '.
|
||||||
'<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> '.
|
'<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> '.
|
||||||
' '.
|
' '.
|
||||||
'<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&menuId='.$menu['rowid'].'">'.img_picto("Monter","1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Descendre","1downarrow").'</a>'.
|
'<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&menuId='.$menu['rowid'].'">'.img_picto("Up","1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Down","1downarrow").'</a>'.
|
||||||
'</td></tr></table>'
|
'</td></tr></table>',
|
||||||
|
'buttons'=>'<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.img_edit('default',0,'class="menuEdit" id="edit'.$menu['rowid'].'"').'</a> '.
|
||||||
|
'<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> '.
|
||||||
|
'<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> '.
|
||||||
|
' '.
|
||||||
|
'<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&menuId='.$menu['rowid'].'">'.img_picto("Up","1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Down","1downarrow").'</a>'
|
||||||
);
|
);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -225,20 +225,6 @@ asort($orders);
|
|||||||
//var_dump($modules);
|
//var_dump($modules);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$h = 0;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=desc';
|
|
||||||
$head[$h][1] = $langs->trans("Description");
|
|
||||||
$head[$h][2] = 'desc';
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=feature';
|
|
||||||
$head[$h][1] = $langs->trans("TechnicalServicesProvided");
|
|
||||||
$head[$h][2] = 'feature';
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
|
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach($orders as $tmpkey => $tmpvalue)
|
foreach($orders as $tmpkey => $tmpvalue)
|
||||||
{
|
{
|
||||||
@ -257,6 +243,28 @@ $special = $objMod->special;
|
|||||||
$tab=explode('_',$value);
|
$tab=explode('_',$value);
|
||||||
$familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$tab[3];
|
$familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$tab[3];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$h = 0;
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=desc';
|
||||||
|
$head[$h][1] = $langs->trans("Description");
|
||||||
|
$head[$h][2] = 'desc';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=feature';
|
||||||
|
$head[$h][1] = $langs->trans("TechnicalServicesProvided");
|
||||||
|
$head[$h][2] = 'feature';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
if ($objMod->isCoreOrExternalModule() == 'external')
|
||||||
|
{
|
||||||
|
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=changelog';
|
||||||
|
$head[$h][1] = $langs->trans("ChangeLog");
|
||||||
|
$head[$h][2] = 'changelog';
|
||||||
|
$h++;
|
||||||
|
}
|
||||||
|
|
||||||
// Check filters
|
// Check filters
|
||||||
$modulename=$objMod->getName();
|
$modulename=$objMod->getName();
|
||||||
$moduledesc=$objMod->getDesc();
|
$moduledesc=$objMod->getDesc();
|
||||||
@ -536,6 +544,13 @@ if ($mode == 'feature')
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($mode == 'changelog')
|
||||||
|
{
|
||||||
|
$changelog=$objMod->getChangeLog();
|
||||||
|
if ($changelog) $text.='<div class="moduledesclong">'.$changelog.'<div>';
|
||||||
|
else $text.='<div class="moduledesclong">'.$langs->trans("NotAvailable").'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
print $text;
|
print $text;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -75,12 +75,19 @@ if ($search_version) $param.='&search_version='.urlencode($search_version);
|
|||||||
$dirins=DOL_DOCUMENT_ROOT.'/custom';
|
$dirins=DOL_DOCUMENT_ROOT.'/custom';
|
||||||
$urldolibarrmodules='https://www.dolistore.com/';
|
$urldolibarrmodules='https://www.dolistore.com/';
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
|
$hookmanager->initHooks(array('adminmodules','globaladmin'));
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('buttonreset'))
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (GETPOST('buttonreset','alpha'))
|
||||||
{
|
{
|
||||||
$search_keyword='';
|
$search_keyword='';
|
||||||
$search_status='';
|
$search_status='';
|
||||||
@ -200,11 +207,22 @@ if ($action == 'set' && $user->admin)
|
|||||||
//var_dump($resarray);exit;
|
//var_dump($resarray);exit;
|
||||||
if ($resarray['nbperms'] > 0)
|
if ($resarray['nbperms'] > 0)
|
||||||
{
|
{
|
||||||
$msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
|
$tmpsql="SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1";
|
||||||
setEventMessages($msg, null, 'warnings');
|
$resqltmp=$db->query($tmpsql);
|
||||||
|
if ($resqltmp)
|
||||||
|
{
|
||||||
|
$obj=$db->fetch_object($resqltmp);
|
||||||
|
//var_dump($obj->nb);exit;
|
||||||
|
if ($obj && $obj->nb > 1)
|
||||||
|
{
|
||||||
|
$msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
|
||||||
|
setEventMessages($msg, null, 'warnings');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
header("Location: modules.php?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
|
header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +230,7 @@ if ($action == 'reset' && $user->admin)
|
|||||||
{
|
{
|
||||||
$result=unActivateModule($value);
|
$result=unActivateModule($value);
|
||||||
if ($result) setEventMessages($result, null, 'errors');
|
if ($result) setEventMessages($result, null, 'errors');
|
||||||
header("Location: modules.php?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
|
header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,6 +448,8 @@ print "<br>\n";
|
|||||||
|
|
||||||
if ($mode == 'common')
|
if ($mode == 'common')
|
||||||
{
|
{
|
||||||
|
dol_set_focus('#search_keyword');
|
||||||
|
|
||||||
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
@ -441,7 +461,7 @@ if ($mode == 'common')
|
|||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
$moreforfilter.='<div class="divsearchfield">';
|
$moreforfilter.='<div class="divsearchfield">';
|
||||||
$moreforfilter.= $langs->trans('Keyword') . ': <input type="text" name="search_keyword" value="'.dol_escape_htmltag($search_keyword).'">';
|
$moreforfilter.= $langs->trans('Keyword') . ': <input type="text" id="search_keyword" name="search_keyword" value="'.dol_escape_htmltag($search_keyword).'">';
|
||||||
$moreforfilter.= '</div>';
|
$moreforfilter.= '</div>';
|
||||||
$moreforfilter.='<div class="divsearchfield">';
|
$moreforfilter.='<div class="divsearchfield">';
|
||||||
$moreforfilter.= $langs->trans('Origin') . ': '.$form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), 1);
|
$moreforfilter.= $langs->trans('Origin') . ': '.$form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), 1);
|
||||||
@ -474,10 +494,13 @@ if ($mode == 'common')
|
|||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$moreforfilter='';
|
||||||
|
|
||||||
print '<div class="clearboth"></div><br>';
|
print '<div class="clearboth"></div><br>';
|
||||||
|
|
||||||
$moreforfilter='';
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('insertExtraHeader',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
// Show list of modules
|
// Show list of modules
|
||||||
|
|
||||||
@ -657,7 +680,7 @@ if ($mode == 'common')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a class="reposition" href="modules.php?id='.$objMod->numero.'&module_position='.$module_position.'&action=reset&value=' . $modName . '&mode=' . $mode . $param . '">';
|
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&module_position='.$module_position.'&action=reset&value=' . $modName . '&mode=' . $mode . $param . '">';
|
||||||
print img_picto($langs->trans("Activated"),'switch_on');
|
print img_picto($langs->trans("Activated"),'switch_on');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
@ -736,20 +759,24 @@ if ($mode == 'common')
|
|||||||
print '<!-- This module is an external module and it may have a warning to show (note: your country is '.$mysoc->country_code.') -->'."\n";
|
print '<!-- This module is an external module and it may have a warning to show (note: your country is '.$mysoc->country_code.') -->'."\n";
|
||||||
foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry)
|
foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry)
|
||||||
{
|
{
|
||||||
if (! empty($modules[$keymodule]->const_name)) // If module that request warning is on
|
$keymodulelowercase=strtolower(preg_replace('/^mod/','',$keymodule));
|
||||||
|
if (in_array($keymodulelowercase, $conf->modules)) // If module that request warning is on
|
||||||
{
|
{
|
||||||
foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage)
|
foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage)
|
||||||
{
|
{
|
||||||
if ($keycountry == 'always' || $keycountry == $mysoc->country_code)
|
if ($keycountry == 'always' || $keycountry == $mysoc->country_code)
|
||||||
{
|
{
|
||||||
$warningmessage .= ($warningmessage?"\n":"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName());
|
$warningmessage .= ($warningmessage?"\n":"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName());
|
||||||
|
$warningmessage .= ($warningmessage?"\n":"").($warningmessage?"\n":"").$langs->trans("Module").' : '.$objMod->getName();
|
||||||
|
if (! empty($objMod->editor_name)) $warningmessage .= ($warningmessage?"\n":"").$langs->trans("Publisher").' : '.$objMod->editor_name;
|
||||||
|
if (! empty($objMod->editor_name)) $warningmessage .= ($warningmessage?"\n":"").$langs->trans("ModuleTriggeringThisWarning").' : '.$modules[$keymodule]->getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '<!-- Message to show: '.$warningmessage.' -->'."\n";
|
print '<!-- Message to show: '.$warningmessage.' -->'."\n";
|
||||||
print '<a class="reposition" href="modules.php?id='.$objMod->numero.'&module_position='.$module_position.'&action=set&value=' . $modName . '&mode=' . $mode . $param . '"';
|
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&module_position='.$module_position.'&action=set&value=' . $modName . '&mode=' . $mode . $param . '"';
|
||||||
if ($warningmessage) print ' onclick="return confirm(\''.dol_escape_js($warningmessage).'\');"';
|
if ($warningmessage) print ' onclick="return confirm(\''.dol_escape_js($warningmessage).'\');"';
|
||||||
print '>';
|
print '>';
|
||||||
print img_picto($langs->trans("Disabled"),'switch_off');
|
print img_picto($langs->trans("Disabled"),'switch_off');
|
||||||
@ -865,6 +892,7 @@ if ($mode == 'deploy')
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
if ($allowfromweb >= 0)
|
if ($allowfromweb >= 0)
|
||||||
{
|
{
|
||||||
@ -885,12 +913,20 @@ if ($mode == 'deploy')
|
|||||||
if ($allowfromweb == 1)
|
if ($allowfromweb == 1)
|
||||||
{
|
{
|
||||||
print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>';
|
print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>';
|
||||||
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
|
||||||
print '<input type="hidden" name="action" value="install">';
|
print '<input type="hidden" name="action" value="install">';
|
||||||
print '<input type="hidden" name="mode" value="deploy">';
|
print '<input type="hidden" name="mode" value="deploy">';
|
||||||
print $langs->trans("YouCanSubmitFile").' <input type="file" name="fileinstall"> ';
|
print $langs->trans("YouCanSubmitFile").' <input type="file" name="fileinstall"> ';
|
||||||
print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">';
|
print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
print '<div class="center"><div class="logo_setup"></div></div>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -159,19 +159,12 @@ $page_name = "MultiCurrencySetup";
|
|||||||
llxHeader('', $langs->trans($page_name));
|
llxHeader('', $langs->trans($page_name));
|
||||||
|
|
||||||
// Subheader
|
// Subheader
|
||||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">'
|
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||||
. $langs->trans("BackToModuleList") . '</a>';
|
|
||||||
print_fiche_titre($langs->trans($page_name), $linkback);
|
print_fiche_titre($langs->trans($page_name), $linkback);
|
||||||
|
|
||||||
// Configuration header
|
// Configuration header
|
||||||
$head = multicurrencyAdminPrepareHead();
|
$head = multicurrencyAdminPrepareHead();
|
||||||
dol_fiche_head(
|
dol_fiche_head($head, 'settings', $langs->trans("ModuleSetup"), -1, "multicurrency");
|
||||||
$head,
|
|
||||||
'settings',
|
|
||||||
$langs->trans("ModuleSetup"),
|
|
||||||
0,
|
|
||||||
"multicurrency"
|
|
||||||
);
|
|
||||||
|
|
||||||
// Setup page goes here
|
// Setup page goes here
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
|||||||
@ -564,7 +564,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
|
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes');
|
||||||
print $doleditor->Create();
|
print $doleditor->Create();
|
||||||
}
|
}
|
||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
|
|||||||
@ -487,7 +487,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
|
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes');
|
||||||
print $doleditor->Create();
|
print $doleditor->Create();
|
||||||
}
|
}
|
||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
|
|||||||
@ -553,7 +553,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
|
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes');
|
||||||
print $doleditor->Create();
|
print $doleditor->Create();
|
||||||
}
|
}
|
||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
|
|||||||
@ -520,7 +520,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
|
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes');
|
||||||
print $doleditor->Create();
|
print $doleditor->Create();
|
||||||
}
|
}
|
||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
|
|||||||
@ -229,6 +229,14 @@ foreach ($syslogModules as $moduleName)
|
|||||||
|
|
||||||
print $option['name'].': <input type="text" class="flat" name="'.$option['constant'].'" value="'.$value.'"'.(isset($option['attr']) ? ' '.$option['attr'] : '').'>';
|
print $option['name'].': <input type="text" class="flat" name="'.$option['constant'].'" value="'.$value.'"'.(isset($option['attr']) ? ' '.$option['attr'] : '').'>';
|
||||||
if (! empty($option['example'])) print '<br>'.$langs->trans("Example").': '.$option['example'];
|
if (! empty($option['example'])) print '<br>'.$langs->trans("Example").': '.$option['example'];
|
||||||
|
|
||||||
|
if ($option['constant'] == 'SYSLOG_FILE' && preg_match('/^DOL_DATA_ROOT\/[^\/]*$/',$value))
|
||||||
|
{
|
||||||
|
$filelogparam =' (<a href="'.DOL_URL_ROOT.'/document.php?modulepart=logs&file='.basename($value).'">';
|
||||||
|
$filelogparam.=$langs->trans('Download');
|
||||||
|
$filelogparam.=$filelog.'</a>)';
|
||||||
|
print $filelogparam;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -88,6 +88,7 @@ if (!empty($ExecTimeLimit))
|
|||||||
@set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64
|
@set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64
|
||||||
error_reporting($err);
|
error_reporting($err);
|
||||||
}
|
}
|
||||||
|
$MemoryLimit=0;
|
||||||
if (!empty($MemoryLimit))
|
if (!empty($MemoryLimit))
|
||||||
{
|
{
|
||||||
@ini_set('memory_limit', $MemoryLimit);
|
@ini_set('memory_limit', $MemoryLimit);
|
||||||
|
|||||||
@ -38,7 +38,7 @@ if (! $user->admin)
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$title=$langs->trans("AdminTools");
|
$title=$langs->trans("AdminTools");
|
||||||
//if (GETPOST('leftmenu') == 'admintools') $title=$langs->trans("ModulesSystemTools");
|
//if (GETPOST('leftmenu',"aZ09") == 'admintools') $title=$langs->trans("ModulesSystemTools");
|
||||||
|
|
||||||
llxHeader('', $title);
|
llxHeader('', $title);
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
|
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
|
||||||
*
|
*
|
||||||
@ -45,15 +45,17 @@ $langs->load("companies");
|
|||||||
$langs->load("users");
|
$langs->load("users");
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
|
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
// Load variable for pagination
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
$page = GETPOST("page",'int');
|
$sortfield = GETPOST('sortfield','alpha');
|
||||||
if ($page == -1) { $page = 0 ; }
|
$sortorder = GETPOST('sortorder','alpha');
|
||||||
$offset = $conf->liste_limit * $page ;
|
$page = GETPOST('page','int');
|
||||||
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (! $sortorder) $sortorder="DESC";
|
|
||||||
if (! $sortfield) $sortfield="dateevent";
|
if (! $sortfield) $sortfield="dateevent";
|
||||||
|
if (! $sortorder) $sortorder="DESC";
|
||||||
|
|
||||||
$search_code = GETPOST("search_code");
|
$search_code = GETPOST("search_code");
|
||||||
$search_ip = GETPOST("search_ip");
|
$search_ip = GETPOST("search_ip");
|
||||||
@ -61,9 +63,9 @@ $search_user = GETPOST("search_user");
|
|||||||
$search_desc = GETPOST("search_desc");
|
$search_desc = GETPOST("search_desc");
|
||||||
$search_ua = GETPOST("search_ua");
|
$search_ua = GETPOST("search_ua");
|
||||||
|
|
||||||
if (!isset($_REQUEST["date_startmonth"]) || $_REQUEST["date_startmonth"] > 0) $date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]);
|
if (GETPOST("date_startmonth") == '' || GETPOST("date_startmonth") > 0) $date_start=dol_mktime(0,0,0,GETPOST("date_startmonth"),GETPOST("date_startday"),GETPOST("date_startyear"));
|
||||||
else $date_start=-1;
|
else $date_start=-1;
|
||||||
if (!isset($_REQUEST["date_endmonth"]) || $_REQUEST["date_endmonth"] > 0) $date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
|
if (GETPOST("date_endmonth") == '' || GETPOST("date_endmonth") > 0) $date_end=dol_mktime(23,59,59,GETPOST("date_endmonth"),GETPOST("date_endday"),GETPOST("date_endyear"));
|
||||||
else $date_end=-1;
|
else $date_end=-1;
|
||||||
|
|
||||||
// checks:if date_start>date_end then date_end=date_start + 24 hours
|
// checks:if date_start>date_end then date_end=date_start + 24 hours
|
||||||
@ -72,14 +74,6 @@ if ($date_start > 0 && $date_end > 0 && $date_start > $date_end) $date_end=$date
|
|||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
$nowarray = dol_getdate($now);
|
$nowarray = dol_getdate($now);
|
||||||
|
|
||||||
$params = "&search_code=$search_code&search_ip=$search_ip&search_user=$search_user&search_desc=$search_desc&search_ua=$search_ua";
|
|
||||||
$params.= "&date_startmonth=".$_REQUEST["date_startmonth"];
|
|
||||||
$params.= "&date_startday=".$_REQUEST["date_startday"];
|
|
||||||
$params.= "&date_startyear=".$_REQUEST["date_startyear"];
|
|
||||||
$params.= "&date_endmonth=".$_REQUEST["date_endmonth"];
|
|
||||||
$params.= "&date_endday=".$_REQUEST["date_endday"];
|
|
||||||
$params.= "&date_endyear=".$_REQUEST["date_endyear"];
|
|
||||||
|
|
||||||
if (empty($date_start)) // We define date_start and date_end
|
if (empty($date_start)) // We define date_start and date_end
|
||||||
{
|
{
|
||||||
$date_start=dol_get_first_day($nowarray['year'],$nowarray['mon'],false);
|
$date_start=dol_get_first_day($nowarray['year'],$nowarray['mon'],false);
|
||||||
@ -88,6 +82,15 @@ if (empty($date_end))
|
|||||||
{
|
{
|
||||||
$date_end=dol_mktime(23,59,59,$nowarray['mon'],$nowarray['mday'],$nowarray['year']);
|
$date_end=dol_mktime(23,59,59,$nowarray['mon'],$nowarray['mday'],$nowarray['year']);
|
||||||
}
|
}
|
||||||
|
// Set $date_startmonth...
|
||||||
|
$tmp = dol_getdate($date_start);
|
||||||
|
$date_startday = $tmp['mday'];
|
||||||
|
$date_startmonth = $tmp['mon'];
|
||||||
|
$date_startyear = $tmp['year'];
|
||||||
|
$tmp = dol_getdate($date_end);
|
||||||
|
$date_endday = $tmp['mday'];
|
||||||
|
$date_endmonth = $tmp['mon'];
|
||||||
|
$date_endyear = $tmp['year'];
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -97,7 +100,7 @@ if (empty($date_end))
|
|||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$date_start=-1;
|
$date_start=-1;
|
||||||
$date_end=-1;
|
$date_end=-1;
|
||||||
@ -192,11 +195,20 @@ if ($result)
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
if ($search_code) $param.='&search_code='.$search_code;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($search_ip) $param.='&search_ip='.$search_ip;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
if ($search_user) $param.='&search_user='.$search_user;
|
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||||
if ($search_desc) $param.='&search_desc='.$search_desc;
|
if ($search_code) $param.='&search_code='.urlencode($search_code);
|
||||||
if ($search_ua) $param.='&search_ua='.$search_ua;
|
if ($search_ip) $param.='&search_ip='.urlencode($search_ip);
|
||||||
|
if ($search_user) $param.='&search_user='.urlencode($search_user);
|
||||||
|
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
||||||
|
if ($search_ua) $param.='&search_ua='.urlencode($search_ua);
|
||||||
|
if ($date_startmonth) $param.= "&date_startmonth=".urlencode($date_startmonth);
|
||||||
|
if ($date_startday) $param.= "&date_startday=".urlencode($date_startday);
|
||||||
|
if ($date_startyear) $param.= "&date_startyear=".urlencode($date_startyear);
|
||||||
|
if ($date_endmonth) $param.= "&date_endmonth=".urlencode($date_endmonth);
|
||||||
|
if ($date_endday) $param.= "&date_endday=".urlencode($date_endday);
|
||||||
|
if ($date_endyear) $param.= "&date_endyear=".urlencode($date_endyear);
|
||||||
|
|
||||||
$langs->load('withdrawals');
|
$langs->load('withdrawals');
|
||||||
if ($num)
|
if ($num)
|
||||||
@ -204,7 +216,9 @@ if ($result)
|
|||||||
$center='<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=purge">'.$langs->trans("Purge").'</a>';
|
$center='<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=purge">'.$langs->trans("Purge").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $nbtotalofrecords, 'setup');
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
|
||||||
|
print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $nbtotalofrecords, 'setup', 0, '', '', $limit);
|
||||||
|
|
||||||
if ($action == 'purge')
|
if ($action == 'purge')
|
||||||
{
|
{
|
||||||
@ -212,19 +226,8 @@ if ($result)
|
|||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('PurgeAuditEvents'), $langs->trans('ConfirmPurgeAuditEvents'),'confirm_purge',$formquestion,'no',1);
|
print $form->formconfirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('PurgeAuditEvents'), $langs->trans('ConfirmPurgeAuditEvents'),'confirm_purge',$formquestion,'no',1);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="liste" width="100%">';
|
print '<table class="liste" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"e.dateevent","","",'align="left"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("Code"),$_SERVER["PHP_SELF"],"e.type","","",'align="left"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("IP"),$_SERVER["PHP_SELF"],"e.ip","","",'align="left"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"u.login","","",'align="left"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"e.description","","",'align="left"',$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre('');
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
|
|
||||||
// Lignes des champs de filtres
|
// Lignes des champs de filtres
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -255,14 +258,20 @@ if ($result)
|
|||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$var=True;
|
|
||||||
|
|
||||||
while ($i < min($num, $conf->liste_limit))
|
print '<tr class="liste_titre">';
|
||||||
|
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"e.dateevent","",$param,'align="left"',$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans("Code"),$_SERVER["PHP_SELF"],"e.type","",$param,'align="left"',$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans("IP"),$_SERVER["PHP_SELF"],"e.ip","",$param,'align="left"',$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"u.login","",$param,'align="left"',$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"e.description","",$param,'align="left"',$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre('');
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
while ($i < min($num, $limit))
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
|
|||||||
@ -47,7 +47,7 @@ $langs->load("other");
|
|||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if ($page == -1) { $page = 0 ; }
|
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||||
$offset = $conf->liste_limit * $page ;
|
$offset = $conf->liste_limit * $page ;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|||||||
@ -83,7 +83,15 @@ if (! empty($conf->syslog->enabled))
|
|||||||
{
|
{
|
||||||
print '<input type="radio" name="choice" value="logfile"';
|
print '<input type="radio" name="choice" value="logfile"';
|
||||||
print ($choice && $choice=='logfile') ? ' checked' : '';
|
print ($choice && $choice=='logfile') ? ' checked' : '';
|
||||||
print '> '.$langs->trans("PurgeDeleteLogFile",$filelog).'<br><br>';
|
$filelogparam=$filelog;
|
||||||
|
if ($user->admin && preg_match('/^dolibarr.*\.log$/', basename($filelog)))
|
||||||
|
{
|
||||||
|
$filelogparam ='<a href="'.DOL_URL_ROOT.'/document.php?modulepart=logs&file=';
|
||||||
|
$filelogparam.=basename($filelog);
|
||||||
|
$filelogparam.='">'.$filelog.'</a>';
|
||||||
|
}
|
||||||
|
print '> '.$langs->trans("PurgeDeleteLogFile", $filelogparam);
|
||||||
|
print '<br><br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<input type="radio" name="choice" value="tempfiles"';
|
print '<input type="radio" name="choice" value="tempfiles"';
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -56,6 +56,9 @@ $pagenext = $page + 1;
|
|||||||
if (! $sortfield) $sortfield='lang,transkey';
|
if (! $sortfield) $sortfield='lang,transkey';
|
||||||
if (! $sortorder) $sortorder='ASC';
|
if (! $sortorder) $sortorder='ASC';
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
|
$hookmanager->initHooks(array('admintranslation','globaladmin'));
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
|
|||||||
@ -25,8 +25,10 @@ require '../main.inc.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php';
|
||||||
|
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
@ -35,7 +37,6 @@ $langs->load("website");
|
|||||||
|
|
||||||
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
$id=GETPOST('id','int');
|
|
||||||
$rowid=GETPOST('rowid','alpha');
|
$rowid=GETPOST('rowid','alpha');
|
||||||
|
|
||||||
$id=1;
|
$id=1;
|
||||||
@ -54,7 +55,7 @@ $status = 1;
|
|||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if ($page == -1) { $page = 0 ; }
|
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||||
$offset = $listlimit * $page ;
|
$offset = $listlimit * $page ;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
@ -185,7 +186,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
if ($result) // Add is ok
|
if ($result) // Add is ok
|
||||||
{
|
{
|
||||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||||
$_POST=array('id'=>$id); // Clean $_POST array, we keep only
|
unset($_POST); // Clean $_POST array, we keep only
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -204,6 +205,10 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
|
$website=new Website($db);
|
||||||
|
$rowid=GETPOST('rowid','int');
|
||||||
|
$website->fetch($rowid);
|
||||||
|
|
||||||
// Modify entry
|
// Modify entry
|
||||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||||
// Modifie valeur des champs
|
// Modifie valeur des champs
|
||||||
@ -229,7 +234,17 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
dol_syslog("actionmodify", LOG_DEBUG);
|
dol_syslog("actionmodify", LOG_DEBUG);
|
||||||
//print $sql;
|
//print $sql;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if (! $resql)
|
if ($resql)
|
||||||
|
{
|
||||||
|
$newname = dol_sanitizeFileName(GETPOST('ref','aZ09'));
|
||||||
|
if ($newname != $website->ref)
|
||||||
|
{
|
||||||
|
$srcfile=DOL_DATA_ROOT.'/websites/'.$website->ref;
|
||||||
|
$destfile=DOL_DATA_ROOT.'/websites/'.$newname;
|
||||||
|
@rename($srcfile, $destfile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($db->error(), null, 'errors');
|
setEventMessages($db->error(), null, 'errors');
|
||||||
}
|
}
|
||||||
@ -321,7 +336,7 @@ print "<br>\n";
|
|||||||
// Confirmation de la suppression de la ligne
|
// Confirmation de la suppression de la ligne
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&id='.$id, $langs->trans('DeleteWebsite'), $langs->trans('ConfirmDeleteWebsite'), 'confirm_delete','',0,1);
|
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid, $langs->trans('DeleteWebsite'), $langs->trans('ConfirmDeleteWebsite'), 'confirm_delete','',0,1);
|
||||||
}
|
}
|
||||||
//var_dump($elementList);
|
//var_dump($elementList);
|
||||||
|
|
||||||
@ -355,7 +370,7 @@ if ($id)
|
|||||||
|
|
||||||
$fieldlist=explode(',',$tabfield[$id]);
|
$fieldlist=explode(',',$tabfield[$id]);
|
||||||
|
|
||||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
@ -388,9 +403,7 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id == 4) print '<td></td>';
|
|
||||||
print '<td colspan="4">';
|
print '<td colspan="4">';
|
||||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -445,7 +458,7 @@ if ($id)
|
|||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||||
@ -456,7 +469,7 @@ if ($id)
|
|||||||
if ($num > $listlimit)
|
if ($num > $listlimit)
|
||||||
{
|
{
|
||||||
print '<tr class="none"><td align="right" colspan="'.(3+count($fieldlist)).'">';
|
print '<tr class="none"><td align="right" colspan="'.(3+count($fieldlist)).'">';
|
||||||
print_fleche_navigation($page, $_SERVER["PHP_SELF"], '&id='.$id, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
|
print_fleche_navigation($page, $_SERVER["PHP_SELF"], '', ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -486,11 +499,11 @@ if ($id)
|
|||||||
// Affiche nom du champ
|
// Affiche nom du champ
|
||||||
if ($showfield)
|
if ($showfield)
|
||||||
{
|
{
|
||||||
print getTitleFieldOfList($valuetoshow,0,$_SERVER["PHP_SELF"],($sortable?$fieldlist[$field]:''),($page?'page='.$page.'&':'').'&id='.$id,"","align=".$align,$sortfield,$sortorder);
|
print getTitleFieldOfList($valuetoshow,0,$_SERVER["PHP_SELF"],($sortable?$fieldlist[$field]:''),($page?'page='.$page.'&':''),"","align=".$align,$sortfield,$sortorder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print getTitleFieldOfList($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"status",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder);
|
print getTitleFieldOfList($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"status",($page?'page='.$page.'&':''),"",'align="center"',$sortfield,$sortorder);
|
||||||
print getTitleFieldOfList('');
|
print getTitleFieldOfList('');
|
||||||
print getTitleFieldOfList('');
|
print getTitleFieldOfList('');
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -539,7 +552,7 @@ if ($id)
|
|||||||
// Can an entry be erased or disabled ?
|
// Can an entry be erased or disabled ?
|
||||||
$iserasable=1;$isdisable=1; // true by default
|
$iserasable=1;$isdisable=1; // true by default
|
||||||
|
|
||||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'').'&id='.$id.'&';
|
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'').'&';
|
||||||
|
|
||||||
// Active
|
// Active
|
||||||
print '<td align="center" class="nowrap">';
|
print '<td align="center" class="nowrap">';
|
||||||
|
|||||||
@ -1,41 +1,54 @@
|
|||||||
API REST howto
|
API REST
|
||||||
==============
|
========
|
||||||
|
|
||||||
This directory contains files to make Dolibarr a server of REST Web Services.
|
## Integrate your ERP with any other applications using Dolibarr APIs
|
||||||
It depends on external library Restler.
|
|
||||||
|
This module provides the service to make Dolibarr a server of REST Web Services. It depends on external library Restler.
|
||||||
|
|
||||||
|
Extract any data or push insert, update or delete record using our new REST APIs. Using standard HTTP and Json format, it is compatible with any language (PHP, Java, Ruby, Python, C#, C++, JavaScript, JQuery, Basic, ...). Use the embedded APIs explorer tool to test APIs or get generated URLs to use in your own code.
|
||||||
|
|
||||||
|
|
||||||
Explore the api
|
<div align="center">
|
||||||
---------------
|
<img class="imgdoc" src="https://www.dolibarr.org//images/doc_apirest.png" alt="Dolibarr API explorer"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
You can explore API method by using web interface : https://**yourdolibarr.tld**/mydolibarr/api/admin/explorer.php (replace **yourdolibarr.tld** by real hostname of your Dolibarr installation)
|
|
||||||
|
|
||||||
Access to the API
|
|
||||||
|
Explore the APIs
|
||||||
|
----------------
|
||||||
|
|
||||||
|
You can explore all available APIs by using the API explorer : [**yourdolibarr.tld**/api/index.php/explorer](../api/index.php/explorer) (replace **yourdolibarr.tld** by real hostname of your Dolibarr installation)
|
||||||
|
|
||||||
|
|
||||||
|
Access to an API
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
> **Warning : access to the API should (or better : must!) be secured with SSL connection**
|
> **Warning : access to any API should (or better : must!) be secured with SSL connection**
|
||||||
|
|
||||||
To access to the API you need a token to identify. When you access the API for the first time, you need to log in with user name and password to get a token. **Only** this token will allow to access API with.
|
To access to the API you need a token to identify. **Only** this token will allow to access API with.
|
||||||
|
The token is dedicated to a user and it **must** be put into requests as **DOLAPIKEY** parameter in HTTP header (or among URL parameters, but this is less secured).
|
||||||
|
|
||||||
To log in with the API, use this uri : https://**yourdolibarr.tld**/mydolibarr/api/index.php/login?login=**username**&password=**password** (replace bold strings with real values)
|
To get a token you can:
|
||||||
|
|
||||||
The token will be saved by Dolibarr for next user accesses to the API and it **must** be put into request uri as **api_key** parameter.
|
* Edit the user card to set the value of token. Each user can have a different token.
|
||||||
|
* or Call the *login* API with login and password. This will return the value of token for the user used to login.
|
||||||
|
|
||||||
Then call other services with
|
Then call other services with
|
||||||
|
|
||||||
https://**yourdolibarr.tld**/mydolibarr/api/index.php/otherservice?api_key=**api_key**
|
https://**yourdolibarr.tld**/mydolibarr/api/index.php/otherservice?DOLAPIKEY=**api_key**
|
||||||
|
|
||||||
|
|
||||||
Develop the API
|
Develop an API
|
||||||
---------------
|
--------------
|
||||||
|
|
||||||
The API uses Lucarast Restler framework. Please check documentation https://www.luracast.com/products/restler and examples http://help.luracast.com/restler/examples/
|
The API uses Lucarast Restler framework. Please check documentation https://www.luracast.com/products/restler and examples http://help.luracast.com/restler/examples/
|
||||||
|
|
||||||
Github contains also usefull informations : https://github.com/Luracast/Restler
|
Github contains also usefull informations : https://github.com/Luracast/Restler
|
||||||
|
|
||||||
To implement it into Dolibarr, we need to create a specific class for object we want to use. A skeleton file is available into /dev directory : *skeleton_api_class.class.php*
|
To implement it into Dolibarr, you need to create a specific class for object we want to use. A skeleton file is available into /modulebuilder/class directory : *api_mymodule_class.class.php*
|
||||||
The API class file must be put into object class directory, with specific file name. By example, API class file for '*myobject*' must be put as : /htdocs/*myobject*/class/api_*myobject*.class.php. Class must be named **MyobjectApi**.
|
The API class file must be put into object class directory, with specific file name. By example, API class file for '*myobject*' must be put as : /htdocs/*myobject*/class/api_*myobject*.class.php. Class must be named **MyobjectApi**.
|
||||||
|
|
||||||
If a module provide several object, use a different name for '*myobject*' and put the file into the same directory.
|
If a module provide several object, use a different name for *'myobject'* and put the file into the same directory.
|
||||||
|
|
||||||
**Define url for methods**
|
**Define url for methods**
|
||||||
|
|
||||||
|
|||||||
@ -42,10 +42,11 @@ class DolibarrApi
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDb $db Database handler
|
* @param DoliDb $db Database handler
|
||||||
* @param string $cachedir Cache dir
|
* @param string $cachedir Cache dir
|
||||||
|
* @param boolean $refreshCache Update cache
|
||||||
*/
|
*/
|
||||||
function __construct($db, $cachedir='')
|
function __construct($db, $cachedir='', $refreshCache=false)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -54,7 +55,7 @@ class DolibarrApi
|
|||||||
|
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$production_mode = ( empty($conf->global->API_PRODUCTION_MODE) ? false : true );
|
$production_mode = ( empty($conf->global->API_PRODUCTION_MODE) ? false : true );
|
||||||
$this->r = new Restler($production_mode);
|
$this->r = new Restler($production_mode, $refreshCache);
|
||||||
|
|
||||||
$this->r->setAPIVersion(1);
|
$this->r->setAPIVersion(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,7 +93,7 @@ class DolibarrApiAccess implements iAuthenticate
|
|||||||
// TODO Add option to disable use of api key on url. Return errors if used.
|
// TODO Add option to disable use of api key on url. Return errors if used.
|
||||||
$api_key = $_GET['DOLAPIKEY']; // With GET method
|
$api_key = $_GET['DOLAPIKEY']; // With GET method
|
||||||
}
|
}
|
||||||
if (isset($_SERVER['HTTP_DOLAPIKEY']))
|
if (isset($_SERVER['HTTP_DOLAPIKEY'])) // Param DOLAPIKEY in header can be read with HTTP_DOLAPIKEY
|
||||||
{
|
{
|
||||||
$api_key = $_SERVER['HTTP_DOLAPIKEY']; // With header method (recommanded)
|
$api_key = $_SERVER['HTTP_DOLAPIKEY']; // With header method (recommanded)
|
||||||
}
|
}
|
||||||
|
|||||||
112
htdocs/api/class/api_dictionaryextrafields.class.php
Normal file
112
htdocs/api/class/api_dictionaryextrafields.class.php
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Luracast\Restler\RestException;
|
||||||
|
|
||||||
|
//require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API class for extra fields (content of the extrafields)
|
||||||
|
*
|
||||||
|
* @access protected
|
||||||
|
* @class DolibarrApiAccess {@requires user,external}
|
||||||
|
*/
|
||||||
|
class DictionaryExtraFields extends DolibarrApi
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
global $db;
|
||||||
|
$this->db = $db;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of extra fields.
|
||||||
|
*
|
||||||
|
* @param string $sortfield Sort field
|
||||||
|
* @param string $sortorder Sort order
|
||||||
|
* @param string $type Type of element ('adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...)
|
||||||
|
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'SO-%')"
|
||||||
|
* @return List of events types
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
*/
|
||||||
|
function index($sortfield = "t.pos", $sortorder = 'ASC', $type = '', $sqlfilters = '')
|
||||||
|
{
|
||||||
|
$list = array();
|
||||||
|
|
||||||
|
if ($type == 'thirdparty') $type='societe';
|
||||||
|
if ($type == 'contact') $type='socpeople';
|
||||||
|
|
||||||
|
$sql = "SELECT t.rowid, t.name, t.label, t.type, t.size, t.elementtype, t.fieldunique, t.fieldrequired, t.param, t.pos, t.alwayseditable, t.perms, t.list, t.ishidden, t.fielddefault, t.fieldcomputed";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."extrafields as t";
|
||||||
|
$sql.= " WHERE t.entity IN (".getEntity('extrafields').")";
|
||||||
|
if (! empty($type)) $sql.= " AND t.elementtype = '".$this->db->escape($type)."'";
|
||||||
|
// Add sql filters
|
||||||
|
if ($sqlfilters)
|
||||||
|
{
|
||||||
|
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||||
|
{
|
||||||
|
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||||
|
}
|
||||||
|
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||||
|
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql.= $this->db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
if ($this->db->num_rows($resql))
|
||||||
|
{
|
||||||
|
while ($tab = $this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
// New usage
|
||||||
|
$list[$tab->elementtype][$tab->name]['type']=$tab->type;
|
||||||
|
$list[$tab->elementtype][$tab->name]['label']=$tab->label;
|
||||||
|
$list[$tab->elementtype][$tab->name]['size']=$tab->size;
|
||||||
|
$list[$tab->elementtype][$tab->name]['elementtype']=$tab->elementtype;
|
||||||
|
$list[$tab->elementtype][$tab->name]['default']=$tab->fielddefault;
|
||||||
|
$list[$tab->elementtype][$tab->name]['computed']=$tab->fieldcomputed;
|
||||||
|
$list[$tab->elementtype][$tab->name]['unique']=$tab->fieldunique;
|
||||||
|
$list[$tab->elementtype][$tab->name]['required']=$tab->fieldrequired;
|
||||||
|
$list[$tab->elementtype][$tab->name]['param']=($tab->param ? unserialize($tab->param) : '');
|
||||||
|
$list[$tab->elementtype][$tab->name]['pos']=$tab->pos;
|
||||||
|
$list[$tab->elementtype][$tab->name]['alwayseditable']=$tab->alwayseditable;
|
||||||
|
$list[$tab->elementtype][$tab->name]['perms']=$tab->perms;
|
||||||
|
$list[$tab->elementtype][$tab->name]['list']=$tab->list;
|
||||||
|
$list[$tab->elementtype][$tab->name]['ishidden']=$tab->ishidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new RestException(503, 'Error when retrieving list of extra fields : '.$this->db->lasterror());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! count($list))
|
||||||
|
{
|
||||||
|
throw new RestException(404, 'No extrafield found');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -40,7 +40,7 @@ class Login
|
|||||||
*
|
*
|
||||||
* @param string $login User login
|
* @param string $login User login
|
||||||
* @param string $password User password
|
* @param string $password User password
|
||||||
* @param int $entity Entity (when multicompany module is used). Empty means 1=first company.
|
* @param string $entity Entity (when multicompany module is used). '' means 1=first company.
|
||||||
* @param int $reset Reset token (0=get current token, 1=ask a new token and canceled old token. This means access using current existing API token of user will fails: new token will be required for new access)
|
* @param int $reset Reset token (0=get current token, 1=ask a new token and canceled old token. This means access using current existing API token of user will fails: new token will be required for new access)
|
||||||
* @return array Response status and user token
|
* @return array Response status and user token
|
||||||
*
|
*
|
||||||
@ -49,7 +49,7 @@ class Login
|
|||||||
* @url GET /
|
* @url GET /
|
||||||
* @url POST /
|
* @url POST /
|
||||||
*/
|
*/
|
||||||
public function index($login, $password, $entity=0, $reset=0) {
|
public function index($login, $password, $entity='', $reset=0) {
|
||||||
|
|
||||||
global $conf, $dolibarr_main_authentication, $dolibarr_auto_user;
|
global $conf, $dolibarr_main_authentication, $dolibarr_auto_user;
|
||||||
|
|
||||||
@ -62,6 +62,8 @@ class Login
|
|||||||
// Set authmode
|
// Set authmode
|
||||||
$authmode = explode(',', $dolibarr_main_authentication);
|
$authmode = explode(',', $dolibarr_main_authentication);
|
||||||
|
|
||||||
|
if ($entity == '') $entity=1;
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php';
|
||||||
$login = checkLoginPassEntity($login, $password, $entity, $authmode);
|
$login = checkLoginPassEntity($login, $password, $entity, $authmode);
|
||||||
if (empty($login))
|
if (empty($login))
|
||||||
@ -72,7 +74,7 @@ class Login
|
|||||||
$token = 'failedtogenerateorgettoken';
|
$token = 'failedtogenerateorgettoken';
|
||||||
|
|
||||||
$tmpuser=new User($this->db);
|
$tmpuser=new User($this->db);
|
||||||
$tmpuser->fetch(0, $login);
|
$tmpuser->fetch(0, $login, 0, 0, $entity);
|
||||||
|
|
||||||
// Renew the hash
|
// Renew the hash
|
||||||
if (empty($tmpuser->api_key) || $reset)
|
if (empty($tmpuser->api_key) || $reset)
|
||||||
@ -102,7 +104,8 @@ class Login
|
|||||||
'success' => array(
|
'success' => array(
|
||||||
'code' => 200,
|
'code' => 200,
|
||||||
'token' => $token,
|
'token' => $token,
|
||||||
'message' => 'Welcome ' . $login.($reset?' - Token is new':' - This is your token (generated by a previous call). You can use it to make any REST API call, or enter it into the DOLAPIKEY field to use the Dolibarr API explorer.')
|
'entity' => $tmpuser->entity,
|
||||||
|
'message' => 'Welcome ' . $login.($reset?' - Token is new':' - This is your token (generated by a previous call). You can use it to make any REST API call, or enter it into the DOLAPIKEY field to use the Dolibarr API explorer.')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,13 +21,21 @@
|
|||||||
* \defgroup api Module DolibarrApi
|
* \defgroup api Module DolibarrApi
|
||||||
* \brief API loader
|
* \brief API loader
|
||||||
* Search files htdocs/<module>/class/api_<module>.class.php
|
* Search files htdocs/<module>/class/api_<module>.class.php
|
||||||
* \file htdocs/api/indexphp
|
* \file htdocs/api/index.php
|
||||||
*
|
|
||||||
* @todo User authentication with api_key
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (! defined("NOLOGIN")) define("NOLOGIN",'1');
|
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||||
if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",'1');
|
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||||
|
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||||
|
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||||
|
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test
|
||||||
|
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
|
||||||
|
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test
|
||||||
|
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
|
||||||
|
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
|
||||||
|
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
|
||||||
|
if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||||
|
|
||||||
|
|
||||||
$res=0;
|
$res=0;
|
||||||
if (! $res && file_exists("../main.inc.php")) $res=include '../main.inc.php';
|
if (! $res && file_exists("../main.inc.php")) $res=include '../main.inc.php';
|
||||||
@ -67,7 +75,31 @@ if (preg_match('/api\/index\.php\/explorer/', $_SERVER["PHP_SELF"]) && ! empty($
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$api = new DolibarrApi($db);
|
|
||||||
|
|
||||||
|
// Analyze URLs
|
||||||
|
// index.php/explorer do a redirect to index.php/explorer/
|
||||||
|
// index.php/explorer/ called by swagger to build explorer page
|
||||||
|
// index.php/explorer/.../....png|.css|.js called by swagger for resources to build explorer page
|
||||||
|
// index.php/explorer/resources.json called by swagger to get list of all services
|
||||||
|
// index.php/explorer/resources.json/xxx called by swagger to get detail of services xxx
|
||||||
|
// index.php/xxx called by any REST client to run API
|
||||||
|
|
||||||
|
|
||||||
|
preg_match('/index\.php\/([^\/]+)(.*)$/', $_SERVER["PHP_SELF"], $reg);
|
||||||
|
// .../index.php/categories?sortfield=t.rowid&sortorder=ASC
|
||||||
|
|
||||||
|
|
||||||
|
// Set the flag to say to refresh (when we reload the explorer, production must be for API call only)
|
||||||
|
$refreshcache=false;
|
||||||
|
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
||||||
|
{
|
||||||
|
$refreshcache=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$api = new DolibarrApi($db, '', $refreshcache);
|
||||||
|
//var_dump($api->r->apiVersionMap);
|
||||||
|
|
||||||
// Enable the Restler API Explorer.
|
// Enable the Restler API Explorer.
|
||||||
// See https://github.com/Luracast/Restler-API-Explorer for more info.
|
// See https://github.com/Luracast/Restler-API-Explorer for more info.
|
||||||
@ -79,110 +111,82 @@ $api->r->addAuthenticationClass('DolibarrApiAccess','');
|
|||||||
// Define accepted mime types
|
// Define accepted mime types
|
||||||
UploadFormat::$allowedMimeTypes = array('image/jpeg', 'image/png', 'text/plain', 'application/octet-stream');
|
UploadFormat::$allowedMimeTypes = array('image/jpeg', 'image/png', 'text/plain', 'application/octet-stream');
|
||||||
|
|
||||||
$listofapis = array();
|
|
||||||
|
|
||||||
$modulesdir = dolGetModulesDirs();
|
|
||||||
foreach ($modulesdir as $dir)
|
// Call Explorer file for all APIs definitions
|
||||||
|
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
||||||
{
|
{
|
||||||
/*
|
// Scan all API files to load them
|
||||||
* Search available module
|
|
||||||
*/
|
|
||||||
//dol_syslog("Scan directory ".$dir." for API modules");
|
|
||||||
|
|
||||||
$handle=@opendir(dol_osencode($dir));
|
$listofapis = array();
|
||||||
if (is_resource($handle))
|
|
||||||
|
$modulesdir = dolGetModulesDirs();
|
||||||
|
foreach ($modulesdir as $dir)
|
||||||
{
|
{
|
||||||
while (($file = readdir($handle))!==false)
|
// Search available module
|
||||||
|
dol_syslog("Scan directory ".$dir." for module descriptor to after search for API files");
|
||||||
|
|
||||||
|
$handle=@opendir(dol_osencode($dir));
|
||||||
|
if (is_resource($handle))
|
||||||
{
|
{
|
||||||
if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i",$file,$reg))
|
while (($file = readdir($handle))!==false)
|
||||||
{
|
{
|
||||||
$module = strtolower($reg[1]);
|
if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i",$file,$reg))
|
||||||
$moduledirforclass = $module;
|
|
||||||
$moduleforperm = $module;
|
|
||||||
|
|
||||||
if ($module == 'propale') {
|
|
||||||
$moduledirforclass = 'comm/propal';
|
|
||||||
$moduleforperm='propal';
|
|
||||||
}
|
|
||||||
elseif ($module == 'agenda') {
|
|
||||||
$moduledirforclass = 'comm/action';
|
|
||||||
}
|
|
||||||
elseif ($module == 'adherent') {
|
|
||||||
$moduledirforclass = 'adherents';
|
|
||||||
}
|
|
||||||
elseif ($module == 'banque') {
|
|
||||||
$moduledirforclass = 'compta/bank';
|
|
||||||
}
|
|
||||||
elseif ($module == 'categorie') {
|
|
||||||
$moduledirforclass = 'categories';
|
|
||||||
}
|
|
||||||
elseif ($module == 'facture') {
|
|
||||||
$moduledirforclass = 'compta/facture';
|
|
||||||
}
|
|
||||||
elseif ($module == 'project') {
|
|
||||||
$moduledirforclass = 'projet';
|
|
||||||
}
|
|
||||||
elseif ($module == 'task') {
|
|
||||||
$moduledirforclass = 'projet';
|
|
||||||
}
|
|
||||||
elseif ($module == 'stock') {
|
|
||||||
$moduledirforclass = 'product/stock';
|
|
||||||
}
|
|
||||||
elseif ($module == 'fournisseur') {
|
|
||||||
$moduledirforclass = 'fourn';
|
|
||||||
}
|
|
||||||
//dol_syslog("Found module file ".$file." - module=".$module." - moduledirforclass=".$moduledirforclass);
|
|
||||||
|
|
||||||
// Defined if module is enabled
|
|
||||||
$enabled=true;
|
|
||||||
if (empty($conf->$moduleforperm->enabled)) $enabled=false;
|
|
||||||
|
|
||||||
if ($enabled)
|
|
||||||
{
|
{
|
||||||
/*
|
$module = strtolower($reg[1]);
|
||||||
* If exists, load the API class for enable module
|
$moduledirforclass = getModuleDirForApiClass($module);
|
||||||
*
|
$moduleforperm = $module;
|
||||||
* Search files named api_<object>.class.php into /htdocs/<module>/class directory
|
if ($module == 'propale') { $moduleforperm='propal'; }
|
||||||
*
|
|
||||||
* @todo : use getElementProperties() function ?
|
|
||||||
*/
|
|
||||||
$dir_part = dol_buildpath('/'.$moduledirforclass.'/class/');
|
|
||||||
|
|
||||||
$handle_part=@opendir(dol_osencode($dir_part));
|
//dol_syslog("Found module file ".$file." - module=".$module." - moduledirforclass=".$moduledirforclass);
|
||||||
if (is_resource($handle_part))
|
|
||||||
|
// Defined if module is enabled
|
||||||
|
$enabled=true;
|
||||||
|
if (empty($conf->$moduleforperm->enabled)) $enabled=false;
|
||||||
|
|
||||||
|
if ($enabled)
|
||||||
{
|
{
|
||||||
while (($file_searched = readdir($handle_part))!==false)
|
// If exists, load the API class for enable module
|
||||||
{
|
// Search files named api_<object>.class.php into /htdocs/<module>/class directory
|
||||||
if ($file_searched == 'api_access.class.php') continue;
|
// @todo : use getElementProperties() function ?
|
||||||
|
$dir_part = dol_buildpath('/'.$moduledirforclass.'/class/');
|
||||||
|
|
||||||
// Support of the deprecated API.
|
$handle_part=@opendir(dol_osencode($dir_part));
|
||||||
if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$reg))
|
if (is_resource($handle_part))
|
||||||
|
{
|
||||||
|
while (($file_searched = readdir($handle_part))!==false)
|
||||||
{
|
{
|
||||||
$classname = ucwords($reg[1]).'Api';
|
if ($file_searched == 'api_access.class.php') continue;
|
||||||
require_once $dir_part.$file_searched;
|
|
||||||
if (class_exists($classname))
|
// Support of the deprecated API.
|
||||||
|
if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$reg))
|
||||||
{
|
{
|
||||||
//dol_syslog("Found deprecated API by index.php: classname=".$classname." for module ".$dir." into ".$dir_part.$file_searched);
|
$classname = ucwords($reg[1]).'Api';
|
||||||
$api->r->addAPIClass($classname, '/');
|
require_once $dir_part.$file_searched;
|
||||||
|
if (class_exists($classname))
|
||||||
|
{
|
||||||
|
//dol_syslog("Found deprecated API by index.php: classname=".$classname." for module ".$dir." into ".$dir_part.$file_searched);
|
||||||
|
$api->r->addAPIClass($classname, '/');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$reg))
|
||||||
{
|
{
|
||||||
dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING);
|
$classname = ucwords($reg[1]);
|
||||||
}
|
$classname = str_replace('_', '', $classname);
|
||||||
}
|
require_once $dir_part.$file_searched;
|
||||||
elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$reg))
|
if (class_exists($classname))
|
||||||
{
|
{
|
||||||
$classname = ucwords($reg[1]);
|
//dol_syslog("Found API by index.php: classname=".$classname." for module ".$dir." into ".$dir_part.$file_searched);
|
||||||
$classname = str_replace('_', '', $classname);
|
$listofapis[] = $classname;
|
||||||
require_once $dir_part.$file_searched;
|
}
|
||||||
if (class_exists($classname))
|
else
|
||||||
{
|
{
|
||||||
//dol_syslog("Found API by index.php: classname=".$classname." for module ".$dir." into ".$dir_part.$file_searched);
|
dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING);
|
||||||
$listofapis[] = $classname;
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -191,20 +195,60 @@ foreach ($modulesdir as $dir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort the classes before adding them to Restler.
|
||||||
|
// The Restler API Explorer shows the classes in the order they are added and it's a mess if they are not sorted.
|
||||||
|
sort($listofapis);
|
||||||
|
foreach ($listofapis as $classname)
|
||||||
|
{
|
||||||
|
$api->r->addAPIClass($classname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort the classes before adding them to Restler. The Restler API Explorer
|
// Call one APIs or one definition of an API
|
||||||
// shows the classes in the order they are added and it's a mess if they are
|
if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json' && preg_match('/^\/resources.json\/(.+)$/', $reg[2], $regbis))))
|
||||||
// not sorted.
|
|
||||||
sort($listofapis);
|
|
||||||
//var_dump($listofapis);
|
|
||||||
foreach ($listofapis as $classname)
|
|
||||||
{
|
{
|
||||||
$api->r->addAPIClass($classname);
|
$module = $reg[1];
|
||||||
|
if ($module == 'explorer') // If we call page to explore details of a service
|
||||||
|
{
|
||||||
|
$module = $regbis[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load a dedicated API file
|
||||||
|
dol_syslog("Load a dedicated API file");
|
||||||
|
|
||||||
|
$module=strtolower($module);
|
||||||
|
$moduledirforclass = getModuleDirForApiClass($module);
|
||||||
|
|
||||||
|
if (in_array($module, array('category','contact','customer','invoice','order','product','thirdparty','user'))) // Old Apis
|
||||||
|
{
|
||||||
|
$classfile = $module;
|
||||||
|
if ($module == 'customer') { $classfile = 'thirdparty'; }
|
||||||
|
if ($module == 'order') { $classfile = 'commande'; }
|
||||||
|
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_deprecated_'.$classfile.'.class.php');
|
||||||
|
$classname=ucwords($module);
|
||||||
|
if ($module == 'customer') { $classname='Thirdparty'; }
|
||||||
|
if ($module == 'order') { $classname='Commande'; }
|
||||||
|
//var_dump($classfile);var_dump($classname);exit;
|
||||||
|
|
||||||
|
require_once $dir_part_file;
|
||||||
|
if (class_exists($classname.'Api')) $api->r->addAPIClass($classname.'Api', '/');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$classfile = str_replace('_', '', $module);
|
||||||
|
if ($module == 'supplierinvoices') $classfile = 'supplier_invoices';
|
||||||
|
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php');
|
||||||
|
$classname=ucwords($module);
|
||||||
|
|
||||||
|
require_once $dir_part_file;
|
||||||
|
if (class_exists($classname)) $api->r->addAPIClass($classname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO If not found, redirect to explorer
|
// TODO If not found, redirect to explorer
|
||||||
//var_dump($api);
|
//var_dump($api->r->apiVersionMap);
|
||||||
|
//exit;
|
||||||
|
|
||||||
// Call API (we suppose we found it)
|
// Call API (we suppose we found it)
|
||||||
$api->r->handle();
|
$api->r->handle();
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/blockedlog/admin/blockedlog.php
|
* \file htdocs/blockedlog/admin/blockedlog.php
|
||||||
* \ingroup system
|
* \ingroup blockedlog
|
||||||
* \brief Page setup for blockedlog module
|
* \brief Page setup for blockedlog module
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -37,6 +37,7 @@ $action = GETPOST('action','alpha');
|
|||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (preg_match('/set_(.*)/',$action,$reg))
|
if (preg_match('/set_(.*)/',$action,$reg))
|
||||||
{
|
{
|
||||||
$code=$reg[1];
|
$code=$reg[1];
|
||||||
@ -77,7 +78,7 @@ $form=new Form($db);
|
|||||||
llxHeader('',$langs->trans("BlockedLogSetup"));
|
llxHeader('',$langs->trans("BlockedLogSetup"));
|
||||||
|
|
||||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
print load_fiche_titre($langs->trans("ModuleSetup").' BlockedLog',$linkback);
|
print load_fiche_titre($langs->trans("ModuleSetup").' '.$langs->trans('BlockedLog'),$linkback);
|
||||||
|
|
||||||
$head=blockedlogadmin_prepare_head();
|
$head=blockedlogadmin_prepare_head();
|
||||||
|
|
||||||
@ -95,13 +96,11 @@ print "</tr>\n";
|
|||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td class="titlefield">';
|
print '<td class="titlefield">';
|
||||||
print $langs->trans("EntityKey").'</td><td align="center">';
|
print $langs->trans("CompanyInitialKey").'</td><td>';
|
||||||
|
|
||||||
print $block_static->getSignature();
|
print $block_static->getSignature();
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) {
|
if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) {
|
||||||
// Example with a yes / no select
|
// Example with a yes / no select
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
|
|||||||
@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/blockedlog/admin/blockedlog.php
|
* \file htdocs/blockedlog/admin/fingerprints.php
|
||||||
* \ingroup system
|
* \ingroup blockedlog
|
||||||
* \brief Page setup for blockedlog module
|
* \brief Page setup for blockedlog module
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ $form=new Form($db);
|
|||||||
llxHeader('',$langs->trans("BlockedLogSetup"));
|
llxHeader('',$langs->trans("BlockedLogSetup"));
|
||||||
|
|
||||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
print load_fiche_titre($langs->trans("ModuleSetup").' BlockedLog',$linkback);
|
print load_fiche_titre($langs->trans("ModuleSetup").' '.$langs->trans('BlockedLog'),$linkback);
|
||||||
|
|
||||||
$head=blockedlogadmin_prepare_head();
|
$head=blockedlogadmin_prepare_head();
|
||||||
|
|
||||||
@ -131,12 +131,14 @@ print ' </div>';
|
|||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|
||||||
print '<td>'.$langs->trans('Date').'</td>';
|
print '<td class="minwidth50">'.$langs->trans('#').'</td>';
|
||||||
print '<td>'.$langs->trans('Ref').'</td>';
|
print '<td class="center">'.$langs->trans('Date').'</td>';
|
||||||
|
print '<td>'.$langs->trans('Author').'</td>';
|
||||||
print '<td>'.$langs->trans('Action').'</td>';
|
print '<td>'.$langs->trans('Action').'</td>';
|
||||||
|
print '<td>'.$langs->trans('Ref').'</td>';
|
||||||
print '<td>'.$langs->trans('Element').'</td>';
|
print '<td>'.$langs->trans('Element').'</td>';
|
||||||
print '<td>'.$langs->trans('Amount').'</td>';
|
print '<td>'.$langs->trans('Amount').'</td>';
|
||||||
print '<td>'.$langs->trans('Author').'</td>';
|
print '<td class="center">'.$langs->trans('DataOfArchivedEvent').'</td>';
|
||||||
print '<td>'.$langs->trans('Fingerprint').'</td>';
|
print '<td>'.$langs->trans('Fingerprint').'</td>';
|
||||||
print '<td><span id="blockchainstatus"></span></td>';
|
print '<td><span id="blockchainstatus"></span></td>';
|
||||||
|
|
||||||
@ -150,20 +152,27 @@ foreach($blocks as &$block) {
|
|||||||
if(!$showonlyerrors || $block->error>0) {
|
if(!$showonlyerrors || $block->error>0) {
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>'.$block->id.'</td>';
|
||||||
print '<td>'.dol_print_date($block->tms,'dayhour').'</td>';
|
print '<td>'.dol_print_date($block->tms,'dayhour').'</td>';
|
||||||
print '<td>'.$block->ref_object.'</td>';
|
|
||||||
print '<td>'.$langs->trans('log'.$block->action).'</td>';
|
|
||||||
print '<td>'.$object_link.'<a href="#" blockid="'.$block->id.'" rel="show-info">'.img_info($langs->trans('ShowDetails')).'</a></td>';
|
|
||||||
print '<td align="right">'.price($block->amounts).'</td>';
|
|
||||||
print '<td>'.$block->getUser().'</td>';
|
print '<td>'.$block->getUser().'</td>';
|
||||||
print '<td>'.$block->signature.'</td>';
|
print '<td>'.$langs->trans('log'.$block->action).'</td>';
|
||||||
print '<td>';
|
print '<td>'.$block->ref_object.'</td>';
|
||||||
|
print '<td>'.$object_link.'</td>';
|
||||||
|
print '<td align="right">'.price($block->amounts).'</td>';
|
||||||
|
print '<td align="center"><a href="#" blockid="'.$block->id.'" rel="show-info">'.img_info($langs->trans('ShowDetails')).'</a></td>';
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
print $form->textwithpicto(dol_trunc($block->signature, '12'), $block->signature);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
print $block->error == 0 ? img_picto($langs->trans('OkCheckFingerprintValidity'), 'tick') : img_picto($langs->trans('KoCheckFingerprintValidity'), 'statut8');
|
||||||
|
|
||||||
print $block->error == 0 ? img_picto($langs->trans('OkCheckFingerprintValidity'), 'on') : img_picto($langs->trans('KoCheckFingerprintValidity'), 'off');
|
|
||||||
if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {
|
if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {
|
||||||
print ' '.($block->certified ? img_picto($langs->trans('AddedByAuthority'), 'info') : img_picto($langs->trans('NotAddedByAuthorityYet'), 'info_black') );
|
print ' '.($block->certified ? img_picto($langs->trans('AddedByAuthority'), 'info') : img_picto($langs->trans('NotAddedByAuthorityYet'), 'info_black') );
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -171,6 +180,8 @@ foreach($blocks as &$block) {
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$('a[rel=show-info]').click(function() {
|
$('a[rel=show-info]').click(function() {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user