Merge remote-tracking branch 'refs/remotes/Dolibarr/develop' into develop
This commit is contained in:
commit
5f38beebbf
21
.travis.yml
21
.travis.yml
@ -37,6 +37,7 @@ php:
|
|||||||
- '5.6'
|
- '5.6'
|
||||||
- '7.0'
|
- '7.0'
|
||||||
- '7.1'
|
- '7.1'
|
||||||
|
- '7.2'
|
||||||
#- hhvm only with dist: trusty
|
#- hhvm only with dist: trusty
|
||||||
- nightly
|
- nightly
|
||||||
|
|
||||||
@ -71,6 +72,8 @@ matrix:
|
|||||||
env: DB=postgresql
|
env: DB=postgresql
|
||||||
- php: '7.0'
|
- php: '7.0'
|
||||||
env: DB=postgresql
|
env: DB=postgresql
|
||||||
|
- php: '7.1'
|
||||||
|
env: DB=postgresql
|
||||||
- php: hhvm
|
- php: hhvm
|
||||||
env: DB=postgresql
|
env: DB=postgresql
|
||||||
- php: nightly
|
- php: nightly
|
||||||
@ -79,7 +82,7 @@ matrix:
|
|||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
on_success: never # [always|never|change] default: change
|
on_success: never # [always|never|change] default: change
|
||||||
on_failure: change # [always|never|change] default: always
|
on_failure: never # [always|never|change] default: always
|
||||||
irc:
|
irc:
|
||||||
channels:
|
channels:
|
||||||
- "chat.freenode.net#dolibarr"
|
- "chat.freenode.net#dolibarr"
|
||||||
@ -123,7 +126,10 @@ install:
|
|||||||
if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ] || [ "$TRAVIS_PHP_VERSION" = '5.5' ]; then
|
if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ] || [ "$TRAVIS_PHP_VERSION" = '5.5' ]; then
|
||||||
composer -n require phpunit/phpunit ^4
|
composer -n require phpunit/phpunit ^4
|
||||||
fi
|
fi
|
||||||
if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ]; then
|
||||||
|
composer -n require phpunit/phpunit ^5
|
||||||
|
fi
|
||||||
|
if [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
||||||
composer -n require phpunit/phpunit ^5
|
composer -n require phpunit/phpunit ^5
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
@ -163,7 +169,7 @@ before_script:
|
|||||||
#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, 7.2 and nightly!
|
||||||
echo 'extension = memcached.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
echo 'extension = memcached.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
||||||
fi
|
fi
|
||||||
phpenv rehash
|
phpenv rehash
|
||||||
@ -237,7 +243,7 @@ before_script:
|
|||||||
echo "Setting up Apache + FPM"
|
echo "Setting up Apache + FPM"
|
||||||
# enable php-fpm
|
# enable php-fpm
|
||||||
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf
|
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf
|
||||||
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
||||||
# Copy the included pool
|
# Copy the included pool
|
||||||
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf
|
cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf
|
||||||
fi
|
fi
|
||||||
@ -313,13 +319,13 @@ script:
|
|||||||
php upgrade2.php 3.9.0 4.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade390400-2.log
|
php upgrade2.php 3.9.0 4.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade390400-2.log
|
||||||
php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log
|
php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log
|
||||||
php upgrade.php 4.0.0 5.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade400500.log
|
php upgrade.php 4.0.0 5.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade400500.log
|
||||||
php upgrade2.php 4.0.0 5.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade400500-2.log
|
php upgrade2.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-2.log
|
||||||
php step5.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-3.log
|
php step5.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-3.log
|
||||||
php upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.log
|
php upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.log
|
||||||
php upgrade2.php 5.0.0 6.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade500600-2.log
|
php upgrade2.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-2.log
|
||||||
php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log
|
php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log
|
||||||
php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log
|
php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log
|
||||||
php upgrade2.php 6.0.0 7.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade600700-2.log
|
php upgrade2.php 6.0.0 7.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade600700-2.log
|
||||||
php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log
|
php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log
|
||||||
cd -
|
cd -
|
||||||
set +e
|
set +e
|
||||||
@ -332,6 +338,7 @@ script:
|
|||||||
|
|
||||||
- |
|
- |
|
||||||
echo "Unit testing"
|
echo "Unit testing"
|
||||||
|
phpunit --version
|
||||||
# Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file.
|
# Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file.
|
||||||
set -e
|
set -e
|
||||||
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||||
|
|||||||
10
COPYRIGHT
10
COPYRIGHT
@ -34,12 +34,11 @@ Swift Mailer 5.4.2-DEV MIT license Yes
|
|||||||
Stripe 4.7.0 MIT licence Yes Library for Stripe module
|
Stripe 4.7.0 MIT licence Yes Library for Stripe module
|
||||||
|
|
||||||
JS libraries:
|
JS libraries:
|
||||||
jQuery 1.11.3 MIT License Yes JS library
|
jQuery 3.1.1 MIT License Yes JS library
|
||||||
jQuery UI 1.11.4 GPL and MIT License Yes JS library plugin UI
|
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
|
||||||
jQuery select2 3.5.2 GPL and Apache License Yes JS library plugin for sexier multiselect
|
jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect
|
||||||
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
||||||
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
|
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
|
||||||
jQuery FileUpload 5.0.3 GPL and MIT License Yes JS library to upload files
|
|
||||||
jQuery Flot 0.8.3 MIT License Yes JS library to build graph
|
jQuery Flot 0.8.3 MIT License Yes JS library to build graph
|
||||||
jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images)
|
jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images)
|
||||||
jQuery Jeditable 1.7.1 GPL and MIT License Yes JS library plugin jeditable (to edit in place)
|
jQuery Jeditable 1.7.1 GPL and MIT License Yes JS library plugin jeditable (to edit in place)
|
||||||
@ -49,8 +48,7 @@ jQuery jqueryFileTree 1.0.1 GPL and MIT License Yes
|
|||||||
jQuery jquerytreeview 1.4.1 MIT License Yes JS library for filetree
|
jQuery jquerytreeview 1.4.1 MIT License Yes JS library for filetree
|
||||||
jQuery TableDnD 0.6 GPL and MIT License Yes JS library plugin TableDnD (to reorder table rows)
|
jQuery TableDnD 0.6 GPL and MIT License Yes JS library plugin TableDnD (to reorder table rows)
|
||||||
jQuery Timepicker 1.1.0 GPL and MIT License Yes JS library Timepicker addon for Datepicker
|
jQuery Timepicker 1.1.0 GPL and MIT License Yes JS library Timepicker addon for Datepicker
|
||||||
jQuery Tiptip 1.3 GPL and MIT License Yes JS library for tooltips
|
jsGanttImproved 1.7.5.4 BSD License Yes JS library (to build Gantt reports)
|
||||||
jsGanttImproved 1.7.5.2 BSD License Yes JS library (to build Gantt reports)
|
|
||||||
JsTimezoneDetect 1.0.6 MIT License Yes JS library to detect user timezone
|
JsTimezoneDetect 1.0.6 MIT License Yes JS library to detect user timezone
|
||||||
SwaggerUI 2.0.24 GPL-2+ Yes JS library to offer the REST API explorer
|
SwaggerUI 2.0.24 GPL-2+ Yes JS library to offer the REST API explorer
|
||||||
Ace 1.2.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
Ace 1.2.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||||
|
|||||||
93
ChangeLog
93
ChangeLog
@ -2,9 +2,31 @@
|
|||||||
English Dolibarr ChangeLog
|
English Dolibarr ChangeLog
|
||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
|
|
||||||
|
***** ChangeLog for 6.0.4 compared to 6.0.3 *****
|
||||||
|
FIX: #7737
|
||||||
|
FIX: #7751
|
||||||
|
FIX: #7756 Add better error message
|
||||||
|
FIX: #7786
|
||||||
|
FIX: #7806
|
||||||
|
FIX: #7824
|
||||||
|
FIX: add line bad price and ref
|
||||||
|
FIX: A lot of several fix on local taxes and NPR tax
|
||||||
|
FIX: createfromorder
|
||||||
|
FIX: CSS for IE10
|
||||||
|
FIX: external user cannot be set as internal
|
||||||
|
FIX: Filter type on actioncomm with multiselect doesn't work
|
||||||
|
FIX: list of donation not filtered on multicompany
|
||||||
|
FIX: list of module not complete when module mb_strlen not available
|
||||||
|
FIX: Locatax were not propagated when cloning order or proposal
|
||||||
|
FIX: Searching translation should not be case sensitive
|
||||||
|
FIX: Search into language is ok for file into external modules two.
|
||||||
|
FIX: test for filter fk_status
|
||||||
|
FIX: too much users on holiday list
|
||||||
|
FIX: Wrong alias sql
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 7.0.0 compared to 6.0.* *****
|
***** ChangeLog for 7.0.0 compared to 6.0.* *****
|
||||||
|
For users:
|
||||||
|
|
||||||
For developers:
|
For developers:
|
||||||
NEW: Add hook addAdminLdapOptions and doAction in ldap admin page
|
NEW: Add hook addAdminLdapOptions and doAction in ldap admin page
|
||||||
@ -12,19 +34,59 @@ NEW: complete_head_from_modules() in ldap_prepare_head()
|
|||||||
|
|
||||||
WARNING:
|
WARNING:
|
||||||
|
|
||||||
|
If you enabled (for test) the experimental BlockedLog module before 7.0, you must purge the table llx_blockedlog because
|
||||||
|
way to save data for final version has changed.
|
||||||
|
|
||||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||||
* The methode "cloture" on contract were renamed into "closeAll".
|
* The methode "cloture" on contract were renamed into "closeAll".
|
||||||
* The substitution key for reference of object is now __REF__ whatever is the object (it replaces __ORDERREF__,
|
* The method "is_erasable" of invoice return a value <= 0 if not erasable (value is meaning) instead of always 0.
|
||||||
|
* The substitution key for reference of objects is now __REF__ whatever is the object (it replaces __ORDERREF__,
|
||||||
__PROPALREF__, ...)
|
__PROPALREF__, ...)
|
||||||
* The substition key __SIGNATURE__ was renamed into __USER_SIGNATURE__ to standardize naming conventions.
|
* The substition key __SIGNATURE__ was renamed into __USER_SIGNATURE__ to follow naming conventions.
|
||||||
* Substitution keys with syntax %XXX% were renamed into __XXX__ to match others.
|
* Substitution keys with syntax %XXX% were renamed into __XXX__ to match others.
|
||||||
* Some REST API to access the dictionary (country, town, ...) were moved into a common API.
|
* Removed old deprecated REST API (APIs found into '/root' section of the REST API explorer in Dolibarr v6).
|
||||||
* Page bank/index.php and bank/bankentries.php were renamed into bank/list.php and bank/bankentries_list.php to
|
* Some REST API to access setup features, like dictionaries (country, town, extrafields, ...) were moved into a
|
||||||
follow page naming conventions (so default filter/sort order features can also work).
|
common API "/setup".
|
||||||
* The trigger ORDER_SUPPLIER_STATUS_ONPROCESS was renamed into ORDER_SUPPLIER_STATUS_ORDERED
|
* The REST API /documents were renamed into /documents/download and /documents/upload.
|
||||||
* The trigger ORDER_SUPPLIER_STATUS_RECEIVED_ALL was renamed into ORDER_SUPPLIER_STATUS_RECEIVED_COMPLETELY
|
* Page bank/index.php, bank/bankentries.php and comm/actions/listactions.php were renamed into
|
||||||
|
bank/list.php, bank/bankentries_list.php and comm/actions/list.php to follow page naming
|
||||||
|
conventions (so default filter/sort order features can also work for this pages).
|
||||||
|
* The trigger ORDER_SUPPLIER_STATUS_ONPROCESS was renamed into ORDER_SUPPLIER_STATUS_ORDERED.
|
||||||
|
* The trigger ORDER_SUPPLIER_STATUS_RECEIVED_ALL was renamed into ORDER_SUPPLIER_STATUS_RECEIVED_COMPLETELY.
|
||||||
|
* The parameter note into method cloture() is added at end of private note (previously in v6, it replaced).
|
||||||
|
* The parameter $user is now mandatory for method createFromOrder and createFromPropal.
|
||||||
|
* Removed js library 'fileupload' that was not used by core code.
|
||||||
|
* Jquery plugin tableDnd updated. You now need to use decodeURI on the return value of tableDnDSerialize()
|
||||||
|
and add 'td.' to the beginning of the dragHandle match string.
|
||||||
|
* IE8 and earlier and Firefox 12 and earlier (< 2012) are no more supported.
|
||||||
|
|
||||||
|
|
||||||
|
***** ChangeLog for 6.0.3 compared to 6.0.2 *****
|
||||||
|
FIX: #7211 Update qty dispatched on qty change
|
||||||
|
FIX: #7458
|
||||||
|
FIX: #7593
|
||||||
|
FIX: #7616
|
||||||
|
FIX: #7619
|
||||||
|
FIX: #7626
|
||||||
|
FIX: #7648
|
||||||
|
FIX: #7675
|
||||||
|
FIX: Agenda events are not exported in the ICAL, VCAL if begin exactly with the same $datestart
|
||||||
|
FIX: API to get object does not return data of linked objects
|
||||||
|
FIX: Bad localtax apply
|
||||||
|
FIX: Bad ressource list in popup in gantt view
|
||||||
|
FIX: bankentries search conciliated if val 0
|
||||||
|
FIX: hook formObjectOptions() must use $expe and not $object
|
||||||
|
FIX: make of link to other object during creation
|
||||||
|
FIX: Missing function getLinesArray
|
||||||
|
FIX: old batch not shown in multi shipping
|
||||||
|
FIX: paid supplier invoices are shown as abandoned
|
||||||
|
FIX: selection of thirdparty was lost on stats page of invoices
|
||||||
|
FIX: sql syntax error because of old field accountancy_journal
|
||||||
|
FIX: Stats on invoices show nothing
|
||||||
|
FIX: substitution in ODT of thirdparties documents
|
||||||
|
FIX: wrong key in selectarray
|
||||||
|
FIX: wrong personnal project time spent
|
||||||
|
|
||||||
***** ChangeLog for 6.0.2 compared to 6.0.1 *****
|
***** ChangeLog for 6.0.2 compared to 6.0.1 *****
|
||||||
FIX: #7148
|
FIX: #7148
|
||||||
FIX: #7288
|
FIX: #7288
|
||||||
@ -248,6 +310,23 @@ 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.7 compared to 5.0.6 *****
|
||||||
|
FIX: #7000 Dashboard link for late pending payment supplier invoices do not work
|
||||||
|
FIX: #7148
|
||||||
|
FIX: #7325 Default VAT rate when editing template invoices is 0%
|
||||||
|
FIX: #7366 renaming table with pgsql
|
||||||
|
FIX: #7391
|
||||||
|
FIX: #7510 Bug: extrafield content disappear when generate pdf within intervention
|
||||||
|
FIX: Agenda events are not exported in the ICAL, VCAL if begin exactly with the same $datestart
|
||||||
|
FIX: Bad link to unpayed suppliers invoices
|
||||||
|
FIX: bankentries search conciliated if val 0
|
||||||
|
FIX: multicompany better accuracy in rounding and with revenue stamp.
|
||||||
|
FIX: PDF output was sharing 2 different currencies in same total
|
||||||
|
FIX: Upgrade missing on field
|
||||||
|
FIX: wrong key in selectarray
|
||||||
|
FIX: wrong personnal project time spent
|
||||||
|
|
||||||
***** ChangeLog for 5.0.6 compared to 5.0.5 *****
|
***** ChangeLog for 5.0.6 compared to 5.0.5 *****
|
||||||
FIX: Removed a bad symbolic link into custom directory.
|
FIX: Removed a bad symbolic link into custom directory.
|
||||||
FIX: Renaming a resource ref rename also the directory of attached files.
|
FIX: Renaming a resource ref rename also the directory of attached files.
|
||||||
|
|||||||
@ -43,3 +43,5 @@ DoliWampWillStartApacheMysql=DoliWamp installer will now start or restart Apache
|
|||||||
OldVersionFoundAndMoveInNew=An old database version has been found and moved to be used by new Dolibarr version
|
OldVersionFoundAndMoveInNew=An old database version has been found and moved to be used by new Dolibarr version
|
||||||
OldVersionFoundButFailedToMoveInNew=An old database version has been found but could not be moved to be used with new Dolibarr version
|
OldVersionFoundButFailedToMoveInNew=An old database version has been found but could not be moved to be used with new Dolibarr version
|
||||||
|
|
||||||
|
DLLMissing=The "Visual C++ Redistributable for Visual Studio 2012" component is missing. Please install the 32-bit version (vcredit_x86.exe) first from https://www.microsoft.com/en-us/download/details.aspx?id=30679 and restart DoliWamp installation/upgrade.
|
||||||
|
ContinueAnyway=Continue anyway (install process may fails without this prerequisite)
|
||||||
|
|||||||
@ -32,7 +32,7 @@ AppPublisherURL=http://www.nltechno.com
|
|||||||
AppSupportURL=http://www.dolibarr.org
|
AppSupportURL=http://www.dolibarr.org
|
||||||
AppUpdatesURL=http://www.dolibarr.org
|
AppUpdatesURL=http://www.dolibarr.org
|
||||||
AppComments=DoliWamp includes Dolibarr, Apache, PHP and Mysql softwares.
|
AppComments=DoliWamp includes Dolibarr, Apache, PHP and Mysql softwares.
|
||||||
AppCopyright=Copyright (C) 2008-2016 Laurent Destailleur, NLTechno
|
AppCopyright=Copyright (C) 2008-2017 Laurent Destailleur (NLTechno), Fabian Rodriguez (Le Goût du Libre)
|
||||||
DefaultDirName=c:\dolibarr
|
DefaultDirName=c:\dolibarr
|
||||||
DefaultGroupName=Dolibarr
|
DefaultGroupName=Dolibarr
|
||||||
;LicenseFile=COPYING
|
;LicenseFile=COPYING
|
||||||
@ -202,10 +202,30 @@ var value: String;
|
|||||||
function InitializeSetup(): Boolean;
|
function InitializeSetup(): Boolean;
|
||||||
begin
|
begin
|
||||||
Result := MsgBox(CustomMessage('YouWillInstallDoliWamp')+#13#13+CustomMessage('ThisAssistantInstallOrUpgrade')+#13#13+CustomMessage('IfYouHaveTechnicalKnowledge')+#13#13+CustomMessage('ButIfYouLook')+#13#13+CustomMessage('DoYouWantToStart'), mbConfirmation, MB_YESNO) = IDYES;
|
Result := MsgBox(CustomMessage('YouWillInstallDoliWamp')+#13#13+CustomMessage('ThisAssistantInstallOrUpgrade')+#13#13+CustomMessage('IfYouHaveTechnicalKnowledge')+#13#13+CustomMessage('ButIfYouLook')+#13#13+CustomMessage('DoYouWantToStart'), mbConfirmation, MB_YESNO) = IDYES;
|
||||||
|
|
||||||
|
if Result then
|
||||||
|
begin
|
||||||
|
|
||||||
|
//----------------------------------------------
|
||||||
|
// Test if msvcr110 DLL has been installed
|
||||||
|
//----------------------------------------------
|
||||||
|
|
||||||
|
if not FileExists ('c:/windows/system32/msvcr110.dll') and not FileExists ('c:/windows/sysWOW64/msvcr110.dll') and not FileExists ('c:/winnt/system32/msvcr110.dll') and not FileExists ('c:/winnt/sysWOW64/msvcr110.dll') then
|
||||||
|
begin
|
||||||
|
// TODO - offer to install the component by opening the URL in the default browser, abort installation if user doesn't accept
|
||||||
|
Result := MsgBox(CustomMessage('DLLMissing')+#13#13+CustomMessage('ContinueAnyway'), mbConfirmation, MB_YESNO) = IDYES;
|
||||||
|
|
||||||
|
end;
|
||||||
|
// Pb seems similar with msvcp110.dll
|
||||||
|
//vcredist_x64.exe
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure InitializeWizard();
|
procedure InitializeWizard();
|
||||||
begin
|
begin
|
||||||
|
|
||||||
//version des applis, a modifier pour chaque version de WampServer 2
|
//version des applis, a modifier pour chaque version de WampServer 2
|
||||||
apacheVersion := '2.4.9';
|
apacheVersion := '2.4.9';
|
||||||
phpVersion := '5.5.12' ;
|
phpVersion := '5.5.12' ;
|
||||||
@ -217,6 +237,7 @@ begin
|
|||||||
mysqlPort := '3306';
|
mysqlPort := '3306';
|
||||||
newPassword := 'changeme';
|
newPassword := 'changeme';
|
||||||
|
|
||||||
|
|
||||||
firstinstall := true;
|
firstinstall := true;
|
||||||
|
|
||||||
|
|
||||||
@ -344,19 +365,6 @@ begin
|
|||||||
exedirold := pathWithSlashes+'/bin/mysql/mysql5.0.45';
|
exedirold := pathWithSlashes+'/bin/mysql/mysql5.0.45';
|
||||||
exedirnew := pathWithSlashes+'/bin/mysql/mysql5.0.45';
|
exedirnew := pathWithSlashes+'/bin/mysql/mysql5.0.45';
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------
|
|
||||||
// Test if msvcr110 DLL has been installed
|
|
||||||
//----------------------------------------------
|
|
||||||
|
|
||||||
if not FileExists ('c:/windows/system32/msvcr110.dll') and not FileExists ('c:/windows/sysWOW64/msvcr110.dll') and not FileExists ('c:/winnt/system32/msvcr110.dll') and not FileExists ('c:/winnt/sysWOW64/msvcr110.dll') then
|
|
||||||
begin
|
|
||||||
// TODO Copy file or ask to install package ?
|
|
||||||
//CustomMessage('YouWillInstallDoliWamp')+#13#13
|
|
||||||
MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from <a href="http://www.microsoft.com/en-us/download/details.aspx?id=30679">http://www.microsoft.com/en-us/download/details.aspx?id=30679</a> then restart DoliWamp installation/upgrade.',mbInformation,MB_OK);
|
|
||||||
end;
|
|
||||||
// Pb seems similar with msvcp110.dll
|
|
||||||
//vcredist_x64.exe
|
|
||||||
|
|
||||||
|
|
||||||
// If we have a new database version, we should only copy old my.ini file into new directory
|
// If we have a new database version, we should only copy old my.ini file into new directory
|
||||||
|
|||||||
@ -535,7 +535,7 @@ a:hover {
|
|||||||
<li><a href="?lang={$langues[$langue]['autreLangueLien1']}">{$langues[$langue]['autreLangue1']}</a>
|
<li><a href="?lang={$langues[$langue]['autreLangueLien1']}">{$langues[$langue]['autreLangue1']}</a>
|
||||||
- <a href="?lang={$langues[$langue]['autreLangueLien2']}">{$langues[$langue]['autreLangue2']}</a></li>
|
- <a href="?lang={$langues[$langue]['autreLangueLien2']}">{$langues[$langue]['autreLangue2']}</a></li>
|
||||||
<br><br>
|
<br><br>
|
||||||
<li>Provided by <a href="http://www.nltechno.com" targer="_blank">NLTechno</a></li>
|
<li>Provided by <a href="https://www.nltechno.com" targer="_blank">NLTechno</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</td></tr></table>
|
</td></tr></table>
|
||||||
<hr>
|
<hr>
|
||||||
@ -580,7 +580,7 @@ a:hover {
|
|||||||
|
|
||||||
|
|
||||||
<ul id="foot">
|
<ul id="foot">
|
||||||
<li><a href="http://www.nltechno.com/pages/dolibarrwinbin.php">DoliWamp project</a> was built from modified sources of <a href="http://www.wampserver.com">WampServer project</a> from Anaska</li>
|
<li><a href="https://www.nltechno.com/pages/dolibarrwinbin.php">DoliWamp project</a> was built from modified sources of <a href="http://www.wampserver.com">WampServer project</a> from Anaska</li>
|
||||||
</ul>
|
</ul>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -131,7 +131,7 @@ $iterator1 = new RecursiveIteratorIterator($dir_iterator1);
|
|||||||
$files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom?'':'custom\/|').'documents\/|conf\/|install\/))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i');
|
$files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom?'':'custom\/|').'documents\/|conf\/|install\/))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i');
|
||||||
*/
|
*/
|
||||||
$regextoinclude='\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$';
|
$regextoinclude='\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$';
|
||||||
$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install)$'; // Exclude dirs
|
$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
|
||||||
$files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
|
$files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
|
||||||
$dir='';
|
$dir='';
|
||||||
$needtoclose=0;
|
$needtoclose=0;
|
||||||
|
|||||||
@ -556,9 +556,6 @@ if ($nboftargetok) {
|
|||||||
$ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`;
|
$ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`;
|
||||||
$ret=`rm -f $BUILDROOT/$PROJECT/.gitignore $BUILDROOT/$PROJECT/*/.gitignore $BUILDROOT/$PROJECT/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.gitignore`;
|
$ret=`rm -f $BUILDROOT/$PROJECT/.gitignore $BUILDROOT/$PROJECT/*/.gitignore $BUILDROOT/$PROJECT/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.gitignore`;
|
||||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/geoip/sample*.*`;
|
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/geoip/sample*.*`;
|
||||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/jqueryFileTree/connectors/jqueryFileTree.pl`; # Avoid errors into rpmlint
|
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/template`; # Package not valid for most linux distributions (errors reported into compile.js). Package should be embed by modules to avoid problems.
|
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpmailer`; # Package not valid for most linux distributions (errors reported into file LICENSE). Package should be embed by modules to avoid problems.
|
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/adapters`; # Keep this removal in case we embed libraries
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/adapters`; # Keep this removal in case we embed libraries
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/samples`; # Keep this removal in case we embed libraries
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/samples`; # Keep this removal in case we embed libraries
|
||||||
#$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/_source`; # _source must be kept into tarball
|
#$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/_source`; # _source must be kept into tarball
|
||||||
@ -571,6 +568,7 @@ if ($nboftargetok) {
|
|||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mobiledetect/mobiledetectlib/.gitmodules`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mobiledetect/mobiledetectlib/.gitmodules`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/parsedown/LICENSE.txt`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/.gitattributes`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/.gitattributes`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Classes/license.md`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Classes/license.md`;
|
||||||
@ -579,6 +577,7 @@ if ($nboftargetok) {
|
|||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Examples`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Examples`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/unitTests`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/unitTests`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/license.md`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/license.md`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/LICENSE`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-*`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-*`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-*`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-*`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/ae_fonts_*`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/ae_fonts_*`;
|
||||||
@ -590,6 +589,8 @@ if ($nboftargetok) {
|
|||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
|
||||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`;
|
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`;
|
||||||
|
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`;
|
||||||
|
|
||||||
|
|
||||||
print "Remove subdir of custom dir\n";
|
print "Remove subdir of custom dir\n";
|
||||||
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\;\n";
|
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\;\n";
|
||||||
|
|||||||
@ -213,7 +213,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/user
|
%_datadir/dolibarr/htdocs/user
|
||||||
%_datadir/dolibarr/htdocs/variants
|
%_datadir/dolibarr/htdocs/variants
|
||||||
%_datadir/dolibarr/htdocs/webservices
|
%_datadir/dolibarr/htdocs/webservices
|
||||||
%_datadir/dolibarr/htdocs/websites
|
%_datadir/dolibarr/htdocs/website
|
||||||
%_datadir/dolibarr/htdocs/*.ico
|
%_datadir/dolibarr/htdocs/*.ico
|
||||||
%_datadir/dolibarr/htdocs/*.patch
|
%_datadir/dolibarr/htdocs/*.patch
|
||||||
%_datadir/dolibarr/htdocs/*.php
|
%_datadir/dolibarr/htdocs/*.php
|
||||||
|
|||||||
@ -293,7 +293,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/user
|
%_datadir/dolibarr/htdocs/user
|
||||||
%_datadir/dolibarr/htdocs/variants
|
%_datadir/dolibarr/htdocs/variants
|
||||||
%_datadir/dolibarr/htdocs/webservices
|
%_datadir/dolibarr/htdocs/webservices
|
||||||
%_datadir/dolibarr/htdocs/websites
|
%_datadir/dolibarr/htdocs/website
|
||||||
%_datadir/dolibarr/htdocs/*.ico
|
%_datadir/dolibarr/htdocs/*.ico
|
||||||
%_datadir/dolibarr/htdocs/*.patch
|
%_datadir/dolibarr/htdocs/*.patch
|
||||||
%_datadir/dolibarr/htdocs/*.php
|
%_datadir/dolibarr/htdocs/*.php
|
||||||
|
|||||||
@ -210,7 +210,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/user
|
%_datadir/dolibarr/htdocs/user
|
||||||
%_datadir/dolibarr/htdocs/variants
|
%_datadir/dolibarr/htdocs/variants
|
||||||
%_datadir/dolibarr/htdocs/webservices
|
%_datadir/dolibarr/htdocs/webservices
|
||||||
%_datadir/dolibarr/htdocs/websites
|
%_datadir/dolibarr/htdocs/website
|
||||||
%_datadir/dolibarr/htdocs/*.ico
|
%_datadir/dolibarr/htdocs/*.ico
|
||||||
%_datadir/dolibarr/htdocs/*.patch
|
%_datadir/dolibarr/htdocs/*.patch
|
||||||
%_datadir/dolibarr/htdocs/*.php
|
%_datadir/dolibarr/htdocs/*.php
|
||||||
|
|||||||
@ -221,7 +221,7 @@ done >>%{name}.lang
|
|||||||
%_datadir/dolibarr/htdocs/user
|
%_datadir/dolibarr/htdocs/user
|
||||||
%_datadir/dolibarr/htdocs/variants
|
%_datadir/dolibarr/htdocs/variants
|
||||||
%_datadir/dolibarr/htdocs/webservices
|
%_datadir/dolibarr/htdocs/webservices
|
||||||
%_datadir/dolibarr/htdocs/websites
|
%_datadir/dolibarr/htdocs/website
|
||||||
%_datadir/dolibarr/htdocs/*.ico
|
%_datadir/dolibarr/htdocs/*.ico
|
||||||
%_datadir/dolibarr/htdocs/*.patch
|
%_datadir/dolibarr/htdocs/*.patch
|
||||||
%_datadir/dolibarr/htdocs/*.php
|
%_datadir/dolibarr/htdocs/*.php
|
||||||
|
|||||||
@ -82,8 +82,14 @@ with
|
|||||||
// LDR To open in same window
|
// LDR To open in same window
|
||||||
//var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth);
|
//var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth);
|
||||||
window.location.href=pRef
|
window.location.href=pRef
|
||||||
* Replace hard coded string with i18n["String"];
|
|
||||||
|
|
||||||
|
* Replace
|
||||||
|
vTmpDiv=this.newNode(vTmpCell, 'div', null, null, vTaskList[i].getResource());
|
||||||
|
with
|
||||||
|
var vTmpNode=this.newNode(vTmpCell, 'div', null, '');
|
||||||
|
vTmpNode=this.newNode(vTmpNode, 'a', null, '', vLangs[vLang]['moreinfo']);
|
||||||
|
vTmpNode.setAttribute('href',vTaskList[i].getLink());
|
||||||
|
|
||||||
|
|
||||||
JCROP:
|
JCROP:
|
||||||
------
|
------
|
||||||
@ -99,7 +105,7 @@ JQUERYFILETREE:
|
|||||||
RESTLER:
|
RESTLER:
|
||||||
--------
|
--------
|
||||||
|
|
||||||
* Add 2 lines into function
|
* Add 2 lines into file AutoLoader.php to complete function
|
||||||
private function alias($className, $currentClass)
|
private function alias($className, $currentClass)
|
||||||
{
|
{
|
||||||
...
|
...
|
||||||
@ -110,4 +116,57 @@ to get
|
|||||||
if ($className == 'Luracast\Restler\string') return;
|
if ($className == 'Luracast\Restler\string') return;
|
||||||
if ($className == 'Luracast\Restler\mixed') return;
|
if ($className == 'Luracast\Restler\mixed') return;
|
||||||
...
|
...
|
||||||
|
|
||||||
|
Change also file Luracast/Restler/explorer/index.html
|
||||||
|
|
||||||
|
+With swagger 2:
|
||||||
|
|
||||||
|
* Add line into Util.php to complete function
|
||||||
|
|
||||||
|
public static function getShortName($className)
|
||||||
|
{
|
||||||
|
// @CHANGE LDR
|
||||||
|
if (! is_string($className)) return;
|
||||||
|
//var_dump($className);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PARSEDOWN
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Add support of css by adding in Parsedown.php:
|
||||||
|
|
||||||
|
// @CHANGE LDR
|
||||||
|
'class' => $Link['element']['attributes']['class']
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
// @CHANGE LDR
|
||||||
|
if (preg_match('/{([^}]+)}/', $remainder, $matches2))
|
||||||
|
{
|
||||||
|
$Element['attributes']['class'] = $matches2[1];
|
||||||
|
$remainder = preg_replace('/{'.preg_quote($matches2[1],'/').'}/', '', $remainder);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// @CHANGE LDR
|
||||||
|
//$markup .= $this->{$Element['handler']}($Element['text']);
|
||||||
|
$markup .= preg_replace('/>{[^}]+}/', '>', $this->{$Element['handler']}($Element['text']));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
* Fix to avoid fatal error when mb_strlen not available:
|
||||||
|
|
||||||
|
// @CHANGE LDR Fix when mb_strlen is not available
|
||||||
|
//$shortage = 4 - mb_strlen($line, 'utf-8') % 4;
|
||||||
|
if (function_exists('mb_strlen')) $len = mb_strlen($line, 'utf-8');
|
||||||
|
else $len = strlen($line);
|
||||||
|
$shortage = 4 - $len % 4;
|
||||||
|
|
||||||
|
|
||||||
|
JEDITABLE.JS
|
||||||
|
------------
|
||||||
|
|
||||||
|
* <button type="submit" /> => <button class="button" type="submit" />
|
||||||
|
* <button type="cancel" /> => <button class="button" type="cancel" />
|
||||||
|
|
||||||
|
|||||||
@ -7,3 +7,7 @@
|
|||||||
# ldapsearch -h hostname -x -b "ou=people,dc=teclib,dc=infra"
|
# ldapsearch -h hostname -x -b "ou=people,dc=teclib,dc=infra"
|
||||||
# ldapsearch -h hostname -x -z 0 -b "o=somecompany.com" -D "cn=manager,o=somecompany.com" -w password "(objectclass=*)"
|
# ldapsearch -h hostname -x -z 0 -b "o=somecompany.com" -D "cn=manager,o=somecompany.com" -w password "(objectclass=*)"
|
||||||
# ldapsearch -h hostname -x -b "o=somecompany.com" -D "cn=manager,o=somecompany.com" -w password "(objectclass=*)"
|
# ldapsearch -h hostname -x -b "o=somecompany.com" -D "cn=manager,o=somecompany.com" -w password "(objectclass=*)"
|
||||||
|
#
|
||||||
|
# Example to test a ldap search:
|
||||||
|
# ldapsearch -h hostname -x -z 5 -b 'OU=Collaborateurs,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -D 'CN=UserAdmin,OU=Informatique,OU=Utilisateurs,OU=MyCompany,DC=bocal,DC=lan' -w password
|
||||||
|
|
||||||
|
|||||||
@ -78,15 +78,17 @@ $sqls=array(
|
|||||||
'DELETE FROM '.MAIN_DB_PREFIX.'propaldet',
|
'DELETE FROM '.MAIN_DB_PREFIX.'propaldet',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'propal',
|
'DELETE FROM '.MAIN_DB_PREFIX.'propal',
|
||||||
),
|
),
|
||||||
'supplier_order'=>array(
|
'supplier_proposal'=>array(
|
||||||
|
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposaldet',
|
||||||
|
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposal',
|
||||||
|
),
|
||||||
|
'supplier_order'=>array(
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet',
|
'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseur',
|
'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseur',
|
||||||
),
|
),
|
||||||
'supplier_invoice'=>array(
|
'supplier_invoice'=>array(
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det',
|
'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn',
|
'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposaldet',
|
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposal',
|
|
||||||
),
|
),
|
||||||
'delivery'=>array(
|
'delivery'=>array(
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'livraisondet',
|
'DELETE FROM '.MAIN_DB_PREFIX.'livraisondet',
|
||||||
@ -114,8 +116,10 @@ $sqls=array(
|
|||||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_lang',
|
'DELETE FROM '.MAIN_DB_PREFIX.'product_lang',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_price',
|
'DELETE FROM '.MAIN_DB_PREFIX.'product_price',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_fournisseur_price',
|
'DELETE FROM '.MAIN_DB_PREFIX.'product_fournisseur_price',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_stock',
|
'DELETE FROM '.MAIN_DB_PREFIX.'product_batch',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'product',
|
'DELETE FROM '.MAIN_DB_PREFIX.'product_stock',
|
||||||
|
'DELETE FROM '.MAIN_DB_PREFIX.'product_lot',
|
||||||
|
'DELETE FROM '.MAIN_DB_PREFIX.'product',
|
||||||
),
|
),
|
||||||
'project'=>array(
|
'project'=>array(
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'projet_task_time',
|
'DELETE FROM '.MAIN_DB_PREFIX.'projet_task_time',
|
||||||
@ -128,12 +132,13 @@ $sqls=array(
|
|||||||
),
|
),
|
||||||
'thirdparty'=>array(
|
'thirdparty'=>array(
|
||||||
'@contact',
|
'@contact',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'cabinetmed_cons',
|
'DELETE FROM '.MAIN_DB_PREFIX.'cabinetmed_cons',
|
||||||
'UPDATE '.MAIN_DB_PREFIX.'adherent SET fk_soc = NULL',
|
'UPDATE '.MAIN_DB_PREFIX.'adherent SET fk_soc = NULL',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'categorie_fournisseur',
|
'DELETE FROM '.MAIN_DB_PREFIX.'categorie_fournisseur',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'categorie_societe',
|
'DELETE FROM '.MAIN_DB_PREFIX.'categorie_societe',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'societe_remise_except',
|
'DELETE FROM '.MAIN_DB_PREFIX.'societe_remise_except',
|
||||||
'DELETE FROM '.MAIN_DB_PREFIX.'societe',
|
'DELETE FROM '.MAIN_DB_PREFIX.'societe_rib',
|
||||||
|
'DELETE FROM '.MAIN_DB_PREFIX.'societe',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -152,27 +157,37 @@ $mode = $argv[1];
|
|||||||
$option = $argv[2];
|
$option = $argv[2];
|
||||||
|
|
||||||
if (empty($mode) || ! in_array($mode,array('test','confirm'))) {
|
if (empty($mode) || ! in_array($mode,array('test','confirm'))) {
|
||||||
print "Usage: $script_file (test|confirm) (all|option)\n";
|
print "Usage: $script_file (test|confirm) (all|option) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
|
||||||
print "\n";
|
print "\n";
|
||||||
print "option can be ".implode(',',array_keys($sqls))."\n";
|
print "option can be ".implode(',',array_keys($sqls))."\n";
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($option) || ! in_array($option, array_merge(array('all'),array_keys($sqls))) ) {
|
if (empty($option) || ! in_array($option, array_merge(array('all'),array_keys($sqls))) ) {
|
||||||
print "Usage: $script_file (test|confirm) (all|option)\n";
|
print "Usage: $script_file (test|confirm) (all|option) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
|
||||||
print "\n";
|
print "\n";
|
||||||
print "option can be ".implode(',',array_keys($sqls))."\n";
|
print "option can be ".implode(',',array_keys($sqls))."\n";
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Replace database handler
|
||||||
|
if (! empty($argv[3]))
|
||||||
|
{
|
||||||
|
$db->close();
|
||||||
|
unset($db);
|
||||||
|
$db=getDoliDBInstance($argv[3], $argv[4], $argv[5], $argv[6], $argv[7], $argv[8]);
|
||||||
|
$user=new User($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
//var_dump($user->db->database_name);
|
||||||
$ret=$user->fetch('','admin');
|
$ret=$user->fetch('','admin');
|
||||||
if (! $ret > 0)
|
if (! $ret > 0)
|
||||||
{
|
{
|
||||||
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
|
print 'An admin user with login "admin" must exists to use this script.'."\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$user->getrights();
|
//$user->getrights();
|
||||||
|
|
||||||
|
|
||||||
print "Purge all data for this database:\n";
|
print "Purge all data for this database:\n";
|
||||||
print "Server = ".$db->database_host."\n";
|
print "Server = ".$db->database_host."\n";
|
||||||
@ -190,14 +205,14 @@ if (! $confirmed)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Process sql requests of a family
|
* Process sql requests of a family
|
||||||
*
|
*
|
||||||
* @param string $family Name of family key of array $sqls
|
* @param string $family Name of family key of array $sqls
|
||||||
* @return int -1 if KO, 1 if OK
|
* @return int -1 if KO, 1 if OK
|
||||||
*/
|
*/
|
||||||
function processfamily($family)
|
function processfamily($family)
|
||||||
{
|
{
|
||||||
global $db, $sqls;
|
global $db, $sqls;
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
foreach($sqls[$family] as $sql)
|
foreach($sqls[$family] as $sql)
|
||||||
{
|
{
|
||||||
@ -207,7 +222,7 @@ function processfamily($family)
|
|||||||
processfamily($newfamily);
|
processfamily($newfamily);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
print "Run sql: ".$sql."\n";
|
print "Run sql: ".$sql."\n";
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
@ -217,7 +232,7 @@ function processfamily($family)
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
print $db->lasterror();
|
print $db->lasterror();
|
||||||
@ -225,7 +240,7 @@ function processfamily($family)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error) return -1;
|
if ($error) return -1;
|
||||||
else return 1;
|
else return 1;
|
||||||
}
|
}
|
||||||
@ -242,7 +257,7 @@ foreach($sqls as $family => $familysql)
|
|||||||
$oldfamily = $family;
|
$oldfamily = $family;
|
||||||
|
|
||||||
$result=processfamily($family);
|
$result=processfamily($family);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
break;
|
break;
|
||||||
|
|||||||
14
dev/resources/iso-normes/accountancy_rules.txt
Normal file
14
dev/resources/iso-normes/accountancy_rules.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
Gestion escompte:
|
||||||
|
|
||||||
|
Sur une facture de 120 € TTC :
|
||||||
|
707xxx 100 € HT
|
||||||
|
44571x 20 € TVA
|
||||||
|
411xxx 120 € TTC
|
||||||
|
|
||||||
|
Le client règle rapidement et on lui accorde un escompte de 3% (120 € * 3% = 3.6 € TTC), on aura donc :
|
||||||
|
665000 3,00 € HT
|
||||||
|
44571x 0,60 € TVA
|
||||||
|
411xxx 3.60 € TVA
|
||||||
|
|
||||||
|
Et ça marche à l’inverse avec un fournisseur sauf que l’on est en 775000 au lieu de 665000 pour escompte obtenus.
|
||||||
@ -11,3 +11,25 @@ Banque Banque 17306 20170119 5121CRA CR AGRICOLE A01 20170119 ZDAV courtage s/
|
|||||||
Banque Banque 17306 20170119 401ZDAV SANDRA DAVILA A01 20170119 ZDAV courtage s/ ventes 508,00 0,00 20170119
|
Banque Banque 17306 20170119 401ZDAV SANDRA DAVILA A01 20170119 ZDAV courtage s/ ventes 508,00 0,00 20170119
|
||||||
Banque Banque 17307 20170119 401ZDAV SANDRA DAVILA A01 20170119 ZDAV courtage s/ ventes 508,00 0,00 20170131
|
Banque Banque 17307 20170119 401ZDAV SANDRA DAVILA A01 20170119 ZDAV courtage s/ ventes 508,00 0,00 20170131
|
||||||
Banque Banque 17307 20170119 5121CRA CR AGRICOLE A01 20170119 ZDAV courtage s/ ventes 0,00 508,00 20170131
|
Banque Banque 17307 20170119 5121CRA CR AGRICOLE A01 20170119 ZDAV courtage s/ ventes 0,00 508,00 20170131
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Other example
|
||||||
|
JournalCode JournalLib EcritureNum EcritureDate CompteNum CompteLib CompAuxNum CompAuxLib PieceRef PieceDate EcritureLib Debit Credit EcritureLet DateLet ValidDate Montantdevise Idevise
|
||||||
|
FAC Factures clients AB6/FAC/2017/0045 20171120 41110000 Clients - Ventes de biens ou de prestations de services ID 2892 2 Et 3 Dimensions - 20171120 / 1 0 0 0 20171120
|
||||||
|
FAC Factures clients AB6/FAC/2017/0052 20171120 70710000 Marchandises (ou groupe) A ID 2892 2 Et 3 Dimensions - 20171120 [AX] Activités Annexes 0 0 1 0 20171120
|
||||||
|
FAC Factures clients AB6/FAC/2017/0052 20171120 70710000 Marchandises (ou groupe) A ID 2892 2 Et 3 Dimensions - 20171120 [AX] Activités Annexes 0 0 1 0 20171120
|
||||||
|
FAC Factures clients AB6/FAC/2017/0052 20171120 41110000 Clients - Ventes de biens ou de prestations de services ID 2892 2 Et 3 Dimensions - 20171120 / 2 0 0 0 20171120
|
||||||
|
OUV Balance initiale Balance initiale BRED 20171101 51215000 BRED - 20171101 / 6201 0 0 0 20171101
|
||||||
|
OUV Balance initiale Balance initiale Crédit Coopératif Nation 20171101 51211000 Crédit Coopératif Nation - 20171101 / 1364 20 0 0 20171101
|
||||||
|
OUV Balance initiale Balance initiale TVA collectée (Taux Intermédiaire) 20171101 44571200 TVA collectée (Taux Intermédiaire) - 20171101 / 0 0 147 4 20171101
|
||||||
|
OUV Balance initiale Balance initiale TVA déductible intracommunautaire 20171101 44566200 TVA déductible intracommunautaire - 20171101 / 18 0 0 0 20171101
|
||||||
|
OUV Balance initiale Balance initiale Capital souscrit - non appelé 20171101 10110000 Capital souscrit - non appelé - 20171101 / 10 0 0 0 20171101
|
||||||
|
OUV Balance initiale Balance initiale Réserves statutaires ou contractuelles 20171101 10630000 Réserves statutaires ou contractuelles - 20171101 / 0 0 10 0 20171101
|
||||||
|
OUV Balance initiale Balance initiale Frais entrepreneurs 20171101 46750000 Frais entrepreneurs - 20171101 / 0 0 100 0 20171101
|
||||||
|
OUV Balance initiale Balance initiale Fournissseurs réglés par Coopaname 20171101 40100000 Fournissseurs réglés par Coopaname - 20171101 / 0 0 4123 20 20171101
|
||||||
|
OUV Balance initiale Balance initiale TVA sur autres biens et services 20171101 44566000 TVA sur autres biens et services - 20171101 / 507 70 0 0 20171101
|
||||||
|
OUV Balance initiale Balance initiale TVA en attente à 20% 20171101 44572200 TVA en attente à 20% - 20171101 / 200 0 0 0 20171101
|
||||||
|
|||||||
133
dev/resources/sepa/test.xml
Normal file
133
dev/resources/sepa/test.xml
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<CstmrDrctDbtInitn>
|
||||||
|
<GrpHdr>
|
||||||
|
<MsgId>PREL20171012/REF10</MsgId>
|
||||||
|
<CreDtTm>2017-10-12T00:08:30</CreDtTm>
|
||||||
|
<NbOfTxs>2</NbOfTxs>
|
||||||
|
<CtrlSum>734.4</CtrlSum>
|
||||||
|
<InitgPty>
|
||||||
|
<Nm>MyBigCompany</Nm>
|
||||||
|
<Id>
|
||||||
|
<PrvtId>
|
||||||
|
<Othr>
|
||||||
|
<Id>FR76AAAAA</Id>
|
||||||
|
</Othr>
|
||||||
|
</PrvtId>
|
||||||
|
</Id>
|
||||||
|
</InitgPty>
|
||||||
|
</GrpHdr>
|
||||||
|
<PmtInf>
|
||||||
|
<PmtInfId>PREL20171012/ID00010-T171001</PmtInfId>
|
||||||
|
<PmtMtd>DD</PmtMtd>
|
||||||
|
<NbOfTxs>2</NbOfTxs>
|
||||||
|
<CtrlSum>734.4</CtrlSum>
|
||||||
|
<PmtTpInf>
|
||||||
|
<SvcLvl>
|
||||||
|
<Cd>SEPA</Cd>
|
||||||
|
</SvcLvl>
|
||||||
|
<LclInstrm>
|
||||||
|
<Cd>CORE</Cd>
|
||||||
|
</LclInstrm>
|
||||||
|
<SeqTp>RCUR</SeqTp>
|
||||||
|
</PmtTpInf>
|
||||||
|
<ReqdColltnDt>2017-10-12</ReqdColltnDt>
|
||||||
|
<Cdtr>
|
||||||
|
<Nm>MyBigCompany</Nm>
|
||||||
|
<PstlAdr>
|
||||||
|
<Ctry>FR</Ctry>
|
||||||
|
<AdrLine>Address1</AdrLine>
|
||||||
|
<AdrLine>Address2</AdrLine>
|
||||||
|
</PstlAdr>
|
||||||
|
</Cdtr>
|
||||||
|
<CdtrAcct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>FR76123456</IBAN>
|
||||||
|
</Id>
|
||||||
|
</CdtrAcct>
|
||||||
|
<CdtrAgt>
|
||||||
|
<FinInstnId>
|
||||||
|
<BIC>BICABCDEF</BIC>
|
||||||
|
</FinInstnId>
|
||||||
|
</CdtrAgt>
|
||||||
|
<ChrgBr>SLEV</ChrgBr>
|
||||||
|
<CdtrSchmeId>
|
||||||
|
<Id>
|
||||||
|
<PrvtId>
|
||||||
|
<Othr>
|
||||||
|
<Id>FR76AAAAA</Id>
|
||||||
|
<SchmeNm>
|
||||||
|
<Prtry>SEPA</Prtry>
|
||||||
|
</SchmeNm>
|
||||||
|
</Othr>
|
||||||
|
</PrvtId>
|
||||||
|
</Id>
|
||||||
|
</CdtrSchmeId>
|
||||||
|
<DrctDbtTxInf>
|
||||||
|
<PmtId>
|
||||||
|
<EndToEndId>AS-FA1710-0416-000679</EndToEndId>
|
||||||
|
</PmtId>
|
||||||
|
<InstdAmt Ccy="EUR">540</InstdAmt>
|
||||||
|
<DrctDbtTx>
|
||||||
|
<MndtRltdInf>
|
||||||
|
<MndtId>RUM-CU1610-0001-3-1476058417</MndtId>
|
||||||
|
<DtOfSgntr>2016-10-10</DtOfSgntr>
|
||||||
|
<AmdmntInd>false</AmdmntInd>
|
||||||
|
</MndtRltdInf>
|
||||||
|
</DrctDbtTx>
|
||||||
|
<DbtrAgt>
|
||||||
|
<FinInstnId>
|
||||||
|
<BIC>BICXYZ</BIC>
|
||||||
|
</FinInstnId>
|
||||||
|
</DbtrAgt>
|
||||||
|
<Dbtr>
|
||||||
|
<Nm>CUSTOMER A</Nm>
|
||||||
|
<PstlAdr>
|
||||||
|
<Ctry>FR</Ctry>
|
||||||
|
<AdrLine>Mr abc</AdrLine>
|
||||||
|
</PstlAdr>
|
||||||
|
</Dbtr>
|
||||||
|
<DbtrAcct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>FR123456</IBAN>
|
||||||
|
</Id>
|
||||||
|
</DbtrAcct>
|
||||||
|
<RmtInf>
|
||||||
|
<Ustrd>FA1710-0416</Ustrd>
|
||||||
|
</RmtInf>
|
||||||
|
</DrctDbtTxInf>
|
||||||
|
<DrctDbtTxInf>
|
||||||
|
<PmtId>
|
||||||
|
<EndToEndId>AS-FA1710-0415-000683</EndToEndId>
|
||||||
|
</PmtId>
|
||||||
|
<InstdAmt Ccy="EUR">194.4</InstdAmt>
|
||||||
|
<DrctDbtTx>
|
||||||
|
<MndtRltdInf>
|
||||||
|
<MndtId>RUM-CU1709-0011-4-1506525346</MndtId>
|
||||||
|
<DtOfSgntr>2017-09-27</DtOfSgntr>
|
||||||
|
<AmdmntInd>false</AmdmntInd>
|
||||||
|
</MndtRltdInf>
|
||||||
|
</DrctDbtTx>
|
||||||
|
<DbtrAgt>
|
||||||
|
<FinInstnId>
|
||||||
|
<BIC>BICJKL</BIC>
|
||||||
|
</FinInstnId>
|
||||||
|
</DbtrAgt>
|
||||||
|
<Dbtr>
|
||||||
|
<Nm>CUSTOMER2</Nm>
|
||||||
|
<PstlAdr>
|
||||||
|
<Ctry>FR</Ctry>
|
||||||
|
</PstlAdr>
|
||||||
|
</Dbtr>
|
||||||
|
<DbtrAcct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>FR76123456</IBAN>
|
||||||
|
</Id>
|
||||||
|
</DbtrAcct>
|
||||||
|
<RmtInf>
|
||||||
|
<Ustrd>FA1710-0415</Ustrd>
|
||||||
|
</RmtInf>
|
||||||
|
</DrctDbtTxInf>
|
||||||
|
</PmtInf>
|
||||||
|
</CstmrDrctDbtInitn>
|
||||||
|
</Document>
|
||||||
62
dev/setup/apache/virtualhost
Normal file
62
dev/setup/apache/virtualhost
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<VirtualHost *:80>
|
||||||
|
#php_admin_value sendmail_path "/usr/sbin/sendmail -t -i"
|
||||||
|
#php_admin_value mail.force_extra_parameters "-f postmaster@mydomain.com"
|
||||||
|
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com"
|
||||||
|
php_admin_value open_basedir /tmp/:/home/../htdocs
|
||||||
|
|
||||||
|
ServerName myvirtualalias
|
||||||
|
ServerAlias myvirtualalias
|
||||||
|
|
||||||
|
UseCanonicalName On
|
||||||
|
|
||||||
|
AddDefaultCharset UTF-8
|
||||||
|
|
||||||
|
DocumentRoot "/home/.../htdocs"
|
||||||
|
|
||||||
|
<Directory /home/.../htdocs/>
|
||||||
|
AllowOverride None
|
||||||
|
Options -Indexes -MultiViews +FollowSymLinks -ExecCGI
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Directory "/home/../htdocs/cache">
|
||||||
|
Deny from all
|
||||||
|
RemoveHandler .phtml .php .php3 .php4 .php5 .php6 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml
|
||||||
|
AddType application/x-httpd-php-source .phtml .php .php3 .php4 .php5 .php6 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
|
||||||
|
ErrorLog /var/log/apache2/myvirtualalias_error_log
|
||||||
|
TransferLog /var/log/apache2/myvirtualalias_access_log
|
||||||
|
|
||||||
|
# Compress returned resources of type php pages, text file export, css and javascript
|
||||||
|
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
|
||||||
|
|
||||||
|
AddType text/javascript .jgz
|
||||||
|
AddEncoding gzip .jgz
|
||||||
|
ExpiresActive On
|
||||||
|
ExpiresByType image/x-icon A2592000
|
||||||
|
ExpiresByType image/gif A2592000
|
||||||
|
ExpiresByType image/png A2592000
|
||||||
|
ExpiresByType image/jpeg A2592000
|
||||||
|
ExpiresByType text/css A2592000
|
||||||
|
ExpiresByType text/javascript A2592000
|
||||||
|
ExpiresByType application/x-javascript A2592000
|
||||||
|
ExpiresByType application/javascript A2592000
|
||||||
|
|
||||||
|
SSLEngine On
|
||||||
|
|
||||||
|
# A self-signed (snakeoil) certificate can be created by installing
|
||||||
|
# the ssl-cert package. See
|
||||||
|
# /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
|
||||||
|
# If both key and certificate are stored in the same file, only the
|
||||||
|
# SSLCertificateFile directive is needed.
|
||||||
|
SSLCertificateFile /etc/letsencrypt/live/www.mydomain.com/cert.pem
|
||||||
|
SSLCertificateKeyFile /etc/letsencrypt/live/www.mydomain.com/privkey.pem
|
||||||
|
SSLCertificateChainFile /etc/letsencrypt/live/www.mydomain.com/chain.pem
|
||||||
|
|
||||||
|
#RewriteEngine on
|
||||||
|
#RewriteCond %{SERVER_PORT} ^80$
|
||||||
|
#RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]
|
||||||
|
|
||||||
|
</VirtualHost>
|
||||||
@ -131,7 +131,7 @@
|
|||||||
</rule>
|
</rule>
|
||||||
<rule ref="Generic.Metrics.NestingLevel">
|
<rule ref="Generic.Metrics.NestingLevel">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="nestingLevel" value="10" />
|
<property name="nestingLevel" value="12" />
|
||||||
<property name="absoluteNestingLevel" value="50" />
|
<property name="absoluteNestingLevel" value="50" />
|
||||||
</properties>
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
|
|||||||
@ -46,13 +46,20 @@ then
|
|||||||
then
|
then
|
||||||
aaupper="GR"
|
aaupper="GR"
|
||||||
fi
|
fi
|
||||||
|
if [ $bb = "EG" ]
|
||||||
|
then
|
||||||
|
aaupper="SA"
|
||||||
|
fi
|
||||||
|
|
||||||
bblower=`echo $dirshort | nawk -F"_" '{ print tolower($2) }'`
|
bblower=`echo $dirshort | nawk -F"_" '{ print tolower($2) }'`
|
||||||
|
|
||||||
|
echo "***** Process language "$aa"_"$bb
|
||||||
if [ "$aa" != "$bblower" -a "$dirshort" != "en_US" ]
|
if [ "$aa" != "$bblower" -a "$dirshort" != "en_US" ]
|
||||||
then
|
then
|
||||||
reflang="htdocs/langs/"$aa"_"$aaupper
|
reflang="htdocs/langs/"$aa"_"$aaupper
|
||||||
if [ -d $reflang -a $aa"_"$bb != $aa"_"$aaupper ]
|
if [ -d $reflang -a $aa"_"$bb != $aa"_"$aaupper ]
|
||||||
then
|
then
|
||||||
echo "***** Process language "$aa"_"$bb" - Search original into "$reflang
|
echo "***** Search original into "$reflang
|
||||||
echo $dirshort is an alternative language of $reflang
|
echo $dirshort is an alternative language of $reflang
|
||||||
echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
|
echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
|
||||||
./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
|
./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
|
||||||
|
|||||||
BIN
doc/images/dolibarr_screenshot1_1680x1050.png
Normal file
BIN
doc/images/dolibarr_screenshot1_1680x1050.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 255 KiB |
BIN
doc/images/dolibarr_screenshot4_1680x1050.png
Normal file
BIN
doc/images/dolibarr_screenshot4_1680x1050.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 171 KiB |
BIN
doc/images/dolibarr_screenshot9_1680x1050.png
Normal file
BIN
doc/images/dolibarr_screenshot9_1680x1050.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 200 KiB |
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -67,8 +67,8 @@ $arrayfields=array(
|
|||||||
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
|
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
|
||||||
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||||
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0),
|
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0),
|
||||||
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
|
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
|
||||||
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
|
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
|
||||||
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
|
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -105,14 +105,32 @@ if (empty($reshook))
|
|||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST('change_chart'))
|
if (GETPOST('change_chart','alpha'))
|
||||||
{
|
{
|
||||||
$chartofaccounts = GETPOST('chartofaccounts', 'int');
|
$chartofaccounts = GETPOST('chartofaccounts', 'int');
|
||||||
|
|
||||||
if (! empty($chartofaccounts)) {
|
if ($chartofaccounts > 0)
|
||||||
|
{
|
||||||
|
// Get language code for this $chartofaccounts
|
||||||
|
$sql ='SELECT code FROM '.MAIN_DB_PREFIX.'c_country as c, '.MAIN_DB_PREFIX.'accounting_system as a';
|
||||||
|
$sql.=' WHERE c.rowid = a.fk_country AND a.rowid = '.(int) $chartofaccounts;
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$country_code = $obj->code;
|
||||||
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
|
|
||||||
|
// Try to load sql file
|
||||||
|
if ($country_code)
|
||||||
|
{
|
||||||
|
$sqlfile = DOL_DOCUMENT_ROOT.'/install/mysql/data/llx_accounting_account_'.strtolower($country_code).'.sql';
|
||||||
|
$result = run_sql($sqlfile, 1, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
|
if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
|
||||||
$error ++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$error ++;
|
$error ++;
|
||||||
@ -211,31 +229,36 @@ if ($resql)
|
|||||||
|
|
||||||
$htmlbuttonadd = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
|
$htmlbuttonadd = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
|
||||||
|
|
||||||
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $htmlbuttonadd, '', $limit);
|
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $htmlbuttonadd, '', $limit);
|
||||||
|
|
||||||
// Box to select active chart of account
|
// Box to select active chart of account
|
||||||
print $langs->trans("Selectchartofaccounts") . " : ";
|
print $langs->trans("Selectchartofaccounts") . " : ";
|
||||||
print '<select class="flat" name="chartofaccounts" id="chartofaccounts">';
|
print '<select class="flat" name="chartofaccounts" id="chartofaccounts">';
|
||||||
$sql = "SELECT rowid, pcg_version, label, active";
|
$sql = "SELECT a.rowid, a.pcg_version, a.label, a.active, c.code as country_code";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a";
|
||||||
$sql .= " WHERE active = 1";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON a.fk_country = c.rowid";
|
||||||
dol_syslog('accountancy/admin/account.php:: $sql=' . $sql);
|
$sql .= " WHERE a.active = 1";
|
||||||
|
dol_syslog('accountancy/admin/account.php $sql='.$sql);
|
||||||
|
print $sql;
|
||||||
$resqlchart = $db->query($sql);
|
$resqlchart = $db->query($sql);
|
||||||
if ($resqlchart) {
|
if ($resqlchart) {
|
||||||
$numbis = $db->num_rows($resqlchart);
|
$numbis = $db->num_rows($resqlchart);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ( $i < $numbis ) {
|
while ($i < $numbis) {
|
||||||
$row = $db->fetch_row($resqlchart);
|
$obj = $db->fetch_object($resqlchart);
|
||||||
|
|
||||||
print '<option value="' . $row[0] . '"';
|
print '<option value="' . $obj->rowid . '"';
|
||||||
print $pcgver == $row[0] ? ' selected' : '';
|
print ($pcgver == $obj->rowid) ? ' selected' : '';
|
||||||
print '>' . $row[1] . ' - ' . $row[2] . '</option>';
|
print '>' . $obj->pcg_version . ' - ' . $obj->label . ' - (' . $obj->country_code . ')</option>';
|
||||||
|
|
||||||
$i ++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
print "</select>";
|
print "</select>";
|
||||||
|
print ajax_combobox("chartofaccounts");
|
||||||
print '<input type="submit" class="button" name="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
print '<input type="submit" class="button" name="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|||||||
@ -41,14 +41,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
|
|
||||||
$langs->load("errors");
|
$langs->loadLangs(array("errors","admin","companies","resource","holiday","compta","accountancy","hrm"));
|
||||||
$langs->load("admin");
|
|
||||||
$langs->load("main");
|
|
||||||
$langs->load("companies");
|
|
||||||
$langs->load("resource");
|
|
||||||
$langs->load("holiday");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
$langs->load("hrm");
|
|
||||||
|
|
||||||
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
@ -68,7 +61,7 @@ $active = 1;
|
|||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
$offset = $listlimit * $page ;
|
$offset = $listlimit * $page ;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
@ -100,7 +93,7 @@ $tablib[32]= "DictionaryAccountancyCategory";
|
|||||||
|
|
||||||
// Requests to extract data
|
// Requests to extract data
|
||||||
$tabsql=array();
|
$tabsql=array();
|
||||||
$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s";
|
$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.fk_country as country_id, c.code as country_code, c.label as country, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_country=c.rowid and c.active=1";
|
||||||
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
||||||
|
|
||||||
// Criteria to sort dictionaries
|
// Criteria to sort dictionaries
|
||||||
@ -110,17 +103,17 @@ $tabsqlsort[32]="position ASC";
|
|||||||
|
|
||||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||||
$tabfield=array();
|
$tabfield=array();
|
||||||
$tabfield[31]= "pcg_version,label";
|
$tabfield[31]= "pcg_version,label,country_id,country";
|
||||||
$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
|
$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
|
||||||
|
|
||||||
// Nom des champs d'edition pour modification d'un enregistrement
|
// Nom des champs d'edition pour modification d'un enregistrement
|
||||||
$tabfieldvalue=array();
|
$tabfieldvalue=array();
|
||||||
$tabfieldvalue[31]= "pcg_version,label";
|
$tabfieldvalue[31]= "pcg_version,label,country";
|
||||||
$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country";
|
$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country";
|
||||||
|
|
||||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||||
$tabfieldinsert=array();
|
$tabfieldinsert=array();
|
||||||
$tabfieldinsert[31]= "pcg_version,label";
|
$tabfieldinsert[31]= "pcg_version,label,fk_country";
|
||||||
$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
|
$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
|
||||||
|
|
||||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||||
@ -173,7 +166,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
$ok=1;
|
$ok=1;
|
||||||
foreach ($listfield as $f => $value)
|
foreach ($listfield as $f => $value)
|
||||||
{
|
{
|
||||||
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp','DictionaryAccountancysystem','DictionaryAccountancyCategory'))) continue; // For some pages, country is not mandatory
|
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp','DictionaryAccountancyCategory','Pcg_version'))) continue; // For some pages, country is not mandatory
|
||||||
if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
|
if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
|
||||||
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
|
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
|
||||||
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
|
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
|
||||||
@ -188,6 +181,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
$ok=0;
|
$ok=0;
|
||||||
$fieldnamekey=$listfield[$f];
|
$fieldnamekey=$listfield[$f];
|
||||||
// We take translate key of field
|
// We take translate key of field
|
||||||
|
|
||||||
|
if ($fieldnamekey == 'pcg_version') $fieldnamekey='Pcg_version';
|
||||||
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
|
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
|
||||||
if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
|
if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
|
||||||
if ($fieldnamekey == 'nbjour') $fieldnamekey='NbOfDays';
|
if ($fieldnamekey == 'nbjour') $fieldnamekey='NbOfDays';
|
||||||
|
|||||||
@ -39,6 +39,7 @@ $mesg = '';
|
|||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
$backtopage = GETPOST('backtopage','alpha');
|
$backtopage = GETPOST('backtopage','alpha');
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
|
$ref = GETPOST('ref', 'alpha');
|
||||||
$rowid = GETPOST('rowid', 'int');
|
$rowid = GETPOST('rowid', 'int');
|
||||||
$cancel = GETPOST('cancel','alpha');
|
$cancel = GETPOST('cancel','alpha');
|
||||||
|
|
||||||
@ -261,8 +262,10 @@ if ($action == 'create') {
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
} else if ($id) {
|
}
|
||||||
$result = $object->fetch($id);
|
else if ($id > 0 || $ref) {
|
||||||
|
|
||||||
|
$result = $object->fetch($id, $ref, 1);
|
||||||
|
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
dol_htmloutput_mesg($mesg);
|
dol_htmloutput_mesg($mesg);
|
||||||
@ -329,17 +332,18 @@ if ($action == 'create') {
|
|||||||
// View mode
|
// View mode
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php">' . $langs->trans("BackToList") . '</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php">' . $langs->trans("BackToList") . '</a>';
|
||||||
|
|
||||||
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
|
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), -1, 'billr');
|
||||||
|
|
||||||
|
dol_banner_tab($object, 'ref', $linkback, 1, 'account_number', 'ref');
|
||||||
|
|
||||||
|
|
||||||
|
print '<div class="fichecenter">';
|
||||||
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Account number
|
|
||||||
print '<tr><td class="titlefield">' . $langs->trans("AccountNumber") . '</td>';
|
|
||||||
print '<td>' . $object->account_number . '</td>';
|
|
||||||
print '<td align="right" width="25%">' . $linkback . '</td></tr>';
|
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<tr><td>' . $langs->trans("Label") . '</td>';
|
print '<tr><td class="titlefield">' . $langs->trans("Label") . '</td>';
|
||||||
print '<td colspan="2">' . $object->label . '</td></tr>';
|
print '<td colspan="2">' . $object->label . '</td></tr>';
|
||||||
|
|
||||||
// Account parent
|
// Account parent
|
||||||
@ -361,20 +365,10 @@ if ($action == 'create') {
|
|||||||
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
|
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
|
||||||
print '<td colspan="2">' . $object->pcg_subtype . '</td></tr>';
|
print '<td colspan="2">' . $object->pcg_subtype . '</td></tr>';
|
||||||
|
|
||||||
// Active
|
|
||||||
print '<tr><td>' . $langs->trans("Status") . '</td>';
|
|
||||||
print '<td colspan="2">';
|
|
||||||
print $object->getLibStatut(4);
|
|
||||||
/*if (empty($object->active)) {
|
|
||||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
|
||||||
} else {
|
|
||||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
|
||||||
}*/
|
|
||||||
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -397,7 +391,7 @@ if ($action == 'create') {
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db, $object->error, $object->errors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -86,9 +86,11 @@ if ($action == 'delete') {
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
|
|
||||||
llxheader('', $langs->trans('AccountAccounting'));
|
llxheader('', $langs->trans('AccountingCategory'));
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans('AccountingCategory'));
|
$linkback = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories_list.php?search_country_id='.$mysoc->country_id.'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
|
print load_fiche_titre($langs->trans('AccountingCategory'), $linkback);
|
||||||
|
|
||||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
@ -110,7 +112,7 @@ if (! empty($cat_id))
|
|||||||
if ($return < 0) {
|
if ($return < 0) {
|
||||||
setEventMessages(null, $accountingcategory->errors, 'errors');
|
setEventMessages(null, $accountingcategory->errors, 'errors');
|
||||||
}
|
}
|
||||||
print '<tr><td class="tdtop">' . $langs->trans("AddAccountFromBookKeepingWithNoCategories") . '</td>';
|
print '<tr><td>' . $langs->trans("AddAccountFromBookKeepingWithNoCategories") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
|
|
||||||
$arraykeyvalue=array();
|
$arraykeyvalue=array();
|
||||||
|
|||||||
@ -31,14 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||||
|
|
||||||
$langs->load("errors");
|
$langs->loadLangs(array("errors","admin","companies","resource","holiday","accountancy","hrm"));
|
||||||
$langs->load("admin");
|
|
||||||
$langs->load("main");
|
|
||||||
$langs->load("companies");
|
|
||||||
$langs->load("resource");
|
|
||||||
$langs->load("holiday");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
$langs->load("hrm");
|
|
||||||
|
|
||||||
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
@ -64,7 +57,7 @@ $active = 1;
|
|||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
$offset = $listlimit * $page ;
|
$offset = $listlimit * $page ;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
@ -418,18 +411,15 @@ if ($action == 'disable_favorite')
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formadmin=new FormAdmin($db);
|
$formadmin=new FormAdmin($db);
|
||||||
|
|
||||||
llxHeader();
|
llxHeader('', $langs->trans('DictionaryAccountancyCategory'));
|
||||||
|
|
||||||
$titre=$langs->trans($tablib[$id]);
|
$titre=$langs->trans($tablib[$id]);
|
||||||
$linkback='';
|
$linkback='';
|
||||||
$titlepicto='title_setup';
|
$titlepicto='title_setup';
|
||||||
|
|
||||||
print load_fiche_titre($titre,$linkback,$titlepicto);
|
print load_fiche_titre($titre, $linkback, $titlepicto);
|
||||||
|
|
||||||
if ($id == 32)
|
print $langs->trans("AccountingAccountGroupsDesc", $langs->transnoentitiesnoconv("ByPersonalizedAccountGroups")).'<br><br>';
|
||||||
{
|
|
||||||
print $langs->trans("AccountingAccountGroupsDesc", $langs->transnoentitiesnoconv("ByPersonalizedAccountGroups")).'<br><br>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Confirmation de la suppression de la ligne
|
// Confirmation de la suppression de la ligne
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
@ -569,6 +559,7 @@ if ($id)
|
|||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
$colspan=count($fieldlist)+3;
|
$colspan=count($fieldlist)+3;
|
||||||
|
if ($id == 32) $colspan++;
|
||||||
|
|
||||||
print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
||||||
}
|
}
|
||||||
@ -657,7 +648,6 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
|
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
|
||||||
{
|
{
|
||||||
$valuetoshow=$langs->trans("Label");
|
$valuetoshow=$langs->trans("Label");
|
||||||
if ($id != 25) $valuetoshow.="*";
|
|
||||||
}
|
}
|
||||||
if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); }
|
if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); }
|
||||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
||||||
@ -806,10 +796,12 @@ if ($id)
|
|||||||
else print '<td> </td>';
|
else print '<td> </td>';
|
||||||
|
|
||||||
// Link to setup the group
|
// Link to setup the group
|
||||||
print '<td>';
|
print '<td class="center">';
|
||||||
if (empty($obj->formula))
|
if (empty($obj->formula))
|
||||||
{
|
{
|
||||||
print '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories.php?action=display&account_category='.$obj->rowid.'">'.$langs->trans("Setup").'</a>';
|
print '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories.php?action=display&account_category='.$obj->rowid.'">';
|
||||||
|
print $langs->trans("ListOfAccounts");
|
||||||
|
print '</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,7 +77,7 @@ $list_account = array (
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$accounting_mode = defined('ACCOUNTING_MODE') ? ACCOUNTING_MODE : 'RECETTES-DEPENSES';
|
$accounting_mode = empty($conf->global->ACCOUNTING_MODE) ? 'RECETTES-DEPENSES' : $conf->global->ACCOUNTING_MODE;
|
||||||
|
|
||||||
|
|
||||||
if (GETPOST('change_chart'))
|
if (GETPOST('change_chart'))
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
|
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -47,12 +48,35 @@ $action = GETPOST('action', 'alpha');
|
|||||||
|
|
||||||
// Parameters ACCOUNTING_EXPORT_*
|
// Parameters ACCOUNTING_EXPORT_*
|
||||||
$main_option = array (
|
$main_option = array (
|
||||||
'ACCOUNTING_EXPORT_PREFIX_SPEC'
|
'ACCOUNTING_EXPORT_PREFIX_SPEC',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$configuration = AccountancyExport::getTypeConfig();
|
||||||
|
|
||||||
|
$listparam = $configuration[param];
|
||||||
|
|
||||||
|
$listformat = $configuration[format];
|
||||||
|
|
||||||
|
$listcr = $configuration[cr];
|
||||||
|
|
||||||
|
|
||||||
$model_option = array (
|
$model_option = array (
|
||||||
'ACCOUNTING_EXPORT_SEPARATORCSV',
|
'1' => array(
|
||||||
'ACCOUNTING_EXPORT_DATE'
|
'label' => 'ACCOUNTING_EXPORT_FORMAT',
|
||||||
|
'param' => $listformat,
|
||||||
|
),
|
||||||
|
'2' => array(
|
||||||
|
'label' => 'ACCOUNTING_EXPORT_SEPARATORCSV',
|
||||||
|
'param' => '',
|
||||||
|
),
|
||||||
|
'3' => array(
|
||||||
|
'label' => 'ACCOUNTING_EXPORT_ENDLINE',
|
||||||
|
'param' => $listcr,
|
||||||
|
),
|
||||||
|
'4' => array(
|
||||||
|
'label' => 'ACCOUNTING_EXPORT_DATE',
|
||||||
|
'param' => '',
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -61,24 +85,15 @@ $model_option = array (
|
|||||||
if ($action == 'update') {
|
if ($action == 'update') {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$format = GETPOST('format', 'alpha');
|
$modelcsv = GETPOST('ACCOUNTING_EXPORT_MODELCSV', 'int');
|
||||||
$modelcsv = GETPOST('modelcsv', 'int');
|
|
||||||
|
|
||||||
if (! empty($format)) {
|
|
||||||
if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', $format, 'chaine', 0, '', $conf->entity)) {
|
|
||||||
$error ++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$error ++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($modelcsv)) {
|
if (! empty($modelcsv)) {
|
||||||
if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) {
|
if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) {
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
if ($modelcsv==AccountancyExport::$EXPORT_TYPE_QUADRATUS || $modelcsv==AccountancyExport::$EXPORT_TYPE_CIEL) {
|
//if ($modelcsv==AccountancyExport::$EXPORT_TYPE_QUADRATUS || $modelcsv==AccountancyExport::$EXPORT_TYPE_CIEL) {
|
||||||
dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', 'txt', 'chaine', 0, '', $conf->entity);
|
// dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', 'txt', 'chaine', 0, '', $conf->entity);
|
||||||
}
|
//}
|
||||||
} else {
|
} else {
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
@ -91,16 +106,22 @@ if ($action == 'update') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ( $model_option as $constname ) {
|
foreach ($listparam[$modelcsv] as $key => $value ) {
|
||||||
$constvalue = GETPOST($constname, 'alpha');
|
$constante = $key;
|
||||||
|
|
||||||
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
if (strpos($constante, 'ACCOUNTING')!==false) {
|
||||||
$error ++;
|
$constvalue = GETPOST($key, 'alpha');
|
||||||
}
|
if (! dolibarr_set_const($db, $constante, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||||
|
$error ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
// reload
|
||||||
|
$configuration = AccountancyExport::getTypeConfig();
|
||||||
|
$listparam = $configuration[param];
|
||||||
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
}
|
}
|
||||||
@ -117,12 +138,54 @@ $form = new Form($db);
|
|||||||
// $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
// $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||||
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
|
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
|
||||||
|
|
||||||
|
print "\n".'<script type="text/javascript" language="javascript">'."\n";
|
||||||
|
print 'jQuery(document).ready(function () {'."\n";
|
||||||
|
print ' function initfields()'."\n";
|
||||||
|
print ' {'."\n";
|
||||||
|
foreach ($listparam as $key => $param) {
|
||||||
|
print ' if (jQuery("#ACCOUNTING_EXPORT_MODELCSV").val()=="'.$key.'")'."\n";
|
||||||
|
print ' {'."\n";
|
||||||
|
print ' //console.log("'.$param[label].'");'."\n";
|
||||||
|
if (empty($param[ACCOUNTING_EXPORT_FORMAT])) {
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$conf->global->ACCOUNTING_EXPORT_FORMAT.'");'."\n";
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").prop("disabled", true);'."\n";
|
||||||
|
} else {
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$param[ACCOUNTING_EXPORT_FORMAT].'");'."\n";
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").removeAttr("disabled");'."\n";
|
||||||
|
}
|
||||||
|
if (empty($param[ACCOUNTING_EXPORT_SEPARATORCSV])) {
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("");'."\n";
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").prop("disabled", true);'."\n";
|
||||||
|
} else {
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("'.$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV.'");'."\n";
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").removeAttr("disabled");'."\n";
|
||||||
|
}
|
||||||
|
if (empty($param[ACCOUNTING_EXPORT_ENDLINE])) {
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").prop("disabled", true);'."\n";
|
||||||
|
} else {
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").removeAttr("disabled");'."\n";
|
||||||
|
}
|
||||||
|
if (empty($param[ACCOUNTING_EXPORT_DATE])) {
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("");'."\n";
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_DATE").prop("disabled", true);'."\n";
|
||||||
|
} else {
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("'.$conf->global->ACCOUNTING_EXPORT_DATE.'");'."\n";
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_DATE").removeAttr("disabled");'."\n";
|
||||||
|
}
|
||||||
|
print ' }'."\n";
|
||||||
|
}
|
||||||
|
print ' }'."\n";
|
||||||
|
print ' initfields();'."\n";
|
||||||
|
print ' jQuery("#ACCOUNTING_EXPORT_MODELCSV").change(function() {'."\n";
|
||||||
|
print ' initfields();'."\n";
|
||||||
|
print ' });'."\n";
|
||||||
|
print '})'."\n";
|
||||||
|
print '</script>'."\n";
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
|
|
||||||
$var = true;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Main Options
|
* Main Options
|
||||||
*/
|
*/
|
||||||
@ -132,7 +195,6 @@ print '<tr class="liste_titre">';
|
|||||||
print '<td colspan="3">' . $langs->trans('Options') . '</td>';
|
print '<td colspan="3">' . $langs->trans('Options') . '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$var = ! $var;
|
|
||||||
|
|
||||||
$num = count($main_option);
|
$num = count($main_option);
|
||||||
if ($num) {
|
if ($num) {
|
||||||
@ -146,7 +208,7 @@ if ($num) {
|
|||||||
|
|
||||||
// Value
|
// Value
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" size="20" name="' . $key . '" value="' . $conf->global->$key . '">';
|
print '<input type="text" size="20" id="'.$key.'" name="' . $key . '" value="' . $conf->global->$key . '">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -164,7 +226,6 @@ print '<tr class="liste_titre">';
|
|||||||
print '<td colspan="2">' . $langs->trans("Modelcsv") . '</td>';
|
print '<td colspan="2">' . $langs->trans("Modelcsv") . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$var = ! $var;
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td width="50%">' . $langs->trans("Selectmodelcsv") . '</td>';
|
print '<td width="50%">' . $langs->trans("Selectmodelcsv") . '</td>';
|
||||||
@ -175,7 +236,7 @@ if (! $conf->use_javascript_ajax) {
|
|||||||
} else {
|
} else {
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$listmodelcsv = AccountancyExport::getType();
|
$listmodelcsv = AccountancyExport::getType();
|
||||||
print $form->selectarray("modelcsv", $listmodelcsv, $conf->global->ACCOUNTING_EXPORT_MODELCSV, 0);
|
print $form->selectarray("ACCOUNTING_EXPORT_MODELCSV", $listmodelcsv, $conf->global->ACCOUNTING_EXPORT_MODELCSV, 0);
|
||||||
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
@ -195,39 +256,21 @@ if ($num2) {
|
|||||||
print '<td colspan="3">' . $langs->trans('OtherOptions') . '</td>';
|
print '<td colspan="3">' . $langs->trans('OtherOptions') . '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > AccountancyExport::$EXPORT_TYPE_NORMAL)
|
foreach ( $model_option as $key) {
|
||||||
{
|
|
||||||
print '<tr><td colspan="2" bgcolor="red"><b>' . $langs->trans('OptionsDeactivatedForThisExportModel') . '</b></td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print '<td width="50%">' . $langs->trans("Selectformat") . '</td>';
|
|
||||||
if (! $conf->use_javascript_ajax) {
|
|
||||||
print '<td class="nowrap">';
|
|
||||||
print $langs->trans("NotAvailableWhenAjaxDisabled");
|
|
||||||
print "</td>";
|
|
||||||
} else {
|
|
||||||
print '<td>';
|
|
||||||
$listformat = array (
|
|
||||||
'csv' => $langs->trans("csv"),
|
|
||||||
'txt' => $langs->trans("txt")
|
|
||||||
);
|
|
||||||
print $form->selectarray("format", $listformat, $conf->global->ACCOUNTING_EXPORT_FORMAT, 0);
|
|
||||||
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
print "</td></tr>";
|
|
||||||
|
|
||||||
foreach ( $model_option as $key ) {
|
|
||||||
print '<tr class="oddeven value">';
|
print '<tr class="oddeven value">';
|
||||||
|
|
||||||
// Param
|
// Param
|
||||||
$label = $langs->trans($key);
|
$label = $key[label];
|
||||||
print '<td width="50%">' . $label . '</td>';
|
print '<td width="50%">' . $langs->trans($label) . '</td>';
|
||||||
|
|
||||||
// Value
|
// Value
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" size="20" name="' . $key . '" value="' . $conf->global->$key . '">';
|
if (is_array($key[param])) {
|
||||||
|
print $form->selectarray($label, $key[param], $conf->global->$label, 0);
|
||||||
|
} else {
|
||||||
|
print '<input type="text" size="20" id="'. $label .'" name="' . $key[label] . '" value="' . $conf->global->$label . '">';
|
||||||
|
}
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -47,16 +47,16 @@ if ($user->societe_id > 0)
|
|||||||
accessforbidden();
|
accessforbidden();
|
||||||
if (! $user->rights->accounting->fiscalyear) // If we can read accounting records, we shoul be able to see fiscal year.
|
if (! $user->rights->accounting->fiscalyear) // If we can read accounting records, we shoul be able to see fiscal year.
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// List of status
|
// List of status
|
||||||
static $tmpstatut2label = array (
|
static $tmpstatut2label = array (
|
||||||
'0' => 'OpenFiscalYear',
|
'0' => 'OpenFiscalYear',
|
||||||
'1' => 'CloseFiscalYear'
|
'1' => 'CloseFiscalYear'
|
||||||
);
|
);
|
||||||
$statut2label = array (
|
$statut2label = array (
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
foreach ( $tmpstatut2label as $key => $val )
|
foreach ( $tmpstatut2label as $key => $val )
|
||||||
$statut2label[$key] = $langs->trans($val);
|
$statut2label[$key] = $langs->trans($val);
|
||||||
@ -100,14 +100,23 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
$sql.= $db->plimit($limit+1, $offset);
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result)
|
||||||
$var = false;
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
|
if (! empty($user->rights->accounting->fiscalyear))
|
||||||
|
{
|
||||||
|
$addbutton = '<a class="butAction" href="fiscalyear_card.php?action=create">' . $langs->trans("NewFiscalYear") . '</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$addbutton = '<a class="butActionRefused" href="#">' . $langs->trans("NewFiscalYear") . '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
$title = $langs->trans('AccountingPeriods');
|
$title = $langs->trans('AccountingPeriods');
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 1);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $addbutton, '', $limit, 1);
|
||||||
|
|
||||||
// Load attribute_label
|
// Load attribute_label
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
@ -132,8 +141,7 @@ if ($result) {
|
|||||||
print '<td align="left">' . dol_print_date($db->jdate($obj->date_end), 'day') . '</td>';
|
print '<td align="left">' . dol_print_date($db->jdate($obj->date_end), 'day') . '</td>';
|
||||||
print '<td align="right">' . $fiscalyearstatic->LibStatut($obj->statut, 5) . '</td>';
|
print '<td align="right">' . $fiscalyearstatic->LibStatut($obj->statut, 5) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$var = ! $var;
|
$i++;
|
||||||
$i ++;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<tr class="oddeven"><td colspan="5" class="opacitymedium">' . $langs->trans("None") . '</td></tr>';
|
print '<tr class="oddeven"><td colspan="5" class="opacitymedium">' . $langs->trans("None") . '</td></tr>';
|
||||||
@ -143,19 +151,6 @@ if ($result) {
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
|
|
||||||
// Buttons
|
|
||||||
print '<div class="tabsAction">';
|
|
||||||
if (! empty($user->rights->accounting->fiscalyear))
|
|
||||||
{
|
|
||||||
print '<a class="butAction" href="fiscalyear_card.php?action=create">' . $langs->trans("NewFiscalYear") . '</a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<a class="butActionRefused" href="#">' . $langs->trans("NewFiscalYear") . '</a>';
|
|
||||||
}
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
@ -60,7 +60,7 @@ $list = array (
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$accounting_mode = defined('ACCOUNTING_MODE') ? ACCOUNTING_MODE : 'RECETTES-DEPENSES';
|
$accounting_mode = empty($conf->global->ACCOUNTING_MODE) ? 'RECETTES-DEPENSES' : $conf->global->ACCOUNTING_MODE;
|
||||||
|
|
||||||
if ($action == 'update') {
|
if ($action == 'update') {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|||||||
@ -58,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 == null) { $page = 0 ; }
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
$offset = $listlimit * $page ;
|
$offset = $listlimit * $page ;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2016-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
|
||||||
@ -66,8 +66,8 @@ $formaccounting = new FormAccounting($db);
|
|||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
if (empty($search_date_start)) {
|
if (empty($search_date_start) && ! GETPOSTISSET('formfilteraction'))
|
||||||
|
{
|
||||||
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||||
$year_start = dol_print_date(dol_now(), '%Y');
|
$year_start = dol_print_date(dol_now(), '%Y');
|
||||||
$year_end = $year_start + 1;
|
$year_end = $year_start + 1;
|
||||||
@ -115,6 +115,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
$search_accountancy_code_end = '';
|
$search_accountancy_code_end = '';
|
||||||
$search_date_start = '';
|
$search_date_start = '';
|
||||||
$search_date_end = '';
|
$search_date_end = '';
|
||||||
|
$filter = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -125,9 +126,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
if ($action == 'export_csv') {
|
if ($action == 'export_csv') {
|
||||||
|
|
||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == AccountancyExport::$EXPORT_TYPE_CEGID) $sep = ";"; // For CEGID, we force separator.
|
|
||||||
|
|
||||||
$journal = 'bookkepping';
|
$journal = 'balance';
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||||
|
|
||||||
@ -136,12 +136,14 @@ if ($action == 'export_csv') {
|
|||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($object->lines as $line) {
|
foreach ($object->lines as $line)
|
||||||
|
{
|
||||||
print length_accountg($line->numero_compte) . $sep;
|
print length_accountg($line->numero_compte) . $sep;
|
||||||
print $line->debit . $sep;
|
print $object->get_compte_desc($line->numero_compte) . $sep;
|
||||||
print $line->credit . $sep;
|
print price($line->debit) . $sep;
|
||||||
print $line->debit . $sep;
|
print price($line->credit) . $sep;
|
||||||
print $line->credit - $line->debit . $sep;
|
print price($line->debit) . $sep;
|
||||||
|
print price($line->credit - $line->debit) . $sep;
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,7 +155,8 @@ else {
|
|||||||
|
|
||||||
// List
|
// List
|
||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
|
{
|
||||||
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
|
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
|
||||||
if ($nbtotalofrecords < 0) {
|
if ($nbtotalofrecords < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
@ -166,6 +169,13 @@ else {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||||
|
print '<input type="hidden" name="action" value="list">';
|
||||||
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
|
|
||||||
$button = '<input type="submit" name="exportcsv" class="butAction" value="' . $langs->trans("Export") . ' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
$button = '<input type="submit" name="exportcsv" 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_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $result, 'title_accountancy', 0, $button);
|
||||||
@ -174,9 +184,9 @@ else {
|
|||||||
|
|
||||||
$moreforfilter .= '<div class="divsearchfield">';
|
$moreforfilter .= '<div class="divsearchfield">';
|
||||||
$moreforfilter .= $langs->trans('DateStart') . ': ';
|
$moreforfilter .= $langs->trans('DateStart') . ': ';
|
||||||
$moreforfilter .= $form->select_date($search_date_start, 'date_start', 0, 0, 1, '', 1, 0, 1);
|
$moreforfilter .= $form->select_date($search_date_start?$search_date_start:-1, 'date_start', 0, 0, 1, '', 1, 0, 1);
|
||||||
$moreforfilter .= $langs->trans('DateEnd') . ': ';
|
$moreforfilter .= $langs->trans('DateEnd') . ': ';
|
||||||
$moreforfilter .= $form->select_date($search_date_end, 'date_end', 0, 0, 1, '', 1, 0, 1);
|
$moreforfilter .= $form->select_date($search_date_end?$search_date_end:-1, 'date_end', 0, 0, 1, '', 1, 0, 1);
|
||||||
$moreforfilter .= '</div>';
|
$moreforfilter .= '</div>';
|
||||||
|
|
||||||
if (! empty($moreforfilter)) {
|
if (! empty($moreforfilter)) {
|
||||||
@ -220,7 +230,8 @@ else {
|
|||||||
$sous_total_credit = 0;
|
$sous_total_credit = 0;
|
||||||
$displayed_account = "";
|
$displayed_account = "";
|
||||||
|
|
||||||
foreach ($object->lines as $line) {
|
foreach ($object->lines as $line)
|
||||||
|
{
|
||||||
$link = '';
|
$link = '';
|
||||||
$total_debit += $line->debit;
|
$total_debit += $line->debit;
|
||||||
$total_credit += $line->credit;
|
$total_credit += $line->credit;
|
||||||
@ -280,4 +291,5 @@ else {
|
|||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* 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
|
||||||
@ -33,6 +33,8 @@ require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||||
|
|
||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
|
$langs->load("bills");
|
||||||
|
$langs->load("compta");
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
@ -40,7 +42,7 @@ if ($user->societe_id > 0) {
|
|||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
$mode = GETPOST('mode','aZ09'); // '' or 'tmp'
|
$mode = GETPOST('mode','aZ09'); // '' or 'tmp'
|
||||||
$piece_num = GETPOST("piece_num");
|
$piece_num = GETPOST("piece_num");
|
||||||
|
|
||||||
$mesg = '';
|
$mesg = '';
|
||||||
@ -72,16 +74,16 @@ if ($action == "confirm_update") {
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
|
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
||||||
$action='update';
|
$action='update';
|
||||||
|
}
|
||||||
|
if (empty($account_number) || $account_number == '-1')
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
|
||||||
|
$action='update';
|
||||||
}
|
}
|
||||||
if (empty($account_number) || $account_number == '-1')
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
|
|
||||||
$action='update';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -89,7 +91,7 @@ if ($action == "confirm_update") {
|
|||||||
|
|
||||||
$result = $book->fetch($id, null, $mode);
|
$result = $book->fetch($id, null, $mode);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
$book->numero_compte = $account_number;
|
$book->numero_compte = $account_number;
|
||||||
@ -112,13 +114,13 @@ if ($action == "confirm_update") {
|
|||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
if ($mode != '_tmp')
|
if ($mode != '_tmp')
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
|
|
||||||
$debit = 0;
|
$debit = 0;
|
||||||
$credit = 0;
|
$credit = 0;
|
||||||
|
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
@ -132,14 +134,14 @@ else if ($action == "add") {
|
|||||||
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0))
|
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
if (empty($account_number) || $account_number == '-1')
|
if (empty($account_number) || $account_number == '-1')
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
@ -175,7 +177,7 @@ else if ($action == "add") {
|
|||||||
} else {
|
} else {
|
||||||
if ($mode != '_tmp')
|
if ($mode != '_tmp')
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
|
|
||||||
$debit = 0;
|
$debit = 0;
|
||||||
@ -209,9 +211,9 @@ else if ($action == "confirm_create") {
|
|||||||
$book = new BookKeeping($db);
|
$book = new BookKeeping($db);
|
||||||
|
|
||||||
if (! GETPOST('code_journal') || GETPOST('code_journal') == '-1') {
|
if (! GETPOST('code_journal') || GETPOST('code_journal') == '-1') {
|
||||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors');
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors');
|
||||||
$action='create';
|
$action='create';
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (! GETPOST('next_num_mvt'))
|
if (! GETPOST('next_num_mvt'))
|
||||||
{
|
{
|
||||||
@ -237,10 +239,10 @@ else if ($action == "confirm_create") {
|
|||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
if ($mode != '_tmp')
|
if ($mode != '_tmp')
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
$action = 'update';
|
$action = 'update';
|
||||||
$id=$book->id;
|
$id=$book->id;
|
||||||
$piece_num = $book->piece_num;
|
$piece_num = $book->piece_num;
|
||||||
@ -254,10 +256,10 @@ if ($action == 'setdate') {
|
|||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
if ($mode != '_tmp')
|
if ($mode != '_tmp')
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -270,7 +272,7 @@ if ($action == 'setjournal') {
|
|||||||
} else {
|
} else {
|
||||||
if ($mode != '_tmp')
|
if ($mode != '_tmp')
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
@ -284,7 +286,7 @@ if ($action == 'setdocref') {
|
|||||||
} else {
|
} else {
|
||||||
if ($mode != '_tmp')
|
if ($mode != '_tmp')
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
@ -318,7 +320,8 @@ if ($action == 'delete') {
|
|||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'create') {
|
if ($action == 'create')
|
||||||
|
{
|
||||||
print load_fiche_titre($langs->trans("CreateMvts"));
|
print load_fiche_titre($langs->trans("CreateMvts"));
|
||||||
|
|
||||||
$book = new BookKeeping($db);
|
$book = new BookKeeping($db);
|
||||||
@ -359,17 +362,21 @@ if ($action == 'create') {
|
|||||||
print '<td><input type="text" class="minwidth200" name="doc_ref" value=""/></td>';
|
print '<td><input type="text" class="minwidth200" name="doc_ref" value=""/></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
/*
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>' . $langs->trans("Doctype") . '</td>';
|
print '<td>' . $langs->trans("Doctype") . '</td>';
|
||||||
print '<td><input type="text" class="minwidth200 name="doc_type" value=""/></td>';
|
print '<td><input type="text" class="minwidth200 name="doc_type" value=""/></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
*/
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
print '<div align="center"><input type="submit" class="button" value="' . $langs->trans("Create") . '">';
|
print '<div class="center">';
|
||||||
print ' <input type="button" value="' . $langs->trans("Cancel") . '" class="button" onclick="history.go(-1)" />';
|
print '<input type="submit" class="button" value="' . $langs->trans("Create") . '">';
|
||||||
|
print ' ';
|
||||||
|
print '<input type="button" value="' . $langs->trans("Cancel") . '" class="button" onclick="history.go(-1)" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
@ -380,9 +387,9 @@ if ($action == 'create') {
|
|||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($book->piece_num)) {
|
if (! empty($book->piece_num))
|
||||||
|
{
|
||||||
$backlink = '<a href="list.php">' . $langs->trans('BackToList') . '</a>';
|
$backlink = '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">' . $langs->trans('BackToList') . '</a>';
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("UpdateMvts"), $backlink);
|
print load_fiche_titre($langs->trans("UpdateMvts"), $backlink);
|
||||||
|
|
||||||
@ -395,23 +402,21 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
dol_fiche_head($head, 'transaction', '', -1);
|
dol_fiche_head($head, 'transaction', '', -1);
|
||||||
|
|
||||||
|
|
||||||
//dol_banner_tab($book, '', $backlink);
|
//dol_banner_tab($book, '', $backlink);
|
||||||
|
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
print '<div class="fichehalfleft">';
|
print '<div class="fichehalfleft">';
|
||||||
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border tableforfield" width="100%">';
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
// account movement
|
// Account movement
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="titlefield">' . $langs->trans("NumMvts") . '</td>';
|
print '<td class="titlefield">' . $langs->trans("NumMvts") . '</td>';
|
||||||
print '<td>' . $book->piece_num . '</td>';
|
print '<td>' . $book->piece_num . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// date
|
// Date
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('Docdate');
|
print $langs->trans('Docdate');
|
||||||
@ -429,11 +434,12 @@ if ($action == 'create') {
|
|||||||
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
} else {
|
} else {
|
||||||
print $book->doc_date ? dol_print_date($book->doc_date, 'daytext') : ' ';
|
print $book->doc_date ? dol_print_date($book->doc_date, 'day') : ' ';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
//journal
|
|
||||||
|
// Journal
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('Codejournal');
|
print $langs->trans('Codejournal');
|
||||||
@ -455,7 +461,8 @@ if ($action == 'create') {
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
//docref
|
|
||||||
|
// Ref document
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('Docref');
|
print $langs->trans('Docref');
|
||||||
@ -488,9 +495,20 @@ if ($action == 'create') {
|
|||||||
print '<table class="border tableforfield" width="100%">';
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
// Doc type
|
// Doc type
|
||||||
|
if(! empty($book->doc_type))
|
||||||
|
{
|
||||||
|
print '<tr>';
|
||||||
|
print '<td class="titlefield">' . $langs->trans("Doctype") . '</td>';
|
||||||
|
print '<td>' . $book->doc_type . '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Date document creation
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>' . $langs->trans("Doctype") . '</td>';
|
print '<td class="titlefield">' . $langs->trans("DateCreation") . '</td>';
|
||||||
print '<td>' . $book->doc_type . '</td>';
|
print '<td>';
|
||||||
|
print $book->date_creation ? dol_print_date($book->date_creation, 'day') : ' ';
|
||||||
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
@ -542,7 +560,6 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
$result = $book->fetchAllPerMvt($piece_num, $mode);
|
$result = $book->fetchAllPerMvt($piece_num, $mode);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
@ -570,7 +587,7 @@ if ($action == 'create') {
|
|||||||
print_liste_field_titre("AccountAccountingShort");
|
print_liste_field_titre("AccountAccountingShort");
|
||||||
print_liste_field_titre("SubledgerAccount");
|
print_liste_field_titre("SubledgerAccount");
|
||||||
print_liste_field_titre("LabelAccount");
|
print_liste_field_titre("LabelAccount");
|
||||||
print_liste_field_titre("Label");
|
print_liste_field_titre("LabelOperation");
|
||||||
print_liste_field_titre("Debit", "", "", "", "", 'align="right"');
|
print_liste_field_titre("Debit", "", "", "", "", 'align="right"');
|
||||||
print_liste_field_titre("Credit", "", "", "", "", 'align="right"');
|
print_liste_field_titre("Credit", "", "", "", "", 'align="right"');
|
||||||
print_liste_field_titre("Action", "", "", "", "", 'width="60" align="center"');
|
print_liste_field_titre("Action", "", "", "", "", 'width="60" align="center"');
|
||||||
@ -587,16 +604,16 @@ if ($action == 'create') {
|
|||||||
print $formaccounting->select_account($line->numero_compte, 'account_number', 1, array (), 1, 1, '');
|
print $formaccounting->select_account($line->numero_compte, 'account_number', 1, array (), 1, 1, '');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||||
{
|
{
|
||||||
print $formaccounting->select_auxaccount($line->subledger_account, 'subledger_account', 1);
|
print $formaccounting->select_auxaccount($line->subledger_account, 'subledger_account', 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<input type="text" name="subledger_account" value="'.$line->subledger_account.'">';
|
print '<input type="text" name="subledger_account" value="'.$line->subledger_account.'">';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
|
print '<td><input type="text" 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><input type="text" size="15" name="label_operation" value="' . $line->label_operation. '"/></td>';
|
||||||
@ -631,7 +648,7 @@ if ($action == 'create') {
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($total_debit != $total_credit)
|
if (price2num($total_debit) != price2num($total_credit))
|
||||||
{
|
{
|
||||||
setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_credit, $total_debit)), 'warnings');
|
setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_credit, $total_debit)), 'warnings');
|
||||||
}
|
}
|
||||||
@ -644,14 +661,14 @@ if ($action == 'create') {
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||||
{
|
{
|
||||||
print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1);
|
print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<input type="text" name="subledger_account" value="">';
|
print '<input type="text" name="subledger_account" value="">';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
|
print '<td><input type="text" 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><input type="text" size="15" name="label_operation" value="' . $line->label_operation. '"/></td>';
|
||||||
@ -665,15 +682,15 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
if ($mode=='_tmp' && $action=='')
|
if ($mode=='_tmp' && $action=='')
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
if ($total_debit == $total_credit)
|
if ($total_debit == $total_credit)
|
||||||
{
|
{
|
||||||
print '<a class="button" href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '&action=valid">'.$langs->trans("ValidTransaction").'</a>';
|
print '<a class="button" href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '&action=valid">'.$langs->trans("ValidTransaction").'</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<input type="submit" class="button" disabled="disabled" href="#" title="'.dol_escape_htmltag($langs->trans("MvtNotCorrectlyBalanced", $credit, $debit)).'" value="'.dol_escape_htmltag($langs->trans("ValidTransaction")).'">';
|
print '<input type="submit" class="button" disabled="disabled" href="#" title="'.dol_escape_htmltag($langs->trans("MvtNotCorrectlyBalanced", $credit, $debit)).'" value="'.dol_escape_htmltag($langs->trans("ValidTransaction")).'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
print ' ';
|
print ' ';
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
@ -44,6 +45,10 @@ $search_doc_ref = GETPOST("search_doc_ref");
|
|||||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
||||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
$search_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'));
|
||||||
|
$search_date_creation_start = dol_mktime(0, 0, 0, GETPOST('date_creation_startmonth', 'int'), GETPOST('date_creation_startday', 'int'), GETPOST('date_creation_startyear', 'int'));
|
||||||
|
$search_date_creation_end = dol_mktime(0, 0, 0, GETPOST('date_creation_endmonth', 'int'), GETPOST('date_creation_endday', 'int'), GETPOST('date_creation_endyear', 'int'));
|
||||||
|
$search_date_modification_start = dol_mktime(0, 0, 0, GETPOST('date_modification_startmonth', 'int'), GETPOST('date_modification_startday', 'int'), GETPOST('date_modification_startyear', 'int'));
|
||||||
|
$search_date_modification_end = dol_mktime(0, 0, 0, GETPOST('date_modification_endmonth', 'int'), GETPOST('date_modification_endday', 'int'), GETPOST('date_modification_endyear', 'int'));
|
||||||
|
|
||||||
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
|
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
|
||||||
$action = 'delbookkeepingyear';
|
$action = 'delbookkeepingyear';
|
||||||
@ -53,7 +58,6 @@ if (GETPOST("button_export_file_x") || GETPOST("button_export_file.x") || GETPOS
|
|||||||
}
|
}
|
||||||
|
|
||||||
$search_accountancy_code = GETPOST("search_accountancy_code");
|
$search_accountancy_code = GETPOST("search_accountancy_code");
|
||||||
|
|
||||||
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
|
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
|
||||||
if ($search_accountancy_code_start == - 1) {
|
if ($search_accountancy_code_start == - 1) {
|
||||||
$search_accountancy_code_start = '';
|
$search_accountancy_code_start = '';
|
||||||
@ -64,7 +68,6 @@ if ($search_accountancy_code_end == - 1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$search_accountancy_aux_code = GETPOST("search_accountancy_aux_code");
|
$search_accountancy_aux_code = GETPOST("search_accountancy_aux_code");
|
||||||
|
|
||||||
$search_accountancy_aux_code_start = GETPOST('search_accountancy_aux_code_start', 'alpha');
|
$search_accountancy_aux_code_start = GETPOST('search_accountancy_aux_code_start', 'alpha');
|
||||||
if ($search_accountancy_aux_code_start == - 1) {
|
if ($search_accountancy_aux_code_start == - 1) {
|
||||||
$search_accountancy_aux_code_start = '';
|
$search_accountancy_aux_code_start = '';
|
||||||
@ -82,7 +85,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->AC
|
|||||||
$sortfield = GETPOST('sortfield', 'alpha');
|
$sortfield = GETPOST('sortfield', 'alpha');
|
||||||
$sortorder = GETPOST('sortorder', 'alpha');
|
$sortorder = GETPOST('sortorder', 'alpha');
|
||||||
$page = GETPOST('page','int');
|
$page = GETPOST('page','int');
|
||||||
if ($page < 0) { $page = 0; }
|
if (empty($page) || $page < 0) { $page = 0; }
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
@ -96,21 +99,46 @@ $formaccounting = new FormAccounting($db);
|
|||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
|
if (! in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && empty($page) && ! GETPOST('noreset','int'))
|
||||||
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'));
|
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||||
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
$year_start = dol_print_date(dol_now(), '%Y');
|
||||||
|
$year_end = $year_start + 1;
|
||||||
|
$month_end = $month_start - 1;
|
||||||
|
if ($month_end < 1)
|
||||||
|
{
|
||||||
|
$month_end = 12;
|
||||||
|
$year_end--;
|
||||||
|
}
|
||||||
|
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||||
|
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$arrayfields=array(
|
||||||
|
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
|
||||||
|
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
|
||||||
|
't.doc_ref'=>array('label'=>$langs->trans("Docref"), 'checked'=>1),
|
||||||
|
't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1),
|
||||||
|
't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
|
||||||
|
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||||
|
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
|
||||||
|
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
|
||||||
|
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
|
||||||
|
't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
|
||||||
|
't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_mvt_num = '';
|
$search_mvt_num = '';
|
||||||
@ -128,6 +156,12 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
$search_ledger_code = '';
|
$search_ledger_code = '';
|
||||||
$search_date_start = '';
|
$search_date_start = '';
|
||||||
$search_date_end = '';
|
$search_date_end = '';
|
||||||
|
$search_date_creation_start = '';
|
||||||
|
$search_date_creation_end = '';
|
||||||
|
$search_date_modification_start = '';
|
||||||
|
$search_date_modification_end = '';
|
||||||
|
$search_debit = '';
|
||||||
|
$search_credit = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Must be after the remove filter action, before the export.
|
// Must be after the remove filter action, before the export.
|
||||||
@ -196,6 +230,34 @@ if (! empty($search_mvt_num)) {
|
|||||||
$filter['t.piece_num'] = $search_mvt_num;
|
$filter['t.piece_num'] = $search_mvt_num;
|
||||||
$param .= '&search_mvt_num=' . $search_mvt_num;
|
$param .= '&search_mvt_num=' . $search_mvt_num;
|
||||||
}
|
}
|
||||||
|
if (! empty($search_date_creation_start)) {
|
||||||
|
$filter['t.date_creation>='] = $search_date_creation_start;
|
||||||
|
$tmp=dol_getdate($search_date_creation_start);
|
||||||
|
$param .= '&date_creation_startmonth=' . $tmp['mon'] . '&date_creation_startday=' . $tmp['mday'] . '&date_creation_startyear=' . $tmp['year'];
|
||||||
|
}
|
||||||
|
if (! empty($search_date_creation_end)) {
|
||||||
|
$filter['t.date_creation<='] = $search_date_creation_end;
|
||||||
|
$tmp=dol_getdate($search_date_creation_end);
|
||||||
|
$param .= '&date_creation_endmonth=' . $tmp['mon'] . '&date_creation_endday=' . $tmp['mday'] . '&date_creation_endyear=' . $tmp['year'];
|
||||||
|
}
|
||||||
|
if (! empty($search_date_modification_start)) {
|
||||||
|
$filter['t.tms>='] = $search_date_modification_start;
|
||||||
|
$tmp=dol_getdate($search_date_modification_start);
|
||||||
|
$param .= '&date_modification_startmonth=' . $tmp['mon'] . '&date_modification_startday=' . $tmp['mday'] . '&date_modification_startyear=' . $tmp['year'];
|
||||||
|
}
|
||||||
|
if (! empty($search_date_modification_end)) {
|
||||||
|
$filter['t.tms<='] = $search_date_modification_end;
|
||||||
|
$tmp=dol_getdate($search_date_modification_end);
|
||||||
|
$param .= '&date_modification_endmonth=' . $tmp['mon'] . '&date_modification_endday=' . $tmp['mday'] . '&date_modification_endyear=' . $tmp['year'];
|
||||||
|
}
|
||||||
|
if (! empty($search_debit)) {
|
||||||
|
$filter['t.debit'] = $search_debit;
|
||||||
|
$param .= '&search_debit=' . $search_debit;
|
||||||
|
}
|
||||||
|
if (! empty($search_credit)) {
|
||||||
|
$filter['t.credit'] = $search_credit;
|
||||||
|
$param .= '&search_credit=' . $search_credit;
|
||||||
|
}
|
||||||
|
|
||||||
if ($action == 'delbookkeeping') {
|
if ($action == 'delbookkeeping') {
|
||||||
|
|
||||||
@ -254,7 +316,8 @@ if ($action == 'delmouvconfirm') {
|
|||||||
{
|
{
|
||||||
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
Header("Location: list.php");
|
|
||||||
|
Header("Location: list.php?noreset=1".($param?'&'.$param:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -306,7 +369,7 @@ if ($result < 0) {
|
|||||||
$num=count($object->lines);
|
$num=count($object->lines);
|
||||||
|
|
||||||
if ($action == 'delmouv') {
|
if ($action == 'delmouv') {
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?mvt_num='.GETPOST('mvt_num').$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1);
|
||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
}
|
}
|
||||||
if ($action == 'delbookkeepingyear') {
|
if ($action == 'delbookkeepingyear') {
|
||||||
@ -357,153 +420,310 @@ $listofformat=AccountancyExport::getType();
|
|||||||
$button = '<a class="butAction" name="button_export_file" href="'.$_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:'').'">';
|
$button = '<a class="butAction" name="button_export_file" href="'.$_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:'').'">';
|
||||||
if (count($filter)) $button.= $langs->trans("ExportFilteredList");
|
if (count($filter)) $button.= $langs->trans("ExportFilteredList");
|
||||||
else $button.= $langs->trans("ExportList");
|
else $button.= $langs->trans("ExportList");
|
||||||
$button.=' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')';
|
//$button.=' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')';
|
||||||
$button.= '</a>';
|
$button.= '</a>';
|
||||||
|
|
||||||
|
|
||||||
$groupby = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php"">' . $langs->trans("GroupByAccountAccounting") . '</a>';
|
$groupby = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php"">' . $langs->trans("GroupByAccountAccounting") . '</a>';
|
||||||
|
$addbutton = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</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.$addbutton, '', $limit);
|
||||||
|
|
||||||
print '<div class="tabsAction tabsActionNoBottom">' . "\n";
|
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
|
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||||
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>';
|
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="tagtable liste" width="100%">';
|
||||||
|
|
||||||
|
// Filters lines
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="' . dol_escape_htmltag($search_mvt_num) . '"></td>';
|
// Movement number
|
||||||
print '<td class="liste_titre center">';
|
if (! empty($arrayfields['t.piece_num']['checked']))
|
||||||
print '<div class="nowrap">';
|
|
||||||
print $langs->trans('From') . ' ';
|
|
||||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
|
||||||
print '</div>';
|
|
||||||
print '<div class="nowrap">';
|
|
||||||
print $langs->trans('to') . ' ';
|
|
||||||
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
|
||||||
print '</div>';
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="' . dol_escape_htmltag($search_doc_ref) . '"></td>';
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print '<div class="nowrap">';
|
|
||||||
print $langs->trans('From').' ';
|
|
||||||
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, 'maxwidth200');
|
|
||||||
print '</div>';
|
|
||||||
print '<div class="nowrap">';
|
|
||||||
print $langs->trans('to').' ';
|
|
||||||
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, 'maxwidth200');
|
|
||||||
print '</div>';
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="liste_titre">';
|
|
||||||
print '<div class="nowrap">';
|
|
||||||
print $langs->trans('From').' ';
|
|
||||||
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
|
||||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
|
||||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
|
||||||
{
|
{
|
||||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="' . dol_escape_htmltag($search_mvt_num) . '"></td>';
|
||||||
}
|
}
|
||||||
else
|
// Date document
|
||||||
|
if (! empty($arrayfields['t.doc_date']['checked']))
|
||||||
{
|
{
|
||||||
print '<input type="text" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'">';
|
print '<td class="liste_titre center">';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('From') . ' ';
|
||||||
|
print $form->select_date($search_date_start?$search_date_start:-1, 'date_start', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to') . ' ';
|
||||||
|
print $form->select_date($search_date_end?$search_date_end:-1, 'date_end', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '</div>';
|
// Ref document
|
||||||
print '<div class="nowrap">';
|
if (! empty($arrayfields['t.doc_ref']['checked']))
|
||||||
print $langs->trans('to').' ';
|
|
||||||
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
|
||||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
|
||||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
|
||||||
{
|
{
|
||||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
print '<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="' . dol_escape_htmltag($search_doc_ref) . '"></td>';
|
||||||
}
|
}
|
||||||
else
|
// Accountancy account
|
||||||
|
if (! empty($arrayfields['t.numero_compte']['checked']))
|
||||||
{
|
{
|
||||||
print '<input type="text" name="search_accountancy_aux_code_end" value="'.$search_accountancy_aux_code_end.'">';
|
print '<td class="liste_titre">';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('From').' ';
|
||||||
|
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, 'maxwidth200');
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to').' ';
|
||||||
|
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, 'maxwidth200');
|
||||||
|
print '</div>';
|
||||||
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '</div>';
|
// Subledger account
|
||||||
print '</td>';
|
if (! empty($arrayfields['t.subledger_account']['checked']))
|
||||||
print '<td class="liste_titre">';
|
{
|
||||||
print '<input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
|
print '<td class="liste_titre">';
|
||||||
print '</td>';
|
print '<div class="nowrap">';
|
||||||
print '<td class="liste_titre center"> </td>';
|
print $langs->trans('From').' ';
|
||||||
print '<td class="liste_titre center"> </td>';
|
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||||
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||||
|
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||||
|
{
|
||||||
|
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<input type="text" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'">';
|
||||||
|
}
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to').' ';
|
||||||
|
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||||
|
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||||
|
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||||
|
{
|
||||||
|
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<input type="text" name="search_accountancy_aux_code_end" value="'.$search_accountancy_aux_code_end.'">';
|
||||||
|
}
|
||||||
|
print '</div>';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
// Label operation
|
||||||
|
if (! empty($arrayfields['t.label_operation']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print '<input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
// Debit
|
||||||
|
if (! empty($arrayfields['t.debit']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre" align="right">';
|
||||||
|
print '<input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
// Credit
|
||||||
|
if (! empty($arrayfields['t.credit']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre" align="right">';
|
||||||
|
print '<input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
// Code journal
|
||||||
|
if (! empty($arrayfields['t.code_journal']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
||||||
|
}
|
||||||
|
// Date creation
|
||||||
|
if (! empty($arrayfields['t.date_creation']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre center">';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('From') . ' ';
|
||||||
|
print $form->select_date($search_date_creation_start, 'date_creation_start', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to') . ' ';
|
||||||
|
print $form->select_date($search_date_creation_end, 'date_creation_end', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
// Date modification
|
||||||
|
if (! empty($arrayfields['t.tms']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre center">';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('From') . ' ';
|
||||||
|
print $form->select_date($search_date_modification_start, 'date_modification_start', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to') . ' ';
|
||||||
|
print $form->select_date($search_date_modification_end, 'date_modification_end', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
// Action column
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
$searchpicto=$form->showFilterButtons();
|
$searchpicto=$form->showFilterButtons();
|
||||||
print $searchpicto;
|
print $searchpicto;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
|
if (! empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
|
if (! empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
|
if (! empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
if (! empty($arrayfields['t.numero_compte']['checked'])) print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre("SubledgerAccount", $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
|
if (! empty($arrayfields['t.subledger_account']['checked'])) print_liste_field_titre("SubledgerAccount", $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
|
if (! empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
|
if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
|
if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
|
if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
$checkpicto='';
|
if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre("DateCreation", $_SERVER['PHP_SELF'], "t.date_creation", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
|
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre("DateModification", $_SERVER['PHP_SELF'], "t.tms", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($checkpicto, $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
$total_debit = 0;
|
if ($num > 0)
|
||||||
$total_credit = 0;
|
|
||||||
|
|
||||||
$i=0;
|
|
||||||
while ($i < min($num, $limit))
|
|
||||||
{
|
{
|
||||||
$line = $object->lines[$i];
|
$i=0;
|
||||||
|
$totalarray=array();
|
||||||
|
while ($i < min($num, $limit))
|
||||||
|
{
|
||||||
|
$line = $object->lines[$i];
|
||||||
|
|
||||||
$total_debit += $line->debit;
|
$total_debit += $line->debit;
|
||||||
$total_credit += $line->credit;
|
$total_credit += $line->credit;
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
print '<td><a href="./card.php?piece_num=' . $line->piece_num . '">' . $line->piece_num . '</a></td>';
|
// Piece number
|
||||||
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
|
if (! empty($arrayfields['t.piece_num']['checked']))
|
||||||
print '<td class="nowrap">' . $line->doc_ref . '</td>';
|
{
|
||||||
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
print '<td><a href="./card.php?piece_num=' . $line->piece_num . '">' . $line->piece_num . '</a></td>';
|
||||||
print '<td>' . length_accounta($line->subledger_account) . '</td>';
|
if (! $i) $totalarray['nbfield']++;
|
||||||
print '<td>' . $line->label_operation . '</td>';
|
}
|
||||||
print '<td align="right">' . ($line->debit ? price($line->debit) : ''). '</td>';
|
|
||||||
print '<td align="right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
|
||||||
|
|
||||||
$accountingjournal = new AccountingJournal($db);
|
// Document date
|
||||||
$result = $accountingjournal->fetch('',$line->code_journal);
|
if (! empty($arrayfields['t.doc_date']['checked']))
|
||||||
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0,0,0,'',0) : $line->code_journal);
|
{
|
||||||
print '<td align="center">' . $journaltoshow . '</td>';
|
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
print '<td align="center">';
|
// Document ref
|
||||||
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a> ';
|
if (! empty($arrayfields['t.doc_ref']['checked']))
|
||||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . '">' . img_delete() . '</a>';
|
{
|
||||||
print '</td>';
|
print '<td class="nowrap">' . $line->doc_ref . '</td>';
|
||||||
print "</tr>\n";
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
$i++;
|
// Account number
|
||||||
|
if (! empty($arrayfields['t.numero_compte']['checked']))
|
||||||
|
{
|
||||||
|
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Subledger account
|
||||||
|
if (! empty($arrayfields['t.subledger_account']['checked']))
|
||||||
|
{
|
||||||
|
print '<td>' . length_accounta($line->subledger_account) . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Label operation
|
||||||
|
if (! empty($arrayfields['t.label_operation']['checked']))
|
||||||
|
{
|
||||||
|
print '<td>' . $line->label_operation . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Amount debit
|
||||||
|
if (! empty($arrayfields['t.debit']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="right">' . ($line->debit ? price($line->debit) : ''). '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield'];
|
||||||
|
$totalarray['totaldebit'] += $line->debit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Amount credit
|
||||||
|
if (! empty($arrayfields['t.credit']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
if (! $i) $totalarray['totalcreditfield']=$totalarray['nbfield'];
|
||||||
|
$totalarray['totalcredit'] += $line->credit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Journal code
|
||||||
|
if (! empty($arrayfields['t.code_journal']['checked']))
|
||||||
|
{
|
||||||
|
$accountingjournal = new AccountingJournal($db);
|
||||||
|
$result = $accountingjournal->fetch('',$line->code_journal);
|
||||||
|
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0,0,0,'',0) : $line->code_journal);
|
||||||
|
print '<td align="center">' . $journaltoshow . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creation operation date
|
||||||
|
if (! empty($arrayfields['t.date_creation']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="center">' . dol_print_date($line->date_creation, 'day') . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Modification operation date
|
||||||
|
if (! empty($arrayfields['t.tms']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="center">' . dol_print_date($line->date_modification, 'day') . '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action column
|
||||||
|
print '<td align="center">';
|
||||||
|
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a> ';
|
||||||
|
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . '">' . img_delete() . '</a>';
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show total line
|
||||||
|
if (isset($totalarray['totaldebitfield']) || isset($totalarray['totalcreditfield']))
|
||||||
|
{
|
||||||
|
$i=0;
|
||||||
|
while ($i < $totalarray['nbfield'])
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
if ($i == 1)
|
||||||
|
{
|
||||||
|
if ($num < $limit && empty($offset)) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||||
|
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||||
|
}
|
||||||
|
elseif ($totalarray['totaldebitfield'] == $i) print '<td align="right">'.price($totalarray['totaldebit']).'</td>';
|
||||||
|
elseif ($totalarray['totalcreditfield'] == $i) print '<td align="right">'.price($totalarray['totalcredit']).'</td>';
|
||||||
|
else print '<td></td>';
|
||||||
|
}
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="liste_total">';
|
|
||||||
if ($num < $limit) print '<td align="left" colspan="7">'.$langs->trans("Total").'</td>';
|
|
||||||
else print '<td align="left" colspan="7">'.$langs->trans("Totalforthispage").'</td>';
|
|
||||||
print '</td>';
|
|
||||||
print '<td align="right">';
|
|
||||||
print price($total_debit);
|
|
||||||
print '</td>';
|
|
||||||
print '<td align="right">';
|
|
||||||
print price($total_credit);
|
|
||||||
print '</td>';
|
|
||||||
print '<td colspan="2"></td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
// TODO Replace this with mass action
|
||||||
|
print '<div class="tabsAction tabsActionNoBottom">' . "\n";
|
||||||
|
print '<a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear'.($param?'&'.$param:'').'">' . $langs->trans("DelBookKeeping") . '</a>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -31,6 +31,7 @@ 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 . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
@ -39,8 +40,22 @@ $page = GETPOST("page");
|
|||||||
$sortorder = GETPOST("sortorder");
|
$sortorder = GETPOST("sortorder");
|
||||||
$sortfield = GETPOST("sortfield");
|
$sortfield = GETPOST("sortfield");
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
|
||||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
if (empty($search_date_start))
|
||||||
|
{
|
||||||
|
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||||
|
$year_start = dol_print_date(dol_now(), '%Y');
|
||||||
|
$year_end = $year_start + 1;
|
||||||
|
$month_end = $month_start - 1;
|
||||||
|
if ($month_end < 1)
|
||||||
|
{
|
||||||
|
$month_end = 12;
|
||||||
|
$year_end--;
|
||||||
|
}
|
||||||
|
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||||
|
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||||
|
}
|
||||||
|
|
||||||
$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'));
|
||||||
|
|
||||||
|
|
||||||
@ -177,7 +192,7 @@ $num=count($object->lines);
|
|||||||
|
|
||||||
|
|
||||||
if ($action == 'delmouv') {
|
if ($action == 'delmouv') {
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1);
|
||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
}
|
}
|
||||||
if ($action == 'delbookkeepingyear') {
|
if ($action == 'delbookkeepingyear') {
|
||||||
@ -208,8 +223,9 @@ if ($action == 'delbookkeepingyear') {
|
|||||||
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||||
|
|
||||||
$viewflat = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">' . $langs->trans("ViewFlatList") . '</a>';
|
$viewflat = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">' . $langs->trans("ViewFlatList") . '</a>';
|
||||||
|
$addbutton = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a>';
|
||||||
|
|
||||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords,'title_accountancy',0,$viewflat,'', $limit);
|
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords,'title_accountancy',0,$viewflat.$addbutton,'', $limit);
|
||||||
|
|
||||||
// Reverse sort order
|
// Reverse sort order
|
||||||
if ( preg_match('/^asc/i', $sortorder) )
|
if ( preg_match('/^asc/i', $sortorder) )
|
||||||
@ -217,10 +233,6 @@ if ( preg_match('/^asc/i', $sortorder) )
|
|||||||
else
|
else
|
||||||
$sortorder = "desc";
|
$sortorder = "desc";
|
||||||
|
|
||||||
print '<div class="tabsAction tabsActionNoBottom">' . "\n";
|
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|||||||
@ -21,11 +21,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file accounting/bookkeeping/thirdparty_lettrage.php
|
* \file accounting/bookkeeping/thirdparty_lettrage.php
|
||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Onglet de gestion de parametrages des ventilations
|
* \brief Onglet de gestion de parametrages des ventilations
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
@ -34,52 +33,71 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||||
|
|
||||||
$action=GETPOST('action','aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
$massaction=GETPOST('massaction','alpha');
|
$massaction = GETPOST('massaction', 'alpha');
|
||||||
$show_files=GETPOST('show_files','int');
|
$show_files = GETPOST('show_files', 'int');
|
||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm = GETPOST('confirm', 'alpha');
|
||||||
$toselect = GETPOST('toselect', 'array');
|
$toselect = GETPOST('toselect', 'array');
|
||||||
|
|
||||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page", 'int');
|
||||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
if (empty($page) || $page == - 1) {
|
||||||
|
$page = 0;
|
||||||
|
} // If $page is not defined, or '' or -1
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if ($sortorder == "") $sortorder = "ASC";
|
if ($sortorder == "")
|
||||||
if ($sortfield == "") $sortfield = "bk.rowid";
|
$sortorder = "DESC";
|
||||||
|
if ($sortfield == "")
|
||||||
|
$sortfield = "bk.doc_date";
|
||||||
|
|
||||||
$search_year = GETPOST ( "search_year" );
|
$search_year = GETPOST("search_year", 'int');
|
||||||
|
$search_doc_type = GETPOST("search_doc_type", 'alpha');
|
||||||
|
$search_doc_ref = GETPOST("search_doc_ref", 'alpha');
|
||||||
|
|
||||||
|
$lettering = GETPOST('lettering');
|
||||||
|
if (! empty($lettering)) {
|
||||||
|
$action = $lettering;
|
||||||
|
}
|
||||||
|
$toselect = GETPOST('toselect', 'array');
|
||||||
|
|
||||||
|
// Did we click on purge search criteria ?
|
||||||
|
// All tests are required to be compatible with all browsers
|
||||||
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||||
|
$search_year = '';
|
||||||
|
$search_doc_type = '';
|
||||||
|
$search_doc_ref = '';
|
||||||
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST("socid",'int');
|
$socid = GETPOST("socid", 'int');
|
||||||
// if ($user->societe_id) $socid=$user->societe_id;
|
// if ($user->societe_id) $socid=$user->societe_id;
|
||||||
|
|
||||||
$object = new Societe($db);
|
$object = new Societe($db);
|
||||||
$object->id = $socid;
|
$object->id = $socid;
|
||||||
$object->fetch($socid);
|
$result = $object->fetch($socid);
|
||||||
|
if ($result < 0) {
|
||||||
|
setEventMessage($object->error, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$BookKeeping = new lettering($db);
|
$BookKeeping = new lettering($db);
|
||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'lettering') {
|
if ($action == 'lettering') {
|
||||||
|
|
||||||
$result = $BookKeeping->updatelettrage($_POST['ids']);
|
$result = $BookKeeping->updateLettrage($toselect);
|
||||||
|
|
||||||
// var_dump($result);
|
|
||||||
if( $result < 0 ){
|
|
||||||
setEventMessages('', $BookKeeping->errors, 'errors' );
|
|
||||||
$error++;
|
|
||||||
|
|
||||||
|
if ($result < 0) {
|
||||||
|
setEventMessages('', $BookKeeping->errors, 'errors');
|
||||||
|
$error ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,243 +105,214 @@ if ($action == 'autolettrage') {
|
|||||||
|
|
||||||
$result = $BookKeeping->lettrageTiers($socid);
|
$result = $BookKeeping->lettrageTiers($socid);
|
||||||
|
|
||||||
if( $result < 0 )
|
if ($result < 0) {
|
||||||
{
|
setEventMessages('', $BookKeeping->errors, 'errors');
|
||||||
setEventMessages('', $BookKeeping->errors, 'errors' );
|
$error ++;
|
||||||
$error++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
llxHeader('', 'Compta - Grand Livre');
|
||||||
|
|
||||||
llxHeader ( '', 'Compta - Grand Livre' );
|
/*
|
||||||
|
* Affichage onglets
|
||||||
|
*/
|
||||||
|
$head = societe_prepare_head($object);
|
||||||
|
|
||||||
|
dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error');
|
||||||
|
|
||||||
/*
|
dol_fiche_head($head, 'accounting', $langs->trans("ThirdParty"), 0, 'company');
|
||||||
* Affichage onglets
|
|
||||||
*/
|
|
||||||
$head = societe_prepare_head($object);
|
|
||||||
|
|
||||||
dol_htmloutput_mesg(is_numeric($error)?'':$error, $errors, 'error');
|
print '<table width="100%" class="border">';
|
||||||
|
print '<tr><td width="30%">' . $langs->trans("ThirdPartyName") . '</td><td width="70%" colspan="3">';
|
||||||
|
$object->next_prev_filter = "te.fournisseur = 1";
|
||||||
|
print $form->showrefnav($object, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom', '', '');
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
dol_fiche_head($head, 'TabAccounting', $langs->trans("ThirdParty"),0,'company');
|
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||||
|
{
|
||||||
|
print '<tr><td>' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<tr>';
|
||||||
|
print '<td class="nowrap">' . $langs->trans("CustomerCode") . '</td><td colspan="3">';
|
||||||
|
print $object->code_client;
|
||||||
|
if ($object->check_codeclient() != 0)
|
||||||
|
print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>';
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
$langs->load('compta');
|
||||||
|
print '<tr>';
|
||||||
|
print '<td>';
|
||||||
|
print $form->editfieldkey("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta, $object, $user->rights->societe->creer);
|
||||||
|
print '</td><td colspan="3">';
|
||||||
|
print $form->editfieldval("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta, $object, $user->rights->societe->creer);
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Address
|
||||||
|
print '<tr><td valign="top">' . $langs->trans("Address") . '</td><td colspan="3">';
|
||||||
|
dol_print_address($object->address, 'gmap', 'thirdparty', $object->id);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<table width="100%" class="border">';
|
// Zip / Town
|
||||||
print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td><td width="70%" colspan="3">';
|
print '<tr><td class="nowrap">' . $langs->trans("Zip") . ' / ' . $langs->trans("Town") . '</td><td colspan="3">' . $object->zip . (($object->zip && $object->town) ? ' / ' : '') . $object->town . '</td>';
|
||||||
$object->next_prev_filter="te.fournisseur = 1";
|
print '</tr>';
|
||||||
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
// Country
|
||||||
{
|
print '<tr><td>' . $langs->trans("Country") . '</td><td colspan="3">';
|
||||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
|
// $img=picto_from_langcode($object->country_code);
|
||||||
}
|
$img = '';
|
||||||
|
if ($object->isInEEC())
|
||||||
|
print $form->textwithpicto(($img ? $img . ' ' : '') . $object->country, $langs->trans("CountryIsInEEC"), 1, 0);
|
||||||
|
else
|
||||||
|
print ($img ? $img . ' ' : '') . $object->country;
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
print '<tr>';
|
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
|
||||||
print '<td class="nowrap">'.$langs->trans("CustomerCode"). '</td><td colspan="3">';
|
$sql .= " bk.thirdparty_code, bk.numero_compte , bk.label_compte, bk.debit, ";
|
||||||
print $object->code_client;
|
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
||||||
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||||
print '</td>';
|
$sql .= " WHERE (bk.thirdparty_code = '" . $object->code_compta . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . "' )";
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
$langs->load('compta');
|
if (dol_strlen($search_year)) {
|
||||||
print '<tr>';
|
$date_start = dol_mktime(0, 0, 0, 1, 1, $search_year);
|
||||||
print '<td>';
|
$date_end = dol_mktime(23, 59, 59, 12, 31, $search_year);
|
||||||
print $form->editfieldkey("CustomerAccountancyCode",'customeraccountancycode',$object->code_compta,$object,$user->rights->societe->creer);
|
$sql .= " AND ( bk.doc_date BETWEEN '" . $db->idate($date_start) . "' AND '" . $db->idate($date_end) . "' )";
|
||||||
print '</td><td colspan="3">';
|
}
|
||||||
print $form->editfieldval("CustomerAccountancyCode",'customeraccountancycode',$object->code_compta,$object,$user->rights->societe->creer);
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
// Address
|
$debit = 0;
|
||||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">';
|
$credit = 0;
|
||||||
dol_print_address($object->address,'gmap','thirdparty',$object->id);
|
$solde = 0;
|
||||||
print '</td></tr>';
|
// Count total nb of records and calc total sum
|
||||||
|
$nbtotalofrecords = '';
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if (! $resql) {
|
||||||
|
dol_print_error($db);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
$nbtotalofrecords = $db->num_rows($resql);
|
||||||
|
|
||||||
// Zip / Town
|
while ( $obj = $db->fetch_object($resql) ) {
|
||||||
print '<tr><td class="nowrap">'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3">'.$object->zip.(($object->zip && $object->town)?' / ':'').$object->town.'</td>';
|
$debit += $obj->debit;
|
||||||
|
$credit += $obj->credit;
|
||||||
|
|
||||||
|
$solde += ($obj->credit - $obj->debit);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
|
dol_syslog("/accountancy/bookkeeping/thirdparty_lettrage.php", LOG_DEBUG);
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if (! $resql) {
|
||||||
|
dol_print_error($db);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
dol_syslog("/accountancy/bookkeeping/thirdparty_lettrage.php", LOG_DEBUG);
|
||||||
|
if ($resql) {
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '" method="POST">';
|
||||||
|
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
||||||
|
|
||||||
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||||
|
|
||||||
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Docref", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Labelcompte", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "bk.montant", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Sens", $_SERVER["PHP_SELF"], "bk.sens", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Solde", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print '<td></td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||||
|
print '<td><input type="text" name="search_year" value="' . $search_year . '"></td>';
|
||||||
|
print '<td><input type="text" name="search_doc_refe" value="' . $search_doc_ref . '"></td>';
|
||||||
|
print '<td colspan="7"> </td>';
|
||||||
|
print '<td align="right">';
|
||||||
|
$searchpicto = $form->showFilterButtons();
|
||||||
|
print $searchpicto;
|
||||||
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Country
|
$var = false;
|
||||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
$solde = 0;
|
||||||
//$img=picto_from_langcode($object->country_code);
|
$tmp = '';
|
||||||
$img='';
|
while ( $obj = $db->fetch_object($resql) ) {
|
||||||
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
|
|
||||||
else print ($img?$img.' ':'').$object->country;
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print '</table>';
|
if ($tmp != $obj->lettering_code || empty($tmp))
|
||||||
|
$tmp = $obj->lettering_code;
|
||||||
|
|
||||||
|
if ($tmp != $obj->lettering_code || empty($obj->lettering_code))
|
||||||
|
$var = ! $var;
|
||||||
|
|
||||||
|
$solde += ($obj->credit - $obj->debit);
|
||||||
|
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
|
if (empty($obj->lettering_code)) {
|
||||||
|
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||||
|
print img_edit();
|
||||||
|
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
||||||
|
} else
|
||||||
|
print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||||
|
|
||||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
print '<td>' . $obj->doc_ref . '</td>';
|
||||||
$sql .= " WHERE (bk.code_tiers = '" . $object->code_compta . "' AND bk.numero_compte = '" .$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER. "' )" ;
|
print '<td>' . $obj->label_compte . '</td>';
|
||||||
|
print '<td>' . price($obj->debit) . '</td>';
|
||||||
|
print '<td>' . price($obj->credit) . '</td>';
|
||||||
|
print '<td>' . price($obj->montant) . '</td>';
|
||||||
|
print '<td>' . $obj->sens . '</td>';
|
||||||
|
print '<td>' . $obj->code_journal . '</td>';
|
||||||
|
print '<td>' . round($solde, 2) . '</td>';
|
||||||
|
|
||||||
|
if (empty($obj->lettering_code)) {
|
||||||
|
print '<td class="nowrap" align="center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
||||||
|
} else
|
||||||
|
print '<td>' . $obj->lettering_code . '</td>';
|
||||||
|
|
||||||
|
|
||||||
if (dol_strlen ( $search_year )) {
|
|
||||||
$sql .= " AND ( bk.doc_date BETWEEN '" . $search_year . "-0-0' AND '" . ($search_year+1). "-0-0' )";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$sql .= " ORDER BY bk.lettering_code ASC, bk.doc_date ASC" ;//. $db->plimit ( $conf->liste_limit + 1, $offset );
|
|
||||||
|
|
||||||
// echo $sql;
|
|
||||||
// dol_syslog ( "bookkeping:liste:create sql=" . $sql, LOG_DEBUG );
|
|
||||||
$resql = $db->query ( $sql );
|
|
||||||
if ($resql) {
|
|
||||||
$num = $db->num_rows ( $resql );
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
|
|
||||||
print '<form name="add" action="?socid='.$object->id.'" method="POST">';
|
|
||||||
print '<input type="hidden" name="action" value="lettering">';
|
|
||||||
print '<input type="hidden" name="socid" value="'.$object->id.'">';
|
|
||||||
|
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<td></td>';
|
|
||||||
print_liste_field_titre("Doctype", "liste.php", "bk.doc_type" );
|
|
||||||
print_liste_field_titre("Docdate", "liste.php", "bk.doc_date" );
|
|
||||||
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
|
|
||||||
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
|
|
||||||
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
|
|
||||||
print_liste_field_titre("LabelAccount", "liste.php", "bk_label_compte" );
|
|
||||||
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
|
|
||||||
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
|
|
||||||
// print_liste_field_titre("Amount", "liste.php", "bk.montant" );
|
|
||||||
// print_liste_field_titre("Sens", "liste.php", "bk.sens" );
|
|
||||||
print_liste_field_titre("Codejournal", "liste.php", "bk.code_journal" );
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<form action="" method="GET">';
|
|
||||||
print '<input type="hidden" name="socid" value="' . $_GET ["socid"] . '">';
|
|
||||||
print '<td><input type="text" name="search_doc_type" value="' . $_GET ["search_doc_type"] . '"></td>';
|
|
||||||
print '<td><input type="text" name="search_year" value="' . $_GET ["search_year"] . '"></td>';
|
|
||||||
print '<td><input type="text" name="search_doc_refe" value="' . $_GET ["search_doc_ref"] . '"></td>';
|
|
||||||
// print '<td><input type="text" name="search_compte" value="' . $_GET ["search_compte"] . '"></td>';
|
|
||||||
// print '<td><input type="text" name="search_tiers" value="' . $_GET ["search_tiers"] . '"></td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
// print '<td> </td>';
|
|
||||||
// print '<td> </td>';
|
|
||||||
print '<td align="right">';
|
|
||||||
print '<input type="image" class="liste_titre" name="button_search" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" value="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '" title="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '">';
|
|
||||||
print '</td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '</form>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
$var = false;
|
|
||||||
|
|
||||||
$debit = 0;
|
|
||||||
$credit = 0;
|
|
||||||
$solde = 0;
|
|
||||||
$tmp = '';
|
|
||||||
while ( $i < $num ) {
|
|
||||||
$obj = $db->fetch_object ( $resql );
|
|
||||||
|
|
||||||
if($tmp !=$obj->lettering_code || empty($tmp) )
|
|
||||||
$tmp =$obj->lettering_code;
|
|
||||||
|
|
||||||
if($tmp !=$obj->lettering_code || empty($obj->lettering_code))
|
|
||||||
$var = ! $var;
|
|
||||||
|
|
||||||
|
|
||||||
$debit+= $obj->debit;
|
|
||||||
$credit+= $obj->credit;
|
|
||||||
|
|
||||||
$solde+=($obj->credit-$obj->debit);
|
|
||||||
print "<tr $bc[$var]>";
|
|
||||||
|
|
||||||
print '<td>' . $obj->rowid . '</td>';
|
|
||||||
if(empty($obj->lettering_code)){
|
|
||||||
print '<td><a href="'.dol_buildpath('/accountancy/bookkeeping/card.php', 1).'?piece_num=' . $obj->piece_num . '">';
|
|
||||||
print img_edit ();
|
|
||||||
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
print '<td>'.$obj->doc_type . '</td>' . "\n";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '<td>' . dol_print_date ( $db->jdate ( $obj->doc_date ), 'day' ) . '</td>';
|
|
||||||
print '<td>' . $obj->doc_ref . '</td>';
|
|
||||||
// print '<td>' . $obj->numero_compte . '</td>';
|
|
||||||
// print '<td>' . $obj->code_tiers . '</td>';
|
|
||||||
print '<td>' . $obj->label_compte . '</td>';
|
|
||||||
print '<td>' . $obj->debit . '</td>';
|
|
||||||
print '<td>' . $obj->credit . '</td>';
|
|
||||||
// print '<td>' . $obj->montant . '</td>';
|
|
||||||
// print '<td>' . $obj->sens . '</td>';
|
|
||||||
print '<td>' . $obj->code_journal . '</td>';
|
|
||||||
print '<td>' . round($solde, 2) . '</td>';
|
|
||||||
|
|
||||||
if(empty($obj->lettering_code)){
|
|
||||||
print '<td><input type="checkbox" name="ids[]" value="' . $obj->rowid . '" /></td>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
print '<td>' . $obj->lettering_code . '</td>';
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
$i ++;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
|
|
||||||
print '<td colspan="4">Mouvement totaux</td>' . "\n";
|
|
||||||
print '<td></td>';
|
|
||||||
// print '<td></td>';
|
|
||||||
// print '<td></td>';
|
|
||||||
print '<td><strong>' . $debit . '</strong></td>';
|
|
||||||
print '<td><strong>' . $credit . '</strong></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
|
||||||
print '<td colspan="5">Solde Comptable</td>' . "\n";
|
|
||||||
// print '<td></td>';
|
|
||||||
// print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td><strong>' . ($credit-$debit) . '</strong></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
print '<input class="butAction" type="submit" value="lettering">';
|
|
||||||
print '<a class="butAction" href="?socid='.$object->id.'&action=autolettrage">auto lettering</a>';
|
|
||||||
print "</form>";
|
|
||||||
$db->free($resql);
|
|
||||||
} else {
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
|
print '<td colspan="4">Mouvement totaux</td>' . "\n";
|
||||||
|
print '<td><strong>' . price($debit) . '</strong></td>';
|
||||||
|
print '<td><strong>' . price($credit) . '</strong></td>';
|
||||||
|
print '<td colspan="5"></td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
print '<td colspan="9">Solde Comptable</td>' . "\n";
|
||||||
|
print '<td><strong>' . price($credit - $debit) . '</strong></td>';
|
||||||
|
print '<td colspan="5"></td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
|
print '<input class="butAction" type="submit" value="lettering" name="lettering" id="lettering">';
|
||||||
|
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '&action=autolettrage">' . $langs->trans('AccountancyAutoLettering') . '</a>';
|
||||||
|
print "</form>";
|
||||||
|
$db->free($resql);
|
||||||
|
} else {
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -21,9 +21,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file accounting/bookkeeping/thirdparty_lettrage.php
|
* \file accounting/bookkeeping/thirdparty_lettrage.php
|
||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Tab to setup lettering
|
* \brief Tab to setup lettering
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Dolibarr environment
|
// Dolibarr environment
|
||||||
@ -35,52 +35,73 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||||
|
|
||||||
|
$action = GETPOST('action', 'aZ09');
|
||||||
$action=GETPOST('action','aZ09');
|
$massaction = GETPOST('massaction', 'alpha');
|
||||||
$massaction=GETPOST('massaction','alpha');
|
$show_files = GETPOST('show_files', 'int');
|
||||||
$show_files=GETPOST('show_files','int');
|
$confirm = GETPOST('confirm', 'alpha');
|
||||||
$confirm=GETPOST('confirm','alpha');
|
|
||||||
$toselect = GETPOST('toselect', 'array');
|
$toselect = GETPOST('toselect', 'array');
|
||||||
|
|
||||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page", 'int');
|
||||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
if (empty($page) || $page == - 1) {
|
||||||
|
$page = 0;
|
||||||
|
} // If $page is not defined, or '' or -1
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if ($sortorder == "") $sortorder = "ASC";
|
if ($sortorder == "")
|
||||||
if ($sortfield == "") $sortfield = "bk.rowid";
|
$sortorder = "DESC";
|
||||||
|
if ($sortfield == "")
|
||||||
|
$sortfield = "bk.doc_date";
|
||||||
|
|
||||||
$search_year = GETPOST ( "search_year" );
|
$search_year = GETPOST("search_year",'int');
|
||||||
|
$search_doc_type = GETPOST("search_doc_type",'alpha');
|
||||||
|
$search_doc_ref = GETPOST("search_doc_ref",'alpha');
|
||||||
|
|
||||||
|
$lettering = GETPOST('lettering');
|
||||||
|
if (!empty($lettering)) {
|
||||||
|
$action=$lettering;
|
||||||
|
}
|
||||||
|
$toselect = GETPOST('toselect','array');
|
||||||
|
|
||||||
|
// Did we click on purge search criteria ?
|
||||||
|
// All tests are required to be compatible with all browsers
|
||||||
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha'))
|
||||||
|
{
|
||||||
|
$search_year='';
|
||||||
|
$search_doc_type='';
|
||||||
|
$search_doc_ref='';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST("socid",'int');
|
$socid = GETPOST("socid", 'int');
|
||||||
// if ($user->societe_id) $socid=$user->societe_id;
|
// if ($user->societe_id) $socid=$user->societe_id;
|
||||||
|
|
||||||
$object = new Societe($db);
|
$object = new Societe($db);
|
||||||
$object->id = $socid;
|
$object->id = $socid;
|
||||||
$object->fetch($socid);
|
$result = $object->fetch($socid);
|
||||||
|
if ($result<0) {
|
||||||
|
setEventMessage($object->error,'errors');
|
||||||
|
}
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$BookKeeping = new lettering($db);
|
$BookKeeping = new lettering($db);
|
||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
if ($action == 'lettering') {
|
if ($action == 'lettering') {
|
||||||
|
|
||||||
$result = $BookKeeping->updatelettrage($_POST['ids']);
|
$result = $BookKeeping->updateLettrage($toselect);
|
||||||
|
|
||||||
// var_dump($result);
|
|
||||||
if( $result < 0 ){
|
|
||||||
setEventMessages('', $BookKeeping->errors, 'errors' );
|
|
||||||
$error++;
|
|
||||||
|
|
||||||
|
// var_dump($result);
|
||||||
|
if ($result < 0) {
|
||||||
|
setEventMessages('', $BookKeeping->errors, 'errors');
|
||||||
|
$error ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,247 +109,230 @@ if ($action == 'autolettrage') {
|
|||||||
|
|
||||||
$result = $BookKeeping->lettrageTiers($socid);
|
$result = $BookKeeping->lettrageTiers($socid);
|
||||||
|
|
||||||
if ( $result < 0 )
|
if ($result < 0) {
|
||||||
{
|
setEventMessages('', $BookKeeping->errors, 'errors');
|
||||||
setEventMessages('', $BookKeeping->errors, 'errors' );
|
$error ++;
|
||||||
$error++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$title = 'AccountancyLettrage';
|
||||||
|
|
||||||
llxHeader ( '', 'Compta - Grand Livre' );
|
llxHeader('', $title);
|
||||||
|
|
||||||
|
|
||||||
/*
|
$param='';
|
||||||
* Affichage onglets
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
*/
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
$head = societe_prepare_head($object);
|
if (!empty($search_year)) $param.='&search_year='.$search_year;
|
||||||
|
if (!empty($socid)) $param.='&socid='.$socid;
|
||||||
|
if (!empty($search_doc_type)) $param.='&search_doc_type='.$search_doc_type;
|
||||||
|
if (!empty($search_doc_ref)) $param.='&search_doc_ref='.$search_doc_ref;
|
||||||
|
|
||||||
dol_htmloutput_mesg(is_numeric($error)?'':$error, $errors, 'error');
|
|
||||||
|
|
||||||
dol_fiche_head($head, 'TabAccounting', $langs->trans("ThirdParty"),0,'company');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '<table width="100%" class="border">';
|
|
||||||
print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td><td width="70%" colspan="3">';
|
|
||||||
$object->next_prev_filter="te.fournisseur = 1";
|
|
||||||
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
print '<tr>';
|
|
||||||
print '<td class="nowrap">'.$langs->trans("SupplierCode"). '</td><td colspan="3">';
|
|
||||||
print $object->code_fournisseur;
|
|
||||||
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
$langs->load('compta');
|
|
||||||
print '<tr>';
|
|
||||||
print '<td>';
|
|
||||||
print $form->editfieldkey("SupplierAccountancyCode",'supplieraccountancycode',$object->code_compta_fournisseur,$object,$user->rights->societe->creer);
|
|
||||||
print '</td><td colspan="3">';
|
|
||||||
print $form->editfieldval("SupplierAccountancyCode",'supplieraccountancycode',$object->code_compta_fournisseur,$object,$user->rights->societe->creer);
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
|
|
||||||
// Address
|
|
||||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">';
|
|
||||||
dol_print_address($object->address,'gmap','thirdparty',$object->id);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Zip / Town
|
|
||||||
print '<tr><td class="nowrap">'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3">'.$object->zip.(($object->zip && $object->town)?' / ':'').$object->town.'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
// Country
|
|
||||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
|
||||||
//$img=picto_from_langcode($object->country_code);
|
|
||||||
$img='';
|
|
||||||
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
|
|
||||||
else print ($img?$img.' ':'').$object->country;
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
// print_r($soc);
|
|
||||||
// exit;
|
|
||||||
// [code_compta] => 411DOUA
|
|
||||||
// [code_compta_fournisseur] => 401SUPPCODE
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mode Liste
|
* Affichage onglets
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
$head = societe_prepare_head($object);
|
||||||
|
|
||||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering ";
|
dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error');
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
|
||||||
$sql .= " WHERE (bk.code_tiers = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" .$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER. "' )" ;
|
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'accounting_supplier', $langs->trans("ThirdParty"), 0, 'company');
|
||||||
|
|
||||||
|
print '<table width="100%" class="border">';
|
||||||
|
print '<tr><td width="30%">' . $langs->trans("ThirdPartyName") . '</td><td width="70%" colspan="3">';
|
||||||
|
$object->next_prev_filter = "te.fournisseur = 1";
|
||||||
|
print $form->showrefnav($object, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom', '', '');
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
if (dol_strlen ( $search_year )) {
|
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||||
$sql .= " AND ( bk.doc_date BETWEEN '" . $search_year . "-0-0' AND '" . ($search_year+1). "-0-0' )";
|
{
|
||||||
}
|
print '<tr><td>' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<tr>';
|
||||||
|
print '<td class="nowrap">' . $langs->trans("SupplierCode") . '</td><td colspan="3">';
|
||||||
|
print $object->code_fournisseur;
|
||||||
|
if ($object->check_codefournisseur() != 0)
|
||||||
|
print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>';
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
$sql .= " ORDER BY bk.lettering ASC, bk.doc_date ASC" ;//. $db->plimit ( $conf->liste_limit + 1, $offset );
|
$langs->load('compta');
|
||||||
|
print '<tr>';
|
||||||
|
print '<td>';
|
||||||
|
print $form->editfieldkey("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->rights->societe->creer);
|
||||||
|
print '</td><td colspan="3">';
|
||||||
|
print $form->editfieldval("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->rights->societe->creer);
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// echo $sql;
|
// Address
|
||||||
// dol_syslog ( "bookkeping:liste:create sql=" . $sql, LOG_DEBUG );
|
print '<tr><td valign="top">' . $langs->trans("Address") . '</td><td colspan="3">';
|
||||||
$resql = $db->query ( $sql );
|
dol_print_address($object->address, 'gmap', 'thirdparty', $object->id);
|
||||||
if ($resql) {
|
print '</td></tr>';
|
||||||
$num = $db->num_rows ( $resql );
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
|
// Zip / Town
|
||||||
|
print '<tr><td class="nowrap">' . $langs->trans("Zip") . ' / ' . $langs->trans("Town") . '</td><td colspan="3">' . $object->zip . (($object->zip && $object->town) ? ' / ' : '') . $object->town . '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
print '<form name="add" action="?socid='.$object->id.'" method="POST">';
|
// Country
|
||||||
print '<input type="hidden" name="action" value="lettering">';
|
print '<tr><td>' . $langs->trans("Country") . '</td><td colspan="3">';
|
||||||
print '<input type="hidden" name="socid" value="'.$object->id.'">';
|
// $img=picto_from_langcode($object->country_code);
|
||||||
|
$img = '';
|
||||||
|
if ($object->isInEEC())
|
||||||
|
print $form->textwithpicto(($img ? $img . ' ' : '') . $object->country, $langs->trans("CountryIsInEEC"), 1, 0);
|
||||||
|
else
|
||||||
|
print ($img ? $img . ' ' : '') . $object->country;
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
|
||||||
|
$sql .= " bk.thirdparty_code, bk.numero_compte , bk.label_compte, bk.debit, ";
|
||||||
|
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||||
|
$sql .= " WHERE (bk.thirdparty_code = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . "' )";
|
||||||
|
|
||||||
|
if (dol_strlen($search_year)) {
|
||||||
|
$date_start = dol_mktime(0, 0, 0, 1, 1, $search_year);
|
||||||
|
$date_end = dol_mktime(23, 59, 59, 12, 31, $search_year);
|
||||||
|
$sql .= " AND ( bk.doc_date BETWEEN '".$db->idate($date_start)."' AND '".$db->idate($date_end)."' )";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
|
|
||||||
|
$debit = 0;
|
||||||
|
$credit = 0;
|
||||||
|
$solde = 0;
|
||||||
|
// Count total nb of records and calc total sum
|
||||||
|
$nbtotalofrecords = '';
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if (! $resql)
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$nbtotalofrecords = $db->num_rows($resql);
|
||||||
|
|
||||||
|
while ($obj = $db->fetch_object($resql)) {
|
||||||
|
$debit += $obj->debit;
|
||||||
|
$credit += $obj->credit;
|
||||||
|
|
||||||
|
$solde += ($obj->credit - $obj->debit);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
|
|
||||||
|
dol_syslog ( "/accountancy/bookkeeping/thirdparty_lettrage_supplier.php", LOG_DEBUG );
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if (! $resql)
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
dol_syslog ( "/accountancy/bookkeeping/thirdparty_lettrage_supplier.php", LOG_DEBUG );
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid=' . $object->id . '" method="POST">';
|
||||||
|
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
||||||
|
|
||||||
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||||
|
|
||||||
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type","",$param,"",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date","",$param,"",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre("Docref", $_SERVER["PHP_SELF"], "bk.doc_ref","",$param,"",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre("Labelcompte", $_SERVER["PHP_SELF"], "bk.label_compte","",$param,"",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit","",$param,"",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit","",$param,"",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "bk.montant","",$param,"",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre("Sens", $_SERVER["PHP_SELF"], "bk.sens","",$param,"",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal","",$param,"",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre("Solde", $_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder);
|
||||||
|
print '<td></td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||||
|
print '<td><input type="text" name="search_year" value="' . $search_year . '"></td>';
|
||||||
|
print '<td><input type="text" name="search_doc_refe" value="' . $search_doc_ref . '"></td>';
|
||||||
|
print '<td colspan="7"> </td>';
|
||||||
|
print '<td align="right">';
|
||||||
|
$searchpicto=$form->showFilterButtons();
|
||||||
|
print $searchpicto;
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
$var = false;
|
||||||
|
$solde = 0;
|
||||||
|
$tmp = '';
|
||||||
|
while ($obj = $db->fetch_object($resql)) {
|
||||||
|
|
||||||
|
if ($tmp != $obj->lettering_code || empty($tmp))
|
||||||
|
$tmp = $obj->lettering_code;
|
||||||
|
|
||||||
|
if ($tmp != $obj->lettering_code || empty($obj->lettering_code))
|
||||||
|
$var = ! $var;
|
||||||
|
|
||||||
|
$solde += ($obj->credit - $obj->debit);
|
||||||
|
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
|
if (empty($obj->lettering_code)) {
|
||||||
|
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||||
|
print img_edit();
|
||||||
|
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
||||||
|
} else
|
||||||
|
print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||||
|
|
||||||
|
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||||
|
print '<td>' . $obj->doc_ref . '</td>';
|
||||||
|
print '<td>' . $obj->label_compte . '</td>';
|
||||||
|
print '<td>' . price($obj->debit) . '</td>';
|
||||||
|
print '<td>' . price($obj->credit) . '</td>';
|
||||||
|
print '<td>' . price($obj->montant) . '</td>';
|
||||||
|
print '<td>' . $obj->sens . '</td>';
|
||||||
|
print '<td>' . $obj->code_journal . '</td>';
|
||||||
|
print '<td>' . round($solde, 2) . '</td>';
|
||||||
|
|
||||||
|
if (empty($obj->lettering_code)) {
|
||||||
|
print '<td class="nowrap" align="center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
||||||
|
} else
|
||||||
|
print '<td>' . $obj->lettering_code . '</td>';
|
||||||
|
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<td></td>';
|
|
||||||
print_liste_field_titre("Doctype", "liste.php", "bk.doc_type" );
|
|
||||||
print_liste_field_titre("Docdate", "liste.php", "bk.doc_date" );
|
|
||||||
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
|
|
||||||
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
|
|
||||||
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
|
|
||||||
print_liste_field_titre("LabelAccount", "liste.php", "bk_label_compte" );
|
|
||||||
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
|
|
||||||
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
|
|
||||||
print_liste_field_titre("Amount", "liste.php", "bk.montant" );
|
|
||||||
print_liste_field_titre("Sens", "liste.php", "bk.sens" );
|
|
||||||
print_liste_field_titre("Codejournal", "liste.php", "bk.code_journal" );
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<form action="" method="GET">';
|
|
||||||
print '<input type="hidden" name="socid" value="' . $_GET ["socid"] . '">';
|
|
||||||
print '<td><input type="text" name="search_doc_type" value="' . $_GET ["search_doc_type"] . '"></td>';
|
|
||||||
print '<td><input type="text" name="search_year" value="' . $_GET ["search_year"] . '"></td>';
|
|
||||||
print '<td><input type="text" name="search_doc_refe" value="' . $_GET ["search_doc_ref"] . '"></td>';
|
|
||||||
// print '<td><input type="text" name="search_compte" value="' . $_GET ["search_compte"] . '"></td>';
|
|
||||||
// print '<td><input type="text" name="search_tiers" value="' . $_GET ["search_tiers"] . '"></td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td align="right">';
|
|
||||||
print '<input type="image" class="liste_titre" name="button_search" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" value="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '" title="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '">';
|
|
||||||
print '</td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '</form>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
$var = false;
|
|
||||||
|
|
||||||
$debit = 0;
|
|
||||||
$credit = 0;
|
|
||||||
$solde = 0;
|
|
||||||
$tmp = '';
|
|
||||||
while ( $i < $num ) {
|
|
||||||
$obj = $db->fetch_object ( $resql );
|
|
||||||
|
|
||||||
if($tmp !=$obj->lettering || empty($tmp) )
|
|
||||||
$tmp =$obj->lettering;
|
|
||||||
|
|
||||||
if($tmp !=$obj->lettering || empty($obj->lettering))
|
|
||||||
$var = ! $var;
|
|
||||||
|
|
||||||
|
|
||||||
$debit+= $obj->debit;
|
|
||||||
$credit+= $obj->credit;
|
|
||||||
|
|
||||||
$solde+=($obj->credit-$obj->debit);
|
|
||||||
print "<tr $bc[$var]>";
|
|
||||||
|
|
||||||
print '<td>' . $obj->rowid . '</td>';
|
|
||||||
if(empty($obj->lettering)){
|
|
||||||
print '<td><a href="'.dol_buildpath('/accountancy/bookkeeping/card.php', 1).'?piece_num=' . $obj->piece_num . '">';
|
|
||||||
print img_edit ();
|
|
||||||
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
print '<td>'.$obj->doc_type . '</td>' . "\n";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '<td>' . dol_print_date ( $db->jdate ( $obj->doc_date ), 'day' ) . '</td>';
|
|
||||||
print '<td>' . $obj->doc_ref . '</td>';
|
|
||||||
// print '<td>' . $obj->numero_compte . '</td>';
|
|
||||||
// print '<td>' . $obj->code_tiers . '</td>';
|
|
||||||
print '<td>' . $obj->label_compte . '</td>';
|
|
||||||
print '<td>' . $obj->debit . '</td>';
|
|
||||||
print '<td>' . $obj->credit . '</td>';
|
|
||||||
print '<td>' . $obj->montant . '</td>';
|
|
||||||
print '<td>' . $obj->sens . '</td>';
|
|
||||||
print '<td>' . $obj->code_journal . '</td>';
|
|
||||||
print '<td>' . round($solde, 2) . '</td>';
|
|
||||||
|
|
||||||
if(empty($obj->lettering)){
|
|
||||||
print '<td><input type="checkbox" name="ids[]" value="' . $obj->rowid . '" /></td>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
print '<td>' . $obj->lettering . '</td>';
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
$i ++;
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
|
|
||||||
print '<td colspan="4">Mouvement totaux</td>' . "\n";
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td><strong>' . $debit . '</strong></td>';
|
|
||||||
print '<td><strong>' . $credit . '</strong></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
|
||||||
print '<td colspan="5">Solde Comptable</td>' . "\n";
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td><strong>' . ($credit-$debit) . '</strong></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
print '<input class="butAction" type="submit" value="lettering">';
|
|
||||||
print '<a class="butAction" href="?socid='.$object->id.'&action=autolettrage">auto lettering</a>';
|
|
||||||
print "</form>";
|
|
||||||
$db->free ( $resql );
|
|
||||||
} else {
|
|
||||||
dol_print_error ( $db );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
|
print '<td colspan="4">Mouvement totaux</td>' . "\n";
|
||||||
|
print '<td><strong>' . price($debit) . '</strong></td>';
|
||||||
|
print '<td><strong>' . price($credit) . '</strong></td>';
|
||||||
|
print '<td colspan="5"></td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
print '<td colspan="9">Solde Comptable</td>' . "\n";
|
||||||
|
print '<td><strong>' . price($credit - $debit) . '</strong></td>';
|
||||||
|
print '<td colspan="5"></td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
|
print '<input class="butAction" type="submit" value="lettering" name="lettering" id="lettering">';
|
||||||
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid=' . $object->id . '&action=autolettrage">'.$langs->trans('AccountancyAutoLettering').'</a>';
|
||||||
|
print "</form>";
|
||||||
|
$db->free($resql);
|
||||||
|
} else {
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -6,6 +6,10 @@
|
|||||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
|
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||||
* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
|
* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
|
* Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com>
|
||||||
|
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr>
|
||||||
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -40,7 +44,7 @@ class AccountancyExport
|
|||||||
/**
|
/**
|
||||||
* @var Type of export. Defined by $conf->global->ACCOUNTING_EXPORT_MODELCSV
|
* @var Type of export. Defined by $conf->global->ACCOUNTING_EXPORT_MODELCSV
|
||||||
*/
|
*/
|
||||||
public static $EXPORT_TYPE_NORMAL = 1; // Classic CSV
|
public static $EXPORT_TYPE_NORMAL = 1; // Classic CSV
|
||||||
public static $EXPORT_TYPE_CEGID = 2;
|
public static $EXPORT_TYPE_CEGID = 2;
|
||||||
public static $EXPORT_TYPE_COALA = 3;
|
public static $EXPORT_TYPE_COALA = 3;
|
||||||
public static $EXPORT_TYPE_BOB50 = 4;
|
public static $EXPORT_TYPE_BOB50 = 4;
|
||||||
@ -49,6 +53,7 @@ class AccountancyExport
|
|||||||
public static $EXPORT_TYPE_EBP = 7;
|
public static $EXPORT_TYPE_EBP = 7;
|
||||||
public static $EXPORT_TYPE_COGILOG = 8;
|
public static $EXPORT_TYPE_COGILOG = 8;
|
||||||
public static $EXPORT_TYPE_AGIRIS = 9;
|
public static $EXPORT_TYPE_AGIRIS = 9;
|
||||||
|
public static $EXPORT_TYPE_CONFIGURABLE = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -78,11 +83,11 @@ class AccountancyExport
|
|||||||
|
|
||||||
$this->db = &$db;
|
$this->db = &$db;
|
||||||
$this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
$this->end_line = "\n";
|
$this->end_line = empty($conf->global->ACCOUNTING_EXPORT_ENDLINE)?"\n":($conf->global->ACCOUNTING_EXPORT_ENDLINE==1?"\n":"\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array wit all export type available (key + label)
|
* Array with all export type available (key + label)
|
||||||
*
|
*
|
||||||
* @return array of type
|
* @return array of type
|
||||||
*/
|
*/
|
||||||
@ -98,7 +103,70 @@ class AccountancyExport
|
|||||||
self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'),
|
self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'),
|
||||||
self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'),
|
self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'),
|
||||||
self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'),
|
self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'),
|
||||||
self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris')
|
self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'),
|
||||||
|
self::$EXPORT_TYPE_CONFIGURABLE => $langs->trans('Modelcsv_configurable'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array with all export type available (key + label) and parameters for config
|
||||||
|
*
|
||||||
|
* @return array of type
|
||||||
|
*/
|
||||||
|
public static function getTypeConfig() {
|
||||||
|
global $conf, $langs;
|
||||||
|
|
||||||
|
return array (
|
||||||
|
'param' => array(
|
||||||
|
self::$EXPORT_TYPE_NORMAL => array(
|
||||||
|
'label' => $langs->trans('Modelcsv_normal'),
|
||||||
|
'ACCOUNTING_EXPORT_FORMAT' => empty($conf->global->ACCOUNTING_EXPORT_FORMAT)?'txt':$conf->global->ACCOUNTING_EXPORT_FORMAT,
|
||||||
|
'ACCOUNTING_EXPORT_SEPARATORCSV' => empty($conf->global->ACCOUNTING_EXPORT_SEPARATORCSV)?',':$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV,
|
||||||
|
'ACCOUNTING_EXPORT_ENDLINE' => empty($conf->global->ACCOUNTING_EXPORT_ENDLINE)?1:$conf->global->ACCOUNTING_EXPORT_ENDLINE,
|
||||||
|
'ACCOUNTING_EXPORT_DATE' => empty($conf->global->ACCOUNTING_EXPORT_DATE)?'%d%m%Y':$conf->global->ACCOUNTING_EXPORT_DATE,
|
||||||
|
),
|
||||||
|
self::$EXPORT_TYPE_CEGID => array(
|
||||||
|
'label' => $langs->trans('Modelcsv_CEGID'),
|
||||||
|
),
|
||||||
|
self::$EXPORT_TYPE_COALA => array(
|
||||||
|
'label' => $langs->trans('Modelcsv_COALA'),
|
||||||
|
),
|
||||||
|
self::$EXPORT_TYPE_BOB50 => array(
|
||||||
|
'label' => $langs->trans('Modelcsv_bob50'),
|
||||||
|
),
|
||||||
|
self::$EXPORT_TYPE_CIEL => array(
|
||||||
|
'label' => $langs->trans('Modelcsv_ciel'),
|
||||||
|
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
|
||||||
|
),
|
||||||
|
self::$EXPORT_TYPE_QUADRATUS => array(
|
||||||
|
'label' => $langs->trans('Modelcsv_quadratus'),
|
||||||
|
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
|
||||||
|
),
|
||||||
|
self::$EXPORT_TYPE_EBP => array(
|
||||||
|
'label' => $langs->trans('Modelcsv_ebp'),
|
||||||
|
),
|
||||||
|
self::$EXPORT_TYPE_COGILOG => array(
|
||||||
|
'label' => $langs->trans('Modelcsv_cogilog'),
|
||||||
|
),
|
||||||
|
self::$EXPORT_TYPE_AGIRIS => array(
|
||||||
|
'label' => $langs->trans('Modelcsv_agiris'),
|
||||||
|
),
|
||||||
|
self::$EXPORT_TYPE_CONFIGURABLE => array(
|
||||||
|
'label' => $langs->trans('Modelcsv_configurable'),
|
||||||
|
'ACCOUNTING_EXPORT_FORMAT' => empty($conf->global->ACCOUNTING_EXPORT_FORMAT)?'txt':$conf->global->ACCOUNTING_EXPORT_FORMAT,
|
||||||
|
'ACCOUNTING_EXPORT_SEPARATORCSV' => empty($conf->global->ACCOUNTING_EXPORT_SEPARATORCSV)?',':$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV,
|
||||||
|
'ACCOUNTING_EXPORT_ENDLINE' => empty($conf->global->ACCOUNTING_EXPORT_ENDLINE)?1:$conf->global->ACCOUNTING_EXPORT_ENDLINE,
|
||||||
|
'ACCOUNTING_EXPORT_DATE' => empty($conf->global->ACCOUNTING_EXPORT_DATE)?'%d%m%Y':$conf->global->ACCOUNTING_EXPORT_DATE,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'cr'=> array (
|
||||||
|
'1' => $langs->trans("Unix"),
|
||||||
|
'2' => $langs->trans("Windows")
|
||||||
|
),
|
||||||
|
'format' => array (
|
||||||
|
'csv' => $langs->trans("csv"),
|
||||||
|
'txt' => $langs->trans("txt")
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,6 +219,9 @@ class AccountancyExport
|
|||||||
case self::$EXPORT_TYPE_AGIRIS :
|
case self::$EXPORT_TYPE_AGIRIS :
|
||||||
$this->exportAgiris($TData);
|
$this->exportAgiris($TData);
|
||||||
break;
|
break;
|
||||||
|
case self::$EXPORT_TYPE_CONFIGURABLE :
|
||||||
|
$this->exportConfigurable($TData);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
|
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
|
||||||
break;
|
break;
|
||||||
@ -192,6 +263,7 @@ class AccountancyExport
|
|||||||
foreach ( $objectLines as $line ) {
|
foreach ( $objectLines as $line ) {
|
||||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||||
$separator = ";";
|
$separator = ";";
|
||||||
|
$end_line = "\n";
|
||||||
|
|
||||||
print $date . $separator;
|
print $date . $separator;
|
||||||
print $line->code_journal . $separator;
|
print $line->code_journal . $separator;
|
||||||
@ -201,7 +273,7 @@ class AccountancyExport
|
|||||||
print price($line->montant) . $separator;
|
print price($line->montant) . $separator;
|
||||||
print $line->label_operation . $separator;
|
print $line->label_operation . $separator;
|
||||||
print $line->doc_ref;
|
print $line->doc_ref;
|
||||||
print $this->end_line;
|
print $end_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,24 +287,26 @@ class AccountancyExport
|
|||||||
public function exportCogilog($objectLines) {
|
public function exportCogilog($objectLines) {
|
||||||
foreach ( $objectLines as $line ) {
|
foreach ( $objectLines as $line ) {
|
||||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||||
|
$separator = ";";
|
||||||
|
$end_line = "\n";
|
||||||
|
|
||||||
print $line->code_journal . $this->separator;
|
print $line->code_journal . $separator;
|
||||||
print $date . $this->separator;
|
print $date . $separator;
|
||||||
print $line->piece_num . $this->separator;
|
print $line->piece_num . $separator;
|
||||||
print length_accountg($line->numero_compte) . $this->separator;
|
print length_accountg($line->numero_compte) . $separator;
|
||||||
print '' . $this->separator;
|
print '' . $separator;
|
||||||
print $line->label_operation . $this->separator;
|
print $line->label_operation . $separator;
|
||||||
print $date . $this->separator;
|
print $date . $separator;
|
||||||
if ($line->sens=='D') {
|
if ($line->sens=='D') {
|
||||||
print price($line->montant) . $this->separator;
|
print price($line->montant) . $separator;
|
||||||
print '' . $this->separator;
|
print '' . $separator;
|
||||||
}elseif ($line->sens=='C') {
|
}elseif ($line->sens=='C') {
|
||||||
print '' . $this->separator;
|
print '' . $separator;
|
||||||
print price($line->montant) . $this->separator;
|
print price($line->montant) . $separator;
|
||||||
}
|
}
|
||||||
print $line->doc_ref . $this->separator;
|
print $line->doc_ref . $separator;
|
||||||
print $line->label_operation . $this->separator;
|
print $line->label_operation . $separator;
|
||||||
print $this->end_line;
|
print $end_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,18 +319,21 @@ class AccountancyExport
|
|||||||
*/
|
*/
|
||||||
public function exportCoala($objectLines) {
|
public function exportCoala($objectLines) {
|
||||||
// Coala export
|
// Coala export
|
||||||
|
$separator = ";";
|
||||||
|
$end_line = "\n";
|
||||||
|
|
||||||
foreach ( $objectLines as $line ) {
|
foreach ( $objectLines as $line ) {
|
||||||
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
||||||
print $date . $this->separator;
|
print $date . $separator;
|
||||||
print $line->code_journal . $this->separator;
|
print $line->code_journal . $separator;
|
||||||
print length_accountg($line->numero_compte) . $this->separator;
|
print length_accountg($line->numero_compte) . $separator;
|
||||||
print $line->piece_num . $this->separator;
|
print $line->piece_num . $separator;
|
||||||
print $line->doc_ref . $this->separator;
|
print $line->doc_ref . $separator;
|
||||||
print price($line->debit) . $this->separator;
|
print price($line->debit) . $separator;
|
||||||
print price($line->credit) . $this->separator;
|
print price($line->credit) . $separator;
|
||||||
print 'E' . $this->separator;
|
print 'E' . $separator;
|
||||||
print length_accountg($line->subledger_account) . $this->separator;
|
print length_accountg($line->subledger_account) . $separator;
|
||||||
print $this->end_line;
|
print $end_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,28 +347,31 @@ class AccountancyExport
|
|||||||
public function exportBob50($objectLines) {
|
public function exportBob50($objectLines) {
|
||||||
|
|
||||||
// Bob50
|
// Bob50
|
||||||
|
$separator = ";";
|
||||||
|
$end_line = "\n";
|
||||||
|
|
||||||
foreach ( $objectLines as $line ) {
|
foreach ( $objectLines as $line ) {
|
||||||
print $line->piece_num . $this->separator;
|
print $line->piece_num . $separator;
|
||||||
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
||||||
print $date . $this->separator;
|
print $date . $separator;
|
||||||
|
|
||||||
if (empty($line->subledger_account)) {
|
if (empty($line->subledger_account)) {
|
||||||
print 'G' . $this->separator;
|
print 'G' . $separator;
|
||||||
print length_accounta($line->numero_compte) . $this->separator;
|
print length_accounta($line->numero_compte) . $separator;
|
||||||
} else {
|
} else {
|
||||||
if (substr($line->numero_compte, 0, 3) == '411') {
|
if (substr($line->numero_compte, 0, 3) == '411') {
|
||||||
print 'C' . $this->separator;
|
print 'C' . $separator;
|
||||||
}
|
}
|
||||||
if (substr($line->numero_compte, 0, 3) == '401') {
|
if (substr($line->numero_compte, 0, 3) == '401') {
|
||||||
print 'F' . $this->separator;
|
print 'F' . $separator;
|
||||||
}
|
}
|
||||||
print length_accountg($line->subledger_account) . $this->separator;
|
print length_accountg($line->subledger_account) . $separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
print price($line->debit) . $this->separator;
|
print price($line->debit) . $separator;
|
||||||
print price($line->credit) . $this->separator;
|
print price($line->credit) . $separator;
|
||||||
print dol_trunc($line->label_operation, 32) . $this->separator;
|
print dol_trunc($line->label_operation, 32) . $separator;
|
||||||
print $this->end_line;
|
print $end_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,7 +385,7 @@ class AccountancyExport
|
|||||||
public function exportCiel(&$TData) {
|
public function exportCiel(&$TData) {
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$this->end_line ="\r\n";
|
$end_line ="\r\n";
|
||||||
|
|
||||||
$i = 1;
|
$i = 1;
|
||||||
$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be yyyymmdd
|
$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be yyyymmdd
|
||||||
@ -321,14 +401,14 @@ class AccountancyExport
|
|||||||
$Tab['date_ope'] = dol_print_date($data->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
|
$Tab['date_ope'] = dol_print_date($data->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||||
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 12), 12);
|
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 12), 12);
|
||||||
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 11), 11);
|
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 11), 11);
|
||||||
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . $data->label_operation, 25), 25);
|
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref) . dol_string_unaccent($data->label_operation), 25), 25);
|
||||||
$Tab['montant'] = str_pad(abs($data->montant), 13, ' ', STR_PAD_LEFT);
|
$Tab['montant'] = str_pad(abs($data->montant), 13, ' ', STR_PAD_LEFT);
|
||||||
$Tab['type_montant'] = str_pad($data->sens, 1);
|
$Tab['type_montant'] = str_pad($data->sens, 1);
|
||||||
$Tab['vide'] = str_repeat(' ', 18);
|
$Tab['vide'] = str_repeat(' ', 18);
|
||||||
$Tab['intitule_compte'] = str_pad(self::trunc($data->label_operation, 34), 34);
|
$Tab['intitule_compte'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 34), 34);
|
||||||
$Tab['end'] = 'O2003';
|
$Tab['end'] = 'O2003';
|
||||||
|
|
||||||
$Tab['end_line'] = $this->end_line;
|
$Tab['end_line'] = $end_line;
|
||||||
|
|
||||||
print implode($Tab);
|
print implode($Tab);
|
||||||
$i ++;
|
$i ++;
|
||||||
@ -345,9 +425,11 @@ class AccountancyExport
|
|||||||
public function exportQuadratus(&$TData) {
|
public function exportQuadratus(&$TData) {
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$this->end_line ="\r\n";
|
$end_line ="\r\n";
|
||||||
|
|
||||||
$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
//We should use dol_now function not time however this is wrong date to transfert in accounting
|
||||||
|
//$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||||
|
//$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||||
foreach ( $TData as $data ) {
|
foreach ( $TData as $data ) {
|
||||||
$code_compta = $data->numero_compte;
|
$code_compta = $data->numero_compte;
|
||||||
if (! empty($data->subledger_account))
|
if (! empty($data->subledger_account))
|
||||||
@ -358,29 +440,58 @@ class AccountancyExport
|
|||||||
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 8), 8);
|
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 8), 8);
|
||||||
$Tab['code_journal'] = str_pad(self::trunc($data->code_journal, 2), 2);
|
$Tab['code_journal'] = str_pad(self::trunc($data->code_journal, 2), 2);
|
||||||
$Tab['folio'] = '000';
|
$Tab['folio'] = '000';
|
||||||
$Tab['date_ecriture'] = $date_ecriture;
|
|
||||||
|
//We use invoice date $data->doc_date not $date_ecriture which is the transfert date
|
||||||
|
//maybe we should set an option for customer who prefer to keep in accounting software the tranfert date instead of invoice date ?
|
||||||
|
//$Tab['date_ecriture'] = $date_ecriture;
|
||||||
|
$Tab['date_ecriture'] = dol_print_date($data->doc_date, '%d%m%y');
|
||||||
$Tab['filler'] = ' ';
|
$Tab['filler'] = ' ';
|
||||||
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_operation, 20), 20);
|
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref) . ' ' . dol_string_unaccent($data->label_operation), 20), 20);
|
||||||
$Tab['sens'] = $data->sens; // C or D
|
$Tab['sens'] = $data->sens; // C or D
|
||||||
$Tab['signe_montant'] = '+';
|
$Tab['signe_montant'] = '+';
|
||||||
$Tab['montant'] = str_pad(abs($data->montant), 12, '0', STR_PAD_LEFT); // TODO manage negative amount
|
|
||||||
|
//elarifr le montant doit etre en centimes sans point decimal !
|
||||||
|
$Tab['montant'] = str_pad(abs($data->montant*100), 12, '0', STR_PAD_LEFT); // TODO manage negative amount
|
||||||
|
// $Tab['montant'] = str_pad(abs($data->montant), 12, '0', STR_PAD_LEFT); // TODO manage negative amount
|
||||||
$Tab['contrepartie'] = str_repeat(' ', 8);
|
$Tab['contrepartie'] = str_repeat(' ', 8);
|
||||||
|
|
||||||
|
// elarifr: date format must be fixed format : 6 char ddmmyy = %d%m%yand not defined by user / dolibarr setting
|
||||||
if (! empty($data->date_echeance))
|
if (! empty($data->date_echeance))
|
||||||
$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);
|
//$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||||
|
$Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%y' ); // elarifr: format must be ddmmyy
|
||||||
else
|
else
|
||||||
$Tab['date_echeance'] = '000000';
|
$Tab['date_echeance'] = '000000';
|
||||||
$Tab['lettrage'] = str_repeat(' ', 5);
|
|
||||||
|
//elarifr please keep quadra named field lettrage(2) + codestat(3) instead of fake lettrage(5)
|
||||||
|
//$Tab['lettrage'] = str_repeat(' ', 5);
|
||||||
|
$Tab['lettrage'] = str_repeat(' ', 2);
|
||||||
|
$Tab['codestat'] = str_repeat(' ', 3);
|
||||||
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 5), 5);
|
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 5), 5);
|
||||||
$Tab['filler2'] = str_repeat(' ', 20);
|
|
||||||
|
//elarifr keep correct quadra named field instead of anon filler
|
||||||
|
//$Tab['filler2'] = str_repeat(' ', 20);
|
||||||
|
$Tab['affaire'] = str_repeat(' ', 10);
|
||||||
|
$Tab['quantity1'] = str_repeat(' ', 10);
|
||||||
$Tab['num_piece2'] = str_pad(self::trunc($data->piece_num, 8), 8);
|
$Tab['num_piece2'] = str_pad(self::trunc($data->piece_num, 8), 8);
|
||||||
$Tab['devis'] = str_pad($conf->currency, 3);
|
$Tab['devis'] = str_pad($conf->currency, 3);
|
||||||
$Tab['code_journal2'] = str_pad(self::trunc($data->code_journal, 3), 3);
|
$Tab['code_journal2'] = str_pad(self::trunc($data->code_journal, 3), 3);
|
||||||
$Tab['filler3'] = str_repeat(' ', 3);
|
$Tab['filler3'] = str_repeat(' ', 3);
|
||||||
$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_operation, 32), 32);
|
|
||||||
$Tab['num_piece3'] = str_pad(self::trunc($data->piece_num, 10), 10);
|
//elarifr keep correct quadra named field instead of anon filler libelle_ecriture2 is 30 char not 32 !!!!
|
||||||
|
//as we use utf8, we must remove accent to have only one ascii char instead of utf8 2 chars for specials that report wrong line size that will exceed import format spec
|
||||||
|
//todo we should filter more than only accent to avoid wrong line size
|
||||||
|
//TODO: remove invoice number doc_ref in libelle,
|
||||||
|
//TODO: we should offer an option for customer to build the libelle using invoice number / name / date in accounting software
|
||||||
|
//$Tab['libelle_ecriture2'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref) . ' ' . dol_string_unaccent($data->label_operation), 30), 30);
|
||||||
|
$Tab['libelle_ecriture2'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 30), 30);
|
||||||
|
$Tab['codetva'] = str_repeat(' ', 2);
|
||||||
|
|
||||||
|
//elarifr we need to keep the 10 lastest number of invoice doc_ref not the beginning part that is the unusefull almost same part
|
||||||
|
//$Tab['num_piece3'] = str_pad(self::trunc($data->piece_num, 10), 10);
|
||||||
|
$Tab['num_piece3'] = substr(self::trunc($data->doc_ref, 20), -10);
|
||||||
$Tab['filler4'] = str_repeat(' ', 73);
|
$Tab['filler4'] = str_repeat(' ', 73);
|
||||||
|
|
||||||
$Tab['end_line'] = $this->end_line;
|
$Tab['end_line'] = $end_line;
|
||||||
|
|
||||||
print implode($Tab);
|
print implode($Tab);
|
||||||
}
|
}
|
||||||
@ -396,24 +507,25 @@ class AccountancyExport
|
|||||||
*/
|
*/
|
||||||
public function exportEbp($objectLines) {
|
public function exportEbp($objectLines) {
|
||||||
|
|
||||||
$this->separator = ',';
|
$separator = ',';
|
||||||
|
$end_line = "\n";
|
||||||
|
|
||||||
foreach ( $objectLines as $line ) {
|
foreach ( $objectLines as $line ) {
|
||||||
|
|
||||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||||
|
|
||||||
print $line->id . $this->separator;
|
print $line->id . $separator;
|
||||||
print $date . $this->separator;
|
print $date . $separator;
|
||||||
print $line->code_journal . $this->separator;
|
print $line->code_journal . $separator;
|
||||||
print length_accountg($line->numero_compte) . $this->separator;
|
print length_accountg($line->numero_compte) . $separator;
|
||||||
print substr(length_accountg($line->numero_compte),0,2) . $this->separator;
|
print substr(length_accountg($line->numero_compte),0,2) . $separator;
|
||||||
print '"'.dol_trunc($line->label_operation,40,'right','UTF-8',1).'"' . $this->separator;
|
print '"'.dol_trunc($line->label_operation,40,'right','UTF-8',1).'"' . $separator;
|
||||||
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator;
|
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$separator;
|
||||||
print price2num($line->montant).$this->separator;
|
print price2num($line->montant).$separator;
|
||||||
print $line->sens.$this->separator;
|
print $line->sens.$separator;
|
||||||
print $date . $this->separator;
|
print $date . $separator;
|
||||||
print 'EUR';
|
print 'EUR';
|
||||||
print $this->end_line;
|
print $end_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,30 +539,61 @@ class AccountancyExport
|
|||||||
*/
|
*/
|
||||||
public function exportAgiris($objectLines) {
|
public function exportAgiris($objectLines) {
|
||||||
|
|
||||||
$this->separator = ';';
|
$separator = ';';
|
||||||
|
$end_line = "\n";
|
||||||
|
|
||||||
foreach ( $objectLines as $line ) {
|
foreach ( $objectLines as $line ) {
|
||||||
|
|
||||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||||
|
|
||||||
print $line->piece_num . $this->separator;
|
print $line->piece_num . $separator;
|
||||||
print $line->label_operation . $this->separator;
|
print $line->label_operation . $separator;
|
||||||
print $date . $this->separator;
|
print $date . $separator;
|
||||||
print $line->label_operation . $this->separator;
|
print $line->label_operation . $separator;
|
||||||
|
|
||||||
if (empty($line->subledger_account)) {
|
if (empty($line->subledger_account)) {
|
||||||
print length_accountg($line->numero_compte) . $this->separator;
|
print length_accountg($line->numero_compte) . $separator;
|
||||||
} else {
|
} else {
|
||||||
print length_accounta($line->subledger_account) . $this->separator;
|
print length_accounta($line->subledger_account) . $separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
print $line->doc_ref . $this->separator;
|
print $line->doc_ref . $separator;
|
||||||
print price($line->debit) . $this->separator;
|
print price($line->debit) . $separator;
|
||||||
print price($line->credit) . $this->separator;
|
print price($line->credit) . $separator;
|
||||||
print price($line->montant).$this->separator;
|
print price($line->montant) . $separator;
|
||||||
print $line->sens.$this->separator;
|
print $line->sens . $separator;
|
||||||
print $line->code_journal;
|
print $line->code_journal;
|
||||||
print $this->end_line;
|
print $end_line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Export format : Configurable
|
||||||
|
*
|
||||||
|
* @param array $objectLines data
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function exportConfigurable($objectLines) {
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
foreach ($objectLines as $line) {
|
||||||
|
$tab = array();
|
||||||
|
// export configurable
|
||||||
|
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||||
|
$tab[] = $line->piece_num;
|
||||||
|
$tab[] = $date;
|
||||||
|
$tab[] = $line->doc_ref;
|
||||||
|
$tab[] = $line->label_operation;
|
||||||
|
$tab[] = length_accountg($line->numero_compte);
|
||||||
|
$tab[] = length_accounta($line->subledger_account);
|
||||||
|
$tab[] = price($line->debit);
|
||||||
|
$tab[] = price($line->credit);
|
||||||
|
$tab[] = price($line->montant);
|
||||||
|
$tab[] = $line->code_journal;
|
||||||
|
|
||||||
|
$separator = $this->separator;
|
||||||
|
print implode($separator, $tab) . $this->end_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -20,9 +20,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/class/accountingaccount.class.php
|
* \file htdocs/accountancy/class/accountingaccount.class.php
|
||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief File of class to manage accounting accounts
|
* \brief File of class to manage accounting accounts
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,6 +30,21 @@
|
|||||||
*/
|
*/
|
||||||
class AccountingAccount extends CommonObject
|
class AccountingAccount extends CommonObject
|
||||||
{
|
{
|
||||||
|
public $element='accounting_account';
|
||||||
|
public $table_element='accounting_account';
|
||||||
|
public $picto = 'billr';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $ismultientitymanaged = 1;
|
||||||
|
/**
|
||||||
|
* 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
public $restrictiononfksoc = 1;
|
||||||
|
|
||||||
var $db;
|
var $db;
|
||||||
var $error;
|
var $error;
|
||||||
var $errors;
|
var $errors;
|
||||||
@ -48,13 +63,17 @@ class AccountingAccount extends CommonObject
|
|||||||
var $active; // duplicate with status
|
var $active; // duplicate with status
|
||||||
var $status;
|
var $status;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handle
|
* @param DoliDB $db Database handle
|
||||||
*/
|
*/
|
||||||
function __construct($db) {
|
function __construct($db) {
|
||||||
|
global $conf;
|
||||||
|
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
$this->next_prev_filter='fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; // Used to add a filter in Form::showrefnav method
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -91,6 +110,7 @@ class AccountingAccount extends CommonObject
|
|||||||
if ($obj) {
|
if ($obj) {
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->rowid = $obj->rowid;
|
$this->rowid = $obj->rowid;
|
||||||
|
$this->ref = $obj->account_number;
|
||||||
$this->datec = $obj->datec;
|
$this->datec = $obj->datec;
|
||||||
$this->tms = $obj->tms;
|
$this->tms = $obj->tms;
|
||||||
$this->fk_pcg_version = $obj->fk_pcg_version;
|
$this->fk_pcg_version = $obj->fk_pcg_version;
|
||||||
@ -152,11 +172,11 @@ class AccountingAccount extends CommonObject
|
|||||||
|
|
||||||
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
||||||
{
|
{
|
||||||
$this->pcg_type = 'XXXXXX';
|
$this->pcg_type = 'XXXXXX';
|
||||||
}
|
}
|
||||||
if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1')
|
if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1')
|
||||||
{
|
{
|
||||||
$this->pcg_subtype = 'XXXXXX';
|
$this->pcg_subtype = 'XXXXXX';
|
||||||
}
|
}
|
||||||
// Check parameters
|
// Check parameters
|
||||||
// Put here code to add control on parameters values
|
// Put here code to add control on parameters values
|
||||||
@ -235,17 +255,17 @@ class AccountingAccount extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function update($user)
|
function update($user)
|
||||||
{
|
{
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
||||||
{
|
{
|
||||||
$this->pcg_type = 'XXXXXX';
|
$this->pcg_type = 'XXXXXX';
|
||||||
}
|
}
|
||||||
if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1')
|
if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1')
|
||||||
{
|
{
|
||||||
$this->pcg_subtype = 'XXXXXX';
|
$this->pcg_subtype = 'XXXXXX';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
|
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
|
||||||
$sql .= " SET fk_pcg_version = " . ($this->fk_pcg_version ? "'" . $this->db->escape($this->fk_pcg_version) . "'" : "null");
|
$sql .= " SET fk_pcg_version = " . ($this->fk_pcg_version ? "'" . $this->db->escape($this->fk_pcg_version) . "'" : "null");
|
||||||
@ -395,17 +415,17 @@ class AccountingAccount extends CommonObject
|
|||||||
$linkclose='';
|
$linkclose='';
|
||||||
if (empty($notooltip))
|
if (empty($notooltip))
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||||
{
|
{
|
||||||
$label=$langs->trans("ShowAccoutingAccount");
|
$label=$langs->trans("ShowAccoutingAccount");
|
||||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
}
|
}
|
||||||
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
$linkclose.=' class="classfortooltip"';
|
$linkclose.=' class="classfortooltip"';
|
||||||
}
|
}
|
||||||
|
|
||||||
$linkstart='<a href="'.$url.'"';
|
$linkstart='<a href="'.$url.'"';
|
||||||
$linkstart.=$linkclose.'>';
|
$linkstart.=$linkclose.'>';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
if ($nourl)
|
if ($nourl)
|
||||||
@ -462,10 +482,10 @@ class AccountingAccount extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Account desactivate
|
* Account deactivated
|
||||||
*
|
*
|
||||||
* @param int $id Id
|
* @param int $id Id
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function account_desactivate($id) {
|
function account_desactivate($id) {
|
||||||
$result = $this->checkUsage();
|
$result = $this->checkUsage();
|
||||||
@ -494,10 +514,10 @@ class AccountingAccount extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Account activate
|
* Account activated
|
||||||
*
|
*
|
||||||
* @param int $id Id
|
* @param int $id Id
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function account_activate($id) {
|
function account_activate($id) {
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@ -522,56 +542,56 @@ class AccountingAccount extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Retourne le libelle du statut d'un user (actif, inactif)
|
* Retourne le libelle du statut d'un user (actif, inactif)
|
||||||
*
|
*
|
||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
* @return string Label of status
|
* @return string Label of status
|
||||||
*/
|
*/
|
||||||
function getLibStatut($mode=0)
|
function getLibStatut($mode=0)
|
||||||
{
|
{
|
||||||
return $this->LibStatut($this->status,$mode);
|
return $this->LibStatut($this->status,$mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renvoi le libelle d'un statut donne
|
* Renvoi le libelle d'un statut donne
|
||||||
*
|
*
|
||||||
* @param int $statut Id statut
|
* @param int $statut Id statut
|
||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
* @return string Label of status
|
* @return string Label of status
|
||||||
*/
|
*/
|
||||||
function LibStatut($statut,$mode=0)
|
function LibStatut($statut,$mode=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load('users');
|
$langs->load('users');
|
||||||
|
|
||||||
if ($mode == 0)
|
if ($mode == 0)
|
||||||
{
|
{
|
||||||
$prefix='';
|
$prefix='';
|
||||||
if ($statut == 1) return $langs->trans('Enabled');
|
if ($statut == 1) return $langs->trans('Enabled');
|
||||||
if ($statut == 0) return $langs->trans('Disabled');
|
if ($statut == 0) return $langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
if ($mode == 1)
|
if ($mode == 1)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return $langs->trans('Enabled');
|
if ($statut == 1) return $langs->trans('Enabled');
|
||||||
if ($statut == 0) return $langs->trans('Disabled');
|
if ($statut == 0) return $langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
if ($mode == 2)
|
if ($mode == 2)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||||
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
if ($mode == 3)
|
if ($mode == 3)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4');
|
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4');
|
||||||
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5');
|
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5');
|
||||||
}
|
}
|
||||||
if ($mode == 4)
|
if ($mode == 4)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||||
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
if ($mode == 5)
|
if ($mode == 5)
|
||||||
{
|
{
|
||||||
if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
|
if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
|
||||||
if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,8 @@ class AccountingJournal extends CommonObject
|
|||||||
public $element='accounting_journal';
|
public $element='accounting_journal';
|
||||||
public $table_element='accounting_journal';
|
public $table_element='accounting_journal';
|
||||||
public $fk_element = '';
|
public $fk_element = '';
|
||||||
protected $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
public $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||||
|
public $picto = 'generic';
|
||||||
|
|
||||||
var $rowid;
|
var $rowid;
|
||||||
|
|
||||||
@ -187,9 +188,6 @@ class AccountingJournal extends CommonObject
|
|||||||
|
|
||||||
$url = DOL_URL_ROOT . '/accountancy/admin/journals_list.php?id=35';
|
$url = DOL_URL_ROOT . '/accountancy/admin/journals_list.php?id=35';
|
||||||
|
|
||||||
$picto = 'billr';
|
|
||||||
$label='';
|
|
||||||
|
|
||||||
$label = '<u>' . $langs->trans("ShowAccountingJournal") . '</u>';
|
$label = '<u>' . $langs->trans("ShowAccountingJournal") . '</u>';
|
||||||
if (! empty($this->code))
|
if (! empty($this->code))
|
||||||
$label .= '<br><b>'.$langs->trans('Code') . ':</b> ' . $this->code;
|
$label .= '<br><b>'.$langs->trans('Code') . ':</b> ' . $this->code;
|
||||||
@ -223,9 +221,11 @@ class AccountingJournal extends CommonObject
|
|||||||
$label_link = $this->code;
|
$label_link = $this->code;
|
||||||
if ($withlabel) $label_link .= ' - ' . $this->label;
|
if ($withlabel) $label_link .= ' - ' . $this->label;
|
||||||
|
|
||||||
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
|
$result .= $linkstart;
|
||||||
if ($withpicto && $withpicto != 2) $result .= ' ';
|
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||||
if ($withpicto != 2) $result.=$linkstart . $label_link . $linkend;
|
if ($withpicto != 2) $result.= $label_link;
|
||||||
|
$result .= $linkend;
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,25 +32,18 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
|
|||||||
class BookKeeping extends CommonObject
|
class BookKeeping extends CommonObject
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var string Error code (or message)
|
* @var string Error code (or message)
|
||||||
* @deprecated
|
|
||||||
*
|
|
||||||
* @see Accountingbookkeeping::errors
|
|
||||||
*/
|
*/
|
||||||
public $error;
|
public $error;
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var string[] Error codes (or messages)
|
* @var string[] Error codes (or messages)
|
||||||
*/
|
*/
|
||||||
public $errors = array ();
|
public $errors = array ();
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var string Id to identify managed objects
|
* @var string Id to identify managed objects
|
||||||
*/
|
*/
|
||||||
public $element = 'accountingbookkeeping';
|
public $element = 'accountingbookkeeping';
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var string Name of table without prefix where object is stored
|
* @var string Name of table without prefix where object is stored
|
||||||
*/
|
*/
|
||||||
public $table_element = 'accounting_bookkeeping';
|
public $table_element = 'accounting_bookkeeping';
|
||||||
@ -58,13 +51,11 @@ class BookKeeping extends CommonObject
|
|||||||
public $entity = 1;
|
public $entity = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var BookKeepingLine[] Lines
|
* @var BookKeepingLine[] Lines
|
||||||
*/
|
*/
|
||||||
public $lines = array ();
|
public $lines = array ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var int ID
|
* @var int ID
|
||||||
*/
|
*/
|
||||||
public $id;
|
public $id;
|
||||||
@ -202,13 +193,18 @@ class BookKeeping extends CommonObject
|
|||||||
|
|
||||||
$this->piece_num = 0;
|
$this->piece_num = 0;
|
||||||
|
|
||||||
// First check if line not yet already in bookkeeping
|
// First check if line not yet already in bookkeeping.
|
||||||
|
// Note that we must include doc_type - fk_doc - numero_compte - label to be sure to have unicity of line (we may have several lines
|
||||||
|
// with same doc_type, fk_odc, numero_compte for 1 invoice line when using localtaxes with same account)
|
||||||
|
// WARNING: This is not reliable, label may have been modified. This is just a small protection.
|
||||||
|
// The page to make journalization make the test on couple doc_type - fk_doc only.
|
||||||
$sql = "SELECT count(*) as nb";
|
$sql = "SELECT count(*) as nb";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sql .= " WHERE doc_type = '" . $this->db->escape($this->doc_type) . "'";
|
$sql .= " WHERE doc_type = '" . $this->db->escape($this->doc_type) . "'";
|
||||||
$sql .= " AND fk_doc = " . $this->fk_doc;
|
$sql .= " AND fk_doc = " . $this->fk_doc;
|
||||||
$sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 is record is for several lines
|
//$sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 if record is for several lines
|
||||||
$sql .= " AND numero_compte = '" . $this->db->escape($this->numero_compte) . "'";
|
$sql .= " AND numero_compte = '" . $this->db->escape($this->numero_compte) . "'";
|
||||||
|
$sql .= " AND label_operation = '" . $this->db->escape($this->label_operation) . "'";
|
||||||
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -279,7 +275,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= ', entity';
|
$sql .= ', entity';
|
||||||
$sql .= ") VALUES (";
|
$sql .= ") VALUES (";
|
||||||
$sql .= "'" . $this->db->idate($this->doc_date) . "'";
|
$sql .= "'" . $this->db->idate($this->doc_date) . "'";
|
||||||
$sql .= ",'" . $this->db->idate($this->date_lim_reglement) . "'";
|
$sql .= ", ".(! isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'" . $this->db->idate($this->date_lim_reglement) . "'");
|
||||||
$sql .= ",'" . $this->db->escape($this->doc_type) . "'";
|
$sql .= ",'" . $this->db->escape($this->doc_type) . "'";
|
||||||
$sql .= ",'" . $this->db->escape($this->doc_ref) . "'";
|
$sql .= ",'" . $this->db->escape($this->doc_ref) . "'";
|
||||||
$sql .= "," . $this->fk_doc;
|
$sql .= "," . $this->fk_doc;
|
||||||
@ -564,7 +560,8 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " t.import_key,";
|
$sql .= " t.import_key,";
|
||||||
$sql .= " t.code_journal,";
|
$sql .= " t.code_journal,";
|
||||||
$sql .= " t.journal_label,";
|
$sql .= " t.journal_label,";
|
||||||
$sql .= " t.piece_num";
|
$sql .= " t.piece_num,";
|
||||||
|
$sql .= " t.date_creation";
|
||||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element.$mode. ' as t';
|
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element.$mode. ' as t';
|
||||||
$sql .= ' WHERE 1 = 1';
|
$sql .= ' WHERE 1 = 1';
|
||||||
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
||||||
@ -603,6 +600,7 @@ class BookKeeping extends CommonObject
|
|||||||
$this->code_journal = $obj->code_journal;
|
$this->code_journal = $obj->code_journal;
|
||||||
$this->journal_label = $obj->journal_label;
|
$this->journal_label = $obj->journal_label;
|
||||||
$this->piece_num = $obj->piece_num;
|
$this->piece_num = $obj->piece_num;
|
||||||
|
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
@ -658,7 +656,8 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " t.import_key,";
|
$sql .= " t.import_key,";
|
||||||
$sql .= " t.code_journal,";
|
$sql .= " t.code_journal,";
|
||||||
$sql .= " t.journal_label,";
|
$sql .= " t.journal_label,";
|
||||||
$sql .= " t.piece_num";
|
$sql .= " t.piece_num,";
|
||||||
|
$sql .= " t.date_creation";
|
||||||
// Manage filter
|
// Manage filter
|
||||||
$sqlwhere = array ();
|
$sqlwhere = array ();
|
||||||
if (count($filter) > 0) {
|
if (count($filter) > 0) {
|
||||||
@ -675,6 +674,8 @@ class BookKeeping extends CommonObject
|
|||||||
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
|
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
|
||||||
} elseif ($key == 't.label_operation') {
|
} elseif ($key == 't.label_operation') {
|
||||||
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
|
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
|
||||||
|
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
|
||||||
|
$sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\'';
|
||||||
} else {
|
} else {
|
||||||
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||||
}
|
}
|
||||||
@ -725,6 +726,7 @@ class BookKeeping extends CommonObject
|
|||||||
$line->code_journal = $obj->code_journal;
|
$line->code_journal = $obj->code_journal;
|
||||||
$line->journal_label = $obj->journal_label;
|
$line->journal_label = $obj->journal_label;
|
||||||
$line->piece_num = $obj->piece_num;
|
$line->piece_num = $obj->piece_num;
|
||||||
|
$line->date_creation = $obj->date_creation;
|
||||||
|
|
||||||
$this->lines[] = $line;
|
$this->lines[] = $line;
|
||||||
}
|
}
|
||||||
@ -777,7 +779,8 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " t.import_key,";
|
$sql .= " t.import_key,";
|
||||||
$sql .= " t.code_journal,";
|
$sql .= " t.code_journal,";
|
||||||
$sql .= " t.journal_label,";
|
$sql .= " t.journal_label,";
|
||||||
$sql .= " t.piece_num";
|
$sql .= " t.piece_num,";
|
||||||
|
$sql .= " t.date_creation";
|
||||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||||
// Manage filter
|
// Manage filter
|
||||||
$sqlwhere = array ();
|
$sqlwhere = array ();
|
||||||
@ -793,6 +796,10 @@ class BookKeeping extends CommonObject
|
|||||||
$sqlwhere[] = $key . '=' . $value;
|
$sqlwhere[] = $key . '=' . $value;
|
||||||
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
|
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
|
||||||
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
|
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
|
||||||
|
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
|
||||||
|
$sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\'';
|
||||||
|
} elseif ($key == 't.tms>=' || $key == 't.tms<=') {
|
||||||
|
$sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\'';
|
||||||
} else {
|
} else {
|
||||||
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||||
}
|
}
|
||||||
@ -841,6 +848,7 @@ class BookKeeping extends CommonObject
|
|||||||
$line->code_journal = $obj->code_journal;
|
$line->code_journal = $obj->code_journal;
|
||||||
$line->journal_label = $obj->journal_label;
|
$line->journal_label = $obj->journal_label;
|
||||||
$line->piece_num = $obj->piece_num;
|
$line->piece_num = $obj->piece_num;
|
||||||
|
$line->date_creation = $obj->date_creation;
|
||||||
|
|
||||||
$this->lines[] = $line;
|
$this->lines[] = $line;
|
||||||
}
|
}
|
||||||
@ -867,9 +875,12 @@ class BookKeeping extends CommonObject
|
|||||||
*
|
*
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') {
|
public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
|
||||||
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
$this->lines = array();
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
$sql = 'SELECT';
|
$sql = 'SELECT';
|
||||||
@ -912,7 +923,6 @@ class BookKeeping extends CommonObject
|
|||||||
if (! empty($limit)) {
|
if (! empty($limit)) {
|
||||||
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||||
}
|
}
|
||||||
$this->lines = array ();
|
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
@ -1336,6 +1346,7 @@ class BookKeeping extends CommonObject
|
|||||||
$this->code_journal = 'VT';
|
$this->code_journal = 'VT';
|
||||||
$this->journal_label = 'Journal de vente';
|
$this->journal_label = 'Journal de vente';
|
||||||
$this->piece_num = '';
|
$this->piece_num = '';
|
||||||
|
$this->date_creation = $now;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1348,7 +1359,7 @@ class BookKeeping extends CommonObject
|
|||||||
public function fetchPerMvt($piecenum, $mode='') {
|
public function fetchPerMvt($piecenum, $mode='') {
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT piece_num,doc_date,code_journal,journal_label,doc_ref,doc_type";
|
$sql = "SELECT piece_num,doc_date,code_journal,journal_label,doc_ref,doc_type,date_creation";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element.$mode;
|
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element.$mode;
|
||||||
$sql .= " WHERE piece_num = " . $piecenum;
|
$sql .= " WHERE piece_num = " . $piecenum;
|
||||||
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
||||||
@ -1364,6 +1375,7 @@ class BookKeeping extends CommonObject
|
|||||||
$this->doc_date = $this->db->jdate($obj->doc_date);
|
$this->doc_date = $this->db->jdate($obj->doc_date);
|
||||||
$this->doc_ref = $obj->doc_ref;
|
$this->doc_ref = $obj->doc_ref;
|
||||||
$this->doc_type = $obj->doc_type;
|
$this->doc_type = $obj->doc_type;
|
||||||
|
$this->date_creation = $obj->date_creation;
|
||||||
} else {
|
} else {
|
||||||
$this->error = "Error " . $this->db->lasterror();
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
dol_syslog(get_class($this) . "::" . __METHOD__ . $this->error, LOG_ERR);
|
dol_syslog(get_class($this) . "::" . __METHOD__ . $this->error, LOG_ERR);
|
||||||
@ -1414,7 +1426,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql = "SELECT rowid, doc_date, doc_type,";
|
$sql = "SELECT rowid, doc_date, doc_type,";
|
||||||
$sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,";
|
$sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,";
|
||||||
$sql .= " numero_compte, label_compte, label_operation, debit, credit,";
|
$sql .= " numero_compte, label_compte, label_operation, debit, credit,";
|
||||||
$sql .= " montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num";
|
$sql .= " montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element.$mode;
|
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element.$mode;
|
||||||
$sql .= " WHERE piece_num = " . $piecenum;
|
$sql .= " WHERE piece_num = " . $piecenum;
|
||||||
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
||||||
@ -1447,6 +1459,7 @@ class BookKeeping extends CommonObject
|
|||||||
$line->code_journal = $obj->code_journal;
|
$line->code_journal = $obj->code_journal;
|
||||||
$line->journal_label = $obj->journal_label;
|
$line->journal_label = $obj->journal_label;
|
||||||
$line->piece_num = $obj->piece_num;
|
$line->piece_num = $obj->piece_num;
|
||||||
|
$line->date_creation = $obj->date_creation;
|
||||||
|
|
||||||
$this->linesmvt[] = $line;
|
$this->linesmvt[] = $line;
|
||||||
}
|
}
|
||||||
@ -1785,4 +1798,5 @@ class BookKeepingLine
|
|||||||
public $code_journal;
|
public $code_journal;
|
||||||
public $journal_label;
|
public $journal_label;
|
||||||
public $piece_num;
|
public $piece_num;
|
||||||
|
public $date_creation;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,15 +18,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file accountancy/class/bookkeeping.class.php
|
* \file accountancy/class/bookkeeping.class.php
|
||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief File of class for lettering
|
* \brief File of class for lettering
|
||||||
*/
|
*/
|
||||||
|
include_once DOL_DOCUMENT_ROOT . "/accountancy/class/bookkeeping.class.php";
|
||||||
include_once DOL_DOCUMENT_ROOT."/accountancy/class/bookkeeping.class.php";
|
include_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php";
|
||||||
include_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
|
include_once DOL_DOCUMENT_ROOT . "/core/lib/date.lib.php";
|
||||||
include_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php";
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class lettering
|
* Class lettering
|
||||||
@ -36,303 +34,275 @@ class lettering extends BookKeeping
|
|||||||
/**
|
/**
|
||||||
* lettrageTiers
|
* lettrageTiers
|
||||||
*
|
*
|
||||||
* @param int $socid Thirdparty id
|
* @param int $socid Thirdparty id
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function lettrageTiers($socid) {
|
public function lettrageTiers($socid)
|
||||||
|
{
|
||||||
$db = $this->db;
|
$error = 0;
|
||||||
|
|
||||||
$object = new Societe($this->db);
|
$object = new Societe($this->db);
|
||||||
$object->id = $socid;
|
$object->id = $socid;
|
||||||
$object->fetch($socid);
|
$object->fetch($socid);
|
||||||
|
|
||||||
|
if ($object->code_compta == '411CUSTCODE') {
|
||||||
if( $object->code_compta == '411CUSTCODE')
|
|
||||||
$object->code_compta = '';
|
$object->code_compta = '';
|
||||||
|
|
||||||
if( $object->code_compta_fournisseur == '401SUPPCODE')
|
|
||||||
$object->code_compta_fournisseur = '';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.lettering_code, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering ";
|
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
|
||||||
$sql .= " WHERE code_journal = 'BQ' AND ( ";
|
|
||||||
if(!empty($object->code_compta) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
|
||||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " OR ";
|
|
||||||
if(!empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
|
||||||
|
|
||||||
$sql .= " ) AND ( bk.date_lettering ='' OR bk.date_lettering IS NULL ) AND bk.lettering_code !='' ";
|
|
||||||
|
|
||||||
$sql .= " GROUP BY bk.lettering_code ";
|
|
||||||
|
|
||||||
|
|
||||||
$resql = $db->query ( $sql );
|
|
||||||
if ($resql) {
|
|
||||||
$num = $db->num_rows ( $resql );
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
while ( $i < $num ) {
|
|
||||||
$obj = $db->fetch_object ( $resql );
|
|
||||||
$i++;
|
|
||||||
|
|
||||||
$sql = "SELECT bk.rowid ";
|
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
|
||||||
$sql .= " WHERE bk.lettering_code = '".$obj->lettering_code."' ";
|
|
||||||
$sql .= " AND ( ";
|
|
||||||
if(!empty($object->code_compta) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
|
||||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " OR ";
|
|
||||||
if(!empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
|
||||||
$sql .= " ) ";
|
|
||||||
// echo $sql;
|
|
||||||
$resql2 = $db->query ( $sql );
|
|
||||||
if ($resql2) {
|
|
||||||
$num2 = $db->num_rows ( $resql2 );
|
|
||||||
$i2 = 0;
|
|
||||||
$ids = array();
|
|
||||||
while ( $i2 < $num2 ) {
|
|
||||||
$obj2 = $db->fetch_object ( $resql2 );
|
|
||||||
$i2++;
|
|
||||||
$ids[] = $obj2->rowid;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(count($ids) > 1 ){
|
|
||||||
$result = $this->updatelettrage($ids);
|
|
||||||
|
|
||||||
// var_dump($result);
|
|
||||||
// if( $result < 0 ){
|
|
||||||
// setEventMessages('', $BookKeeping->errors, 'errors' );
|
|
||||||
// $error++;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($object->code_compta_fournisseur == '401SUPPCODE') {
|
||||||
|
$object->code_compta_fournisseur = '';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Prise en charge des lettering complexe avec prelevment , virement
|
* Prise en charge des lettering complexe avec prelevment , virement
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering, bu.url_id , bu.type ";
|
$sql = "SELECT DISTINCT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.thirdparty_code, ";
|
||||||
|
$sql .= " bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant ";
|
||||||
|
$sql .= " , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering, bu.url_id , bu.type ";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu ON(bk.fk_doc = bu.fk_bank AND bu.type IN ('payment', 'payment_supplier') ) ";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu ON(bk.fk_doc = bu.fk_bank AND bu.type IN ('payment', 'payment_supplier') ) ";
|
||||||
$sql .= " WHERE code_journal = 'BQ' AND ( ";
|
$sql .= " WHERE ( ";
|
||||||
if(!empty($object->code_compta) )
|
if (! empty($object->code_compta))
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
$sql .= " bk.thirdparty_code = '" . $object->code_compta . "' ";
|
||||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur))
|
||||||
$sql .= " OR ";
|
$sql .= " OR ";
|
||||||
if(!empty($object->code_compta_fournisseur) )
|
if (! empty($object->code_compta_fournisseur))
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
$sql .= " bk.thirdparty_code = '" . $object->code_compta_fournisseur . "' ";
|
||||||
|
|
||||||
$sql .= " ) AND date_lettering ='' ";
|
$sql .= " ) AND (bk.date_lettering ='' OR bk.date_lettering IS NULL) ";
|
||||||
$sql .= " GROUP BY bk.lettering_code ";
|
$sql .= " AND (bk.lettering_code != '' OR bk.lettering_code IS NULL) ";
|
||||||
|
$sql .= $this->db->order('bk.doc_date', 'DESC');
|
||||||
|
|
||||||
// echo $sql;
|
// echo $sql;
|
||||||
//
|
//
|
||||||
$resql = $db->query ( $sql );
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows ( $resql );
|
$num = $this->db->num_rows($resql);
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
while ( $i < $num ) {
|
while ($obj = $this->db->fetch_object($resql) ) {
|
||||||
$obj = $db->fetch_object ( $resql );
|
|
||||||
$ids = array();
|
$ids = array();
|
||||||
$i++;
|
$ids_fact = array();
|
||||||
|
|
||||||
// print_r($obj);
|
if ($obj->type == 'payment_supplier')
|
||||||
|
{
|
||||||
|
$sql = 'SELECT DISTINCT bk.rowid, facf.ref, facf.ref_supplier, payf.fk_bank, facf.rowid as fact_id';
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
|
||||||
if($obj->type =='payment_supplier' ) {
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
|
||||||
$ids[] = $obj->rowid;
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON (bk.fk_doc = payf.fk_bank AND bk.code_journal='" . $obj->code_journal . "')";
|
||||||
$sql= 'SELECT bk.rowid, facf.ref, facf.ref_supplier, payf.fk_bank ';
|
$sql .= " WHERE payfacf.fk_paiementfourn = '" . $obj->url_id . "' ";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
|
$sql .= " AND code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=4) ";
|
||||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
|
$sql .= " AND ( ";
|
||||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid";
|
if (! empty($object->code_compta)) {
|
||||||
$sql.= " INNER JOIN " .MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = facf.ref) ";
|
$sql .= " bk.thirdparty_code = '" . $object->code_compta . "' ";
|
||||||
// $sqlmid.= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc ON soc.rowid=facf.fk_soc";
|
|
||||||
// $sqlmid.= " INNER JOIN " . MAIN_DB_PREFIX . "c_paiement as payc ON payc.id=payf.fk_paiement";
|
|
||||||
$sql .= " WHERE 1 ";
|
|
||||||
$sql .= " AND fk_paiementfourn = '".$obj->url_id."' ";
|
|
||||||
// $sql .= " AND (bk.numero_compte = '" . $object->code_compta . "' OR bk.numero_compte = '" . $object->code_compta_fournisseur . "') ";
|
|
||||||
$sql .= " AND ( ";
|
|
||||||
if(!empty($object->code_compta) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
|
||||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " OR ";
|
|
||||||
if(!empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
|
||||||
$sql .= " ) ";
|
|
||||||
// echo $sql;
|
|
||||||
// exit;
|
|
||||||
}
|
}
|
||||||
elseif($obj->type =='payment' ){
|
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
|
||||||
$ids[] = $obj->rowid;
|
$sql .= " OR ";
|
||||||
|
|
||||||
$sql= 'SELECT bk.rowid,fac.facnumber , pay.fk_bank ';
|
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facture fac ";
|
|
||||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
|
|
||||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid";
|
|
||||||
$sql.= " INNER JOIN " .MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = fac.rowid) ";
|
|
||||||
$sql .= " WHERE 1 ";
|
|
||||||
$sql .= " AND payfac.fk_paiement = '".$obj->url_id."' ";
|
|
||||||
$sql .= " AND ( ";
|
|
||||||
if(!empty($object->code_compta) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
|
||||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " OR ";
|
|
||||||
if(!empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
|
||||||
$sql .= " ) ";
|
|
||||||
|
|
||||||
// echo $sql;
|
|
||||||
}
|
}
|
||||||
|
if (! empty($object->code_compta_fournisseur)) {
|
||||||
|
$sql .= " bk.thirdparty_code = '" . $object->code_compta_fournisseur . "' ";
|
||||||
|
}
|
||||||
|
$sql .= " ) ";
|
||||||
|
|
||||||
|
$resql2 = $this->db->query($sql);
|
||||||
|
|
||||||
$resql2 = $db->query ( $sql );
|
|
||||||
if ($resql2) {
|
if ($resql2) {
|
||||||
$num2 = $db->num_rows ( $resql2 );
|
while ( $obj2 = $this->db->fetch_object($resql2) ) {
|
||||||
$i2 = 0;
|
$ids[$obj2->rowid] = $obj2->rowid;
|
||||||
|
$ids_fact[] = $obj2->fact_id;
|
||||||
while ( $i2 < $num2 ) {
|
|
||||||
$obj2 = $db->fetch_object ( $resql2 );
|
|
||||||
$i2++;
|
|
||||||
$ids[] = $obj2->rowid;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
// print_r($ids);
|
$this->errors[] = $this->db->lasterror;
|
||||||
// exit;
|
return - 1;
|
||||||
if(count($ids) > 1 ){
|
|
||||||
$result = $this->updatelettrage($ids);
|
|
||||||
|
|
||||||
// var_dump($result);
|
|
||||||
// if( $result < 0 ){
|
|
||||||
// setEventMessages('', $BookKeeping->errors, 'errors' );
|
|
||||||
// $error++;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
// exit;
|
|
||||||
}
|
}
|
||||||
}
|
if (count($ids_fact)) {
|
||||||
}
|
$sql = 'SELECT bk.rowid, facf.ref, facf.ref_supplier ';
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = facf.rowid AND facf.rowid IN (" . implode(',', $ids_fact) . "))";
|
||||||
|
$sql .= " WHERE bk.code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=3) ";
|
||||||
|
$sql .= " AND ( ";
|
||||||
|
if (! empty($object->code_compta)) {
|
||||||
|
$sql .= " bk.thirdparty_code = '" . $object->code_compta . "' ";
|
||||||
|
}
|
||||||
|
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
|
||||||
|
$sql .= " OR ";
|
||||||
|
}
|
||||||
|
if (! empty($object->code_compta_fournisseur)) {
|
||||||
|
$sql .= " bk.thirdparty_code = '" . $object->code_compta_fournisseur . "' ";
|
||||||
|
}
|
||||||
|
$sql .= " ) ";
|
||||||
|
|
||||||
return 1;
|
$resql2 = $this->db->query($sql);
|
||||||
}
|
if ($resql2) {
|
||||||
|
while ( $obj2 = $this->db->fetch_object($resql2) ) {
|
||||||
|
$ids[$obj2->rowid] = $obj2->rowid;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->errors[] = $this->db->lasterror;
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif ($obj->type == 'payment') {
|
||||||
|
|
||||||
|
$sql = 'SELECT DISTINCT bk.rowid, fac.ref, fac.ref, pay.fk_bank, fac.rowid as fact_id';
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON (bk.fk_doc = pay.fk_bank AND bk.code_journal='" . $obj->code_journal . "')";
|
||||||
|
$sql .= " WHERE payfac.fk_paiement = '" . $obj->url_id . "' ";
|
||||||
|
$sql .= " AND bk.code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=4) ";
|
||||||
|
$sql .= " AND ( ";
|
||||||
|
if (! empty($object->code_compta)) {
|
||||||
|
$sql .= " bk.thirdparty_code = '" . $object->code_compta . "' ";
|
||||||
|
}
|
||||||
|
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
|
||||||
|
$sql .= " OR ";
|
||||||
|
}
|
||||||
|
if (! empty($object->code_compta_fournisseur)) {
|
||||||
|
$sql .= " bk.thirdparty_code = '" . $object->code_compta_fournisseur . "' ";
|
||||||
|
}
|
||||||
|
$sql .= " ) ";
|
||||||
|
|
||||||
public function updatelettrage($ids, $notrigger=false){
|
$resql2 = $this->db->query($sql);
|
||||||
$error = 0;
|
if ($resql2) {
|
||||||
|
while ( $obj2 = $this->db->fetch_object($resql2) ) {
|
||||||
|
$ids[$obj2->rowid] = $obj2->rowid;
|
||||||
|
$ids_fact[] = $obj2->fact_id;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->errors[] = $this->db->lasterror;
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
if (count($ids_fact)) {
|
||||||
|
$sql = 'SELECT bk.rowid, fac.ref, fac.ref_supplier ';
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = fac.rowid AND fac.rowid IN (" . implode(',', $ids_fact) . "))";
|
||||||
|
$sql .= " WHERE code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=2) ";
|
||||||
|
$sql .= " AND ( ";
|
||||||
|
if (! empty($object->code_compta)) {
|
||||||
|
$sql .= " bk.thirdparty_code = '" . $object->code_compta . "' ";
|
||||||
|
}
|
||||||
|
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
|
||||||
|
$sql .= " OR ";
|
||||||
|
}
|
||||||
|
if (! empty($object->code_compta_fournisseur)) {
|
||||||
|
$sql .= " bk.thirdparty_code = '" . $object->code_compta_fournisseur . "' ";
|
||||||
|
}
|
||||||
|
$sql .= " ) ";
|
||||||
|
|
||||||
$lettre='';
|
$resql2 = $this->db->query($sql);
|
||||||
|
if ($resql2) {
|
||||||
|
while ( $obj2 = $this->db->fetch_object($resql2) ) {
|
||||||
|
$ids[$obj2->rowid] = $obj2->rowid;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->errors[] = $this->db->lasterror;
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$sql = "SELECT lettering_code FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
if (count($ids) > 1) {
|
||||||
$sql .= " lettering_code != '' GROUP BY lettering_code ORDER BY lettering_code DESC limit 1; ";
|
$result = $this->updatelettrage($ids);
|
||||||
// echo $sql;
|
|
||||||
$result = $this->db->query ( $sql );
|
|
||||||
if ($result) {
|
|
||||||
$obj = $this->db->fetch_object ( $result );
|
|
||||||
$lettre = (empty($obj->lettering_code)? 'AAA' : $obj->lettering_code );
|
|
||||||
if(!empty($obj->lettering_code))
|
|
||||||
$lettre++;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$this->errors[] = 'Error'.$this->db->lasterror();;
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
// var_dump(__line__, $error);
|
|
||||||
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
|
||||||
$sql .= " rowid IN (".implode(',', $ids).") ";
|
|
||||||
$result = $this->db->query ( $sql );
|
|
||||||
if ($result) {
|
|
||||||
$obj = $this->db->fetch_object ( $result );
|
|
||||||
// print_r($obj);
|
|
||||||
if( !(round(abs($obj->deb),2) === round(abs($obj->cred),2)) ){
|
|
||||||
// echo $sql;
|
|
||||||
// print_r($obj);
|
|
||||||
$this->errors[] = 'Total not exacts '.round(abs($obj->deb),2).' vs '. round(abs($obj->cred),2);
|
|
||||||
$error++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
}
|
||||||
$this->errors[] = 'Erreur sql'.$this->db->lasterror();;
|
if ($error) {
|
||||||
|
foreach ( $this->errors as $errmsg ) {
|
||||||
|
dol_syslog(get_class($this) . "::" . __METHOD__ . $errmsg, LOG_ERR);
|
||||||
|
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
|
||||||
|
}
|
||||||
|
return - 1 * $error;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param array $ids ids array
|
||||||
|
* @param boolean $notrigger no trigger
|
||||||
|
* @return number
|
||||||
|
*/
|
||||||
|
public function updateLettrage($ids = array(), $notrigger = false)
|
||||||
|
{
|
||||||
|
$error = 0;
|
||||||
|
$lettre = 'AAA';
|
||||||
|
|
||||||
|
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
|
$sql = "SELECT DISTINCT lettering_code FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||||
|
$sql .= " lettering_code != '' ORDER BY lettering_code DESC limit 1; ";
|
||||||
|
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
if ($result) {
|
||||||
|
$obj = $this->db->fetch_object($result);
|
||||||
|
$lettre = (empty($obj->lettering_code) ? 'AAA' : $obj->lettering_code);
|
||||||
|
if (! empty($obj->lettering_code))
|
||||||
|
$lettre++;
|
||||||
|
} else {
|
||||||
|
$this->errors[] = 'Error' . $this->db->lasterror();
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||||
|
$sql .= " rowid IN (" . implode(',', $ids) . ") ";
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
if ($result) {
|
||||||
|
$obj = $this->db->fetch_object($result);
|
||||||
|
if (! (round(abs($obj->deb), 2) === round(abs($obj->cred), 2))) {
|
||||||
|
$this->errors[] = 'Total not exacts ' . round(abs($obj->deb), 2) . ' vs ' . round(abs($obj->cred), 2);
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$this->errors[] = 'Erreur sql' . $this->db->lasterror();
|
||||||
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update request
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
// Update request
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
|
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET";
|
||||||
$sql.= " lettering_code='".$lettre."'";
|
$sql .= " lettering_code='" . $lettre . "'";
|
||||||
$sql.= " , date_lettering = " .$now ; // todo correct date it's false
|
$sql .= " , date_lettering = '" . $this->db->idate($now) . "'"; // todo correct date it's false
|
||||||
$sql.= " WHERE rowid IN (".implode(',', $ids).") ";
|
$sql .= " WHERE rowid IN (" . implode(',', $ids) . ") ";
|
||||||
// echo $sql ;
|
|
||||||
//
|
|
||||||
// var_dump(__line__, $error);
|
|
||||||
// print_r($this->errors);
|
|
||||||
// exit;
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
if (! $resql) {
|
||||||
|
$error++;
|
||||||
if (! $error)
|
$this->errors[] = "Error " . $this->db->lasterror();
|
||||||
{
|
|
||||||
if (! $notrigger)
|
|
||||||
{
|
|
||||||
// Uncomment this and change MYOBJECT to your own tag if you
|
|
||||||
// want this action calls a trigger.
|
|
||||||
|
|
||||||
//// Call triggers
|
|
||||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
|
||||||
//$interface=new Interfaces($this->db);
|
|
||||||
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
|
||||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
//// End call triggers
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// var_dump(__line__, $error);
|
|
||||||
|
|
||||||
// Commit or rollback
|
|
||||||
if ($error)
|
|
||||||
{
|
|
||||||
// foreach($this->errors as $errmsg)
|
|
||||||
// {
|
|
||||||
// dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
|
||||||
// $this->error.=($this->error?', '.$errmsg:$errmsg);
|
|
||||||
// }
|
|
||||||
$this->db->rollback();
|
|
||||||
// echo $this->error;
|
|
||||||
// var_dump(__line__, $error);
|
|
||||||
return -1*$error;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->db->commit();
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (! $error) {
|
||||||
|
if (! $notrigger) {
|
||||||
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
|
// want this action calls a trigger.
|
||||||
|
|
||||||
|
// // Call triggers
|
||||||
|
// include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
|
// $interface=new Interfaces($this->db);
|
||||||
|
// $result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
||||||
|
// if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||||
|
// // End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error) {
|
||||||
|
foreach ( $this->errors as $errmsg ) {
|
||||||
|
dol_syslog(get_class($this) . "::update " . $errmsg, LOG_ERR);
|
||||||
|
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
return - 1 * $error;
|
||||||
|
} else {
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,9 @@ $langs->load("bills");
|
|||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
$cancel = GETPOST('cancel', 'alpha');
|
||||||
|
$backtopage = GETPOST('backtopage', 'alpha');
|
||||||
|
|
||||||
$codeventil = GETPOST('codeventil');
|
$codeventil = GETPOST('codeventil');
|
||||||
$id = GETPOST('id');
|
$id = GETPOST('id');
|
||||||
|
|
||||||
@ -40,12 +43,15 @@ $id = GETPOST('id');
|
|||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
if ($action == 'ventil' && $user->rights->accounting->bind->write)
|
||||||
if (! GETPOST('cancel', 'alpha')) {
|
{
|
||||||
|
if (! $cancel)
|
||||||
|
{
|
||||||
if ($codeventil < 0) $codeventil = 0;
|
if ($codeventil < 0) $codeventil = 0;
|
||||||
|
|
||||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
||||||
@ -59,6 +65,11 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||||
|
if ($backtopage)
|
||||||
|
{
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header("Location: ./lines.php");
|
header("Location: ./lines.php");
|
||||||
@ -109,6 +120,7 @@ if (! empty($id)) {
|
|||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
|
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="ventil">';
|
print '<input type="hidden" name="action" value="ventil">';
|
||||||
|
print '<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).'">';
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans('CustomersVentilation'), '', 'title_setup');
|
print load_fiche_titre($langs->trans('CustomersVentilation'), '', 'title_setup');
|
||||||
|
|
||||||
|
|||||||
@ -341,7 +341,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
|
|
||||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||||
|
|
||||||
print "<br>\n";
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
|
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
|
||||||
|
|||||||
@ -64,7 +64,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->AC
|
|||||||
$sortfield = GETPOST('sortfield', 'alpha');
|
$sortfield = GETPOST('sortfield', 'alpha');
|
||||||
$sortorder = GETPOST('sortorder', 'alpha');
|
$sortorder = GETPOST('sortorder', 'alpha');
|
||||||
$page = GETPOST('page', 'int');
|
$page = GETPOST('page', 'int');
|
||||||
if ($page < 0) $page = 0;
|
if (empty($page) || $page < 0) $page = 0;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
@ -365,7 +365,7 @@ if ($result) {
|
|||||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||||
print '<td align="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
print '<td align="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
|
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:'')).'">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -73,7 +73,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->AC
|
|||||||
$sortfield = GETPOST('sortfield', 'alpha');
|
$sortfield = GETPOST('sortfield', 'alpha');
|
||||||
$sortorder = GETPOST('sortorder', 'alpha');
|
$sortorder = GETPOST('sortorder', 'alpha');
|
||||||
$page = GETPOST('page','int');
|
$page = GETPOST('page','int');
|
||||||
if ($page < 0) { $page = 0; }
|
if (empty($page) || $page < 0) { $page = 0; }
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
@ -91,11 +91,16 @@ if ($user->societe_id > 0)
|
|||||||
if (! $user->rights->accounting->bind->write)
|
if (! $user->rights->accounting->bind->write)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
|
$hookmanager->initHooks(array('accountancycustomerlist'));
|
||||||
|
|
||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
$accounting = new AccountingAccount($db);
|
$accounting = new AccountingAccount($db);
|
||||||
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
|
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
|
||||||
$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1);
|
$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1);
|
||||||
|
|
||||||
|
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
@ -104,32 +109,40 @@ $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOU
|
|||||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
// Purge search criteria
|
$parameters=array();
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
$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 (empty($reshook))
|
||||||
{
|
{
|
||||||
$search_lineid = '';
|
// Purge search criteria
|
||||||
$search_ref = '';
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||||
$search_invoice = '';
|
{
|
||||||
$search_label = '';
|
$search_lineid = '';
|
||||||
$search_desc = '';
|
$search_ref = '';
|
||||||
$search_amount = '';
|
$search_invoice = '';
|
||||||
$search_account = '';
|
$search_label = '';
|
||||||
$search_vat = '';
|
$search_desc = '';
|
||||||
$search_day = '';
|
$search_amount = '';
|
||||||
$search_month = '';
|
$search_account = '';
|
||||||
$search_year = '';
|
$search_vat = '';
|
||||||
|
$search_day = '';
|
||||||
|
$search_month = '';
|
||||||
|
$search_year = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mass actions
|
||||||
|
$objectclass='AccountingAccount';
|
||||||
|
$permtoread = $user->rights->accounting->read;
|
||||||
|
$permtodelete = $user->rights->accounting->delete;
|
||||||
|
$uploaddir = $conf->accounting->dir_output;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mass actions
|
|
||||||
$objectclass='Skeleton';
|
|
||||||
$objectlabel='Skeleton';
|
|
||||||
$permtoread = $user->rights->accounting->read;
|
|
||||||
$permtodelete = $user->rights->accounting->delete;
|
|
||||||
$uploaddir = $conf->accounting->dir_output;
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
|
||||||
|
|
||||||
if ($massaction == 'ventil') {
|
if ($massaction == 'ventil') {
|
||||||
$msg='';
|
$msg='';
|
||||||
|
|
||||||
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
||||||
if (! empty($mesCasesCochees)) {
|
if (! empty($mesCasesCochees)) {
|
||||||
$msg = '<div>' . $langs->trans("SelectedLines") . ': '.count($mesCasesCochees).'</div>';
|
$msg = '<div>' . $langs->trans("SelectedLines") . ': '.count($mesCasesCochees).'</div>';
|
||||||
@ -157,7 +170,7 @@ if ($massaction == 'ventil') {
|
|||||||
$accountventilated = new AccountingAccount($db);
|
$accountventilated = new AccountingAccount($db);
|
||||||
$accountventilated->fetch($monCompte, '');
|
$accountventilated->fetch($monCompte, '');
|
||||||
|
|
||||||
dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
|
dol_syslog("accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
|
||||||
if ($db->query($sql)) {
|
if ($db->query($sql)) {
|
||||||
$msg.= '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
|
$msg.= '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
|
||||||
$ok++;
|
$ok++;
|
||||||
@ -187,20 +200,30 @@ $formother = new FormOther($db);
|
|||||||
|
|
||||||
llxHeader('', $langs->trans("Ventilation"));
|
llxHeader('', $langs->trans("Ventilation"));
|
||||||
|
|
||||||
|
if (empty($chartaccountcode))
|
||||||
|
{
|
||||||
|
print $langs->trans("ErrorChartOfAccountSystemNotSelected");
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Customer Invoice lines
|
// Customer Invoice lines
|
||||||
$sql = "SELECT f.facnumber, f.rowid as facid, f.datef, f.type as ftype,";
|
$sql = "SELECT f.rowid as facid, f.facnumber, f.datef, f.type as ftype,";
|
||||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
|
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
|
||||||
$sql .= " aa.rowid as aarowid";
|
$sql.= " aa.rowid as aarowid";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
|
$parameters=array();
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
|
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
$sql.=$hookmanager->resPrint;
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number";
|
$sql.= " FROM " . MAIN_DB_PREFIX . "facture as f";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
|
||||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||||
$sql .= " AND product_type <= 2";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."'";
|
||||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='' OR p.accountancy_code_sell NOT IN
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.fk_pcg_version = '" . $chartaccountcode."'";
|
||||||
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid ='" . $conf->global->CHARTOFACCOUNTS . "'))";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.fk_pcg_version = '" . $chartaccountcode."'";
|
||||||
|
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||||
|
$sql.= " AND product_type <= 2";
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
if ($search_lineid) {
|
if ($search_lineid) {
|
||||||
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
||||||
@ -242,10 +265,15 @@ else if ($search_year > 0)
|
|||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||||
} else {
|
} else {
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_STANDARD . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||||
}
|
}
|
||||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||||
|
|
||||||
|
// Add where from hooks
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
|
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
// Count total nb of records
|
// Count total nb of records
|
||||||
@ -258,7 +286,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
|
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
dol_syslog("/accountancy/customer/list.php", LOG_DEBUG);
|
dol_syslog("accountancy/customer/list.php", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num_lines = $db->num_rows($result);
|
$num_lines = $db->num_rows($result);
|
||||||
@ -284,8 +312,8 @@ if ($result) {
|
|||||||
//'presend'=>$langs->trans("SendByMail"),
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||||
//if ($massaction == 'presend') $arrayofmassactions=array();
|
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||||
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
||||||
@ -301,6 +329,12 @@ if ($result) {
|
|||||||
|
|
||||||
print $langs->trans("DescVentilTodoCustomer") . '</br><br>';
|
print $langs->trans("DescVentilTodoCustomer") . '</br><br>';
|
||||||
|
|
||||||
|
/*$topicmail="Information";
|
||||||
|
$modelmail="project";
|
||||||
|
$objecttmp=new Project($db);
|
||||||
|
$trackid='prj'.$object->id;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';*/
|
||||||
|
|
||||||
if ($msg) print $msg.'<br>';
|
if ($msg) print $msg.'<br>';
|
||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
@ -439,12 +473,14 @@ if ($result) {
|
|||||||
|
|
||||||
// Suggested accounting account
|
// Suggested accounting account
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
// Column with checkbox
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<input type="checkbox" class="flat checkforselect" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
@ -456,5 +492,17 @@ if ($result) {
|
|||||||
print $db->error();
|
print $db->error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add code to auto check the box when we select an account
|
||||||
|
print '<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
jQuery(".codeventil").change(function() {
|
||||||
|
var s=$(this).attr("id").replace("codeventil", "")
|
||||||
|
console.log(s+" "+$(this).val());
|
||||||
|
if ($(this).val() == -1) jQuery(".checkforselect"+s).prop("checked", false);
|
||||||
|
else jQuery(".checkforselect"+s).prop("checked", true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -38,6 +38,9 @@ $langs->load("accountancy");
|
|||||||
$langs->load("trips");
|
$langs->load("trips");
|
||||||
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
$cancel = GETPOST('cancel', 'alpha');
|
||||||
|
$backtopage = GETPOST('backtopage', 'alpha');
|
||||||
|
|
||||||
$codeventil = GETPOST('codeventil');
|
$codeventil = GETPOST('codeventil');
|
||||||
$id = GETPOST('id');
|
$id = GETPOST('id');
|
||||||
|
|
||||||
@ -45,12 +48,15 @@ $id = GETPOST('id');
|
|||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
if ($action == 'ventil' && $user->rights->accounting->bind->write)
|
||||||
if (! GETPOST('cancel', 'alpha')) {
|
{
|
||||||
|
if (! $cancel)
|
||||||
|
{
|
||||||
if ($codeventil < 0) $codeventil = 0;
|
if ($codeventil < 0) $codeventil = 0;
|
||||||
|
|
||||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "expensereport_det";
|
$sql = " UPDATE " . MAIN_DB_PREFIX . "expensereport_det";
|
||||||
@ -64,6 +70,11 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||||
|
if ($backtopage)
|
||||||
|
{
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header("Location: ./lines.php");
|
header("Location: ./lines.php");
|
||||||
@ -111,6 +122,7 @@ if (! empty($id)) {
|
|||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
|
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="ventil">';
|
print '<input type="hidden" name="action" value="ventil">';
|
||||||
|
print '<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).'">';
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans('ExpenseReportsVentilation'), '', 'title_setup');
|
print load_fiche_titre($langs->trans('ExpenseReportsVentilation'), '', 'title_setup');
|
||||||
|
|
||||||
|
|||||||
@ -310,7 +310,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
|
|
||||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||||
|
|
||||||
print "<br>\n";
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
||||||
|
|||||||
@ -106,7 +106,7 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
|
|||||||
$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=" . GETPOST('account_parent');
|
$sql1 .= " SET erd.fk_code_ventilation=" . GETPOST('account_parent','int');
|
||||||
$sql1 .= ' WHERE erd.rowid IN (' . implode(',', $changeaccount) . ')';
|
$sql1 .= ' WHERE erd.rowid IN (' . implode(',', $changeaccount) . ')';
|
||||||
|
|
||||||
dol_syslog('accountancy/expensereport/lines.php::changeaccount sql= ' . $sql1);
|
dol_syslog('accountancy/expensereport/lines.php::changeaccount sql= ' . $sql1);
|
||||||
@ -328,7 +328,7 @@ if ($result) {
|
|||||||
|
|
||||||
print '<td>' . $codeCompta . '</td>';
|
print '<td>' . $codeCompta . '</td>';
|
||||||
|
|
||||||
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '">';
|
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:'')). '">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a></td>';
|
print '</a></td>';
|
||||||
|
|
||||||
|
|||||||
@ -92,6 +92,8 @@ if (! $user->rights->accounting->bind->write)
|
|||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
$accounting = new AccountingAccount($db);
|
$accounting = new AccountingAccount($db);
|
||||||
|
|
||||||
|
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
@ -182,18 +184,24 @@ $formother = new FormOther($db);
|
|||||||
|
|
||||||
llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
||||||
|
|
||||||
|
if (empty($chartaccountcode))
|
||||||
|
{
|
||||||
|
print $langs->trans("ErrorChartOfAccountSystemNotSelected");
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Expense report lines
|
// Expense report lines
|
||||||
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut,";
|
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut,";
|
||||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.vat_src_code, erd.date,";
|
$sql.= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.vat_src_code, erd.date,";
|
||||||
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,";
|
$sql.= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,";
|
||||||
$sql .= " aa.rowid as aarowid";
|
$sql.= " aa.rowid as aarowid";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
$sql.= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "expensereport_det as erd ON er.rowid = erd.fk_expensereport";
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "expensereport_det as erd ON er.rowid = erd.fk_expensereport";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON f.accountancy_code = aa.account_number";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."'";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
$sql.= " WHERE er.fk_statut > 4 AND erd.fk_code_ventilation <= 0";
|
||||||
$sql .= " WHERE er.fk_statut > 4 AND erd.fk_code_ventilation <= 0";
|
|
||||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR f.accountancy_code IS NULL OR f.accountancy_code ='')";
|
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
if (strlen(trim($search_expensereport))) {
|
if (strlen(trim($search_expensereport))) {
|
||||||
$sql .= natural_search("er.ref",$search_expensereport);
|
$sql .= natural_search("er.ref",$search_expensereport);
|
||||||
@ -266,8 +274,8 @@ if ($result) {
|
|||||||
//'presend'=>$langs->trans("SendByMail"),
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||||
//if ($massaction == 'presend') $arrayofmassactions=array();
|
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||||
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||||
|
|
||||||
|
|
||||||
@ -284,6 +292,12 @@ if ($result) {
|
|||||||
|
|
||||||
print $langs->trans("DescVentilTodoExpenseReport") . '</br><br>';
|
print $langs->trans("DescVentilTodoExpenseReport") . '</br><br>';
|
||||||
|
|
||||||
|
/*$topicmail="Information";
|
||||||
|
$modelmail="project";
|
||||||
|
$objecttmp=new Project($db);
|
||||||
|
$trackid='prj'.$object->id;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';*/
|
||||||
|
|
||||||
if ($msg) print $msg.'<br>';
|
if ($msg) print $msg.'<br>';
|
||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
@ -380,11 +394,11 @@ if ($result) {
|
|||||||
|
|
||||||
// Suggested accounting account
|
// Suggested accounting account
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<input type="checkbox" class="flat checkforselect" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
@ -399,5 +413,17 @@ if ($result) {
|
|||||||
print $db->error();
|
print $db->error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add code to auto check the box when we select an account
|
||||||
|
print '<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
jQuery(".codeventil").change(function() {
|
||||||
|
var s=$(this).attr("id").replace("codeventil", "")
|
||||||
|
console.log(s+" "+$(this).val());
|
||||||
|
if ($(this).val() == -1) jQuery(".checkforselect"+s).prop("checked", false);
|
||||||
|
else jQuery(".checkforselect"+s).prop("checked", true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -66,7 +66,7 @@ $step = 0;
|
|||||||
print $langs->trans("AccountancyAreaDescIntro")."<br>\n";
|
print $langs->trans("AccountancyAreaDescIntro")."<br>\n";
|
||||||
print "<br>\n";print "<br>\n";
|
print "<br>\n";print "<br>\n";
|
||||||
|
|
||||||
print_fiche_titre($langs->trans("AccountancyAreaDescActionOnce"), '', 'object_calendar')."<br>\n";
|
print_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."<br>\n";
|
||||||
print '<hr>';
|
print '<hr>';
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ print '<br>';
|
|||||||
|
|
||||||
|
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
print_fiche_titre($langs->trans("AccountancyAreaDescActionFreq"), '', 'object_calendarweek');
|
print_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionFreq"), '', '');
|
||||||
print '<hr>';
|
print '<hr>';
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
$step = 0;
|
$step = 0;
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 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) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
|
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -93,7 +94,7 @@ if ($pastmonth == 0) {
|
|||||||
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||||
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||||
|
|
||||||
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
if (! GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
|
||||||
{
|
{
|
||||||
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);
|
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);
|
||||||
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
||||||
@ -118,10 +119,15 @@ $sql .= " WHERE ba.fk_accountancy_journal=" . $id_journal;
|
|||||||
$sql .= ' AND b.amount != 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
|
$sql .= ' AND b.amount != 0 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) . "'";
|
||||||
|
// Already in bookkeeping or not
|
||||||
if ($in_bookkeeping == 'already')
|
if ($in_bookkeeping == 'already')
|
||||||
|
{
|
||||||
$sql .= " AND (b.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='bank') )";
|
$sql .= " AND (b.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='bank') )";
|
||||||
|
}
|
||||||
if ($in_bookkeeping == 'notyet')
|
if ($in_bookkeeping == 'notyet')
|
||||||
|
{
|
||||||
$sql .= " AND (b.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='bank') )";
|
$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";
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
@ -401,6 +407,9 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
|
|
||||||
$errorforline = 0;
|
$errorforline = 0;
|
||||||
|
|
||||||
|
$totalcredit = 0;
|
||||||
|
$totaldebit = 0;
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
// Introduce a protection. Total of tabtp must be total of tabbq
|
// Introduce a protection. Total of tabtp must be total of tabbq
|
||||||
@ -459,6 +468,9 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -565,6 +577,9 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -584,6 +599,13 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($totaldebit != $totalcredit)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
setEventMessages('Try to insert a non balanced transaction in book for '.$ref.'. Canceled. Surely a bug.', null, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -596,8 +618,8 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$MAXNBERRORS=5;
|
$MAXNBERRORS=5;
|
||||||
if ($error >= $MAXNBERRORS)
|
if ($error >= $MAXNBERRORS)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped").' (>'.$MAXNBERRORS.')', null, 'errors');
|
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped").' (>'.$MAXNBERRORS.')', null, 'errors');
|
||||||
break; // Break in the foreach
|
break; // Break in the foreach
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -626,7 +648,7 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
$param.='&date_endday='.$date_endday;
|
$param.='&date_endday='.$date_endday;
|
||||||
$param.='&date_endmonth='.$date_endmonth;
|
$param.='&date_endmonth='.$date_endmonth;
|
||||||
$param.='&date_endyear='.$date_endyear;
|
$param.='&date_endyear='.$date_endyear;
|
||||||
$param.='&in_bookeeping='.$in_bookeeping;
|
$param.='&in_bookkeeping='.$in_bookkeeping;
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -674,7 +696,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||||||
|
|
||||||
// Bank
|
// Bank
|
||||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||||
print '"' . $journal . '"' . $sep;
|
print '"' . $key . '"' . $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;
|
||||||
@ -686,7 +708,8 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||||||
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
print '"' . $val['bank_account_ref'] . ' - ' . 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) : '') . '"' . $sep;
|
||||||
|
print '"' . $journal . '"' . $sep;
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -694,7 +717,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||||||
if (is_array($tabtp[$key])) {
|
if (is_array($tabtp[$key])) {
|
||||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '"' . $journal . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["type_payment"] . '"' . $sep;
|
print '"' . $val["type_payment"] . '"' . $sep;
|
||||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
@ -712,13 +735,14 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||||||
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($companystatic->name) . '"' . $sep;
|
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) : '') . '"' . $sep;
|
||||||
|
print '"' . $journal . '"' . $sep;
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||||
print '"' . $journal . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["type_payment"] . '"' . $sep;
|
print '"' . $val["type_payment"] . '"' . $sep;
|
||||||
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
||||||
@ -730,7 +754,8 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
|||||||
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
print '"' . $val['bank_account_ref'] . ' - ' . 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) : '') . '"' . $sep;
|
||||||
|
print '"' . $journal . '"' . $sep;
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -761,7 +786,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||||
|
|
||||||
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||||
$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("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
$period = $form->select_date($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||||
|
|
||||||
$varlink = 'id_journal=' . $id_journal;
|
$varlink = 'id_journal=' . $id_journal;
|
||||||
|
|
||||||
@ -769,15 +794,15 @@ if (empty($action) || $action == 'view') {
|
|||||||
|
|
||||||
|
|
||||||
// Test that setup is complete
|
// Test that setup is complete
|
||||||
$sql='SELECT COUNT(rowid) as nb FROM '.MAIN_DB_PREFIX.'bank_account WHERE fk_accountancy_journal IS NULL';
|
$sql = 'SELECT COUNT(rowid) as nb FROM '.MAIN_DB_PREFIX.'bank_account WHERE fk_accountancy_journal IS NULL';
|
||||||
$resql=$db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$obj=$db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
if ($obj->nb > 0)
|
if ($obj->nb > 0)
|
||||||
{
|
{
|
||||||
print '<br>'.img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount");
|
print '<br>'.img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount");
|
||||||
print ' : '.$langs->trans("AccountancyAreaDescBank", 9, '<strong>'.$langs->transnoentitiesnoconv("MenuBankCash").'</strong>');
|
print ' : '.$langs->trans("AccountancyAreaDescBank", 9, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("BankAccounts").'</strong>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else dol_print_error($db);
|
else dol_print_error($db);
|
||||||
@ -793,8 +818,9 @@ if (empty($action) || $action == 'view') {
|
|||||||
|
|
||||||
|
|
||||||
print '<div class="tabsAction tabsActionNoBottom">';
|
print '<div class="tabsAction tabsActionNoBottom">';
|
||||||
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
|
||||||
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||||
|
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
|
else print '<a class="butActionRefused" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>';
|
||||||
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
|
||||||
@ -906,7 +932,14 @@ if (empty($action) || $action == 'view') {
|
|||||||
if ($tabtype[$key] == 'unknown')
|
if ($tabtype[$key] == 'unknown')
|
||||||
{
|
{
|
||||||
// We will accept writing, but into a waiting account
|
// We will accept writing, but into a waiting account
|
||||||
print '<span class="warning">'.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).'</span>'; // We will a waiting account
|
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) || $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE == '-1')
|
||||||
|
{
|
||||||
|
print '<span class="error">'.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').'</span>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<span class="warning">'.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).'</span>'; // We will a waiting account
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1004,134 +1037,90 @@ function getSourceDocRef($val, $typerecord)
|
|||||||
|
|
||||||
// Defined the docref into $ref (We start with $val['ref'] by default and we complete according to other data)
|
// Defined the docref into $ref (We start with $val['ref'] by default and we complete according to other data)
|
||||||
// WE MUST HAVE SAME REF FOR ALL LINES WE WILL RECORD INTO THE BOOKKEEPING
|
// WE MUST HAVE SAME REF FOR ALL LINES WE WILL RECORD INTO THE BOOKKEEPING
|
||||||
$reflabel = $val['ref'];
|
$ref = $val['ref'];
|
||||||
if ($reflabel == '(SupplierInvoicePayment)' || $reflabel == '(SupplierInvoicePaymentBack)') {
|
if ($ref == '(SupplierInvoicePayment)' || $ref == '(SupplierInvoicePaymentBack)') {
|
||||||
$reflabel = $langs->trans('Supplier');
|
$ref = $langs->trans('Supplier');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(CustomerInvoicePayment)' || $reflabel == '(CustomerInvoicePaymentBack)') {
|
if ($ref == '(CustomerInvoicePayment)' || $ref == '(CustomerInvoicePaymentBack)') {
|
||||||
$reflabel = $langs->trans('Customer');
|
$ref = $langs->trans('Customer');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(SocialContributionPayment)') {
|
if ($ref == '(SocialContributionPayment)') {
|
||||||
$reflabel = $langs->trans('SocialContribution');
|
$ref = $langs->trans('SocialContribution');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(DonationPayment)') {
|
if ($ref == '(DonationPayment)') {
|
||||||
$reflabel = $langs->trans('Donation');
|
$ref = $langs->trans('Donation');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(SubscriptionPayment)') {
|
if ($ref == '(SubscriptionPayment)') {
|
||||||
$reflabel = $langs->trans('Subscription');
|
$ref = $langs->trans('Subscription');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(ExpenseReportPayment)') {
|
if ($ref == '(ExpenseReportPayment)') {
|
||||||
$reflabel = $langs->trans('Employee');
|
$ref = $langs->trans('Employee');
|
||||||
}
|
}
|
||||||
if ($reflabel == '(payment_salary)') {
|
if ($ref == '(payment_salary)') {
|
||||||
$reflabel = $langs->trans('Employee');
|
$ref = $langs->trans('Employee');
|
||||||
}
|
}
|
||||||
$ref=$reflabel;
|
|
||||||
|
$sqlmid = '';
|
||||||
if ($typerecord == 'payment')
|
if ($typerecord == 'payment')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT payfac.fk_facture as id, f.facnumber as ref';
|
$sqlmid = 'SELECT payfac.fk_facture as id, f.facnumber as ref';
|
||||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f";
|
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f";
|
||||||
$sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=" . $val["paymentid"];
|
$sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=" . $val["paymentid"];
|
||||||
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
$ref = $langs->trans("Invoice");
|
||||||
$resultmid = $db->query($sqlmid);
|
|
||||||
if ($resultmid) {
|
|
||||||
$ref=$langs->trans("Invoice");
|
|
||||||
while ($objmid = $db->fetch_object($resultmid))
|
|
||||||
{
|
|
||||||
$ref.=' '.$objmid->ref;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
elseif ($typerecord == 'payment_supplier')
|
elseif ($typerecord == 'payment_supplier')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref';
|
$sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfac, ".MAIN_DB_PREFIX."facture_fourn as f";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfac, ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||||
$sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=" . $val["paymentsupplierid"];
|
$sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=" . $val["paymentsupplierid"];
|
||||||
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
$ref = $langs->trans("SupplierInvoice");
|
||||||
$resultmid = $db->query($sqlmid);
|
|
||||||
if ($resultmid) {
|
|
||||||
$ref=$langs->trans("SupplierInvoice");
|
|
||||||
while($objmid = $db->fetch_object($resultmid))
|
|
||||||
{
|
|
||||||
$ref.=' '.$objmid->ref;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
elseif ($typerecord == 'payment_expensereport')
|
elseif ($typerecord == 'payment_expensereport')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT e.rowid as id, e.ref';
|
$sqlmid = 'SELECT e.rowid as id, e.ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_expensereport as pe, " . MAIN_DB_PREFIX . "expensereport as e";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_expensereport as pe, " . MAIN_DB_PREFIX . "expensereport as e";
|
||||||
$sqlmid .= " WHERE pe.rowid=" . $val["paymentexpensereport"]." AND pe.fk_expensereport = e.rowid";
|
$sqlmid .= " WHERE pe.rowid=" . $val["paymentexpensereport"]." AND pe.fk_expensereport = e.rowid";
|
||||||
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
$ref = $langs->trans("ExpenseReport");
|
||||||
$resultmid = $db->query($sqlmid);
|
|
||||||
if ($resultmid) {
|
|
||||||
$ref=$langs->trans("ExpenseReport");
|
|
||||||
while($objmid = $db->fetch_object($resultmid))
|
|
||||||
{
|
|
||||||
$ref.=' '.$objmid->ref;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
elseif ($typerecord == 'payment_salary')
|
elseif ($typerecord == 'payment_salary')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT s.rowid as ref';
|
$sqlmid = 'SELECT s.rowid as ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_salary as s";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_salary as s";
|
||||||
$sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"];
|
$sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"];
|
||||||
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
$ref = $langs->trans("SalaryPayment");
|
||||||
$resultmid = $db->query($sqlmid);
|
|
||||||
if ($resultmid) {
|
|
||||||
$ref=$langs->trans("SalaryPayment");
|
|
||||||
while ($objmid = $db->fetch_object($resultmid))
|
|
||||||
{
|
|
||||||
$ref.=' '.$objmid->ref;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
elseif ($typerecord == 'payment_vat')
|
elseif ($typerecord == 'payment_vat')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT v.rowid as ref';
|
$sqlmid = 'SELECT v.rowid as ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "tva as v";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "tva as v";
|
||||||
$sqlmid .= " WHERE v.rowid=" . $val["paymentvatid"];
|
$sqlmid .= " WHERE v.rowid=" . $val["paymentvatid"];
|
||||||
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
$ref = $langs->trans("PaymentVat");
|
||||||
$resultmid = $db->query($sqlmid);
|
|
||||||
if ($resultmid) {
|
|
||||||
$ref=$langs->trans("PaymentVat");
|
|
||||||
while ($objmid = $db->fetch_object($resultmid))
|
|
||||||
{
|
|
||||||
$ref.=' '.$objmid->ref;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
elseif ($typerecord == 'payment_donation')
|
elseif ($typerecord == 'payment_donation')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT payd.fk_donation as ref';
|
$sqlmid = 'SELECT payd.fk_donation as ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_donation as payd";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_donation as payd";
|
||||||
$sqlmid .= " WHERE payd.fk_donation=" . $val["paymentdonationid"];
|
$sqlmid .= " WHERE payd.fk_donation=" . $val["paymentdonationid"];
|
||||||
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
$ref = $langs->trans("Donation").' ';
|
||||||
$resultmid = $db->query($sqlmid);
|
|
||||||
if ($resultmid) {
|
|
||||||
$ref=$langs->trans("Donation").' ';
|
|
||||||
while ($objmid = $db->fetch_object($resultmid))
|
|
||||||
{
|
|
||||||
$ref.=' '.$objmid->ref;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
elseif ($typerecord == 'payment_various')
|
elseif ($typerecord == 'payment_various')
|
||||||
{
|
{
|
||||||
$sqlmid = 'SELECT v.rowid as ref';
|
$sqlmid = 'SELECT v.rowid as ref';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_various as v";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_various as v";
|
||||||
$sqlmid .= " WHERE v.rowid=" . $val["paymentvariousid"];
|
$sqlmid .= " WHERE v.rowid=" . $val["paymentvariousid"];
|
||||||
|
$ref = $langs->trans("VariousPayment");
|
||||||
|
}
|
||||||
|
// Add warning
|
||||||
|
if (empty($sqlmid))
|
||||||
|
{
|
||||||
|
dol_syslog("Found a typerecord=".$typerecord." not supported", LOG_WARNING);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sqlmid)
|
||||||
|
{
|
||||||
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||||
$resultmid = $db->query($sqlmid);
|
$resultmid = $db->query($sqlmid);
|
||||||
if ($resultmid) {
|
if ($resultmid) {
|
||||||
$ref=$langs->trans("VariousPayment");
|
|
||||||
while ($objmid = $db->fetch_object($resultmid))
|
while ($objmid = $db->fetch_object($resultmid))
|
||||||
{
|
{
|
||||||
$ref.=' '.$objmid->ref;
|
$ref.=' '.$objmid->ref;
|
||||||
|
|||||||
@ -77,7 +77,7 @@ if ($pastmonth == 0) {
|
|||||||
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||||
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||||
|
|
||||||
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
if (! GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
|
||||||
{
|
{
|
||||||
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);
|
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);
|
||||||
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
||||||
@ -101,10 +101,15 @@ $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) . "'";
|
||||||
|
// Already in bookkeeping or not
|
||||||
if ($in_bookkeeping == 'already')
|
if ($in_bookkeeping == 'already')
|
||||||
|
{
|
||||||
$sql .= " AND er.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
|
$sql .= " AND er.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
|
||||||
|
}
|
||||||
if ($in_bookkeeping == 'notyet')
|
if ($in_bookkeeping == 'notyet')
|
||||||
|
{
|
||||||
$sql .= " AND er.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
|
$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', LOG_DEBUG);
|
dol_syslog('accountancy/journal/expensereportsjournal.php', LOG_DEBUG);
|
||||||
@ -183,6 +188,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
$errorforline = 0;
|
$errorforline = 0;
|
||||||
|
|
||||||
|
$totalcredit = 0;
|
||||||
|
$totaldebit = 0;
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
@ -209,6 +217,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -255,6 +266,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -307,6 +321,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -327,6 +344,13 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($totaldebit != $totalcredit)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
setEventMessages('Try to insert a non balanced transaction in book for '.$val["ref"].'. Canceled. Surely a bug.', null, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -343,6 +367,8 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tabpay = $taber;
|
||||||
|
|
||||||
if (empty($error) && count($tabpay) > 0) {
|
if (empty($error) && count($tabpay) > 0) {
|
||||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
@ -367,7 +393,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$param.='&date_endday='.$date_endday;
|
$param.='&date_endday='.$date_endday;
|
||||||
$param.='&date_endmonth='.$date_endmonth;
|
$param.='&date_endmonth='.$date_endmonth;
|
||||||
$param.='&date_endyear='.$date_endyear;
|
$param.='&date_endyear='.$date_endyear;
|
||||||
$param.='&in_bookeeping='.$in_bookeeping;
|
$param.='&in_bookkeeping='.$in_bookkeeping;
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -502,7 +528,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||||
|
|
||||||
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||||
$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->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
$period = $form->select_date($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||||
|
|
||||||
$varlink = 'id_journal=' . $id_journal;
|
$varlink = 'id_journal=' . $id_journal;
|
||||||
|
|
||||||
@ -510,15 +536,16 @@ if (empty($action) || $action == 'view') {
|
|||||||
|
|
||||||
// Button to write into Ledger
|
// Button to write into Ledger
|
||||||
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
||||||
print '<br>'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
print '<br>'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||||
}
|
}
|
||||||
print '<div class="tabsAction tabsActionNoBottom">';
|
print '<div class="tabsAction tabsActionNoBottom">';
|
||||||
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
||||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
|
else print '<a href="#" class="butActionRefused" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>';
|
||||||
}
|
}
|
||||||
//print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
//print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@ -544,7 +571,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
print "<tr class=\"liste_titre\">";
|
print "<tr class=\"liste_titre\">";
|
||||||
print "<td></td>";
|
print "<td></td>";
|
||||||
|
|||||||
@ -56,9 +56,18 @@ $now = dol_now();
|
|||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
$hookmanager->initHooks(array('purchasesjournal'));
|
||||||
|
$parameters=array();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$user,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Views
|
||||||
|
*/
|
||||||
|
|
||||||
// Get informations of journal
|
// Get informations of journal
|
||||||
$accountingjournalstatic = new AccountingJournal($db);
|
$accountingjournalstatic = new AccountingJournal($db);
|
||||||
@ -77,7 +86,7 @@ if ($pastmonth == 0) {
|
|||||||
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||||
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||||
|
|
||||||
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
if (! GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
|
||||||
{
|
{
|
||||||
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);
|
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);
|
||||||
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
||||||
@ -85,7 +94,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
|||||||
|
|
||||||
$idpays = $mysoc->country_id;
|
$idpays = $mysoc->country_id;
|
||||||
|
|
||||||
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, ";
|
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, f.close_code,";
|
||||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,";
|
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,";
|
||||||
$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 , 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";
|
||||||
@ -106,10 +115,15 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
|||||||
}
|
}
|
||||||
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) . "'";
|
||||||
|
// Already in bookkeeping or not
|
||||||
if ($in_bookkeeping == 'already')
|
if ($in_bookkeeping == 'already')
|
||||||
$sql .= " AND f.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
|
{
|
||||||
|
$sql .= " AND f.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
|
||||||
|
}
|
||||||
if ($in_bookkeeping == 'notyet')
|
if ($in_bookkeeping == 'notyet')
|
||||||
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
|
{
|
||||||
|
$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', LOG_DEBUG);
|
dol_syslog('accountancy/journal/purchasesjournal.php', LOG_DEBUG);
|
||||||
@ -123,6 +137,7 @@ if ($result) {
|
|||||||
$tablocaltax1 = array ();
|
$tablocaltax1 = array ();
|
||||||
$tablocaltax2 = array ();
|
$tablocaltax2 = array ();
|
||||||
$tabcompany = array ();
|
$tabcompany = array ();
|
||||||
|
$tabother = array();
|
||||||
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
@ -147,6 +162,9 @@ if ($result) {
|
|||||||
|
|
||||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||||
$compta_tva = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
$compta_tva = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||||
|
$compta_localtax1 = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||||
|
$compta_localtax2 = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||||
|
$compta_counterpart_tva_npr = (! empty($conf->global->ACCOUNTING_COUNTERPART_VAT_NPR)) ? $conf->global->ACCOUNTING_COUNTERPART_VAT_NPR : 'NotDefined';
|
||||||
|
|
||||||
// Define array to display all VAT rates that use this accounting account $compta_tva
|
// Define array to display all VAT rates that use this accounting account $compta_tva
|
||||||
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
||||||
@ -154,14 +172,17 @@ if ($result) {
|
|||||||
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':''));
|
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':''));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$line = new SupplierInvoiceLine($db);
|
||||||
|
$line->fetch($obj->fdid);
|
||||||
|
|
||||||
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
|
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
|
||||||
$tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr);
|
$tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr);
|
||||||
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')';
|
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')';
|
||||||
$tabfac[$obj->rowid]["refsologest"] = $obj->ref;
|
$tabfac[$obj->rowid]["refsologest"] = $obj->ref;
|
||||||
$tabfac[$obj->rowid]["refsuppliersologest"] = $obj->ref_supplier;
|
$tabfac[$obj->rowid]["refsuppliersologest"] = $obj->ref_supplier;
|
||||||
|
|
||||||
$tabfac[$obj->rowid]["type"] = $obj->type;
|
$tabfac[$obj->rowid]["type"] = $obj->type;
|
||||||
$tabfac[$obj->rowid]["description"] = $obj->description;
|
$tabfac[$obj->rowid]["description"] = $obj->description;
|
||||||
|
$tabfac[$obj->rowid]["close_code"] = $obj->close_code; // close_code = 'replaced' for replacement invoices (not used in most european countries)
|
||||||
//$tabfac[$obj->rowid]["fk_facturefourndet"] = $obj->fdid;
|
//$tabfac[$obj->rowid]["fk_facturefourndet"] = $obj->fdid;
|
||||||
|
|
||||||
// Avoid warnings
|
// Avoid warnings
|
||||||
@ -174,6 +195,10 @@ if ($result) {
|
|||||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
||||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
||||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||||
|
if (! empty($line->tva_npr)) // Add an entry for counterpart
|
||||||
|
{
|
||||||
|
$tabother[$obj->rowid][$compta_counterpart_tva_npr] += $obj->total_tva;
|
||||||
|
}
|
||||||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
|
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
|
||||||
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2;
|
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2;
|
||||||
$tabcompany[$obj->rowid] = array (
|
$tabcompany[$obj->rowid] = array (
|
||||||
@ -181,9 +206,9 @@ if ($result) {
|
|||||||
'name' => $obj->name,
|
'name' => $obj->name,
|
||||||
'code_fournisseur' => $obj->code_fournisseur,
|
'code_fournisseur' => $obj->code_fournisseur,
|
||||||
'code_compta_fournisseur' => $compta_soc
|
'code_compta_fournisseur' => $compta_soc
|
||||||
);
|
);
|
||||||
|
|
||||||
$i ++;
|
$i++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
@ -194,13 +219,17 @@ if ($action == 'writebookkeeping') {
|
|||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
|
$companystatic = new Societe($db);
|
||||||
|
$invoicestatic = new FactureFournisseur($db);
|
||||||
|
|
||||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||||
|
|
||||||
$errorforline = 0;
|
$errorforline = 0;
|
||||||
|
|
||||||
$db->begin();
|
$totalcredit = 0;
|
||||||
|
$totaldebit = 0;
|
||||||
|
|
||||||
$companystatic = new Societe($db);
|
$db->begin();
|
||||||
$invoicestatic = new FactureFournisseur($db);
|
|
||||||
|
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
@ -208,13 +237,31 @@ if ($action == 'writebookkeeping') {
|
|||||||
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
|
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
|
||||||
$companystatic->code_client = $tabcompany[$key]['code_client'];
|
$companystatic->code_client = $tabcompany[$key]['code_client'];
|
||||||
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
||||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
$companystatic->fournisseur = 1;
|
||||||
|
|
||||||
$invoicestatic->id = $key;
|
$invoicestatic->id = $key;
|
||||||
$invoicestatic->ref = (string) $val["refsologest"];
|
$invoicestatic->ref = (string) $val["refsologest"];
|
||||||
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
$invoicestatic->ref_supplier = $val["refsuppliersologest"];
|
||||||
$invoicestatic->type = $val["type"];
|
$invoicestatic->type = $val["type"];
|
||||||
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
||||||
|
$invoicestatic->close_code = $val["close_code"];
|
||||||
|
|
||||||
|
$date = dol_print_date($val["date"], 'day');
|
||||||
|
|
||||||
|
// Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
|
||||||
|
$replacedinvoice = 0;
|
||||||
|
if ($invoicestatic->close_code == FactureFournisseur::CLOSECODE_REPLACED)
|
||||||
|
{
|
||||||
|
$replacedinvoice = 1;
|
||||||
|
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||||
|
if ($alreadydispatched) $replacedinvoice = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If not already into bookkeeping, we won't add it, if yes, add the counterpart ???.
|
||||||
|
if ($replacedinvoice == 1)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
@ -233,7 +280,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
|
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
|
||||||
$bookkeeping->subledger_label = ''; // TODO To complete
|
$bookkeeping->subledger_label = ''; // TODO To complete
|
||||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("SubledgerAccount");
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount");
|
||||||
$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;
|
||||||
@ -242,6 +289,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -281,7 +331,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label;
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label;
|
||||||
$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;
|
||||||
@ -290,6 +340,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -322,6 +375,56 @@ if ($action == 'writebookkeeping') {
|
|||||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||||
|
|
||||||
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||||
|
if ($mt) {
|
||||||
|
$bookkeeping = new BookKeeping($db);
|
||||||
|
$bookkeeping->doc_date = $val["date"];
|
||||||
|
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||||
|
$bookkeeping->doc_ref = $val["refsologest"];
|
||||||
|
$bookkeeping->date_create = $now;
|
||||||
|
$bookkeeping->doc_type = 'supplier_invoice';
|
||||||
|
$bookkeeping->fk_doc = $key;
|
||||||
|
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||||
|
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||||
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->subledger_label = '';
|
||||||
|
$bookkeeping->numero_compte = $k;
|
||||||
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:'');
|
||||||
|
$bookkeeping->montant = $mt;
|
||||||
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
|
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||||
|
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
|
||||||
|
$bookkeeping->code_journal = $journal;
|
||||||
|
$bookkeeping->journal_label = $journal_label;
|
||||||
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
|
$result = $bookkeeping->create($user);
|
||||||
|
if ($result < 0) {
|
||||||
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Counterpart of VAT for VAT NPR
|
||||||
|
// var_dump($tabother);
|
||||||
|
if (! $errorforline)
|
||||||
|
{
|
||||||
|
foreach ( $tabother[$key] as $k => $mt ) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
@ -335,7 +438,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:'');
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("VAT").' NPR';
|
||||||
$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;
|
||||||
@ -344,6 +447,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -362,6 +468,12 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($totaldebit != $totalcredit)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
setEventMessages('Try to insert a non balanced transaction in book for '.$invoicestatic->ref.'. Canceled. Surely a bug.', null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
@ -380,6 +492,8 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tabpay = $tabfac;
|
||||||
|
|
||||||
if (empty($error) && count($tabpay) > 0) {
|
if (empty($error) && count($tabpay) > 0) {
|
||||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
@ -404,7 +518,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$param.='&date_endday='.$date_endday;
|
$param.='&date_endday='.$date_endday;
|
||||||
$param.='&date_endmonth='.$date_endmonth;
|
$param.='&date_endmonth='.$date_endmonth;
|
||||||
$param.='&date_endyear='.$date_endyear;
|
$param.='&date_endyear='.$date_endyear;
|
||||||
$param.='&in_bookeeping='.$in_bookeeping;
|
$param.='&in_bookkeeping='.$in_bookkeeping;
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -427,65 +541,84 @@ if ($action == 'exportcsv') {
|
|||||||
|
|
||||||
foreach ( $tabfac as $key => $val )
|
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->code_compta = $tabcompany[$key]['code_compta'];
|
||||||
|
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
|
||||||
|
$companystatic->code_client = $tabcompany[$key]['code_client'];
|
||||||
|
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
||||||
|
$companystatic->fournisseur = 1;
|
||||||
|
|
||||||
$invoicestatic->id = $key;
|
$invoicestatic->id = $key;
|
||||||
$invoicestatic->ref = $val["ref"];
|
$invoicestatic->ref = $val["refsologest"];
|
||||||
$invoicestatic->ref = $val["refsologest"];
|
$invoicestatic->ref_supplier = $val["refsuppliersologest"];
|
||||||
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
$invoicestatic->type = $val["type"];
|
||||||
$invoicestatic->type = $val["type"];
|
$invoicestatic->description = dol_trunc(html_entity_decode($val["description"]), 32);
|
||||||
$invoicestatic->description = dol_trunc($val["description"], 32);
|
$invoicestatic->close_code = $val["close_code"];
|
||||||
|
|
||||||
$date = dol_print_date($val["date"], 'day');
|
$date = dol_print_date($val["date"], 'day');
|
||||||
|
|
||||||
// Third party
|
// Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
$replacedinvoice = 0;
|
||||||
|
if ($invoicestatic->close_code == FactureFournisseur::CLOSECODE_REPLACED)
|
||||||
|
{
|
||||||
|
$replacedinvoice = 1;
|
||||||
|
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||||
|
if ($alreadydispatched) $replacedinvoice = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If not already into bookkeeping, we won't add it, if yes, add the counterpart ???.
|
||||||
|
if ($replacedinvoice == 1)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Third party
|
||||||
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
|
print '"' . $key . '"' . $sep;
|
||||||
|
print '"' . $date . '"' . $sep;
|
||||||
|
print '"' . $val["refsologest"] . '"' . $sep;
|
||||||
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
||||||
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $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 '"' . $journal . '"' ;
|
||||||
|
print "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Product / Service
|
||||||
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
|
$accountingaccount = new AccountingAccount($db);
|
||||||
|
$accountingaccount->fetch(null, $k, true);
|
||||||
|
if ($mt) {
|
||||||
print '"' . $key . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["refsologest"] . '"' . $sep;
|
print '"' . $val["refsologest"] . '"' . $sep;
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
||||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
print '""' . $sep;
|
||||||
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
print '"' . utf8_decode ( dol_trunc($accountingaccount->label, 32) ) . '"' . $sep;
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $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) : '') . '"'. $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
||||||
print '"' . $journal . '"' ;
|
print '"' . $journal . '"' ;
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Product / Service
|
// VAT
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
$listoftax = array(0, 1, 2);
|
||||||
$accountingaccount = new AccountingAccount($db);
|
foreach ($listoftax as $numtax) {
|
||||||
$accountingaccount->fetch(null, $k, true);
|
$arrayofvat = $tabtva;
|
||||||
if ($mt) {
|
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||||
print '"' . $key . '"' . $sep;
|
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||||
print '"' . $date . '"' . $sep;
|
|
||||||
print '"' . $val["refsologest"] . '"' . $sep;
|
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
|
||||||
print '""' . $sep;
|
|
||||||
print '"' . 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 '"' . $journal . '"' ;
|
|
||||||
print "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// VAT
|
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||||
$listoftax = array(0, 1, 2);
|
|
||||||
foreach ($listoftax as $numtax) {
|
|
||||||
$arrayofvat = $tabtva;
|
|
||||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
|
||||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
|
||||||
|
|
||||||
foreach ($arrayofvat[$key] as $k => $mt) {
|
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '"' . $key . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
@ -502,6 +635,28 @@ if ($action == 'exportcsv') {
|
|||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VAT counterpart for NPR
|
||||||
|
if (is_array($tabother[$key]))
|
||||||
|
{
|
||||||
|
foreach ( $tabother[$key] as $k => $mt ) {
|
||||||
|
if ($mt) {
|
||||||
|
print '"' . $key . '"' . $sep;
|
||||||
|
print '"' . $date . '"' . $sep;
|
||||||
|
print '"' . $val["refsologest"] . '"' . $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 '"' . 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("VAT") . ' NPR"' . $sep;
|
||||||
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep;
|
||||||
|
print '"' . $journal . '"' ;
|
||||||
|
print "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -523,7 +678,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||||
$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->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
$period = $form->select_date($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||||
|
|
||||||
$varlink = 'id_journal=' . $id_journal;
|
$varlink = 'id_journal=' . $id_journal;
|
||||||
|
|
||||||
@ -535,13 +690,14 @@ if (empty($action) || $action == 'view') {
|
|||||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||||
}
|
}
|
||||||
print '<div class="tabsAction tabsActionNoBottom">';
|
print '<div class="tabsAction tabsActionNoBottom">';
|
||||||
|
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
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") . '" />';
|
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
|
else print '<a href="#" class="butActionRefused" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>';
|
||||||
}
|
}
|
||||||
print '<input type="button" class="butAction" name="exportcsv" 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
|
||||||
@ -583,27 +739,62 @@ if (empty($action) || $action == 'view') {
|
|||||||
$invoicestatic = new FactureFournisseur($db);
|
$invoicestatic = new FactureFournisseur($db);
|
||||||
$companystatic = new Fournisseur($db);
|
$companystatic = new Fournisseur($db);
|
||||||
|
|
||||||
foreach ( $tabfac as $key => $val ) {
|
foreach ( $tabfac as $key => $val )
|
||||||
|
{
|
||||||
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
|
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
|
||||||
|
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
|
||||||
|
$companystatic->code_client = $tabcompany[$key]['code_client'];
|
||||||
|
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
||||||
|
$companystatic->fournisseur = 1;
|
||||||
|
|
||||||
$invoicestatic->id = $key;
|
$invoicestatic->id = $key;
|
||||||
$invoicestatic->ref = $val["ref"];
|
|
||||||
$invoicestatic->type = $val["type"];
|
|
||||||
|
|
||||||
$invoicestatic->ref = $val["refsologest"];
|
$invoicestatic->ref = $val["refsologest"];
|
||||||
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
$invoicestatic->ref_supplier = $val["refsuppliersologest"];
|
||||||
|
$invoicestatic->type = $val["type"];
|
||||||
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
$invoicestatic->description = dol_trunc(html_entity_decode($val["description"]), 32);
|
||||||
|
$invoicestatic->close_code = $val["close_code"];
|
||||||
|
|
||||||
$date = dol_print_date($val["date"], 'day');
|
$date = dol_print_date($val["date"], 'day');
|
||||||
|
|
||||||
|
// Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
|
||||||
|
$replacedinvoice = 0;
|
||||||
|
if ($invoicestatic->close_code == FactureFournisseur::CLOSECODE_REPLACED)
|
||||||
|
{
|
||||||
|
$replacedinvoice = 1;
|
||||||
|
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||||
|
if ($alreadydispatched) $replacedinvoice = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If not already into bookkeeping, we won't add it, if yes, add the counterpart ???.
|
||||||
|
if ($replacedinvoice == 1)
|
||||||
|
{
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print "<td><!-- Replaced invoice --></td>";
|
||||||
|
print "<td>" . $date . "</td>";
|
||||||
|
print "<td><strike>" . $invoicestatic->getNomUrl(1) . "</strike></td>";
|
||||||
|
// Account
|
||||||
|
print "<td>";
|
||||||
|
print $langs->trans("Replaced");
|
||||||
|
print '</td>';
|
||||||
|
// Subledger account
|
||||||
|
print "<td>";
|
||||||
|
print '</td>';
|
||||||
|
print "<td>";
|
||||||
|
print "</td>";
|
||||||
|
print '<td align="right"></td>';
|
||||||
|
print '<td align="right"></td>';
|
||||||
|
print "</tr>";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td><!-- Thirdparty --></td>";
|
print "<td><!-- Thirdparty --></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
|
||||||
$companystatic->supplier_code = $tabcompany[$key]['code_supplier'];
|
|
||||||
// Account
|
// Account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER);
|
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER);
|
||||||
@ -622,7 +813,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("SubledgerAccount") . "</td>";
|
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount") . "</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>";
|
||||||
@ -652,7 +843,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label . "</td>";
|
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label . "</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>";
|
||||||
@ -668,8 +859,39 @@ if (empty($action) || $action == 'view') {
|
|||||||
|
|
||||||
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print "<td><!-- VAT --></td>";
|
||||||
|
print "<td>" . $date . "</td>";
|
||||||
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
|
// Account
|
||||||
|
print "<td>";
|
||||||
|
$accountoshow = length_accountg($k);
|
||||||
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
|
{
|
||||||
|
print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Purchase").')'.'</span>';
|
||||||
|
}
|
||||||
|
else print $accountoshow;
|
||||||
|
print "</td>";
|
||||||
|
// Subledger account
|
||||||
|
print "<td>";
|
||||||
|
print '</td>';
|
||||||
|
print "<td>";
|
||||||
|
print $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
|
||||||
|
print "</td>";
|
||||||
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
|
print "</tr>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// VAT counterpart for NPR
|
||||||
|
if (is_array($tabother[$key]))
|
||||||
|
{
|
||||||
|
foreach ( $tabother[$key] as $k => $mt ) {
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td><!-- VAT --></td>";
|
print "<td><!-- VAT counterpart NPR --></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
// Account
|
// Account
|
||||||
@ -677,20 +899,18 @@ if (empty($action) || $action == 'view') {
|
|||||||
$accountoshow = length_accountg($k);
|
$accountoshow = length_accountg($k);
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("NPR counterpart").'). Set ACCOUNTING_COUNTERPART_VAT_NPR to the subvention account'.'</span>';
|
||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print '</td>';
|
||||||
// Subledger account
|
// Subledger account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
|
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("VAT") . " NPR (counterpart)</td>";
|
||||||
print "</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>";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -81,7 +81,7 @@ if ($pastmonth == 0) {
|
|||||||
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||||
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||||
|
|
||||||
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
if (! GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
|
||||||
{
|
{
|
||||||
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);
|
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);
|
||||||
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
||||||
@ -89,7 +89,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
|||||||
|
|
||||||
$idpays = $mysoc->country_id;
|
$idpays = $mysoc->country_id;
|
||||||
|
|
||||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr,";
|
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code,";
|
||||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
|
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
|
||||||
$sql .= " 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";
|
||||||
@ -111,10 +111,17 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
|||||||
$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) . "'";
|
||||||
|
// Already in bookkeeping or not
|
||||||
if ($in_bookkeeping == 'already')
|
if ($in_bookkeeping == 'already')
|
||||||
$sql .= " AND f.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
|
{
|
||||||
|
$sql .= " AND f.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
|
||||||
|
// $sql .= " AND fd.rowid IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account
|
||||||
|
}
|
||||||
if ($in_bookkeeping == 'notyet')
|
if ($in_bookkeeping == 'notyet')
|
||||||
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
|
{
|
||||||
|
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
|
||||||
|
// $sql .= " AND fd.rowid NOT IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account
|
||||||
|
}
|
||||||
$sql .= " ORDER BY f.datef";
|
$sql .= " ORDER BY f.datef";
|
||||||
|
|
||||||
dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG);
|
dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG);
|
||||||
@ -161,9 +168,10 @@ if ($result) {
|
|||||||
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':''));
|
$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
|
|
||||||
$line = new FactureLigne($db);
|
$line = new FactureLigne($db);
|
||||||
$line->fetch($obj->fdid);
|
$line->fetch($obj->fdid);
|
||||||
|
|
||||||
|
// Situation invoices handling
|
||||||
$prev_progress = $line->get_prev_progress($obj->fdid);
|
$prev_progress = $line->get_prev_progress($obj->fdid);
|
||||||
if ($obj->type == Facture::TYPE_SITUATION) {
|
if ($obj->type == Facture::TYPE_SITUATION) {
|
||||||
// Avoid divide by 0
|
// Avoid divide by 0
|
||||||
@ -182,6 +190,7 @@ if ($result) {
|
|||||||
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
|
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
|
||||||
$tabfac[$obj->rowid]["type"] = $obj->type;
|
$tabfac[$obj->rowid]["type"] = $obj->type;
|
||||||
$tabfac[$obj->rowid]["description"] = $obj->label_compte;
|
$tabfac[$obj->rowid]["description"] = $obj->label_compte;
|
||||||
|
$tabfac[$obj->rowid]["close_code"] = $obj->close_code; // close_code = 'replaced' for replacement invoices (not used in most european countries)
|
||||||
//$tabfac[$obj->rowid]["fk_facturedet"] = $obj->fdid;
|
//$tabfac[$obj->rowid]["fk_facturedet"] = $obj->fdid;
|
||||||
|
|
||||||
// Avoid warnings
|
// Avoid warnings
|
||||||
@ -193,7 +202,7 @@ if ($result) {
|
|||||||
|
|
||||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc * $situation_ratio;
|
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc * $situation_ratio;
|
||||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
|
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
|
||||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio;
|
if (empty($line->tva_npr)) $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio; // We ignore line if VAT is a NPR
|
||||||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1 * $situation_ratio;
|
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1 * $situation_ratio;
|
||||||
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2 * $situation_ratio;
|
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2 * $situation_ratio;
|
||||||
$tabcompany[$obj->rowid] = array (
|
$tabcompany[$obj->rowid] = array (
|
||||||
@ -214,14 +223,17 @@ if ($action == 'writebookkeeping') {
|
|||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
|
$companystatic = new Societe($db);
|
||||||
|
$invoicestatic = new Facture($db);
|
||||||
|
|
||||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||||
|
|
||||||
$errorforline = 0;
|
$errorforline = 0;
|
||||||
|
|
||||||
$db->begin();
|
$totalcredit = 0;
|
||||||
|
$totaldebit = 0;
|
||||||
|
|
||||||
$companystatic = new Societe($db);
|
$db->begin();
|
||||||
$invoicestatic = new Facture($db);
|
|
||||||
|
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
@ -229,10 +241,29 @@ if ($action == 'writebookkeeping') {
|
|||||||
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
|
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
|
||||||
$companystatic->code_client = $tabcompany[$key]['code_client'];
|
$companystatic->code_client = $tabcompany[$key]['code_client'];
|
||||||
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
||||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
$companystatic->client = 3;
|
||||||
|
|
||||||
$invoicestatic->id = $key;
|
$invoicestatic->id = $key;
|
||||||
$invoicestatic->ref = (string) $val["ref"];
|
$invoicestatic->ref = (string) $val["ref"];
|
||||||
|
$invoicestatic->type = $val["type"];
|
||||||
|
$invoicestatic->close_code = $val["close_code"];
|
||||||
|
|
||||||
|
$date = dol_print_date($val["date"], 'day');
|
||||||
|
|
||||||
|
// Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
|
||||||
|
$replacedinvoice = 0;
|
||||||
|
if ($invoicestatic->close_code == Facture::CLOSECODE_REPLACED)
|
||||||
|
{
|
||||||
|
$replacedinvoice = 1;
|
||||||
|
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||||
|
if ($alreadydispatched) $replacedinvoice = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If not already into bookkeeping, we won't add it, if yes, add the counterpart ???.
|
||||||
|
if ($replacedinvoice == 1)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
@ -260,6 +291,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -308,6 +342,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -343,7 +380,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
if ($mt) {
|
if ($mt) {
|
||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping->doc_ref = $val["ref"];
|
||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->date_create = $now;
|
||||||
$bookkeeping->doc_type = 'customer_invoice';
|
$bookkeeping->doc_type = 'customer_invoice';
|
||||||
@ -362,6 +399,9 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->journal_label = $journal_label;
|
$bookkeeping->journal_label = $journal_label;
|
||||||
$bookkeeping->fk_user_author = $user->id;
|
$bookkeeping->fk_user_author = $user->id;
|
||||||
|
|
||||||
|
$totaldebit += $bookkeeping->debit;
|
||||||
|
$totalcredit += $bookkeeping->credit;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
@ -382,6 +422,13 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($totaldebit != $totalcredit)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$errorforline++;
|
||||||
|
setEventMessages('Try to insert a non balanced transaction in book for '.$invoicestatic->ref.'. Canceled. Surely a bug.', null, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -399,6 +446,8 @@ if ($action == 'writebookkeeping') {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tabpay = $tabfac;
|
||||||
|
|
||||||
if (empty($error) && count($tabpay) > 0) {
|
if (empty($error) && count($tabpay) > 0) {
|
||||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
@ -423,7 +472,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$param.='&date_endday='.$date_endday;
|
$param.='&date_endday='.$date_endday;
|
||||||
$param.='&date_endmonth='.$date_endmonth;
|
$param.='&date_endmonth='.$date_endmonth;
|
||||||
$param.='&date_endyear='.$date_endyear;
|
$param.='&date_endyear='.$date_endyear;
|
||||||
$param.='&in_bookeeping='.$in_bookeeping;
|
$param.='&in_bookkeeping='.$in_bookkeeping;
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -451,13 +500,34 @@ if ($action == 'exportcsv') {
|
|||||||
{
|
{
|
||||||
$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->code_compta = $tabcompany[$key]['code_compta'];
|
||||||
|
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
|
||||||
|
$companystatic->code_client = $tabcompany[$key]['code_client'];
|
||||||
|
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
||||||
|
$companystatic->client = 3;
|
||||||
|
|
||||||
$invoicestatic->id = $key;
|
$invoicestatic->id = $key;
|
||||||
$invoicestatic->ref = $val["ref"];
|
$invoicestatic->ref = (string) $val["ref"];
|
||||||
|
$invoicestatic->type = $val["type"];
|
||||||
|
$invoicestatic->close_code = $val["close_code"];
|
||||||
|
|
||||||
$date = dol_print_date($val["date"], 'day');
|
$date = dol_print_date($val["date"], 'day');
|
||||||
|
|
||||||
|
// Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
|
||||||
|
$replacedinvoice = 0;
|
||||||
|
if ($invoicestatic->close_code == Facture::CLOSECODE_REPLACED)
|
||||||
|
{
|
||||||
|
$replacedinvoice = 1;
|
||||||
|
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||||
|
if ($alreadydispatched) $replacedinvoice = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If not already into bookkeeping, we won't add it, if yes, add the counterpart ???.
|
||||||
|
if ($replacedinvoice == 1)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
foreach ($tabttc[$key] as $k => $mt) {
|
foreach ($tabttc[$key] as $k => $mt) {
|
||||||
print '"' . $key . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
@ -542,7 +612,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$description .= $langs->trans("DepositsAreIncluded");
|
$description .= $langs->trans("DepositsAreIncluded");
|
||||||
|
|
||||||
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||||
$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->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
$period = $form->select_date($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||||
|
|
||||||
$varlink = 'id_journal=' . $id_journal;
|
$varlink = 'id_journal=' . $id_journal;
|
||||||
|
|
||||||
@ -554,13 +624,14 @@ if (empty($action) || $action == 'view') {
|
|||||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||||
}
|
}
|
||||||
print '<div class="tabsAction tabsActionNoBottom">';
|
print '<div class="tabsAction tabsActionNoBottom">';
|
||||||
|
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
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") . '" />';
|
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
|
else print '<a href="#" class="butActionRefused" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>';
|
||||||
}
|
}
|
||||||
print '<input type="button" class="butAction" name="exportcsv" 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
|
||||||
@ -599,25 +670,64 @@ if (empty($action) || $action == 'view') {
|
|||||||
|
|
||||||
$r = '';
|
$r = '';
|
||||||
|
|
||||||
$invoicestatic = new Facture($db);
|
|
||||||
$companystatic = new Client($db);
|
$companystatic = new Client($db);
|
||||||
|
$invoicestatic = new Facture($db);
|
||||||
|
|
||||||
|
foreach ( $tabfac as $key => $val )
|
||||||
|
{
|
||||||
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
|
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
|
||||||
|
$companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur'];
|
||||||
|
$companystatic->code_client = $tabcompany[$key]['code_client'];
|
||||||
|
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
||||||
|
$companystatic->client = 3;
|
||||||
|
|
||||||
foreach ( $tabfac as $key => $val ) {
|
|
||||||
$invoicestatic->id = $key;
|
$invoicestatic->id = $key;
|
||||||
$invoicestatic->ref = $val["ref"];
|
$invoicestatic->ref = (string) $val["ref"];
|
||||||
$invoicestatic->type = $val["type"];
|
$invoicestatic->type = $val["type"];
|
||||||
|
$invoicestatic->close_code = $val["close_code"];
|
||||||
|
|
||||||
$date = dol_print_date($val["date"], 'day');
|
$date = dol_print_date($val["date"], 'day');
|
||||||
|
|
||||||
|
// Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
|
||||||
|
$replacedinvoice = 0;
|
||||||
|
if ($invoicestatic->close_code == Facture::CLOSECODE_REPLACED)
|
||||||
|
{
|
||||||
|
$replacedinvoice = 1;
|
||||||
|
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
|
||||||
|
if ($alreadydispatched) $replacedinvoice = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If not already into bookkeeping, we won't add it, if yes, add the counterpart ???.
|
||||||
|
if ($replacedinvoice == 1)
|
||||||
|
{
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print "<td><!-- Replaced invoice --></td>";
|
||||||
|
print "<td>" . $date . "</td>";
|
||||||
|
print "<td><strike>" . $invoicestatic->getNomUrl(1) . "</strike></td>";
|
||||||
|
// Account
|
||||||
|
print "<td>";
|
||||||
|
print $langs->trans("Replaced");
|
||||||
|
print '</td>';
|
||||||
|
// Subledger account
|
||||||
|
print "<td>";
|
||||||
|
print '</td>';
|
||||||
|
print "<td>";
|
||||||
|
print "</td>";
|
||||||
|
print '<td align="right"></td>';
|
||||||
|
print '<td align="right"></td>';
|
||||||
|
print "</tr>";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
foreach ($tabttc[$key] as $k => $mt)
|
||||||
|
{
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td><!-- Thirdparty --></td>";
|
print "<td><!-- Thirdparty --></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
|
||||||
$companystatic->customer_code = $tabcompany[$key]['code_client'];
|
|
||||||
// Account
|
// Account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER);
|
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER);
|
||||||
@ -643,7 +753,8 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Product / Service
|
// Product / Service
|
||||||
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);
|
||||||
|
|
||||||
@ -675,7 +786,8 @@ if (empty($action) || $action == 'view') {
|
|||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
$listoftax = array(0, 1, 2);
|
$listoftax = array(0, 1, 2);
|
||||||
foreach ($listoftax as $numtax) {
|
foreach ($listoftax as $numtax)
|
||||||
|
{
|
||||||
$arrayofvat = $tabtva;
|
$arrayofvat = $tabtva;
|
||||||
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||||
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||||
@ -691,7 +803,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$accountoshow = length_accountg($k);
|
$accountoshow = length_accountg($k);
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Sale").')'.'</span>';
|
||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print "</td>";
|
||||||
|
|||||||
@ -37,6 +37,9 @@ $langs->load("bills");
|
|||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
$cancel = GETPOST('cancel', 'alpha');
|
||||||
|
$backtopage = GETPOST('backtopage', 'alpha');
|
||||||
|
|
||||||
$codeventil = GETPOST('codeventil');
|
$codeventil = GETPOST('codeventil');
|
||||||
$id = GETPOST('id');
|
$id = GETPOST('id');
|
||||||
|
|
||||||
@ -49,8 +52,10 @@ if ($user->societe_id > 0)
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
if ($action == 'ventil' && $user->rights->accounting->bind->write)
|
||||||
if (! GETPOST('cancel', 'alpha')) {
|
{
|
||||||
|
if (! $cancel)
|
||||||
|
{
|
||||||
if ($codeventil < 0) $codeventil = 0;
|
if ($codeventil < 0) $codeventil = 0;
|
||||||
|
|
||||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
|
$sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
|
||||||
@ -64,6 +69,11 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||||
|
if ($backtopage)
|
||||||
|
{
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header("Location: ./lines.php");
|
header("Location: ./lines.php");
|
||||||
@ -111,6 +121,7 @@ if (! empty($id)) {
|
|||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
|
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="ventil">';
|
print '<input type="hidden" name="action" value="ventil">';
|
||||||
|
print '<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).'">';
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans('SuppliersVentilation'), '', 'title_setup');
|
print load_fiche_titre($langs->trans('SuppliersVentilation'), '', 'title_setup');
|
||||||
|
|
||||||
|
|||||||
@ -309,7 +309,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
|
|
||||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||||
|
|
||||||
print "<br>\n";
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
||||||
|
|||||||
@ -114,7 +114,7 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
||||||
$sql1 .= " SET l.fk_code_ventilation=" . GETPOST('account_parent');
|
$sql1 .= " SET l.fk_code_ventilation=" . GETPOST('account_parent','int');
|
||||||
$sql1 .= ' WHERE l.rowid IN (' . implode(',', $changeaccount) . ')';
|
$sql1 .= ' WHERE l.rowid IN (' . implode(',', $changeaccount) . ')';
|
||||||
|
|
||||||
dol_syslog('accountancy/supplier/lines.php::changeaccount sql= ' . $sql1);
|
dol_syslog('accountancy/supplier/lines.php::changeaccount sql= ' . $sql1);
|
||||||
@ -368,13 +368,13 @@ if ($result) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||||
print '<td align="center">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
print '<td align="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||||
print '<td align="left">';
|
print '<td align="center">';
|
||||||
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
|
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:'')) . '">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a></td>';
|
print '</a></td>';
|
||||||
print '<td align="right">' . $objp->country .'</td>';
|
print '<td>' . $objp->country .'</td>';
|
||||||
print '<td align="center">' . $objp->tva_intra . '</td>';
|
print '<td>' . $objp->tva_intra . '</td>';
|
||||||
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="' . $objp->rowid . '"/></td>';
|
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="' . $objp->rowid . '"/></td>';
|
||||||
|
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|||||||
@ -91,12 +91,17 @@ if ($user->societe_id > 0)
|
|||||||
if (! $user->rights->accounting->bind->write)
|
if (! $user->rights->accounting->bind->write)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
|
$hookmanager->initHooks(array('accountancysupplierlist'));
|
||||||
|
|
||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
$accounting = new AccountingAccount($db);
|
$accounting = new AccountingAccount($db);
|
||||||
// TODO: we should need to check if result is a really exist accountaccount rowid.....
|
// TODO: we should need to check if result is a really exist accountaccount rowid.....
|
||||||
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
|
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
|
||||||
$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
|
$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
|
||||||
|
|
||||||
|
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
@ -105,42 +110,49 @@ $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUN
|
|||||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
// Purge search criteria
|
$parameters=array();
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
$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 (empty($reshook))
|
||||||
{
|
{
|
||||||
$search_lineid = '';
|
// Purge search criteria
|
||||||
$search_ref = '';
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||||
$search_invoice = '';
|
{
|
||||||
$search_label = '';
|
$search_lineid = '';
|
||||||
$search_desc = '';
|
$search_ref = '';
|
||||||
$search_amount = '';
|
$search_invoice = '';
|
||||||
$search_account = '';
|
$search_label = '';
|
||||||
$search_vat = '';
|
$search_desc = '';
|
||||||
$search_day = '';
|
$search_amount = '';
|
||||||
$search_month = '';
|
$search_account = '';
|
||||||
$search_year = '';
|
$search_vat = '';
|
||||||
|
$search_day = '';
|
||||||
|
$search_month = '';
|
||||||
|
$search_year = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mass actions
|
||||||
|
$objectclass='AccountingAccount';
|
||||||
|
$permtoread = $user->rights->accounting->read;
|
||||||
|
$permtodelete = $user->rights->accounting->delete;
|
||||||
|
$uploaddir = $conf->accounting->dir_output;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mass actions
|
|
||||||
$objectclass='Skeleton';
|
|
||||||
$objectlabel='Skeleton';
|
|
||||||
$permtoread = $user->rights->accounting->read;
|
|
||||||
$permtodelete = $user->rights->accounting->delete;
|
|
||||||
$uploaddir = $conf->accounting->dir_output;
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
|
||||||
|
|
||||||
if ($massaction == 'ventil') {
|
if ($massaction == 'ventil') {
|
||||||
$msg='';
|
$msg='';
|
||||||
|
|
||||||
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
||||||
if (! empty($mesCasesCochees)) {
|
if (! empty($mesCasesCochees)) {
|
||||||
$msg = '<div>' . $langs->trans("SelectedLines") . ': '.count($mesCasesCochees).'</div>';
|
$msg = '<div>' . $langs->trans("SelectedLines") . ': '.count($mesCasesCochees).'</div>';
|
||||||
$msg.='<div class="detail">';
|
$msg.='<div class="detail">';
|
||||||
$mesCodesVentilChoisis = $codeventil;
|
|
||||||
$cpt = 0;
|
$cpt = 0;
|
||||||
$ok=0;
|
$ok=0;
|
||||||
$ko=0;
|
$ko=0;
|
||||||
|
|
||||||
foreach ( $mesCasesCochees as $maLigneCochee ) {
|
foreach ($mesCasesCochees as $maLigneCochee) {
|
||||||
$maLigneCourante = explode("_", $maLigneCochee);
|
$maLigneCourante = explode("_", $maLigneCochee);
|
||||||
$monId = $maLigneCourante[0];
|
$monId = $maLigneCourante[0];
|
||||||
$monCompte = GETPOST('codeventil'.$monId);
|
$monCompte = GETPOST('codeventil'.$monId);
|
||||||
@ -189,20 +201,28 @@ $formother = new FormOther($db);
|
|||||||
|
|
||||||
llxHeader('', $langs->trans("SuppliersVentilation"));
|
llxHeader('', $langs->trans("SuppliersVentilation"));
|
||||||
|
|
||||||
|
if (empty($chartaccountcode))
|
||||||
|
{
|
||||||
|
print $langs->trans("ErrorChartOfAccountSystemNotSelected");
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Supplier Invoice Lines
|
// Supplier Invoice Lines
|
||||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef,";
|
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
|
||||||
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht as price, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
|
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
|
||||||
$sql.= " aa.rowid as aarowid";
|
$sql.= " aa.rowid as aarowid";
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."'";
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
|
||||||
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||||
$sql.= " AND product_type <= 2";
|
$sql.= " AND product_type <= 2";
|
||||||
$sql.= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_buy IS NULL OR p.accountancy_code_buy =''OR p.accountancy_code_buy NOT IN
|
|
||||||
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid ='" . $conf->global->CHARTOFACCOUNTS . "'))";
|
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
if ($search_lineid) {
|
if ($search_lineid) {
|
||||||
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
||||||
@ -241,8 +261,18 @@ else if ($search_year > 0)
|
|||||||
{
|
{
|
||||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||||
}
|
}
|
||||||
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
|
$sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_SITUATION . ")";
|
||||||
|
} else {
|
||||||
|
$sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_DEPOSIT . "," . FactureFournisseur::TYPE_SITUATION . ")";
|
||||||
|
}
|
||||||
$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
|
||||||
|
|
||||||
|
// Add where from hooks
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
|
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
// Count total nb of records
|
// Count total nb of records
|
||||||
@ -281,8 +311,8 @@ if ($result) {
|
|||||||
//'presend'=>$langs->trans("SendByMail"),
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||||
//if ($massaction == 'presend') $arrayofmassactions=array();
|
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||||
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
||||||
@ -298,13 +328,18 @@ if ($result) {
|
|||||||
|
|
||||||
print $langs->trans("DescVentilTodoCustomer") . '</br><br>';
|
print $langs->trans("DescVentilTodoCustomer") . '</br><br>';
|
||||||
|
|
||||||
|
/*$topicmail="Information";
|
||||||
|
$modelmail="project";
|
||||||
|
$objecttmp=new Project($db);
|
||||||
|
$trackid='prj'.$object->id;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';*/
|
||||||
|
|
||||||
if ($msg) print $msg.'<br>';
|
if ($msg) print $msg.'<br>';
|
||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
|
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
|
||||||
|
|
||||||
// We add search filter
|
// We add search filter
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
@ -423,7 +458,7 @@ if ($result) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print price($objp->price);
|
print price($objp->total_ht);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Vat rate
|
// Vat rate
|
||||||
@ -445,15 +480,15 @@ if ($result) {
|
|||||||
|
|
||||||
// Suggested accounting account
|
// Suggested accounting account
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Colonne choix ligne a ventiler
|
// Column with checkbox
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print '<input type="checkbox" class="flat checkforselect" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>";
|
print '</tr>';
|
||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,5 +500,17 @@ if ($result) {
|
|||||||
print $db->error();
|
print $db->error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add code to auto check the box when we select an account
|
||||||
|
print '<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
jQuery(".codeventil").change(function() {
|
||||||
|
var s=$(this).attr("id").replace("codeventil", "")
|
||||||
|
console.log(s+" "+$(this).val());
|
||||||
|
if ($(this).val() == -1) jQuery(".checkforselect"+s).prop("checked", false);
|
||||||
|
else jQuery(".checkforselect"+s).prop("checked", true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -15,6 +15,15 @@
|
|||||||
* 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/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Protection to avoid direct call of template
|
||||||
|
if (empty($conf) || ! is_object($conf))
|
||||||
|
{
|
||||||
|
print "Error, template page can't be called as URL";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$prefix = $conf->global->ACCOUNTING_EXPORT_PREFIX_SPEC;
|
$prefix = $conf->global->ACCOUNTING_EXPORT_PREFIX_SPEC;
|
||||||
$format = $conf->global->ACCOUNTING_EXPORT_FORMAT;
|
$format = $conf->global->ACCOUNTING_EXPORT_FORMAT;
|
||||||
$nodateexport = $conf->global->ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME;
|
$nodateexport = $conf->global->ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME;
|
||||||
|
|||||||
@ -37,7 +37,7 @@ $form = new Form($db);
|
|||||||
// List of supported format
|
// List of supported format
|
||||||
$tmptype2label=ExtraFields::$type2label;
|
$tmptype2label=ExtraFields::$type2label;
|
||||||
$type2label=array('');
|
$type2label=array('');
|
||||||
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
|
||||||
|
|
||||||
$action=GETPOST('action', 'alpha');
|
$action=GETPOST('action', 'alpha');
|
||||||
$attrname=GETPOST('attrname', 'alpha');
|
$attrname=GETPOST('attrname', 'alpha');
|
||||||
|
|||||||
@ -40,7 +40,7 @@ $form = new Form($db);
|
|||||||
// List of supported format
|
// List of supported format
|
||||||
$tmptype2label=ExtraFields::$type2label;
|
$tmptype2label=ExtraFields::$type2label;
|
||||||
$type2label=array('');
|
$type2label=array('');
|
||||||
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
|
||||||
|
|
||||||
$action=GETPOST('action', 'alpha');
|
$action=GETPOST('action', 'alpha');
|
||||||
$attrname=GETPOST('attrname', 'alpha');
|
$attrname=GETPOST('attrname', 'alpha');
|
||||||
|
|||||||
@ -168,7 +168,7 @@ if ($object->id > 0)
|
|||||||
$filters=array();
|
$filters=array();
|
||||||
$filters['search_agenda_label']=$search_agenda_label;
|
$filters['search_agenda_label']=$search_agenda_label;
|
||||||
|
|
||||||
// TODO Replace this with same code than into listactions.php
|
// TODO Replace this with same code than into list.php
|
||||||
show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder);
|
show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,8 +14,15 @@
|
|||||||
*
|
*
|
||||||
* 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/>.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Protection to avoid direct call of template
|
||||||
|
if (empty($conf) || ! is_object($conf))
|
||||||
|
{
|
||||||
|
print "Error, template page can't be called as URL";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE ADHERENTCARD_CREATE.TPL.PHP DEFAULT -->
|
<!-- BEGIN PHP TEMPLATE ADHERENTCARD_CREATE.TPL.PHP DEFAULT -->
|
||||||
|
|||||||
@ -14,9 +14,16 @@
|
|||||||
*
|
*
|
||||||
* 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/>.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Protection to avoid direct call of template
|
||||||
|
if (empty($conf) || ! is_object($conf))
|
||||||
|
{
|
||||||
|
print "Error, template page can't be called as URL";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$contact = $GLOBALS['objcanvas']->control->object;
|
$contact = $GLOBALS['objcanvas']->control->object;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -14,10 +14,18 @@
|
|||||||
*
|
*
|
||||||
* 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/>.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Protection to avoid direct call of template
|
||||||
|
if (empty($conf) || ! is_object($conf))
|
||||||
|
{
|
||||||
|
print "Error, template page can't be called as URL";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$contact = $GLOBALS['objcanvas']->control->object;
|
$contact = $GLOBALS['objcanvas']->control->object;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE ADHERENTCARD_VIEW.TPL.PHP DEFAULT -->
|
<!-- BEGIN PHP TEMPLATE ADHERENTCARD_VIEW.TPL.PHP DEFAULT -->
|
||||||
|
|||||||
@ -1211,15 +1211,6 @@ else
|
|||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Other attributes
|
|
||||||
$parameters=array();
|
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
|
||||||
print $hookmanager->resPrint;
|
|
||||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
|
||||||
{
|
|
||||||
print $object->showOptionals($extrafields,'edit',$parameters);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Third party Dolibarr
|
// Third party Dolibarr
|
||||||
if (! empty($conf->societe->enabled))
|
if (! empty($conf->societe->enabled))
|
||||||
{
|
{
|
||||||
@ -1246,6 +1237,15 @@ else
|
|||||||
else print $langs->trans("NoDolibarrAccess");
|
else print $langs->trans("NoDolibarrAccess");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Other attributes
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||||
|
{
|
||||||
|
print $object->showOptionals($extrafields,'edit',$parameters);
|
||||||
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
@ -1487,55 +1487,29 @@ else
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
// Date end subscription
|
||||||
|
print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';
|
||||||
print '</div>';
|
if ($object->datefin)
|
||||||
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
|
||||||
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
|
||||||
print '<table class="border tableforfield" width="100%">';
|
|
||||||
|
|
||||||
// Birthday
|
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($object->birth,'day').'</td></tr>';
|
|
||||||
|
|
||||||
// Public
|
|
||||||
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
|
|
||||||
|
|
||||||
// Categories
|
|
||||||
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
|
|
||||||
{
|
{
|
||||||
print '<tr><td>' . $langs->trans("Categories") . '</td>';
|
print dol_print_date($object->datefin,'day');
|
||||||
print '<td colspan="2">';
|
if ($object->hasDelay()) {
|
||||||
print $form->showCategories($object->id, 'member', 1);
|
print " ".img_warning($langs->trans("Late"));
|
||||||
print '</td></tr>';
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
// Other attributes
|
{
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
if (! $adht->subscription)
|
||||||
|
{
|
||||||
// Date end subscription
|
print $langs->trans("SubscriptionNotRecorded");
|
||||||
print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';
|
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
|
||||||
if ($object->datefin)
|
}
|
||||||
{
|
else
|
||||||
print dol_print_date($object->datefin,'day');
|
{
|
||||||
if ($object->hasDelay()) {
|
print $langs->trans("SubscriptionNotReceived");
|
||||||
print " ".img_warning($langs->trans("Late"));
|
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
print '</td></tr>';
|
||||||
{
|
|
||||||
if (! $adht->subscription)
|
|
||||||
{
|
|
||||||
print $langs->trans("SubscriptionNotRecorded");
|
|
||||||
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $langs->trans("SubscriptionNotReceived");
|
|
||||||
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Third party Dolibarr
|
// Third party Dolibarr
|
||||||
if (! empty($conf->societe->enabled))
|
if (! empty($conf->societe->enabled))
|
||||||
@ -1607,6 +1581,32 @@ else
|
|||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
|
// Birthday
|
||||||
|
print '<tr><td class="titlefield">'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($object->birth,'day').'</td></tr>';
|
||||||
|
|
||||||
|
// Public
|
||||||
|
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
|
||||||
|
|
||||||
|
// Categories
|
||||||
|
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
|
||||||
|
{
|
||||||
|
print '<tr><td>' . $langs->trans("Categories") . '</td>';
|
||||||
|
print '<td colspan="2">';
|
||||||
|
print $form->showCategories($object->id, 'member', 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Other attributes
|
||||||
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
print "</div></div></div>\n";
|
print "</div></div></div>\n";
|
||||||
@ -1778,8 +1778,8 @@ else
|
|||||||
//$filedir = $conf->adherent->dir_output . '/' . get_exdir($object->id, 2, 0, 0, $object, 'member') . dol_sanitizeFileName($object->ref);
|
//$filedir = $conf->adherent->dir_output . '/' . get_exdir($object->id, 2, 0, 0, $object, 'member') . dol_sanitizeFileName($object->ref);
|
||||||
$filedir = $conf->adherent->dir_output . '/' . get_exdir(0, 0, 0, 0, $object, 'member');
|
$filedir = $conf->adherent->dir_output . '/' . get_exdir(0, 0, 0, 0, $object, 'member');
|
||||||
$urlsource = $_SERVER['PHP_SELF'] . '?id=' . $object->id;
|
$urlsource = $_SERVER['PHP_SELF'] . '?id=' . $object->id;
|
||||||
$genallowed = $user->rights->adherent->creer;
|
$genallowed = $user->rights->adherent->lire;
|
||||||
$delallowed = $user->rights->adherent->supprimer;
|
$delallowed = $user->rights->adherent->creer;
|
||||||
|
|
||||||
print $formfile->showdocuments('member', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $object->default_lang, '', $object);
|
print $formfile->showdocuments('member', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $object->default_lang, '', $object);
|
||||||
$somethingshown = $formfile->numoffiles;
|
$somethingshown = $formfile->numoffiles;
|
||||||
|
|||||||
@ -269,7 +269,8 @@ foreach(array_keys($_Avery_Labels) as $codecards)
|
|||||||
{
|
{
|
||||||
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
|
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
|
||||||
}
|
}
|
||||||
print $form->selectarray('model',$arrayoflabels,(GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE),1,0,0);
|
asort($arrayoflabels);
|
||||||
|
print $form->selectarray('model', $arrayoflabels, (GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||||
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
|
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -285,7 +286,8 @@ foreach(array_keys($_Avery_Labels) as $codecards)
|
|||||||
{
|
{
|
||||||
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
|
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
|
||||||
}
|
}
|
||||||
print $form->selectarray('model',$arrayoflabels,(GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE),1,0,0);
|
asort($arrayoflabels);
|
||||||
|
print $form->selectarray('model',$arrayoflabels,(GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||||
print '<br>'.$langs->trans("Login").': <input size="10" type="text" name="foruserlogin" value="'.GETPOST('foruserlogin').'">';
|
print '<br>'.$langs->trans("Login").': <input size="10" type="text" name="foruserlogin" value="'.GETPOST('foruserlogin').'">';
|
||||||
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
|
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
@ -302,7 +304,8 @@ foreach(array_keys($_Avery_Labels) as $codecards)
|
|||||||
{
|
{
|
||||||
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
|
$arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
|
||||||
}
|
}
|
||||||
print $form->selectarray('modellabel',$arrayoflabels,(GETPOST('modellabel')?GETPOST('modellabel'):$conf->global->ADHERENT_ETIQUETTE_TYPE),1,0,0);
|
asort($arrayoflabels);
|
||||||
|
print $form->selectarray('modellabel',$arrayoflabels,(GETPOST('modellabel')?GETPOST('modellabel'):$conf->global->ADHERENT_ETIQUETTE_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||||
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
|
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
@ -43,7 +43,7 @@ class Adherent extends CommonObject
|
|||||||
{
|
{
|
||||||
public $element='member';
|
public $element='member';
|
||||||
public $table_element='adherent';
|
public $table_element='adherent';
|
||||||
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||||
|
|
||||||
var $mesgs;
|
var $mesgs;
|
||||||
|
|
||||||
@ -1303,11 +1303,6 @@ class Adherent extends CommonObject
|
|||||||
$this->last_subscription_amount=$montant;
|
$this->last_subscription_amount=$montant;
|
||||||
$this->last_subscription_date_start=$date;
|
$this->last_subscription_date_start=$date;
|
||||||
$this->last_subscription_date_end=$datefin;
|
$this->last_subscription_date_end=$datefin;
|
||||||
|
|
||||||
// Call trigger
|
|
||||||
$result=$this->call_trigger('MEMBER_SUBSCRIPTION',$user);
|
|
||||||
if ($result < 0) { $error++; }
|
|
||||||
// End call triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -1969,7 +1964,7 @@ class Adherent extends CommonObject
|
|||||||
$this->fullname=$this->getFullName($langs);
|
$this->fullname=$this->getFullName($langs);
|
||||||
|
|
||||||
// For avoid ldap error when firstname and lastname are empty
|
// For avoid ldap error when firstname and lastname are empty
|
||||||
if ($this->morphy == 'mor' && empty($this->fullname)) {
|
if ($this->morphy == 'mor' && (empty($this->fullname) || $this->fullname == $this->societe)) {
|
||||||
$this->fullname = $this->societe;
|
$this->fullname = $this->societe;
|
||||||
$this->lastname = $this->societe;
|
$this->lastname = $this->societe;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -388,23 +388,24 @@ class AdherentType extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||||
* @param int $maxlen length max label
|
* @param int $maxlen length max label
|
||||||
|
* @param int $notooltip 1=Disable tooltip
|
||||||
* @return string String with URL
|
* @return string String with URL
|
||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0,$maxlen=0)
|
function getNomUrl($withpicto=0, $maxlen=0, $notooltip=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
$label=$langs->trans("ShowTypeCard",$this->label);
|
$label=$langs->trans("ShowTypeCard",$this->label);
|
||||||
|
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$linkstart = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
$picto='group';
|
$result .= $linkstart;
|
||||||
|
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||||
|
if ($withpicto != 2) $result.= ($maxlen?dol_trunc($this->label,$maxlen):$this->label);
|
||||||
|
$result .= $linkend;
|
||||||
|
|
||||||
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
|
||||||
$result.=$link.($maxlen?dol_trunc($this->label,$maxlen):$this->label).$linkend;
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -79,9 +79,10 @@ class AdherentStats extends Stats
|
|||||||
* Return the number of proposition by month for a given year
|
* Return the number of proposition by month for a given year
|
||||||
*
|
*
|
||||||
* @param int $year Year
|
* @param int $year Year
|
||||||
|
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
|
||||||
* @return array Array of nb each month
|
* @return array Array of nb each month
|
||||||
*/
|
*/
|
||||||
function getNbByMonth($year)
|
function getNbByMonth($year, $format=0)
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
@ -93,7 +94,7 @@ class AdherentStats extends Stats
|
|||||||
$sql.= " GROUP BY dm";
|
$sql.= " GROUP BY dm";
|
||||||
$sql.= $this->db->order('dm','DESC');
|
$sql.= $this->db->order('dm','DESC');
|
||||||
|
|
||||||
return $this->_getNbByMonth($year, $sql);
|
return $this->_getNbByMonth($year, $sql, $format);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -116,12 +117,13 @@ class AdherentStats extends Stats
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the number of subscriptions by month for a given year
|
* Return the number of subscriptions by month for a given year
|
||||||
*
|
*
|
||||||
* @param int $year Year
|
* @param int $year Year
|
||||||
|
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
|
||||||
* @return array Array of amount each month
|
* @return array Array of amount each month
|
||||||
*/
|
*/
|
||||||
function getAmountByMonth($year)
|
function getAmountByMonth($year, $format=0)
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
@ -133,7 +135,7 @@ class AdherentStats extends Stats
|
|||||||
$sql.= " GROUP BY dm";
|
$sql.= " GROUP BY dm";
|
||||||
$sql.= $this->db->order('dm','DESC');
|
$sql.= $this->db->order('dm','DESC');
|
||||||
|
|
||||||
return $this->_getAmountByMonth($year, $sql);
|
return $this->_getAmountByMonth($year, $sql, $format);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -91,7 +91,7 @@ class Members extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $typeid = '', $sqlfilters = '') {
|
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $typeid = '', $sqlfilters = '') {
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
$obj_ret = array();
|
$obj_ret = array();
|
||||||
@ -225,10 +225,14 @@ class Members extends DolibarrApi
|
|||||||
|
|
||||||
// If there is no error, update() returns the number of affected rows
|
// If there is no error, update() returns the number of affected rows
|
||||||
// so if the update is a no op, the return value is zero.
|
// so if the update is a no op, the return value is zero.
|
||||||
if($member->update(DolibarrApiAccess::$user) >= 0)
|
if ($member->update(DolibarrApiAccess::$user) >= 0)
|
||||||
|
{
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
|
}
|
||||||
return false;
|
else
|
||||||
|
{
|
||||||
|
throw new RestException(500, $member->error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -295,6 +299,17 @@ class Members extends DolibarrApi
|
|||||||
|
|
||||||
// Remove the subscriptions because they are handled as a subresource.
|
// Remove the subscriptions because they are handled as a subresource.
|
||||||
unset($object->subscriptions);
|
unset($object->subscriptions);
|
||||||
|
unset($object->fk_incoterms);
|
||||||
|
unset($object->libelle_incoterms);
|
||||||
|
unset($object->location_incoterms);
|
||||||
|
unset($object->fk_delivery_address);
|
||||||
|
unset($object->shipping_method_id);
|
||||||
|
|
||||||
|
unset($object->total_ht);
|
||||||
|
unset($object->total_ttc);
|
||||||
|
unset($object->total_tva);
|
||||||
|
unset($object->total_localtax1);
|
||||||
|
unset($object->total_localtax2);
|
||||||
|
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -86,7 +86,7 @@ class MembersTypes extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $sqlfilters = '') {
|
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') {
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
$obj_ret = array();
|
$obj_ret = array();
|
||||||
@ -204,9 +204,13 @@ class MembersTypes extends DolibarrApi
|
|||||||
// If there is no error, update() returns the number of affected rows
|
// If there is no error, update() returns the number of affected rows
|
||||||
// so if the update is a no op, the return value is zero.
|
// so if the update is a no op, the return value is zero.
|
||||||
if ($membertype->update(DolibarrApiAccess::$user) >= 0)
|
if ($membertype->update(DolibarrApiAccess::$user) >= 0)
|
||||||
|
{
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
|
}
|
||||||
return false;
|
else
|
||||||
|
{
|
||||||
|
throw new RestException(500, $membertype->error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -85,7 +85,7 @@ class Subscriptions extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 0, $page = 0, $sqlfilters = '') {
|
function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') {
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
$obj_ret = array();
|
$obj_ret = array();
|
||||||
@ -98,7 +98,7 @@ class Subscriptions extends DolibarrApi
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."subscription as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."subscription as t";
|
||||||
$sql.= ' WHERE 1 = 1';
|
$sql.= ' WHERE 1 = 1';
|
||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters)
|
if ($sqlfilters)
|
||||||
{
|
{
|
||||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||||
{
|
{
|
||||||
@ -107,7 +107,7 @@ class Subscriptions extends DolibarrApi
|
|||||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql.= $db->order($sortfield, $sortorder);
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
if ($limit) {
|
if ($limit) {
|
||||||
if ($page < 0)
|
if ($page < 0)
|
||||||
@ -193,9 +193,13 @@ class Subscriptions extends DolibarrApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($subscription->update(DolibarrApiAccess::$user) > 0)
|
if ($subscription->update(DolibarrApiAccess::$user) > 0)
|
||||||
|
{
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
|
}
|
||||||
return false;
|
else
|
||||||
|
{
|
||||||
|
throw new RestException(500, $subscription->error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -22,6 +22,8 @@
|
|||||||
* \brief File of class to manage subscriptions of foundation members
|
* \brief File of class to manage subscriptions of foundation members
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//namespace DolibarrMember;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||||
|
|
||||||
|
|
||||||
@ -57,13 +59,16 @@ class Subscription extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Function who permitted cretaion of the subscription
|
* Function who permitted cretaion of the subscription
|
||||||
*
|
*
|
||||||
* @param int $userid userid de celui qui insere
|
* @param User $user User that create
|
||||||
* @return int <0 if KO, Id subscription created if OK
|
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||||
|
* @return int <0 if KO, Id subscription created if OK
|
||||||
*/
|
*/
|
||||||
function create($userid)
|
function create($user, $notrigger = false)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
@ -73,6 +78,8 @@ class Subscription extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, datec, dateadh, datef, subscription, note)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, datec, dateadh, datef, subscription, note)";
|
||||||
$sql.= " VALUES (".$this->fk_adherent.", '".$this->db->idate($now)."',";
|
$sql.= " VALUES (".$this->fk_adherent.", '".$this->db->idate($now)."',";
|
||||||
$sql.= " '".$this->db->idate($this->dateh)."',";
|
$sql.= " '".$this->db->idate($this->dateh)."',";
|
||||||
@ -80,17 +87,32 @@ class Subscription extends CommonObject
|
|||||||
$sql.= " ".$this->amount.",";
|
$sql.= " ".$this->amount.",";
|
||||||
$sql.= " '".$this->db->escape($this->note)."')";
|
$sql.= " '".$this->db->escape($this->note)."')";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($res===false) {
|
||||||
{
|
$error++;
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."subscription");
|
$this->errors[] = $this->db->lasterror();
|
||||||
return $this->id;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (! $error)
|
||||||
{
|
{
|
||||||
$this->error=$this->db->lasterror();
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error && ! $notrigger)
|
||||||
|
{
|
||||||
|
// Call triggers
|
||||||
|
$result=$this->call_trigger('MEMBER_SUBSCRIPTION_CREATE',$user);
|
||||||
|
if ($result < 0) { $error++; }
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error) {
|
||||||
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
|
} else {
|
||||||
|
$this->db->commit();
|
||||||
|
return $this->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,8 +174,10 @@ class Subscription extends CommonObject
|
|||||||
* @param int $notrigger 0=Disable triggers
|
* @param int $notrigger 0=Disable triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function update($user,$notrigger=0)
|
function update($user, $notrigger=0)
|
||||||
{
|
{
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET ";
|
||||||
@ -170,18 +194,31 @@ class Subscription extends CommonObject
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
$member=new Adherent($this->db);
|
$member=new Adherent($this->db);
|
||||||
$result=$member->fetch($this->fk_adherent);
|
$result=$member->fetch($this->fk_adherent);
|
||||||
$result=$member->update_end_date($user);
|
$result=$member->update_end_date($user);
|
||||||
|
|
||||||
$this->db->commit();
|
if (! $error && ! $notrigger) {
|
||||||
return 1;
|
// Call triggers
|
||||||
|
$result=$this->call_trigger('MEMBER_SUBSCRIPTION_MODIFY',$user);
|
||||||
|
if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$error++;
|
||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->lasterror();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error) {
|
||||||
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
|
} else {
|
||||||
|
$this->db->commit();
|
||||||
|
return $this->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,10 +226,13 @@ class Subscription extends CommonObject
|
|||||||
* Delete a subscription
|
* Delete a subscription
|
||||||
*
|
*
|
||||||
* @param User $user User that delete
|
* @param User $user User that delete
|
||||||
|
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||||
*/
|
*/
|
||||||
function delete($user)
|
function delete($user, $notrigger=false)
|
||||||
{
|
{
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
// It subscription is linked to a bank transaction, we get it
|
// It subscription is linked to a bank transaction, we get it
|
||||||
if ($this->fk_bank > 0)
|
if ($this->fk_bank > 0)
|
||||||
{
|
{
|
||||||
@ -203,51 +243,71 @@ class Subscription extends CommonObject
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".$this->id;
|
if (! $error) {
|
||||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
if (! $notrigger) {
|
||||||
$resql=$this->db->query($sql);
|
// Call triggers
|
||||||
if ($resql)
|
$result=$this->call_trigger('MEMBER_SUBSCRIPTION_DELETE', $user);
|
||||||
{
|
if ($result < 0) { $error++; } // Do also here what you must do to rollback action if trigger fail
|
||||||
$num=$this->db->affected_rows($resql);
|
// End call triggers
|
||||||
if ($num)
|
}
|
||||||
{
|
}
|
||||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
|
||||||
$member=new Adherent($this->db);
|
|
||||||
$result=$member->fetch($this->fk_adherent);
|
|
||||||
$result=$member->update_end_date($user);
|
|
||||||
|
|
||||||
if ($this->fk_bank > 0 && is_object($accountline) && $accountline->id > 0) // If we found bank account line (this means this->fk_bank defined)
|
if (! $error)
|
||||||
|
{
|
||||||
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".$this->id;
|
||||||
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num=$this->db->affected_rows($resql);
|
||||||
|
if ($num)
|
||||||
{
|
{
|
||||||
$result=$accountline->delete($user); // Return false if refused because line is conciliated
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
if ($result > 0)
|
$member=new Adherent($this->db);
|
||||||
|
$result=$member->fetch($this->fk_adherent);
|
||||||
|
$result=$member->update_end_date($user);
|
||||||
|
|
||||||
|
if ($this->fk_bank > 0 && is_object($accountline) && $accountline->id > 0) // If we found bank account line (this means this->fk_bank defined)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$result=$accountline->delete($user); // Return false if refused because line is conciliated
|
||||||
return 1;
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$accountline->error;
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$accountline->error;
|
$this->db->commit();
|
||||||
$this->db->rollback();
|
return 1;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$error++;
|
||||||
return 0;
|
$this->error=$this->db->lasterror();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
// Commit or rollback
|
||||||
$this->error=$this->db->lasterror();
|
if ($error) {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
|
} else {
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,23 +316,26 @@ class Subscription extends CommonObject
|
|||||||
* Return clicable name (with picto eventually)
|
* Return clicable name (with picto eventually)
|
||||||
*
|
*
|
||||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||||
|
* @param int $notooltip 1=Disable tooltip
|
||||||
* @return string Chaine avec URL
|
* @return string Chaine avec URL
|
||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0)
|
function getNomUrl($withpicto=0, $notooltip=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
$label=$langs->trans("ShowSubscription").': '.$this->ref;
|
$label=$langs->trans("ShowSubscription").': '.$this->ref;
|
||||||
|
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$linkstart = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$linkend='</a>';
|
$linkend='</a>';
|
||||||
|
|
||||||
$picto='payment';
|
$picto='payment';
|
||||||
|
|
||||||
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
$result .= $linkstart;
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||||
$result.=$link.$this->ref.$linkend;
|
if ($withpicto != 2) $result.= $this->ref;
|
||||||
|
$result .= $linkend;
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -42,17 +42,13 @@ $action=GETPOST('action','alpha');
|
|||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
|
||||||
{
|
|
||||||
$id = $user->societe_id;
|
|
||||||
}
|
|
||||||
$result=restrictedArea($user,'adherent',$id);
|
$result=restrictedArea($user,'adherent',$id);
|
||||||
|
|
||||||
// Get parameters
|
// Get parameters
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
$offset = $conf->liste_limit * $page ;
|
$offset = $conf->liste_limit * $page ;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2002 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-2012 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>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -162,14 +162,16 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
|
|||||||
|
|
||||||
if ($conf->use_javascript_ajax)
|
if ($conf->use_javascript_ajax)
|
||||||
{
|
{
|
||||||
print '<table class="noborder nohover" width="100%">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
|
print '<table class="noborder nohover" width="100%">';
|
||||||
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
|
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
|
||||||
print '<tr '.$bc[0].'><td align="center" colspan="2">';
|
print '<tr><td align="center" colspan="2">';
|
||||||
|
|
||||||
$SommeA=0;
|
$SommeA=0;
|
||||||
$SommeB=0;
|
$SommeB=0;
|
||||||
$SommeC=0;
|
$SommeC=0;
|
||||||
$SommeD=0;
|
$SommeD=0;
|
||||||
|
$total=0;
|
||||||
$dataval=array();
|
$dataval=array();
|
||||||
$datalabels=array();
|
$datalabels=array();
|
||||||
$i=0;
|
$i=0;
|
||||||
@ -186,19 +188,29 @@ if ($conf->use_javascript_ajax)
|
|||||||
$SommeD+=isset($MembersResiliated[$key])?$MembersResiliated[$key]:0;
|
$SommeD+=isset($MembersResiliated[$key])?$MembersResiliated[$key]:0;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
$total = $SommeA + $SommeB + $SommeC + $SommeD;
|
||||||
$dataseries=array();
|
$dataseries=array();
|
||||||
$dataseries[]=array('label'=>$langs->trans("MenuMembersNotUpToDate"),'data'=>round($SommeB));
|
$dataseries[]=array($langs->trans("MenuMembersNotUpToDate"), round($SommeB));
|
||||||
$dataseries[]=array('label'=>$langs->trans("MenuMembersUpToDate"),'data'=>round($SommeC));
|
$dataseries[]=array($langs->trans("MenuMembersUpToDate"), round($SommeC));
|
||||||
$dataseries[]=array('label'=>$langs->trans("MembersStatusResiliated"),'data'=>round($SommeD));
|
$dataseries[]=array($langs->trans("MembersStatusResiliated"), round($SommeD));
|
||||||
$dataseries[]=array('label'=>$langs->trans("MembersStatusToValid"),'data'=>round($SommeA));
|
$dataseries[]=array($langs->trans("MembersStatusToValid"), round($SommeA));
|
||||||
$data=array('series'=>$dataseries);
|
|
||||||
dol_print_graph('stats',300,180,$data,1,'pie',1);
|
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||||
|
$dolgraph = new DolGraph();
|
||||||
|
$dolgraph->SetData($dataseries);
|
||||||
|
$dolgraph->setShowLegend(1);
|
||||||
|
$dolgraph->setShowPercent(1);
|
||||||
|
$dolgraph->SetType(array('pie'));
|
||||||
|
$dolgraph->setWidth('100%');
|
||||||
|
$dolgraph->draw('idgraphstatus');
|
||||||
|
print $dolgraph->show($total?0:1);
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">';
|
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">';
|
||||||
print $SommeA+$SommeB+$SommeC+$SommeD;
|
print $SommeA+$SommeB+$SommeC+$SommeD;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -234,6 +246,7 @@ if ($result)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<th>'.$langs->trans("Subscriptions").'</th>';
|
print '<th>'.$langs->trans("Subscriptions").'</th>';
|
||||||
@ -261,7 +274,8 @@ print "<td align=\"right\">".$numb."</td>";
|
|||||||
print '<td align="right">'.price($tot)."</td>";
|
print '<td align="right">'.price($tot)."</td>";
|
||||||
print "<td align=\"right\">".price(price2num($numb>0?($tot/$numb):0,'MT'))."</td>";
|
print "<td align=\"right\">".price(price2num($numb>0?($tot/$numb):0,'MT'))."</td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
print "</table><br>\n";
|
print "</table></div>";
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
|
||||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||||
@ -283,6 +297,7 @@ $sql.= $db->plimit($max, 0);
|
|||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<th colspan="4">'.$langs->trans("LastMembersModified",$max).'</th></tr>';
|
print '<th colspan="4">'.$langs->trans("LastMembersModified",$max).'</th></tr>';
|
||||||
@ -319,7 +334,8 @@ if ($resql)
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print "</table><br>";
|
print "</table></div>";
|
||||||
|
print "<br>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -344,6 +360,7 @@ $sql.= $db->plimit($max, 0);
|
|||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<th colspan="5">'.$langs->trans("LastSubscriptionsModified",$max).'</th></tr>';
|
print '<th colspan="5">'.$langs->trans("LastSubscriptionsModified",$max).'</th></tr>';
|
||||||
@ -379,7 +396,8 @@ if ($resql)
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print "</table><br>";
|
print "</table></div>";
|
||||||
|
print "<br>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -388,6 +406,7 @@ else
|
|||||||
|
|
||||||
|
|
||||||
// Summary of members by type
|
// Summary of members by type
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<th>'.$langs->trans("MembersTypes").'</th>';
|
print '<th>'.$langs->trans("MembersTypes").'</th>';
|
||||||
@ -416,7 +435,7 @@ print '<td class="liste_total" align="right">'.$SommeD.' '.$staticmember->LibSta
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print "</div>";
|
||||||
|
|
||||||
print '</div></div></div>';
|
print '</div></div></div>';
|
||||||
|
|
||||||
|
|||||||
@ -61,9 +61,10 @@ $search_type=GETPOST("search_type");
|
|||||||
$search_email=GETPOST("search_email");
|
$search_email=GETPOST("search_email");
|
||||||
$search_categ = GETPOST("search_categ",'int');
|
$search_categ = GETPOST("search_categ",'int');
|
||||||
$catid = GETPOST("catid",'int');
|
$catid = GETPOST("catid",'int');
|
||||||
$sall=GETPOST('sall', 'alphanohtml');
|
|
||||||
$optioncss = GETPOST('optioncss','alpha');
|
$optioncss = GETPOST('optioncss','alpha');
|
||||||
|
|
||||||
|
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
|
||||||
|
|
||||||
if ($statut < -1) $statut = '';
|
if ($statut < -1) $statut = '';
|
||||||
|
|
||||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
@ -100,6 +101,7 @@ $fieldstosearchall = array(
|
|||||||
'd.note_public'=>'NotePublic',
|
'd.note_public'=>'NotePublic',
|
||||||
'd.note_private'=>'NotePrivate',
|
'd.note_private'=>'NotePrivate',
|
||||||
);
|
);
|
||||||
|
if($db->type == 'pgsql') unset($fieldstosearchall['d.rowid']);
|
||||||
$arrayfields=array(
|
$arrayfields=array(
|
||||||
'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||||
'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
||||||
@ -129,7 +131,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
{
|
{
|
||||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,19 +245,8 @@ if ($filter == 'uptodate') $sql.=" AND datefin >= '".$db->idate($now)."'";
|
|||||||
if ($filter == 'outofdate') $sql.=" AND (datefin IS NULL OR datefin < '".$db->idate($now)."')";
|
if ($filter == 'outofdate') $sql.=" AND (datefin IS NULL OR datefin < '".$db->idate($now)."')";
|
||||||
|
|
||||||
// Add where from extra fields
|
// Add where from extra fields
|
||||||
foreach ($search_array_options as $key => $val)
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||||
{
|
|
||||||
$crit=$val;
|
|
||||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
|
||||||
$typ=$extrafields->attribute_type[$tmpkey];
|
|
||||||
$mode=0;
|
|
||||||
if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric
|
|
||||||
if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int
|
|
||||||
if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0'))
|
|
||||||
{
|
|
||||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Add where from hooks
|
// Add where from hooks
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
@ -342,21 +333,15 @@ if ($filter) $param.="&filter=".urlencode($filter);
|
|||||||
if ($search_type > 0) $param.="&search_type=".urlencode($search_type);
|
if ($search_type > 0) $param.="&search_type=".urlencode($search_type);
|
||||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||||
// Add $param from extra fields
|
// Add $param from extra fields
|
||||||
foreach ($search_array_options as $key => $val)
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||||
{
|
|
||||||
$crit=$val;
|
|
||||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
|
||||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
|
||||||
}
|
|
||||||
|
|
||||||
// List of mass actions available
|
// List of mass actions available
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
// 'presend'=>$langs->trans("SendByMail"),
|
// 'presend'=>$langs->trans("SendByMail"),
|
||||||
// 'builddoc'=>$langs->trans("PDFMerge"),
|
// 'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
//if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||||
if ($user->rights->adherent->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||||
//if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array();
|
|
||||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|
||||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
@ -371,6 +356,12 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
|||||||
|
|
||||||
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
|
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
|
||||||
|
|
||||||
|
$topicmail="Information";
|
||||||
|
$modelmail="member";
|
||||||
|
$objecttmp=new Adherent($db);
|
||||||
|
$trackid='mem'.$object->id;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||||
|
|
||||||
if ($sall)
|
if ($sall)
|
||||||
{
|
{
|
||||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||||
@ -410,7 +401,7 @@ print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"")
|
|||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
|
|
||||||
// Line numbering
|
// Line numbering
|
||||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
}
|
}
|
||||||
@ -522,28 +513,8 @@ if (! empty($arrayfields['d.datefin']['checked']))
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||||
{
|
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
|
||||||
{
|
|
||||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
|
||||||
{
|
|
||||||
$align=$extrafields->getAlignFlag($key);
|
|
||||||
$typeofextrafield=$extrafields->attribute_type[$key];
|
|
||||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
|
||||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
|
|
||||||
{
|
|
||||||
$crit=$val;
|
|
||||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
|
||||||
$searchclass='';
|
|
||||||
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
|
||||||
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
|
||||||
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Fields from hook
|
// Fields from hook
|
||||||
$parameters=array('arrayfields'=>$arrayfields);
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
@ -581,10 +552,7 @@ print '</td>';
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) print_liste_field_titre("ID",$_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder);
|
||||||
{
|
|
||||||
print '<td colspan="1" align="center">'.$langs->trans("NumberingShort").'</td>';
|
|
||||||
}
|
|
||||||
if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'],$_SERVER["PHP_SELF"],'d.rowid','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'],$_SERVER["PHP_SELF"],'d.rowid','',$param,'',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'],$_SERVER["PHP_SELF"],'d.firstname','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'],$_SERVER["PHP_SELF"],'d.firstname','',$param,'',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'],$_SERVER["PHP_SELF"],'d.lastname','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'],$_SERVER["PHP_SELF"],'d.lastname','',$param,'',$sortfield,$sortorder);
|
||||||
@ -603,19 +571,8 @@ if (! empty($arrayfields['d.phone_mobile']['checked'])) print_liste_field_titr
|
|||||||
if (! empty($arrayfields['d.email']['checked'])) print_liste_field_titre($arrayfields['d.email']['label'],$_SERVER["PHP_SELF"],'d.email','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['d.email']['checked'])) print_liste_field_titre($arrayfields['d.email']['label'],$_SERVER["PHP_SELF"],'d.email','',$param,'',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['d.datefin']['checked'])) print_liste_field_titre($arrayfields['d.datefin']['label'],$_SERVER["PHP_SELF"],'d.datefin','',$param,'align="center"',$sortfield,$sortorder);
|
if (! empty($arrayfields['d.datefin']['checked'])) print_liste_field_titre($arrayfields['d.datefin']['label'],$_SERVER["PHP_SELF"],'d.datefin','',$param,'align="center"',$sortfield,$sortorder);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||||
{
|
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
|
||||||
{
|
|
||||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
|
||||||
{
|
|
||||||
$align=$extrafields->getAlignFlag($key);
|
|
||||||
$sortonfield = "ef.".$key;
|
|
||||||
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
|
|
||||||
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Hook fields
|
// Hook fields
|
||||||
$parameters=array('arrayfields'=>$arrayfields);
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
@ -651,9 +608,9 @@ while ($i < min($num, $limit))
|
|||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID))
|
||||||
{
|
{
|
||||||
print '<td align="center">'.($i+1).'</td>';
|
print '<td align="center">'.$obj->rowid.'</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
@ -800,23 +757,7 @@ while ($i < min($num, $limit))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||||
{
|
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
|
||||||
{
|
|
||||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
|
||||||
{
|
|
||||||
print '<td';
|
|
||||||
$align=$extrafields->getAlignFlag($key);
|
|
||||||
if ($align) print ' align="'.$align.'"';
|
|
||||||
print '>';
|
|
||||||
$tmpkey='options_'.$key;
|
|
||||||
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
|
||||||
print '</td>';
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Fields from hook
|
// Fields from hook
|
||||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2012-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2012-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
*
|
*
|
||||||
@ -36,18 +36,28 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||||
|
|
||||||
$langs->load("companies");
|
$langs->loadLangs(array("companies","bills","members","users","mails",'other'));
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("members");
|
|
||||||
$langs->load("users");
|
|
||||||
$langs->load("mails");
|
|
||||||
$langs->load('other');
|
|
||||||
|
|
||||||
$action=GETPOST('action','alpha');
|
$action=GETPOST('action','alpha');
|
||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
$rowid=GETPOST('rowid','int');
|
$rowid=GETPOST('rowid','int')?GETPOST('rowid','int'):GETPOST('id','int');
|
||||||
$typeid=GETPOST('typeid','int');
|
$typeid=GETPOST('typeid','int');
|
||||||
|
|
||||||
|
// Load variable for pagination
|
||||||
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
|
$sortfield = GETPOST('sortfield','alpha');
|
||||||
|
$sortorder = GETPOST('sortorder','alpha');
|
||||||
|
$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;
|
||||||
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
|
// Default sort order (if not yet defined by previous GETPOST)
|
||||||
|
if (! $sortfield) $sortfield="c.rowid";
|
||||||
|
if (! $sortorder) $sortorder="DESC";
|
||||||
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$result=restrictedArea($user,'adherent',$rowid,'','cotisation');
|
$result=restrictedArea($user,'adherent',$rowid,'','cotisation');
|
||||||
|
|
||||||
@ -98,6 +108,7 @@ $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') :
|
|||||||
$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
|
$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
|
||||||
$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
|
$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
@ -582,6 +593,16 @@ $title=$langs->trans("Member") . " - " . $langs->trans("Subscriptions");
|
|||||||
$helpurl="EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros";
|
$helpurl="EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros";
|
||||||
llxHeader("",$title,$helpurl);
|
llxHeader("",$title,$helpurl);
|
||||||
|
|
||||||
|
|
||||||
|
$param='';
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||||
|
$param.= '&id='.$rowid;
|
||||||
|
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||||
|
// Add $param from extra fields
|
||||||
|
//include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||||
|
|
||||||
|
|
||||||
if ($rowid > 0)
|
if ($rowid > 0)
|
||||||
{
|
{
|
||||||
$res=$object->fetch($rowid);
|
$res=$object->fetch($rowid);
|
||||||
@ -776,7 +797,7 @@ if ($rowid > 0)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hotbar
|
* Action buttons
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Button to create a new subscription if member no draft neither resiliated
|
// Button to create a new subscription if member no draft neither resiliated
|
||||||
@ -810,6 +831,7 @@ if ($rowid > 0)
|
|||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||||
$sql.= " WHERE d.rowid = c.fk_adherent AND d.rowid=".$rowid;
|
$sql.= " WHERE d.rowid = c.fk_adherent AND d.rowid=".$rowid;
|
||||||
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -822,7 +844,7 @@ if ($rowid > 0)
|
|||||||
print '<table class="noborder" width="100%">'."\n";
|
print '<table class="noborder" width="100%">'."\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Ref").'</td>';
|
print_liste_field_titre('Ref',$_SERVER["PHP_SELF"],'c.rowid','',$param,'',$sortfield,$sortorder);
|
||||||
print '<td align="center">'.$langs->trans("DateCreation").'</td>';
|
print '<td align="center">'.$langs->trans("DateCreation").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("DateStart").'</td>';
|
print '<td align="center">'.$langs->trans("DateStart").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("DateEnd").'</td>';
|
print '<td align="center">'.$langs->trans("DateEnd").'</td>';
|
||||||
@ -834,13 +856,15 @@ if ($rowid > 0)
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$accountstatic=new Account($db);
|
$accountstatic=new Account($db);
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
print '<tr class="oddeven">';
|
|
||||||
$subscriptionstatic->ref=$objp->crowid;
|
$subscriptionstatic->ref=$objp->crowid;
|
||||||
$subscriptionstatic->id=$objp->crowid;
|
$subscriptionstatic->id=$objp->crowid;
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>';
|
print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>';
|
||||||
print '<td align="center">'.dol_print_date($db->jdate($objp->datec),'dayhour')."</td>\n";
|
print '<td align="center">'.dol_print_date($db->jdate($objp->datec),'dayhour')."</td>\n";
|
||||||
print '<td align="center">'.dol_print_date($db->jdate($objp->dateh),'day')."</td>\n";
|
print '<td align="center">'.dol_print_date($db->jdate($objp->dateh),'day')."</td>\n";
|
||||||
@ -885,18 +909,21 @@ if ($rowid > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Shon online payment link
|
if (($action != 'addsubscription' && $action != 'create_thirdparty'))
|
||||||
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
|
|
||||||
|
|
||||||
if ($useonlinepayment)
|
|
||||||
{
|
{
|
||||||
print '<br>';
|
// Shon online payment link
|
||||||
|
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
if ($useonlinepayment)
|
||||||
print showOnlinePaymentUrl('membersubscription', $object->ref);
|
{
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||||
|
print showOnlinePaymentUrl('membersubscription', $object->ref);
|
||||||
|
print '<br>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add new subscription form
|
* Add new subscription form
|
||||||
*/
|
*/
|
||||||
@ -1011,8 +1038,9 @@ if ($rowid > 0)
|
|||||||
$paymentdate=dol_mktime(0, 0, 0, GETPOST('paymentmonth'), GETPOST('paymentday'), GETPOST('paymentyear'));
|
$paymentdate=dol_mktime(0, 0, 0, GETPOST('paymentmonth'), GETPOST('paymentday'), GETPOST('paymentyear'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<tr>';
|
||||||
// Date start subscription
|
// Date start subscription
|
||||||
print '<tr><td width="30%" class="fieldrequired">'.$langs->trans("DateSubscription").'</td><td>';
|
print '<td class="fieldrequired">'.$langs->trans("DateSubscription").'</td><td>';
|
||||||
if (GETPOST('reday'))
|
if (GETPOST('reday'))
|
||||||
{
|
{
|
||||||
$datefrom=dol_mktime(0,0,0,GETPOST('remonth'),GETPOST('reday'),GETPOST('reyear'));
|
$datefrom=dol_mktime(0,0,0,GETPOST('remonth'),GETPOST('reday'),GETPOST('reyear'));
|
||||||
|
|||||||
@ -390,8 +390,8 @@ if ($rowid && $action != 'edit')
|
|||||||
$filename = dol_sanitizeFileName($object->ref);
|
$filename = dol_sanitizeFileName($object->ref);
|
||||||
$filedir = $conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref);
|
$filedir = $conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref);
|
||||||
$urlsource = $_SERVER['PHP_SELF'] . '?facid=' . $object->id;
|
$urlsource = $_SERVER['PHP_SELF'] . '?facid=' . $object->id;
|
||||||
$genallowed = $user->rights->facture->creer;
|
$genallowed = $user->rights->facture->lire;
|
||||||
$delallowed = $user->rights->facture->supprimer;
|
$delallowed = $user->rights->facture->creer;
|
||||||
|
|
||||||
print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
|
print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
|
||||||
$somethingshown = $formfile->numoffiles;
|
$somethingshown = $formfile->numoffiles;
|
||||||
|
|||||||
@ -36,7 +36,7 @@ $langs->load("users");
|
|||||||
if (!$user->rights->adherent->lire)
|
if (!$user->rights->adherent->lire)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
|
$rowid=GETPOST("rowid",'int');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -44,10 +44,10 @@ $rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader();
|
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
|
llxHeader();
|
||||||
|
|
||||||
$object = new Subscription($db);
|
$object = new Subscription($db);
|
||||||
$result = $object->fetch($rowid);
|
$result = $object->fetch($rowid);
|
||||||
|
|
||||||
|
|||||||
@ -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 == null) { $page = 0 ; }
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
$offset = $limit * $page ;
|
$offset = $limit * $page ;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
@ -177,9 +177,8 @@ if ($result)
|
|||||||
//'presend'=>$langs->trans("SendByMail"),
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
//if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||||
if ($user->rights->adherent->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||||
//if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array();
|
|
||||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
@ -194,6 +193,12 @@ if ($result)
|
|||||||
|
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
|
||||||
|
|
||||||
|
$topicmail="Information";
|
||||||
|
$modelmail="subscription";
|
||||||
|
$objecttmp=new Subscription($db);
|
||||||
|
$trackid='sub'.$object->id;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||||
|
|
||||||
if ($sall)
|
if ($sall)
|
||||||
{
|
{
|
||||||
print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
|
print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
|
||||||
|
|||||||
@ -15,8 +15,15 @@
|
|||||||
*
|
*
|
||||||
* 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/>.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Protection to avoid direct call of template
|
||||||
|
if (empty($conf) || ! is_object($conf))
|
||||||
|
{
|
||||||
|
print "Error, template page can't be called as URL";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE -->
|
<!-- BEGIN PHP TEMPLATE -->
|
||||||
@ -33,7 +40,7 @@ $var=true;
|
|||||||
$total=0;
|
$total=0;
|
||||||
foreach($linkedObjectBlock as $key => $objectlink)
|
foreach($linkedObjectBlock as $key => $objectlink)
|
||||||
{
|
{
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<tr <?php echo $GLOBALS['bc'][$var]; ?> >
|
<tr <?php echo $GLOBALS['bc'][$var]; ?> >
|
||||||
<td><?php echo $langs->trans("Subscription"); ?></td>
|
<td><?php echo $langs->trans("Subscription"); ?></td>
|
||||||
|
|||||||
@ -204,10 +204,10 @@ if ($action == 'confirm_delete' && $user->rights->adherent->configurer)
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader('',$langs->trans("MembersTypeSetup"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
|
||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
|
||||||
|
llxHeader('',$langs->trans("MembersTypeSetup"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||||
|
|
||||||
|
|
||||||
// List of members type
|
// List of members type
|
||||||
if (! $rowid && $action != 'create' && $action != 'edit')
|
if (! $rowid && $action != 'create' && $action != 'edit')
|
||||||
@ -252,11 +252,21 @@ if (! $rowid && $action != 'create' && $action != 'edit')
|
|||||||
print '<th> </th>';
|
print '<th> </th>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$membertype = new AdherentType($db);
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
|
$membertype->id = $objp->rowid;
|
||||||
|
$membertype->ref = $objp->rowid;
|
||||||
|
$membertype->label = $objp->rowid;
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a></td>';
|
print '<td>';
|
||||||
|
print $membertype->getNomUrl(1);
|
||||||
|
//<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
|
||||||
|
print '</td>';
|
||||||
print '<td>'.dol_escape_htmltag($objp->label).'</td>';
|
print '<td>'.dol_escape_htmltag($objp->label).'</td>';
|
||||||
print '<td align="center">'.yn($objp->subscription).'</td>';
|
print '<td align="center">'.yn($objp->subscription).'</td>';
|
||||||
print '<td align="center">'.yn($objp->vote).'</td>';
|
print '<td align="center">'.yn($objp->vote).'</td>';
|
||||||
@ -440,11 +450,11 @@ if ($rowid > 0)
|
|||||||
}
|
}
|
||||||
if ($status != '')
|
if ($status != '')
|
||||||
{
|
{
|
||||||
$sql.= " AND d.statut IN (".$db->escape($status).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
|
$sql.= natural_search('d.statut', $status, 2);
|
||||||
}
|
}
|
||||||
if ($action == 'search')
|
if ($action == 'search')
|
||||||
{
|
{
|
||||||
if (GETPOST('search'))
|
if (GETPOST('search','alpha'))
|
||||||
{
|
{
|
||||||
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search','alpha'));
|
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search','alpha'));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,6 +38,7 @@ $langs->load("agenda");
|
|||||||
$action = GETPOST('action','alpha');
|
$action = GETPOST('action','alpha');
|
||||||
$cancel = GETPOST('cancel','alpha');
|
$cancel = GETPOST('cancel','alpha');
|
||||||
|
|
||||||
|
$search_event = GETPOST('search_event', 'alpha');
|
||||||
|
|
||||||
// Get list of triggers available
|
// Get list of triggers available
|
||||||
$sql = "SELECT a.rowid, a.code, a.label, a.elementtype";
|
$sql = "SELECT a.rowid, a.code, a.label, a.elementtype";
|
||||||
@ -70,6 +71,12 @@ else
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Purge search criteria
|
||||||
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
|
{
|
||||||
|
$search_event = '';
|
||||||
|
}
|
||||||
|
|
||||||
if ($action == "save" && empty($cancel))
|
if ($action == "save" && empty($cancel))
|
||||||
{
|
{
|
||||||
$i=0;
|
$i=0;
|
||||||
@ -78,10 +85,13 @@ if ($action == "save" && empty($cancel))
|
|||||||
|
|
||||||
foreach ($triggers as $trigger)
|
foreach ($triggers as $trigger)
|
||||||
{
|
{
|
||||||
$param='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
|
$keyparam='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
|
||||||
//print "param=".$param." - ".$_POST[$param];
|
//print "param=".$param." - ".$_POST[$param];
|
||||||
$res = dolibarr_set_const($db,$param,(GETPOST($param,'alpha')?GETPOST($param,'alpha'):''),'chaine',0,'',$conf->entity);
|
if ($search_event === '' || preg_match('/'.preg_quote($search_event,'/').'/i', $keyparam))
|
||||||
if (! $res > 0) $error++;
|
{
|
||||||
|
$res = dolibarr_set_const($db,$keyparam,(GETPOST($keyparam,'alpha')?GETPOST($keyparam,'alpha'):''),'chaine',0,'',$conf->entity);
|
||||||
|
if (! $res > 0) $error++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -140,19 +150,33 @@ 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="save">';
|
print '<input type="hidden" name="action" value="save">';
|
||||||
|
|
||||||
|
$param = '';
|
||||||
|
$param.= '&search_event='.urlencode($search_event);
|
||||||
|
|
||||||
$head=agenda_prepare_head();
|
$head=agenda_prepare_head();
|
||||||
|
|
||||||
dol_fiche_head($head, 'autoactions', $langs->trans("Agenda"), -1, 'action');
|
dol_fiche_head($head, 'autoactions', $langs->trans("Agenda"), -1, 'action');
|
||||||
|
|
||||||
print $langs->trans("AgendaAutoActionDesc")."<br>\n";
|
print $langs->trans("AgendaAutoActionDesc")."<br>\n";
|
||||||
print $langs->trans("OnlyActiveElementsAreShown").'<br>';
|
print $langs->trans("OnlyActiveElementsAreShown", 'modules.php').'<br>';
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="2">'.$langs->trans("ActionsEvents").'</td>';
|
print '<td class="liste_titre"><input type="text" name="search_event" value="'.dol_escape_htmltag($search_event).'"></td>';
|
||||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=selectall">'.$langs->trans("All").'</a>/<a href="'.$_SERVER["PHP_SELF"].'?action=selectnone">'.$langs->trans("None").'</a>';
|
print '<td class="liste_titre"></td>';
|
||||||
|
// Action column
|
||||||
|
print '<td class="liste_titre" align="right">';
|
||||||
|
$searchpicto=$form->showFilterButtons();
|
||||||
|
print $searchpicto;
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
print '</tr>'."\n";
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<th class="liste_titre" colspan="2">'.$langs->trans("ActionsEvents").'</th>';
|
||||||
|
print '<th class="liste_titre"><a href="'.$_SERVER["PHP_SELF"].'?action=selectall'.($param?$param:'').'">'.$langs->trans("All").'</a>/<a href="'.$_SERVER["PHP_SELF"].'?action=selectnone'.($param?$param:'').'">'.$langs->trans("None").'</a></th>';
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
// Show each trigger (list is in c_action_trigger)
|
// Show each trigger (list is in c_action_trigger)
|
||||||
if (! empty($triggers))
|
if (! empty($triggers))
|
||||||
@ -173,19 +197,22 @@ if (! empty($triggers))
|
|||||||
if ($trigger['code'] == 'FICHINTER_CLASSIFY_BILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue;
|
if ($trigger['code'] == 'FICHINTER_CLASSIFY_BILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue;
|
||||||
if ($trigger['code'] == 'FICHINTER_CLASSIFY_UNBILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue;
|
if ($trigger['code'] == 'FICHINTER_CLASSIFY_UNBILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue;
|
||||||
|
|
||||||
|
if ($search_event === '' || preg_match('/'.preg_quote($search_event,'/').'/i', $trigger['code']))
|
||||||
print '<tr class="oddeven">';
|
{
|
||||||
print '<td>'.$trigger['code'].'</td>';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$trigger['label'].'</td>';
|
print '<td>'.$trigger['code'].'</td>';
|
||||||
print '<td align="right" width="40">';
|
print '<td>'.$trigger['label'].'</td>';
|
||||||
$key='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
|
print '<td align="right" width="40">';
|
||||||
$value=$conf->global->$key;
|
$key='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
|
||||||
print '<input class="oddeven" type="checkbox" name="'.$key.'" value="1"'.((($action=='selectall'||$value) && $action!="selectnone")?' checked':'').'>';
|
$value=$conf->global->$key;
|
||||||
print '</td></tr>'."\n";
|
print '<input class="oddeven" type="checkbox" name="'.$key.'" value="1"'.((($action=='selectall'||$value) && $action!="selectnone")?' checked':'').'>';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,7 @@ $form = new Form($db);
|
|||||||
// List of supported format
|
// List of supported format
|
||||||
$tmptype2label=ExtraFields::$type2label;
|
$tmptype2label=ExtraFields::$type2label;
|
||||||
$type2label=array('');
|
$type2label=array('');
|
||||||
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
|
||||||
|
|
||||||
$action=GETPOST('action', 'alpha');
|
$action=GETPOST('action', 'alpha');
|
||||||
$attrname=GETPOST('attrname', 'alpha');
|
$attrname=GETPOST('attrname', 'alpha');
|
||||||
|
|||||||
@ -352,6 +352,15 @@ else
|
|||||||
}
|
}
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
// AGENDA_DEFAULT_VIEW
|
||||||
|
print '<tr class="oddeven">'."\n";
|
||||||
|
print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
|
||||||
|
print '<td align="center"> </td>'."\n";
|
||||||
|
print '<td align="right">'."\n";
|
||||||
|
$tmplist=array('show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
|
||||||
|
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -381,15 +390,6 @@ print '<td align="right">'."\n";
|
|||||||
$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100');
|
$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100');
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
// AGENDA_DEFAULT_VIEW
|
|
||||||
print '<tr class="oddeven">'."\n";
|
|
||||||
print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
|
|
||||||
print '<td align="center"> </td>'."\n";
|
|
||||||
print '<td align="right">'."\n";
|
|
||||||
$tmplist=array('show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
|
|
||||||
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
|
|
||||||
print '</td></tr>'."\n";
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|||||||
@ -39,7 +39,7 @@ $form = new Form($db);
|
|||||||
// List of supported format
|
// List of supported format
|
||||||
$tmptype2label=ExtraFields::$type2label;
|
$tmptype2label=ExtraFields::$type2label;
|
||||||
$type2label=array('');
|
$type2label=array('');
|
||||||
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
|
||||||
|
|
||||||
$action=GETPOST('action', 'alpha');
|
$action=GETPOST('action', 'alpha');
|
||||||
$attrname=GETPOST('attrname', 'alpha');
|
$attrname=GETPOST('attrname', 'alpha');
|
||||||
|
|||||||
@ -248,10 +248,8 @@ if ($resql)
|
|||||||
// Check record to know if we must recalculate sort order
|
// Check record to know if we must recalculate sort order
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$decalage=0;
|
$decalage=0;
|
||||||
$var=false;
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$var = ! $var;
|
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$boxes[$obj->position][$obj->box_id]=1;
|
$boxes[$obj->position][$obj->box_id]=1;
|
||||||
$i++;
|
$i++;
|
||||||
@ -321,6 +319,8 @@ if ($resql)
|
|||||||
|
|
||||||
// Available boxes to activate
|
// Available boxes to activate
|
||||||
$boxtoadd=InfoBox::listBoxes($db,'available',-1,null,$actives);
|
$boxtoadd=InfoBox::listBoxes($db,'available',-1,null,$actives);
|
||||||
|
// Activated boxes
|
||||||
|
$boxactivated=InfoBox::listBoxes($db,'activated',-1,null);
|
||||||
|
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
print "\n\n".'<!-- Boxes Available -->'."\n";
|
print "\n\n".'<!-- Boxes Available -->'."\n";
|
||||||
@ -339,11 +339,9 @@ print '<td>'.$langs->trans("Note").'/'.$langs->trans("Parameters").'</td>';
|
|||||||
print '<td>'.$langs->trans("SourceFile").'</td>';
|
print '<td>'.$langs->trans("SourceFile").'</td>';
|
||||||
print '<td width="160" align="center">'.$langs->trans("ActivateOn").'</td>';
|
print '<td width="160" align="center">'.$langs->trans("ActivateOn").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$var=true;
|
|
||||||
foreach($boxtoadd as $box)
|
foreach($boxtoadd as $box)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$box->boximg))
|
if (preg_match('/^([^@]+)@([^@]+)$/i',$box->boximg))
|
||||||
{
|
{
|
||||||
$logo = $box->boximg;
|
$logo = $box->boximg;
|
||||||
@ -376,7 +374,10 @@ foreach($boxtoadd as $box)
|
|||||||
|
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
}
|
}
|
||||||
|
if (! count($boxtoadd) && count($boxactivated))
|
||||||
|
{
|
||||||
|
print '<tr><td class="opacitymedium" colspan="4">'.$langs->trans("AllWidgetsWereEnabled").'</td></tr>';
|
||||||
|
}
|
||||||
print '</table>'."\n";
|
print '</table>'."\n";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
@ -387,8 +388,6 @@ print '</form>';
|
|||||||
print "\n".'<!-- End Boxes Available -->'."\n";
|
print "\n".'<!-- End Boxes Available -->'."\n";
|
||||||
|
|
||||||
|
|
||||||
// Activated boxes
|
|
||||||
$boxactivated=InfoBox::listBoxes($db,'activated',-1,null);
|
|
||||||
//var_dump($boxactivated);
|
//var_dump($boxactivated);
|
||||||
print "<br>\n\n";
|
print "<br>\n\n";
|
||||||
print load_fiche_titre($langs->trans("BoxesActivated"));
|
print load_fiche_titre($langs->trans("BoxesActivated"));
|
||||||
@ -404,13 +403,10 @@ print '<td align="center" width="60" colspan="2">'.$langs->trans("PositionByDefa
|
|||||||
print '<td align="center" width="80">'.$langs->trans("Disable").'</td>';
|
print '<td align="center" width="80">'.$langs->trans("Disable").'</td>';
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
$var=true;
|
|
||||||
$box_order=1;
|
$box_order=1;
|
||||||
$foundrupture=1;
|
$foundrupture=1;
|
||||||
foreach($boxactivated as $key => $box)
|
foreach($boxactivated as $key => $box)
|
||||||
{
|
{
|
||||||
$var = ! $var;
|
|
||||||
|
|
||||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$box->boximg))
|
if (preg_match('/^([^@]+)@([^@]+)$/i',$box->boximg))
|
||||||
{
|
{
|
||||||
$logo = $box->boximg;
|
$logo = $box->boximg;
|
||||||
@ -462,7 +458,6 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|||||||
print '<input type="hidden" name="action" value="addconst">';
|
print '<input type="hidden" name="action" value="addconst">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
$var=false;
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre">'.$langs->trans("Parameter").'</td>';
|
print '<td class="liste_titre">'.$langs->trans("Parameter").'</td>';
|
||||||
print '<td class="liste_titre">'.$langs->trans("Value").'</td>';
|
print '<td class="liste_titre">'.$langs->trans("Value").'</td>';
|
||||||
|
|||||||
@ -258,14 +258,14 @@ $var=true;
|
|||||||
|
|
||||||
$var=! $var;
|
$var=! $var;
|
||||||
|
|
||||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||||
$htmltext.='</i>';
|
$htmltext.='</i>';
|
||||||
|
|
||||||
print '<tr class="oddeven"><td colspan="2">';
|
print '<tr class="oddeven"><td colspan="2">';
|
||||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnChequeReceipts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
print $form->textwithpicto($langs->trans("FreeLegalTextOnChequeReceipts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||||
$variablename='BANK_CHEQUERECEIPT_FREE_TEXT';
|
$variablename='BANK_CHEQUERECEIPT_FREE_TEXT';
|
||||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -539,7 +539,7 @@ print "<td> </td>\n";
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||||
@ -550,7 +550,7 @@ 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="set_ORDER_FREE_TEXT">';
|
print '<input type="hidden" name="action" value="set_ORDER_FREE_TEXT">';
|
||||||
print '<tr class="oddeven"><td colspan="2">';
|
print '<tr class="oddeven"><td colspan="2">';
|
||||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||||
$variablename='ORDER_FREE_TEXT';
|
$variablename='ORDER_FREE_TEXT';
|
||||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||||
{
|
{
|
||||||
@ -573,7 +573,7 @@ print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
|
|||||||
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=\"set_COMMANDE_DRAFT_WATERMARK\">";
|
print "<input type=\"hidden\" name=\"action\" value=\"set_COMMANDE_DRAFT_WATERMARK\">";
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftOrders"), $htmltext);
|
print $form->textwithpicto($langs->trans("WatermarkOnDraftOrders"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print '<input class="flat minwidth200" type="text" name="COMMANDE_DRAFT_WATERMARK" value="'.$conf->global->COMMANDE_DRAFT_WATERMARK.'">';
|
print '<input class="flat minwidth200" type="text" name="COMMANDE_DRAFT_WATERMARK" value="'.$conf->global->COMMANDE_DRAFT_WATERMARK.'">';
|
||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
|
|||||||
@ -69,6 +69,8 @@ if ( ($action == 'update' && ! GETPOST("cancel",'alpha'))
|
|||||||
|
|
||||||
$s=$mysoc->country_id.':'.$mysoc->country_code.':'.$mysoc->country_label;
|
$s=$mysoc->country_id.':'.$mysoc->country_code.':'.$mysoc->country_label;
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_COUNTRY", $s,'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_COUNTRY", $s,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
|
activateModulesRequiredByCountry($mysoc->country_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom",'nohtml'),'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom",'nohtml'),'chaine',0,'',$conf->entity);
|
||||||
@ -981,12 +983,13 @@ else
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
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("VATManagement").'</td><td>'.$langs->trans("Description").'</td>';
|
print '<td class="titlefield">'.$langs->trans("VATManagement").'</td><td>'.$langs->trans("Description").'</td>';
|
||||||
print '<td align="right"> </td>';
|
print '<td align="right"> </td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
print "<tr class=\"oddeven\"><td width=\"160\"><input class=\"oddeven\" type=\"radio\" name=\"optiontva\" id=\"use_vat\" disabled value=\"1\"".(empty($conf->global->FACTURE_TVAOPTION)?"":" checked")."> ".$langs->trans("VATIsUsed")."</td>";
|
print '<tr class="oddeven"><td class="titlefield">';
|
||||||
|
print "<input class=\"oddeven\" type=\"radio\" name=\"optiontva\" id=\"use_vat\" disabled value=\"1\"".(empty($conf->global->FACTURE_TVAOPTION)?"":" checked")."> ".$langs->trans("VATIsUsed")."</td>";
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
print "<table>";
|
print "<table>";
|
||||||
print "<tr><td><label for=\"use_vat\">".$langs->trans("VATIsUsedDesc")."</label></td></tr>";
|
print "<tr><td><label for=\"use_vat\">".$langs->trans("VATIsUsedDesc")."</label></td></tr>";
|
||||||
@ -995,7 +998,8 @@ else
|
|||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|
||||||
|
|
||||||
print "<tr class=\"oddeven\"><td width=\"160\"><input class=\"oddeven\" type=\"radio\" name=\"optiontva\" id=\"no_vat\" disabled value=\"0\"".(empty($conf->global->FACTURE_TVAOPTION)?" checked":"")."> ".$langs->trans("VATIsNotUsed")."</td>";
|
print '<tr class="oddeven"><td class="titlefield">';
|
||||||
|
print "<input class=\"oddeven\" type=\"radio\" name=\"optiontva\" id=\"no_vat\" disabled value=\"0\"".(empty($conf->global->FACTURE_TVAOPTION)?" checked":"")."> ".$langs->trans("VATIsNotUsed")."</td>";
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
print "<table>";
|
print "<table>";
|
||||||
print "<tr><td><label=\"no_vat\">".$langs->trans("VATIsNotUsedDesc")."</label></td></tr>";
|
print "<tr><td><label=\"no_vat\">".$langs->trans("VATIsNotUsedDesc")."</label></td></tr>";
|
||||||
@ -1015,12 +1019,13 @@ else
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
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->transcountry("LocalTax1Management",$mysoc->country_code).'</td><td>'.$langs->trans("Description").'</td>';
|
print '<td class="titlefield">'.$langs->transcountry("LocalTax1Management",$mysoc->country_code).'</td><td>'.$langs->trans("Description").'</td>';
|
||||||
print '<td align="right"> </td>';
|
print '<td align="right"> </td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
print "<tr class=\"oddeven\"><td width=\"160\"><input class=\"oddeven\" type=\"radio\" name=\"optionlocaltax1\" id=\"lt1\" disabled value=\"localtax1on\"".(($conf->global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on")?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code)."</td>";
|
print "<tr class=\"oddeven\"><td>";
|
||||||
|
print "<input class=\"oddeven\" type=\"radio\" name=\"optionlocaltax1\" id=\"lt1\" disabled value=\"localtax1on\"".(($conf->global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on")?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code)."</td>";
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
print "<table>";
|
print "<table>";
|
||||||
print "<tr><td></label for=\"lt1\">".$langs->transcountry("LocalTax1IsUsedDesc",$mysoc->country_code)."</label></td></tr>";
|
print "<tr><td></label for=\"lt1\">".$langs->transcountry("LocalTax1IsUsedDesc",$mysoc->country_code)."</label></td></tr>";
|
||||||
@ -1048,7 +1053,8 @@ else
|
|||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|
||||||
|
|
||||||
print "<tr class=\"oddeven\"><td width=\"160\"><input class=\"oddeven\" type=\"radio\" name=\"optionlocaltax1\" id=\"nolt1\" disabled value=\"localtax1off\"".((empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off")?" checked":"")."> ".$langs->transcountry("LocalTax1IsNotUsed",$mysoc->country_code)."</td>";
|
print '<tr class="oddeven"><td>';
|
||||||
|
print "<input class=\"oddeven\" type=\"radio\" name=\"optionlocaltax1\" id=\"nolt1\" disabled value=\"localtax1off\"".((empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off")?" checked":"")."> ".$langs->transcountry("LocalTax1IsNotUsed",$mysoc->country_code)."</td>";
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
print "<table>";
|
print "<table>";
|
||||||
print "<tr><td><label for=\"no_lt1\">".$langs->transcountry("LocalTax1IsNotUsedDesc",$mysoc->country_code)."</label></td></tr>";
|
print "<tr><td><label for=\"no_lt1\">".$langs->transcountry("LocalTax1IsNotUsedDesc",$mysoc->country_code)."</label></td></tr>";
|
||||||
@ -1065,12 +1071,13 @@ else
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
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->transcountry("LocalTax2Management",$mysoc->country_code).'</td><td>'.$langs->trans("Description").'</td>';
|
print '<td class="titlefield">'.$langs->transcountry("LocalTax2Management",$mysoc->country_code).'</td><td>'.$langs->trans("Description").'</td>';
|
||||||
print '<td align="right"> </td>';
|
print '<td align="right"> </td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
print "<tr class=\"oddeven\"><td width=\"160\"><input class=\"oddeven\" type=\"radio\" name=\"optionlocaltax2\" id=\"lt2\" disabled value=\"localtax2on\"".(($conf->global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on")?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code)."</td>";
|
print "<tr class=\"oddeven\"><td>";
|
||||||
|
print "<input class=\"oddeven\" type=\"radio\" name=\"optionlocaltax2\" id=\"lt2\" disabled value=\"localtax2on\"".(($conf->global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on")?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code)."</td>";
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
print "<table>";
|
print "<table>";
|
||||||
print "<tr><td><label for=\"lt2\">".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code)."</label></td></tr>";
|
print "<tr><td><label for=\"lt2\">".$langs->transcountry("LocalTax2IsUsedDesc",$mysoc->country_code)."</label></td></tr>";
|
||||||
|
|||||||
@ -54,7 +54,7 @@ $list = array(
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$accounting_mode = defined('ACCOUNTING_MODE')?ACCOUNTING_MODE:'RECETTES-DEPENSES';
|
$accounting_mode = empty($conf->global->ACCOUNTING_MODE) ? 'RECETTES-DEPENSES' : $conf->global->ACCOUNTING_MODE;
|
||||||
|
|
||||||
if ($action == 'update')
|
if ($action == 'update')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -474,7 +474,7 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'));
|
$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
|
||||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||||
@ -482,8 +482,7 @@ $htmltext.='</i>';
|
|||||||
|
|
||||||
$var=! $var;
|
$var=! $var;
|
||||||
print '<tr class="oddeven"><td colspan="2">';
|
print '<tr class="oddeven"><td colspan="2">';
|
||||||
//print $form->textwithpicto($langs->trans("FreeLegalTextOnContracts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
|
print $form->textwithpicto($langs->trans("FreeLegalTextOnContracts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
|
||||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnContracts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2);
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
$variablename='CONTRACT_FREE_TEXT';
|
$variablename='CONTRACT_FREE_TEXT';
|
||||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||||
@ -501,8 +500,7 @@ print '</td></tr>'."\n";
|
|||||||
//Use draft Watermark
|
//Use draft Watermark
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
//print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
|
print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2);
|
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print '<input size="50" class="flat" type="text" name="CONTRACT_DRAFT_WATERMARK" value="'.$conf->global->CONTRACT_DRAFT_WATERMARK.'">';
|
print '<input size="50" class="flat" type="text" name="CONTRACT_DRAFT_WATERMARK" value="'.$conf->global->CONTRACT_DRAFT_WATERMARK.'">';
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|||||||
@ -276,7 +276,7 @@ if ($mode != 'focus')
|
|||||||
{
|
{
|
||||||
$texthelp.=$key.' -> '.$val.'<br>';
|
$texthelp.=$key.' -> '.$val.'<br>';
|
||||||
}
|
}
|
||||||
$textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, ''); // No tooltip on click, this also triggers the sort click
|
$textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, 'subsitutiontooltip');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -74,12 +74,16 @@ $active = 1;
|
|||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
$offset = $listlimit * $page ;
|
$offset = $listlimit * $page ;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
$search_country_id = GETPOST('search_country_id','int');
|
$search_country_id = GETPOST('search_country_id','int');
|
||||||
|
if ($search_country_id == '' && ($id == 2 || $id == 3 || $id == 10)) // Not a so good idea to force on current country for all dictionaries. Some tables have entries that are for all countries, we must be able to see them, so this is done for dedicated dictionaries only.
|
||||||
|
{
|
||||||
|
$search_country_id = $mysoc->country_id;
|
||||||
|
}
|
||||||
$search_code = GETPOST('search_code','alpha');
|
$search_code = GETPOST('search_code','alpha');
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
@ -89,7 +93,7 @@ $hookmanager->initHooks(array('admin'));
|
|||||||
// Put here declaration of dictionaries properties
|
// Put here declaration of dictionaries properties
|
||||||
|
|
||||||
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
||||||
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,17,35,36,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,26,0,);
|
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,26,0,);
|
||||||
|
|
||||||
// Name of SQL tables of dictionaries
|
// Name of SQL tables of dictionaries
|
||||||
$tabname=array();
|
$tabname=array();
|
||||||
@ -193,7 +197,7 @@ $tabsql[19]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREF
|
|||||||
$tabsql[20]= "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_input_method";
|
$tabsql[20]= "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_input_method";
|
||||||
$tabsql[21]= "SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_availability AS c";
|
$tabsql[21]= "SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_availability AS c";
|
||||||
$tabsql[22]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
|
$tabsql[22]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
|
||||||
$tabsql[23]= "SELECT t.rowid as rowid, t.taux, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
|
$tabsql[23]= "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
|
||||||
$tabsql[24]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
|
$tabsql[24]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
|
||||||
//$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').")";
|
//$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').")";
|
||||||
$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
|
$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
|
||||||
@ -271,7 +275,7 @@ $tabfield[19]= "code,libelle";
|
|||||||
$tabfield[20]= "code,libelle";
|
$tabfield[20]= "code,libelle";
|
||||||
$tabfield[21]= "code,label";
|
$tabfield[21]= "code,label";
|
||||||
$tabfield[22]= "code,label";
|
$tabfield[22]= "code,label";
|
||||||
$tabfield[23]= "country_id,country,taux,accountancy_code_sell,accountancy_code_buy,note";
|
$tabfield[23]= "country_id,country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
|
||||||
$tabfield[24]= "code,label";
|
$tabfield[24]= "code,label";
|
||||||
//$tabfield[25]= "label,type_template,private,position,topic,content_lines,content";
|
//$tabfield[25]= "label,type_template,private,position,topic,content_lines,content";
|
||||||
$tabfield[26]= "code,label,short_label";
|
$tabfield[26]= "code,label,short_label";
|
||||||
@ -281,6 +285,8 @@ $tabfield[29]= "code,label,percent,position";
|
|||||||
$tabfield[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
$tabfield[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||||
//$tabfield[31]= "pcg_version,label";
|
//$tabfield[31]= "pcg_version,label";
|
||||||
//$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
|
//$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
|
||||||
|
$tabfield[33]= "code,label";
|
||||||
|
$tabfield[34]= "code,label";
|
||||||
$tabfield[35]= "label";
|
$tabfield[35]= "label";
|
||||||
$tabfield[36]= "range_ik,fk_c_exp_tax_cat";
|
$tabfield[36]= "range_ik,fk_c_exp_tax_cat";
|
||||||
|
|
||||||
@ -308,7 +314,7 @@ $tabfieldvalue[19]= "code,libelle";
|
|||||||
$tabfieldvalue[20]= "code,libelle";
|
$tabfieldvalue[20]= "code,libelle";
|
||||||
$tabfieldvalue[21]= "code,label";
|
$tabfieldvalue[21]= "code,label";
|
||||||
$tabfieldvalue[22]= "code,label";
|
$tabfieldvalue[22]= "code,label";
|
||||||
$tabfieldvalue[23]= "country,taux,accountancy_code_sell,accountancy_code_buy,note";
|
$tabfieldvalue[23]= "country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
|
||||||
$tabfieldvalue[24]= "code,label";
|
$tabfieldvalue[24]= "code,label";
|
||||||
//$tabfieldvalue[25]= "label,type_template,private,position,topic,content_lines,content";
|
//$tabfieldvalue[25]= "label,type_template,private,position,topic,content_lines,content";
|
||||||
$tabfieldvalue[26]= "code,label,short_label";
|
$tabfieldvalue[26]= "code,label,short_label";
|
||||||
@ -347,7 +353,7 @@ $tabfieldinsert[19]= "code,libelle";
|
|||||||
$tabfieldinsert[20]= "code,libelle";
|
$tabfieldinsert[20]= "code,libelle";
|
||||||
$tabfieldinsert[21]= "code,label";
|
$tabfieldinsert[21]= "code,label";
|
||||||
$tabfieldinsert[22]= "code,label";
|
$tabfieldinsert[22]= "code,label";
|
||||||
$tabfieldinsert[23]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note";
|
$tabfieldinsert[23]= "fk_pays,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
|
||||||
$tabfieldinsert[24]= "code,label";
|
$tabfieldinsert[24]= "code,label";
|
||||||
//$tabfieldinsert[25]= "label,type_template,private,position,topic,content_lines,content,entity";
|
//$tabfieldinsert[25]= "label,type_template,private,position,topic,content_lines,content,entity";
|
||||||
$tabfieldinsert[26]= "code,label,short_label";
|
$tabfieldinsert[26]= "code,label,short_label";
|
||||||
@ -466,7 +472,7 @@ $tabhelp[19] = array('code'=>$langs->trans("EnterAnyCode"));
|
|||||||
$tabhelp[20] = array('code'=>$langs->trans("EnterAnyCode"));
|
$tabhelp[20] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||||
$tabhelp[21] = array('code'=>$langs->trans("EnterAnyCode"));
|
$tabhelp[21] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||||
$tabhelp[22] = array('code'=>$langs->trans("EnterAnyCode"));
|
$tabhelp[22] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||||
$tabhelp[23] = array();
|
$tabhelp[23] = array('revenuestamp_type'=>'FixedOfPercent');
|
||||||
$tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
|
$tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||||
//$tabhelp[25] = array('topic'=>$langs->trans('SeeSubstitutionVars'),'content'=>$langs->trans('SeeSubstitutionVars'),'content_lines'=>$langs->trans('SeeSubstitutionVars'),'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
|
//$tabhelp[25] = array('topic'=>$langs->trans('SeeSubstitutionVars'),'content'=>$langs->trans('SeeSubstitutionVars'),'content_lines'=>$langs->trans('SeeSubstitutionVars'),'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
|
||||||
$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
|
$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||||
@ -645,6 +651,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
if ($fieldnamekey == 'deductible') $fieldnamekey = 'Deductible';
|
if ($fieldnamekey == 'deductible') $fieldnamekey = 'Deductible';
|
||||||
if ($fieldnamekey == 'sortorder') $fieldnamekey = 'SortOrder';
|
if ($fieldnamekey == 'sortorder') $fieldnamekey = 'SortOrder';
|
||||||
if ($fieldnamekey == 'category_type') $fieldnamekey = 'Calculated';
|
if ($fieldnamekey == 'category_type') $fieldnamekey = 'Calculated';
|
||||||
|
if ($fieldnamekey == 'revenuestamp_type') $fieldnamekey = 'TypeOfRevenueStamp';
|
||||||
|
|
||||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||||
}
|
}
|
||||||
@ -799,7 +806,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
||||||
$sql.= " AND entity = '".getEntity($tabname[$id])."'";
|
if (in_array('entity', $listfieldmodify)) $sql.= " AND entity = '".getEntity($tabname[$id])."'";
|
||||||
|
|
||||||
dol_syslog("actionmodify", LOG_DEBUG);
|
dol_syslog("actionmodify", LOG_DEBUG);
|
||||||
//print $sql;
|
//print $sql;
|
||||||
@ -1009,6 +1016,11 @@ if ($id)
|
|||||||
$sql.=$db->plimit($listlimit+1,$offset);
|
$sql.=$db->plimit($listlimit+1,$offset);
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
|
if (empty($tabfield[$id]))
|
||||||
|
{
|
||||||
|
dol_print_error($db, 'The table with id '.$id.' has no array tabfield defined');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
$fieldlist=explode(',',$tabfield[$id]);
|
$fieldlist=explode(',',$tabfield[$id]);
|
||||||
|
|
||||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||||
@ -1106,7 +1118,8 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
|
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
|
||||||
if ($fieldlist[$field]=='fk_tva') { $valuetoshow=$langs->trans("VAT"); }
|
if ($fieldlist[$field]=='fk_tva') { $valuetoshow=$langs->trans("VAT"); }
|
||||||
if ($fieldlist[$field]=='range_ik') { $valuetoshow=$langs->trans("RangeIk"); }
|
if ($fieldlist[$field]=='range_ik') { $valuetoshow=$langs->trans("RangeIk"); }
|
||||||
if ($fieldlist[$field]=='fk_c_exp_tax_cat'){ $valuetoshow=$langs->trans("CarCategory"); }
|
if ($fieldlist[$field]=='fk_c_exp_tax_cat') { $valuetoshow=$langs->trans("CarCategory"); }
|
||||||
|
if ($fieldlist[$field]=='revenuestamp_type') { $valuetoshow=$langs->trans('TypeOfRevenueStamp'); }
|
||||||
|
|
||||||
if ($id == 2) // Special cas for state page
|
if ($id == 2) // Special cas for state page
|
||||||
{
|
{
|
||||||
@ -1332,7 +1345,8 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
|
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
|
||||||
if ($fieldlist[$field]=='fk_tva') { $valuetoshow=$langs->trans("VAT"); }
|
if ($fieldlist[$field]=='fk_tva') { $valuetoshow=$langs->trans("VAT"); }
|
||||||
if ($fieldlist[$field]=='range_ik') { $valuetoshow=$langs->trans("RangeIk"); }
|
if ($fieldlist[$field]=='range_ik') { $valuetoshow=$langs->trans("RangeIk"); }
|
||||||
if ($fieldlist[$field]=='fk_c_exp_tax_cat'){ $valuetoshow=$langs->trans("CarCategory"); }
|
if ($fieldlist[$field]=='fk_c_exp_tax_cat') { $valuetoshow=$langs->trans("CarCategory"); }
|
||||||
|
if ($fieldlist[$field]=='revenuestamp_type') { $valuetoshow=$langs->trans('TypeOfRevenueStamp'); }
|
||||||
|
|
||||||
// Affiche nom du champ
|
// Affiche nom du champ
|
||||||
if ($showfield)
|
if ($showfield)
|
||||||
@ -1392,6 +1406,7 @@ if ($id)
|
|||||||
|
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
{
|
{
|
||||||
|
//var_dump($fieldlist);
|
||||||
$showfield=1;
|
$showfield=1;
|
||||||
$align="left";
|
$align="left";
|
||||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||||
@ -1749,7 +1764,7 @@ $db->close();
|
|||||||
* @param Object $obj If we show a particular record, obj is filled with record fields
|
* @param Object $obj If we show a particular record, obj is filled with record fields
|
||||||
* @param string $tabname Name of SQL table
|
* @param string $tabname Name of SQL table
|
||||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||||
* @return string '' or value of entity into table
|
* @return string '' or value of entity into table
|
||||||
*/
|
*/
|
||||||
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -477,14 +477,14 @@ print "<tr class=\"liste_titre\">";
|
|||||||
print "<td>".$langs->trans("Parameter")."</td>\n";
|
print "<td>".$langs->trans("Parameter")."</td>\n";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||||
$htmltext.='</i>';
|
$htmltext.='</i>';
|
||||||
|
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnShippings"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
print $form->textwithpicto($langs->trans("FreeLegalTextOnShippings"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||||
$variablename='SHIPPING_FREE_TEXT';
|
$variablename='SHIPPING_FREE_TEXT';
|
||||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||||
{
|
{
|
||||||
@ -499,7 +499,7 @@ else
|
|||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext).'<br>';
|
print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||||
print '<input size="50" class="flat" type="text" name="SHIPPING_DRAFT_WATERMARK" value="'.$conf->global->SHIPPING_DRAFT_WATERMARK.'">';
|
print '<input size="50" class="flat" type="text" name="SHIPPING_DRAFT_WATERMARK" value="'.$conf->global->SHIPPING_DRAFT_WATERMARK.'">';
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user