Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop

This commit is contained in:
David Bensel 2021-01-18 17:33:22 +03:00
commit 85d63891d9
2683 changed files with 59796 additions and 32235 deletions

View File

@ -38,8 +38,8 @@ env:
jobs: jobs:
fast_finish: true fast_finish: true
allow_failures: #allow_failures:
- php: nightly #- php: nightly
include: include:
- if: type = push - if: type = push
php: '5.6' php: '5.6'
@ -50,6 +50,9 @@ jobs:
- if: type = push AND branch = develop - if: type = push AND branch = develop
php: nightly php: nightly
env: DB=mysql env: DB=mysql
- if: type = push AND branch = 14.0
php: nightly
env: DB=mysql
notifications: notifications:
email: email:
@ -70,13 +73,6 @@ before_install:
phpenv config-rm xdebug.ini phpenv config-rm xdebug.ini
echo echo
- |
if [ "$DB" = 'postgresql' ]; then
echo "Check pgloader version"
pgloader --version
echo
fi
install: install:
- | - |
echo "Updating Composer" echo "Updating Composer"
@ -175,6 +171,10 @@ before_script:
mysql --version | head - mysql --version | head -
mysql -e "SELECT VERSION();" | head - mysql -e "SELECT VERSION();" | head -
psql --version psql --version
if [ "$DB" = 'postgresql' ]; then
echo "Check pgloader version"
pgloader --version
fi
echo echo
- | - |
@ -268,7 +268,7 @@ script:
# Ensure we catch errors # Ensure we catch errors
set -e set -e
#parallel-lint --exclude htdocs/includes --blame . #parallel-lint --exclude htdocs/includes --blame .
parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \ parallel-lint --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \
--exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \ --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \
--exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \ --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \
--exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \ --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \
@ -398,9 +398,14 @@ script:
php upgrade.php 12.0.0 13.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade12001300.log php upgrade.php 12.0.0 13.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade12001300.log
php upgrade2.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-2.log php upgrade2.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-2.log
php step5.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-3.log php step5.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-3.log
php upgrade.php 13.0.0 14.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade13001400.log
php upgrade2.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-2.log
php step5.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-3.log
# Enable modules not enabled into original dump # Enable modules not enabled into original dump
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP,MAIN_MODULE_RECRUITMENT > $TRAVIS_BUILD_DIR/enablemodule.log php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_PRODUCTBATCH,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_STRIPE > $TRAVIS_BUILD_DIR/enablemodule.log
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP >> $TRAVIS_BUILD_DIR/enablemodule.log
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $TRAVIS_BUILD_DIR/enablemodule.log
echo $? echo $?
cd - cd -
set +e set +e

View File

@ -29,10 +29,10 @@ PHPoAuthLib 0.8.2 MIT License Yes
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
PSR/Logs 1.0 Library for logs (used by DebugBar) PSR/Logs 1.0 Library for logs (used by DebugBar)
PSR/simple-cache ? Library for cache (used by PHPSpreadSheet) PSR/simple-cache ? Library for cache (used by PHPSpreadSheet)
Restler 3.0.0RC6 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer) Restler 3.1.1 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer)
Sabre 3.2.2 BSD Yes DAV support Sabre 3.2.2 BSD Yes DAV support
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP
Stripe 6.43.1 MIT licence Yes Library for Stripe module Stripe 7.67.0 MIT licence Yes Library for Stripe module
TCPDF 6.3.2 LGPL-3+ Yes PDF generation TCPDF 6.3.2 LGPL-3+ Yes PDF generation
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
@ -52,7 +52,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
jsGanttImproved 1.7.5.4 BSD License Yes JS library (to build Gantt reports) jsGanttImproved 2.7.3 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

View File

@ -7,7 +7,8 @@ English Dolibarr ChangeLog
For users: For users:
---------- ----------
NEW: Add module "Credit transfer SEPA" to manage payment of vendors using bank credit transfer SEPA files. NEW: Module "Credit transfer SEPA" to manage payment of vendors using bank credit transfer SEPA files.
NEW: Module Intracomm report
NEW: Module Reception (for a more accurate management of your receptions) moved from experimental to stable. NEW: Module Reception (for a more accurate management of your receptions) moved from experimental to stable.
NEW: Module Recruitment to manage Job position and applications. NEW: Module Recruitment to manage Job position and applications.
NEW: Several security issues after a private bug bounty campaign. NEW: Several security issues after a private bug bounty campaign.
@ -16,12 +17,12 @@ NEW: Accountancy - add options to disable binding on sales, purchases & expense
NEW: Accountancy balance - add a menu entry to show subtotal by group NEW: Accountancy balance - add a menu entry to show subtotal by group
NEW: Accountancy - change menu disposition NEW: Accountancy - change menu disposition
NEW: Accountancy - on transfers, select the periodicity by default NEW: Accountancy - on transfers, select the periodicity by default
NEW: Accountancy - Add export for Gestinum (v3 & v5) NEW: Accountancy - Add export for Gestinum (v3 & v5) #15180
NEW: new currency rate editor NEW: new currency rate editor
NEW: Solve blocking feature. Can increase stock of a Kit without changing subproduct stock.
NEW: add a widget to show the customers with outstanding limits reached NEW: add a widget to show the customers with outstanding limits reached
NEW: add 2 rules for emailcollector: Message send/not sent from Dolibarr NEW: add 2 rules for emailcollector: Message send/not sent from Dolibarr
NEW: add a counter of number of words for pages in website module NEW: add a counter of number of words for pages in website module
NEW: add alert before changing thirdparty in TakePOS
NEW: add a page to list Stock at a given date in the past NEW: add a page to list Stock at a given date in the past
NEW: add a start date to begin binding in accountancy NEW: add a start date to begin binding in accountancy
NEW: add a statistics page to list popularity of products on invoices NEW: add a statistics page to list popularity of products on invoices
@ -33,12 +34,12 @@ NEW: add column vat rate in page to define accounting account on product/service
NEW: add costprice in fields of products list NEW: add costprice in fields of products list
NEW: add an import profile for CUSTOMER ORDER, PO, PROPOSAL MODULE, SUPPLIER INVOICE NEW: add an import profile for CUSTOMER ORDER, PO, PROPOSAL MODULE, SUPPLIER INVOICE
NEW: add employee link in expense report binding page NEW: add employee link in expense report binding page
NEW: add EORI No. as ProfID5 NEW: add EORI No. as ProfID5 #15382
NEW: add export for various payments NEW: add export for various payments
NEW: add Extrafields labels and values in mail on create ticket NEW: add Extrafields labels and values in mail on create ticket
NEW: add Extrafields support on ECM module NEW: add Extrafields support on ECM module
NEW: add filter rules "is answer" and "is not answer" in email collector NEW: add filter rules "is answer" and "is not answer" in email collector
NEW: add focus when editing on product/stock/product.php Close #14548 NEW: add focus when editing on product/stock/product.php -> close #14548
NEW: add free text on each terminal of cash desk NEW: add free text on each terminal of cash desk
NEW: add global search for customer payments and vendor payments NEW: add global search for customer payments and vendor payments
NEW: add global search for miscellaneous payments NEW: add global search for miscellaneous payments
@ -56,7 +57,6 @@ NEW: add option TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT
NEW: add option to define a default warehouse at user level NEW: add option to define a default warehouse at user level
NEW: add option to include products without alert in replenish NEW: add option to include products without alert in replenish
NEW: add order by lastname and firstname by default in get sales representatives NEW: add order by lastname and firstname by default in get sales representatives
NEW: add param to not show links when output tags
NEW: add PDF document templates for warehouses (list of stock) NEW: add PDF document templates for warehouses (list of stock)
NEW: add a prospect status for the contact with managment of custom icon NEW: add a prospect status for the contact with managment of custom icon
NEW: add public note on products ; this also partially fix the #14342 NEW: add public note on products ; this also partially fix the #14342
@ -67,7 +67,6 @@ NEW: add search param for close date on order list
NEW: add show preview for mail attachement on form mail NEW: add show preview for mail attachement on form mail
NEW: add State/Province origin for products NEW: add State/Province origin for products
NEW: add the workflow interaction close intervention on closing ticket NEW: add the workflow interaction close intervention on closing ticket
NEW: add third order printer to TakePOS
NEW: add tracking number in list and search_all items NEW: add tracking number in list and search_all items
NEW: add vcard for adherent and user NEW: add vcard for adherent and user
NEW: add week number for month view in agenda NEW: add week number for month view in agenda
@ -75,11 +74,10 @@ NEW: Algeria data (VAT and forme_juridique)
NEW: allow click on all header numbers on commerce area NEW: allow click on all header numbers on commerce area
NEW: allow to reopen interventions (green button) NEW: allow to reopen interventions (green button)
NEW: allow zero quantity on supplier/vendor order line NEW: allow zero quantity on supplier/vendor order line
NEW: appearance tab in TakePOS with more visual parameters
NEW: better currency rate editor NEW: better currency rate editor
NEW: can build vendor invoice from vendor orders NEW: can build vendor invoice from vendor orders
NEW: can change a product in lines of a recurring invoice or contract NEW: can change a product in lines of a recurring invoice or contract
NEW: can change size of logo on PDF documents NEW: can set the size of the logo on PDF documents
NEW: can change VAT rate of all lines of a draft object in one step NEW: can change VAT rate of all lines of a draft object in one step
NEW: can define date range of validity of a login during creation NEW: can define date range of validity of a login during creation
NEW: can disable, from edit page, the whole web site NEW: can disable, from edit page, the whole web site
@ -88,16 +86,14 @@ NEW: can edit the list of sending email profiles
NEW: can enable/disable users in bulk actions NEW: can enable/disable users in bulk actions
NEW: can filter on accounting system ref in export of chart of account NEW: can filter on accounting system ref in export of chart of account
NEW: can filter on container type, language and tags in the list of web pages NEW: can filter on container type, language and tags in the list of web pages
NEW: can hide eatby, sellby dates with option PRODUCT_DISABLE_SELLBY and PRODUCT_DISABLE_EATBY NEW: can hide eatby, sellby dates with option PRODUCT_DISABLE_EATBY and PRODUCT_DISABLE_SELLBY
NEW: can import proposals, sales orders, supplier invoices NEW: can import proposals, sales orders, supplier invoices
NEW: can set a dedicated SMTP config for sending email from public ticket interface NEW: can set a dedicated SMTP config for sending email from public ticket interface
NEW: can set tags/categories to website pages NEW: can set tags/categories to website pages
NEW: can set type of price without tax per default for new sale price creation NEW: can set type of price without tax per default for new sale price creation
NEW: can use desired stock of a given warehouse for replenishment NEW: can use desired stock of a given warehouse for replenishment
NEW: change thirdparty with barcode scan in TakePOS
NEW: common behavior for monthly leave list view NEW: common behavior for monthly leave list view
NEW: convert all subscription in datetime NEW: convert all subscription in datetime
NEW: can create a thirdparty customer from TakePOS
NEW: date shipment from order accepts hours NEW: date shipment from order accepts hours
NEW: price level compatibility for variant NEW: price level compatibility for variant
NEW: delayed payment in TakePOS NEW: delayed payment in TakePOS
@ -124,29 +120,24 @@ NEW: link on balance to the ledger
NEW: MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER const in email collector NEW: MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER const in email collector
NEW: manage errors on update extra fields in ticket card NEW: manage errors on update extra fields in ticket card
NEW: mass-actions for the event list view NEW: mass-actions for the event list view
NEW: Module Intracomm report
NEW: more filter for "View change logs" NEW: more filter for "View change logs"
NEW: multicurrency total in TakePOS
NEW: multiselect type and date to date filter NEW: multiselect type and date to date filter
NEW: Nature of product is now a dictionay
NEW: new line template: hidden conf to fill service dates from the last service line NEW: new line template: hidden conf to fill service dates from the last service line
NEW: PDF model storm for delivery NEW: PDF model storm for delivery
NEW: possibilty to group payments by mode and show their subtotal NEW: possibilty to group payments by mode and show their subtotal
NEW: Print payment method and change in TakePOS
NEW: Priority and transparency from external calendar events NEW: Priority and transparency from external calendar events
NEW: Products - Nature of product is now a dictionary #13287
NEW: Products Import/Export 'default warehouse' and 'use batch number' fields NEW: Products Import/Export 'default warehouse' and 'use batch number' fields
NEW: Purchase price table: added filterable table columns NEW: Purchase price table: added filterable table columns
NEW: rate editor for multicurrency NEW: rate editor for multicurrency
NEW: ref_ext field for Commande lines, order lines, Attributes and Combinations, Invoice lines, payments, order lines NEW: ref_ext field for Commande lines, order lines, Attributes and Combinations, Invoice lines, payments, order lines
NEW: remove new lines in mail on add ticket message NEW: remove new lines in mail on add ticket message
NEW: restrict thirdparty to customer in TakePOS
NEW: Rule "email to" accept wildcard * NEW: Rule "email to" accept wildcard *
NEW: Save filter of the project homepage NEW: save filter of the project homepage
NEW: select-able columns on customer and supplier invoice paymnet list NEW: select-able columns on customer and supplier invoice paymnet list
NEW: select-able columns on miscellaneous payments + more data columns NEW: select-able columns on miscellaneous payments + more data columns
NEW: select-able columns on social taxes list NEW: select-able columns on social taxes list
NEW: send context and remove new lines on create ticket NEW: send context and remove new lines on create ticket
NEW: show available stock in TakePOS
NEW: show category filter on lists only when user have rights to read categories NEW: show category filter on lists only when user have rights to read categories
NEW: show header number and make it clickable in warehouse area, payment area, shipment area NEW: show header number and make it clickable in warehouse area, payment area, shipment area
NEW: show image of user in the combo select of users NEW: show image of user in the combo select of users
@ -159,70 +150,80 @@ NEW: show tags and status in search list of website pages
NEW: show user on external calender events (when found) NEW: show user on external calender events (when found)
NEW: subject title with company name instead of application title in ticket message NEW: subject title with company name instead of application title in ticket message
NEW: Support for Samba4 AD NEW: Support for Samba4 AD
NEW: TakePOS appearance tab with more visual parameters
NEW: TakePOS add alert before changing thirdparty
NEW: TakePOS add third order printer
NEW: TakePOS can change thirdparty with barcode scan
NEW: TakePOS can create a thirdparty customer from TakePOS frontend
NEW: TakePOS connector compatibility with RECEIPT PRINTERS module NEW: TakePOS connector compatibility with RECEIPT PRINTERS module
NEW: TakePOS Gift Receipt NEW: TakePOS Gift Receipt
NEW: TakePOS Multicurrency compatibility NEW: TakePOS multicurrency compatibility
NEW: the global header of a website can also have dynamic content NEW: TakePOS multicurrency total
NEW: Third-Party Import new fields: mother company,outstanding debt limit,bank account,incoterms NEW: TakePOS print payment method and change
NEW: TakePOS restrict thirdparty to customer
NEW: TakePOS show available stock
NEW: TakePOS Weighing Scale compatibility with TakePOS connector #14725
NEW: Thirdparty Import new fields: mother company,outstanding debt limit,bank account,incoterms
NEW: Thirdparty module : box on customer/supplier tab for invoice outsantding amount late NEW: Thirdparty module : box on customer/supplier tab for invoice outsantding amount late
NEW: ticket classification on create from email collector NEW: Ticket classification on create from email collector
NEW: Ticket message notifications when edited from public interface NEW: Ticket message notifications when edited from public interface
NEW: translate classification labels in ticket NEW: Ticket translate classification labels in ticket
NEW: VAT rate for Angola #15606 NEW: VAT rate for Angola #15606
NEW: VAT and juridical status for Algeria NEW: VAT and juridical status for Algeria
NEW: VAT report - Invert constant to show by default zero VAT in reports NEW: VAT report - Invert constant to show by default zero VAT in reports
NEW: website page fields selection NEW: website page fields selection
NEW: Weighing Scale compatibility with TakePOS connector NEW: website - global header of a website can also have dynamic content
NEW: when creating a user from a member linked to a thirdparty, you can choose to create it as external or internal user NEW: when creating a user from a member linked to a thirdparty, you can choose to create it as external or internal user
NEW: add clone button on miscellaneous payment NEW: add clone button on miscellaneous payment
NEW: #15065 Add option to put the product label in bold in the PDF templates if configured NEW: add option to put the product label in bold in the PDF templates if configured #15065
NEW: Add option "If the feature to manage kits of module Stock is used, show details of subproducts of a kit on PDF." NEW: add option "If the feature to manage kits of module Stock is used, show details of subproducts of a kit on PDF."
For developers: For developers:
--------------- ---------------
NEW: add __MEMBER_TYPE__ substitution key NEW: add substitution key __MEMBER_TYPE__
NEW: add __TYPE__ substitution key NEW: add substitution key __TYPE__
NEW: add function dolButtonToOpenUrlInDialogPopup() to be able to open page into a popup NEW: add function dolButtonToOpenUrlInDialogPopup() to be able to open page into a popup
NEW: show line number on intervention card (via MAIN_VIEW_LINE_NUMBER) NEW: show line number on intervention card (via MAIN_VIEW_LINE_NUMBER)
NEW: Add some fields to link website page to an other object NEW: add some fields to link website page to an other object
NEW: fill ECM src object fields in dol_add_file_process NEW: fill ECM src object fields in dol_add_file_process
NEW: conf to allow to show the full tree in warehouse popup NEW: conf to allow to show the full tree in warehouse popup
NEW: can use THEME_DARKMODEENABLED=2 for a preview of theme in dark mode NEW: can use parameter ?THEME_DARKMODEENABLED=2 for a preview of theme in dark mode
NEW: can force the antivirus from conf file or autoprepend ini setup NEW: can force the antivirus from conf file or autoprepend ini setup
NEW: can add event to log into blockedlog module with a constant NEW: can add event to log into blockedlog module with a constant
NEW: add property cssview when declaring fields of an object NEW: add property cssview when declaring fields of an object
NEW: Can use dynamic code into the 'enabled' property of DAO fields NEW: can use dynamic code into the 'enabled' property of DAO fields
NEW: allow to edit "demand reason" field though API
NEW: fetch contact by email with REST API
NEW: field ref_ext in llx_commandedet NEW: field ref_ext in llx_commandedet
NEW: fields ref_ext for Attributes and Combinations NEW: field ref_ext for Attributes and Combinations
NEW: get state by REST API
NEW: get state dictionnary by REST API
NEW: improve Product API for variant products
NEW: OAuth SCOPE for Admin SDK NEW: OAuth SCOPE for Admin SDK
NEW: retrieve discount from invoice from API NEW: retrieve discount from invoice from API
NEW: standardizes API thirdparties by email like other object NEW: standardizes API thirdparties by email like other object
NEW: Thirdparty REST API: endpoint to set price level NEW: Thirdparty REST API: endpoint to set price level
NEW: use new category API for project list view NEW: use new category API for project list view
NEW: Triggers Attributes and Attributes values NEW: Triggers Attributes and Attributes values
NEW: added incoterms data into the substitution array NEW: add incoterms data into the substitution array
NEW: add send context for ticket NEW: add send context for ticket
NEW: add a message in error_log after detection of SQL or script injection NEW: add a message in error_log after detection of SQL or script injection
NEW: add validation of MX domain for emails NEW: add validation of MX domain for emails
NEW: calculate the virtual stock in transverse mode ( not on getEntity('commande'), ... but on getEntity('stock') ) NEW: calculate the virtual stock in transverse mode ( not on getEntity('commande'), ... but on getEntity('stock') )
NEW: Graphics can be horizontal bars NEW: Graphics can be horizontal bars
NEW: add param to not show links when output tags
APIs APIs
NEW: API get contacts list of a given order NEW: API get contacts list of a given order
NEW: API endpoint getContacts and Clean results NEW: API endpoint getContacts and clean results
NEW: API can update a payment NEW: API can update a payment
NEW: API get member by thirdparty NEW: API get member by thirdparty
NEW: API get thirdparty by barcode NEW: API get thirdparty by barcode
NEW: API get users by email / login NEW: API get users by email / login
NEW: allow to edit field "demand reason" through API
NEW: fetch contact by email with REST API
NEW: get state by REST API
NEW: get state dictionary by REST API
NEW: improve Product API for product variants
HOOKs HOOKs
NEW: Hook on propal card NEW: add hook on propal card
NEW: add hooks on newpayment page to allow external payment modules NEW: add hooks on newpayment page to allow external payment modules
NEW: add hooks on stats pages NEW: add hooks on stats pages
NEW: add formConfirm hook on product page NEW: add formConfirm hook on product page
@ -249,6 +250,7 @@ Following changes may create regressions for some external modules, but were nec
* Function showStripePaymentUrl, getStripePaymentUrl, showPaypalPaymentUrl and getPaypalPaymentUrl has been removed. The generic one showOnlinePaymentUrl and getOnlinePaymentUrl are always used. * Function showStripePaymentUrl, getStripePaymentUrl, showPaypalPaymentUrl and getPaypalPaymentUrl has been removed. The generic one showOnlinePaymentUrl and getOnlinePaymentUrl are always used.
* Context for hook showSocinfoOnPrint has been moved from "showsocinfoonprint" to "main" * Context for hook showSocinfoOnPrint has been moved from "showsocinfoonprint" to "main"
* Library htdocs/includes/phpoffice/phpexcel as been removed (replaced with htdocs/includes/phpoffice/PhpSpreadsheet) * Library htdocs/includes/phpoffice/phpexcel as been removed (replaced with htdocs/includes/phpoffice/PhpSpreadsheet)
* Databse transaction in your triggers must be correctly balanced (one close for one open). If not, an error will be returned by the trigger, even if trigger did return error code.
***** ChangeLog for 12.0.4 compared to 12.0.3 ***** ***** ChangeLog for 12.0.4 compared to 12.0.3 *****

View File

@ -55,23 +55,23 @@ ONLY vulnerabilities discovered, when the following setup on test platform is us
* $dolibarr_nocsrfcheck must be kept to the value 0 into conf.php (this is the default value) * $dolibarr_nocsrfcheck must be kept to the value 0 into conf.php (this is the default value)
* $dolibarr_main_force_https must be set to something else than 0. * $dolibarr_main_force_https must be set to something else than 0.
* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 1 into backoffice menu Home - Setup - Other (this protection should be set to 1 soon by default) * The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 1 into backoffice menu Home - Setup - Other (this protection should be set to 1 soon by default)
* The module DebugBar must NOT be enabled (by default, this module is not enabled. This is a developer tool) * The module DebugBar and ModuleBuilder must NOT be enabled (by default, this module is not enabled. This is a developer tool)
* The module ModuleBuilder must NOT be enabled (by default, this module is not enabled. This is a developer tool)
* ONLY security reports on modules provided by default and with the "stable" status are valid (troubles into "experimental", "developement" or external modules are not valid vulnerabilities). * ONLY security reports on modules provided by default and with the "stable" status are valid (troubles into "experimental", "developement" or external modules are not valid vulnerabilities).
* The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer). * The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer).
* The web server setup must be done so only the documents directory is in write mode. The root directory called htdocs must be readonly. * The web server setup must be done so only the documents directory is in write mode. The root directory called htdocs must be readonly.
* CSRF attacks are accepted for all when using a POST URL, but when using GET URL, they are validated only for creating or updating data resctricted to the admin user. * CSRF attacks are accepted when using a POST URL, but when using GET URL, they are validated only for creating, updating or deleting data resctricted from pages restricted to admin users.
* Ability for a high level user to edit web site pages into the CMS by including HTML or Javascript is an expected feature. Vulnerabilities into the website module are validated only if HTML or Javascript injection can be done by a non allowed user. * Ability for a high level user to edit web site pages into the CMS by including HTML or Javascript is an expected feature. Vulnerabilities into the website module are validated only if HTML or Javascript injection can be done by a non allowed user.
Scope is the web application (back office) and the APIs. Scope is the web application (back office) and the APIs.
## Qualifying vulnerabilities for Bug bounty programs ## Qualifying vulnerabilities for Bug bounty programs
* Remote code execution (RCE) * Remote code execution (RCE)
* Local files access and manipulation (LFI, RFI, XXE, SSRF, XSPA) * Local files access and manipulation (LFI, RFI, XXE, SSRF, XSPA)
* Code injections (HTML, JS, SQL, PHP, ...) * Code injections (HTML, JS, SQL, PHP, ...)
* Cross-Site Scripting (XSS) * Cross-Site Scripting (XSS)
* Cross-Site Requests Forgery (CSRF) with real security impact * Cross-Site Requests Forgery (CSRF) with real security impact (when using GET URLs, CSRF are qualified only for creating, updating or deleting data from pages restricted to admin users)
* Open redirect * Open redirect
* Broken authentication & session management * Broken authentication & session management
* Insecure direct object references * Insecure direct object references
@ -83,6 +83,7 @@ Scope is the web application (back office) and the APIs.
## Non-qualifying vulnerabilities for Bug bounty programs, but qualified for reporting ## Non-qualifying vulnerabilities for Bug bounty programs, but qualified for reporting
* "Self" XSS * "Self" XSS
* SSL/TLS best practices * SSL/TLS best practices
* Denial of Service attacks * Denial of Service attacks

102
build.xml
View File

@ -1,102 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Script build for hudson CI -->
<project name="dolibarr" default="hudson" basedir=".">
<!-- Exclude/ignore paths -->
<property name="ignorepaths" value="${basedir}/htdocs/conf,${basedir}/htdocs/core/filemanagerdol,${basedir}/htdocs/includes" />
<property name="ignoreregexp" value="**/PEAR/*,**/NET/*,**/HTTP/*,**/zendgdata/*,**/reportico/*" />
<target name="clean">
<!-- Clean up -->
<delete dir="${basedir}/hudson"/>
<delete dir="${basedir}/generatedJUnitFiles"/>
<!-- Create build directories -->
<mkdir dir="${basedir}/hudson/doxygen"/>
<mkdir dir="${basedir}/hudson/logs"/>
<mkdir dir="${basedir}/hudson/coverage"/>
</target>
<!-- Run phpmd, phpcpd, phpcs, doxygen and phploc in parallel -->
<target name="parallelTasks">
<parallel>
<!-- <antcall target="phpmd"/> -->
<antcall target="phpcpd"/>
<!-- <antcall target="phpcs"/> -->
<antcall target="doxygen"/>
<antcall target="phploc"/>
</parallel>
</target>
<!-- Generate pmd.xml -->
<!--
<target name="phpmd">
<exec executable="phpmd">
<arg line="htdocs xml codesize,unusedcode
-\-reportfile '${basedir}/hudson/logs/pmd.xml'
-\-ignore=${ignorepaths}
" />
</exec>
</target>
-->
<!-- Generate pmd-cpd.xml -->
<target name="phpcpd">
<exec executable="phpcpd">
<arg line=" --log-pmd '${basedir}/hudson/logs/pmd-cpd.xml'
--exclude '${basedir}/htdocs/conf'
--exclude '${basedir}/htdocs/core/filemanagerdol'
--exclude '${basedir}/htdocs/includes'
--exclude '**/PEAR/*,**/NET/*,**/HTTP/*,**/zendgdata/*,**/reportico/*'
--min-tokens 70
--min-lines 20
htdocs
" />
</exec>
</target>
<!-- Generate phploc.csv -->
<target name="phploc">
<exec executable="phploc">
<arg line=" --log-csv '${basedir}/hudson/logs/phploc.csv'
--exclude '${basedir}/htdocs/conf'
--exclude '${basedir}/htdocs/core/filemanagerdol'
--exclude '${basedir}/htdocs/includes'
--exclude '**/PEAR/*,**/NET/*,**/HTTP/*,**/zendgdata/*,**/reportico/*'
htdocs
" />
</exec>
</target>
<!-- Generate checkstyle.xml -->
<target name="phpcs">
<exec executable="phpcs" dir="${basedir}">
<arg line=" --standard=${basedir}/dev/codesniffer/jenkins_ruleset.xml
--report=checkstyle
--report-file=${basedir}/hudson/logs/checkstyle.xml
--ignore=${ignorepaths},${ignoreregexp}
htdocs
"/>
</exec>
</target>
<!-- Run unit tests and generate junit.xml and clover.xml -->
<target name="phpunit">
<exec executable="phpunit" dir="${basedir}" failonerror="true">
<arg line=" --configuration ${basedir}/test/phpunit/phpunittest.xml
--log-junit ${basedir}/hudson/logs/junit.xml
--coverage-clover ${basedir}/hudson/coverage/clover.xml
--coverage-html ${basedir}/hudson/coverage/
test/phpunit/AllTests.php
"/>
</exec>
</target>
<!-- Generate Doxygen documentation -->
<target name="doxygen" description="Dolibarr documentation" >
<exec executable="doxygen" dir="${basedir}" failonerror="false">
<arg value="${basedir}/build/doxygen/jenkins_doxygen.doxyfile"/>
</exec>
</target>
<target name="hudson" depends="clean,phpunit,phpcs,parallelTasks"/>
</project>

View File

@ -7,6 +7,9 @@ Building packages
################################################## ##################################################
All sub-directories of "build" directory contains files (setup or binary tools) required to build automatically Dolibarr packages. All sub-directories of "build" directory contains files (setup or binary tools) required to build automatically Dolibarr packages.
The build directory and all its contents is absolutely not required to make Dolibarr working.
It is here only to build Dolibarr packages, and those generated packages will not contains this "build" directory.
There are several tools: There are several tools:
@ -17,8 +20,7 @@ There are several tools:
-------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------
Prerequisites to build tgz, debian, rpm package: Prerequisites to build tgz, debian and rpm packages:
> apt-get install tar dpkg dpatch p7zip-full rpm zip > apt-get install tar dpkg dpatch p7zip-full rpm zip
@ -58,10 +60,6 @@ Prerequisites to build autoexe DoliWamp package:
-------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------
Note:
The build directory and all its contents is absolutely not required to make Dolibarr working.
It is here only to build Dolibarr packages, and those generated packages will not contains this "build" directory.
You can find in "build", following sub-directories: You can find in "build", following sub-directories:

View File

@ -292,6 +292,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/product %_datadir/dolibarr/htdocs/product
%_datadir/dolibarr/htdocs/projet %_datadir/dolibarr/htdocs/projet
%_datadir/dolibarr/htdocs/public %_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/recruitment
%_datadir/dolibarr/htdocs/reception %_datadir/dolibarr/htdocs/reception
%_datadir/dolibarr/htdocs/resource %_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/salaries %_datadir/dolibarr/htdocs/salaries

View File

@ -209,6 +209,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/product %_datadir/dolibarr/htdocs/product
%_datadir/dolibarr/htdocs/projet %_datadir/dolibarr/htdocs/projet
%_datadir/dolibarr/htdocs/public %_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/recruitment
%_datadir/dolibarr/htdocs/reception %_datadir/dolibarr/htdocs/reception
%_datadir/dolibarr/htdocs/resource %_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/salaries %_datadir/dolibarr/htdocs/salaries

View File

@ -220,6 +220,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/product %_datadir/dolibarr/htdocs/product
%_datadir/dolibarr/htdocs/projet %_datadir/dolibarr/htdocs/projet
%_datadir/dolibarr/htdocs/public %_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/recruitment
%_datadir/dolibarr/htdocs/reception %_datadir/dolibarr/htdocs/reception
%_datadir/dolibarr/htdocs/resource %_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/salaries %_datadir/dolibarr/htdocs/salaries

View File

@ -1,13 +1,14 @@
README (English) README (English)
-------------------------------- --------------------------------
This directory contains sub-directories to provide tools or
documentation for developers.
Note: All files in this directory are in VCS only and are not
provided with a standard release.
This directory contains sub-directories to provide tools or documentation for developers.
Note: All files in this directory are in the source repository only and are not provided with a standard release. They are useless to make Dolibarr working.
You may find a more complete documentation on Dolibarr on the wiki:
There is also some documentation on Dolibarr Wiki:
https://wiki.dolibarr.org/ https://wiki.dolibarr.org/
and
https://doxygen.dolibarr.org/
and on
https://doxygen.dolibarr.org/

View File

@ -50,6 +50,13 @@ Replace call to serialize_val with no bugged value
* In all files, replace constructor names into __construct. Replace also parent::constructor_name with parent::__construct * In all files, replace constructor names into __construct. Replace also parent::constructor_name with parent::__construct
* Line 4222 of file nusoap.php
$rev = array();
preg_match('/\$Revision: ([^ ]+)/', $this->revision, $rev);
$this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".(isset($rev[1]) ? $rev[1] : '').")";
TCPDF: TCPDF:
@ -126,17 +133,15 @@ with
} }
} }
elseif (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { elseif (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) {
* In tecnickcom/tcpdf/include/tcpdf_static, in function fopenLocal, replace * In tecnickcom/tcpdf/include/tcpdf_static.php, in function fopenLocal, replace
if (strpos($filename, '://') === false) { if (strpos($filename, '://') === false) {
with with
if (strpos($filename, '//') === 0) if (strpos($filename, '//') === 0) {
{
// Share folder on a (windows) server // Share folder on a (windows) server
// e.g.: "//[MyServerName]/[MySharedFolder]/" // e.g.: "//[MyServerName]/[MySharedFolder]/"
// //
@ -168,17 +173,17 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php
TCPDI: TCPDI:
------ ------
Add fpdf_tpl.php 1.2 Add file fpdf_tpl.php 1.2
Add tcpdi.php Add file tcpdi.php
Add tcpdi_parser.php and replace: Add file tcpdi_parser.php and replace:
require_once(dirname(__FILE__).'/include/tcpdf_filters.php'); require_once(dirname(__FILE__).'/include/tcpdf_filters.php');
with: with:
require_once(dirname(__FILE__).'/../tecnickcom/tcpdf/include/tcpdf_filters.php'); require_once(dirname(__FILE__).'/../tecnickcom/tcpdf/include/tcpdf_filters.php');
* Fix by replacing * Fix syntax error by replacing
} elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1] >= 2))) { } elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1] >= 2))) {
with with
} elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1]) >= 2)) { } elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1]) >= 2)) {
@ -188,23 +193,23 @@ with
JSGANTT: JSGANTT:
-------- --------
* Replace in function JSGantt.taskLink * Replace in function JSGantt.taskLink
var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth); var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth);
with 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 * Replace
vTmpDiv=this.newNode(vTmpCell, 'div', null, null, vTaskList[i].getResource()); vTmpDiv=this.newNode(vTmpCell, 'div', null, null, vTaskList[i].getResource());
with with
var vTmpNode=this.newNode(vTmpCell, 'div', null, ''); var vTmpNode=this.newNode(vTmpCell, 'div', null, '');
vTmpNode=this.newNode(vTmpNode, 'a', null, '', vLangs[vLang]['moreinfo']); vTmpNode=this.newNode(vTmpNode, 'a', null, '', vLangs[vLang]['moreinfo']);
vTmpNode.setAttribute('href',vTaskList[i].getLink()); vTmpNode.setAttribute('href',vTaskList[i].getLink());
* Replace '% Comp.' to have a smaller text column header * Replace '% Comp.' to have a smaller text column header
'comp':'% Comp.' 'comp':'% Comp.'
with with
'comp':'%' 'comp':'%'
@ -229,11 +234,21 @@ Change content of file htdocs/includes/restler/framework/Luracast/Restler/explor
public static function getShortName($className) public static function getShortName($className)
{ {
// @CHANGE LDR // @CHANGE LDR
if (! is_string($className)) return; if (!is_string($className)) return;
//var_dump($className); //var_dump($className);
* Add line into Data/Text.php to complete function
public static function endsWith($haystack, $needle)
{
$length = strlen($needle);
if ($length == 0) {
return true;
}
// @CHANGE LDR
if (!is_string($haystack)) return false;
PARSEDOWN PARSEDOWN
--------- ---------
@ -299,7 +314,7 @@ SELECT2
Edit CSS to restore line removed between 4.0.5 and 4.0.6. It generates this bug: https://github.com/select2/select2/issues/5832 Edit CSS to restore line removed between 4.0.5 and 4.0.6. It generates this bug: https://github.com/select2/select2/issues/5832
.select2-hidden-accessible { .select2-hidden-accessible {
margin: -1px !important; /* line to restore */ margin: -10000px !important; /* line to restore */
} }

View File

@ -12,6 +12,11 @@ The script initdemo.sh will erase current database with data into mysqldump_doli
Do a chmod 700 initdemo.sh Do a chmod 700 initdemo.sh
then run ./initdemo.sh to launch Graphic User Interface. then run ./initdemo.sh to launch Graphic User Interface.
After loading the demo files, admin login may be:
- admin / admin
or
- admin / adminadmin
*** Save demo *** Save demo

View File

@ -53,7 +53,7 @@ then
DIALOG="$DIALOG --ascii-lines" DIALOG="$DIALOG --ascii-lines"
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$ fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15 trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Init Dolibarr with demo values" --clear \ $DIALOG --title "Reset login password" --clear \
--inputbox "Mysql database name :" 16 55 dolibarrdemo 2> $fichtemp --inputbox "Mysql database name :" 16 55 dolibarrdemo 2> $fichtemp
valret=$? valret=$?
case $valret in case $valret in
@ -70,7 +70,7 @@ then
DIALOG=${DIALOG=dialog} DIALOG=${DIALOG=dialog}
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$ fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15 trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Init Dolibarr with demo values" --clear \ $DIALOG --title "Reset login password" --clear \
--inputbox "Mysql port (ex: 3306):" 16 55 3306 2> $fichtemp --inputbox "Mysql port (ex: 3306):" 16 55 3306 2> $fichtemp
valret=$? valret=$?
@ -128,7 +128,7 @@ then
# ---------------------------- confirmation # ---------------------------- confirmation
DIALOG=${DIALOG=dialog} DIALOG=${DIALOG=dialog}
$DIALOG --title "Init demo login with demo values" --clear \ $DIALOG --title "Reset login password" --clear \
--yesno "Do you confirm ? \n Mysql database : '$base' \n Mysql port : '$port' \n Demo login: '$demologin' \n Demo password : '$demopass'" 15 55 --yesno "Do you confirm ? \n Mysql database : '$base' \n Mysql port : '$port' \n Demo login: '$demologin' \n Demo password : '$demopass'" 15 55
case $? in case $? in

Binary file not shown.

View File

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="INSTAT">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Envelope"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Envelope">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="envelopeId"/>
<xsd:element ref="DateTime"/>
<xsd:element ref="Party"/>
<xsd:element ref="softwareUsed" minOccurs="0"/>
<xsd:element ref="Declaration" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="envelopeId" type="xsd:string"/>
<xsd:element name="DateTime">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="date"/>
<xsd:element ref="time" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Party">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="partyId"/>
<xsd:element ref="partyName"/>
</xsd:sequence>
<xsd:attribute name="partyType" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="PSI"/>
<xsd:enumeration value="TDP"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="partyRole" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="sender"/>
<xsd:enumeration value="PSI"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="partyId" type="xsd:string"/>
<xsd:element name="partyName" type="xsd:string"/>
<xsd:element name="softwareUsed" type="xsd:string"/>
<xsd:element name="Declaration">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="declarationId"/>
<xsd:element ref="referencePeriod"/>
<xsd:element ref="PSIId"/>
<xsd:element ref="Function"/>
<xsd:element ref="declarationTypeCode"/>
<xsd:element ref="flowCode"/>
<xsd:element ref="currencyCode"/>
<xsd:element ref="Item" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="declarationId" type="xsd:string"/>
<xsd:element name="referencePeriod" type="xsd:string"/>
<xsd:element name="PSIId" type="xsd:string"/>
<xsd:element name="Function">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="functionCode"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="functionCode" type="xsd:string"/>
<xsd:element name="declarationTypeCode" type="xsd:string"/>
<xsd:element name="flowCode" type="xsd:string"/>
<xsd:element name="currencyCode" type="xsd:string"/>
<xsd:element name="Item">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="itemNumber"/>
<xsd:element ref="CN8" minOccurs="0"/>
<xsd:element ref="MSConsDestCode" minOccurs="0"/>
<xsd:element ref="countryOfOriginCode" minOccurs="0"/>
<xsd:element ref="netMass" minOccurs="0"/>
<xsd:element ref="quantityInSU" minOccurs="0"/>
<xsd:element ref="invoicedAmount"/>
<xsd:element ref="partnerId" minOccurs="0"/>
<xsd:element ref="invoicedNumber" minOccurs="0"/>
<xsd:element ref="statisticalProcedureCode" />
<xsd:element ref="NatureOfTransaction" minOccurs="0"/>
<xsd:element ref="modeOfTransportCode" minOccurs="0"/>
<xsd:element ref="regionCode" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="itemNumber" type="xsd:integer"/>
<xsd:element name="CN8">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="CN8Code" minOccurs="0"/>
<xsd:element ref="SUCode" minOccurs="0"/>
<xsd:element ref="additionalGoodsCode" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="CN8Code" type="xsd:string"/>
<xsd:element name="SUCode" type="xsd:string"/>
<xsd:element name="additionalGoodsCode" type="xsd:string"/>
<xsd:element name="MSConsDestCode" type="xsd:string"/>
<xsd:element name="countryOfOriginCode" type="xsd:string"/>
<xsd:element name="netMass" type="xsd:integer"/>
<xsd:element name="quantityInSU" type="xsd:integer"/>
<xsd:element name="invoicedAmount" type="xsd:integer"/>
<xsd:element name="partnerId" type="xsd:string"/>
<xsd:element name="invoicedNumber" type="xsd:string"/>
<xsd:element name="statisticalProcedureCode" type="xsd:integer"/>
<xsd:element name="NatureOfTransaction">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="natureOfTransactionACode"/>
<xsd:element ref="natureOfTransactionBCode" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="natureOfTransactionACode" type="xsd:string"/>
<xsd:element name="natureOfTransactionBCode" type="xsd:string"/>
<xsd:element name="modeOfTransportCode" type="xsd:string"/>
<xsd:element name="regionCode" type="xsd:string"/>
<xsd:element name="date" type="xsd:date"/>
<xsd:element name="time" type="xsd:time"/>
</xsd:schema>

View File

@ -6,7 +6,7 @@
<exclude-pattern type="relative">build/html</exclude-pattern> <exclude-pattern type="relative">build/html</exclude-pattern>
<exclude-pattern type="relative">build/aps</exclude-pattern> <exclude-pattern type="relative">build/aps</exclude-pattern>
<exclude-pattern type="relative">dev/namespacemig</exclude-pattern> <exclude-pattern type="relative">dev/tools/test/namespacemig</exclude-pattern>
<exclude-pattern type="relative">dev/initdata/dbf/includes</exclude-pattern> <exclude-pattern type="relative">dev/initdata/dbf/includes</exclude-pattern>
<exclude-pattern type="relative">documents</exclude-pattern> <exclude-pattern type="relative">documents</exclude-pattern>
<exclude-pattern type="relative">htdocs/core/class/lessc.class.php</exclude-pattern> <exclude-pattern type="relative">htdocs/core/class/lessc.class.php</exclude-pattern>

View File

@ -15,6 +15,9 @@ function faaa()
return 'faaa'; return 'faaa';
} }
/**
* Class Aaa
*/
class Aaa class Aaa
{ {
const AAA='aaa'; const AAA='aaa';

View File

@ -12,6 +12,9 @@ function fbbb()
return 'fbbb'; return 'fbbb';
} }
/**
* Class Bbb
*/
class Bbb class Bbb
{ {
const BBB='bbb'; const BBB='bbb';

View File

@ -6,18 +6,15 @@
</head> </head>
<body> <body>
This directory contains several subdirectories with entries for This directory contains several subdirectories with entries for informations on Dolibarr.<br>
informations on Dolibarr.<br> But if you are looking for other resources (downloads, documentation, addons, ...), you can find this on Internet on web following sites:<br>
But if you are looking for other resources (downloads, documentation, addons, ...), you can find this
on Internet on web following sites:<br>
<br>
* <a href="https://wiki.dolibarr.org">Dolibarr wiki (documentation)</a><br>
<br> <br>
* <a href="https://www.dolibarr.org">Dolibarr portal (official website)</a><br> * <a href="https://www.dolibarr.org">Dolibarr portal (official website)</a><br>
<br> <br>
* <a href="https://demo.dolibarr.org">Dolibarr demo (online)</a><br> * <a href="https://wiki.dolibarr.org">Dolibarr wiki (documentation)</a><br>
<br> <br>
* <a href="https://www.nltechno.com/pages/dolibarrwinbin.php">DoliWamp, the Dolibarr for Windows</a><br> * <a href="https://demo.dolibarr.org">Dolibarr demo (online)</a><br>
<br> <br>
* <a href="https://www.dolistore.com">DoliStore (official addons/plugins market place)</a><br> * <a href="https://www.dolistore.com">DoliStore (official addons/plugins market place)</a><br>

View File

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
$error = 0; $error = 0;
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("bills", "accountancy")); $langs->loadLangs(array("bills", "accountancy", "compta"));
$mesg = ''; $mesg = '';
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
@ -41,7 +41,9 @@ $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
$rowid = GETPOST('rowid', 'int'); $rowid = GETPOST('rowid', 'int');
$cancel = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
$accountingaccount = GETPOST('accountingaccount', 'alpha');
$account_number = GETPOST('account_number', 'string');
$label = GETPOST('label', 'alpha');
// Security check // Security check
if ($user->socid > 0) accessforbidden(); if ($user->socid > 0) accessforbidden();
@ -65,104 +67,118 @@ if (GETPOST('cancel', 'alpha'))
if ($action == 'add' && $user->rights->accounting->chartofaccount) if ($action == 'add' && $user->rights->accounting->chartofaccount)
{ {
if (!$cancel) { if (!$cancel) {
$sql = 'SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$conf->global->CHARTOFACCOUNTS; if (!$account_number)
dol_syslog('accountancy/admin/card.php:: $sql='.$sql);
$result = $db->query($sql);
$obj = $db->fetch_object($result);
// Clean code
// To manage zero or not at the end of the accounting account
if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1)
{ {
$account_number = GETPOST('account_number', 'string'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors');
$action = 'create';
} elseif (!$label)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
$action = 'create';
} else { } else {
$account_number = clean_account(GETPOST('account_number', 'string')); $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
}
if (GETPOST('account_parent', 'int') <= 0) dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
{ $result = $db->query($sql);
$account_parent = 0; $obj = $db->fetch_object($result);
} else {
$account_parent = GETPOST('account_parent', 'int');
}
$object->fk_pcg_version = $obj->pcg_version; // Clean code
$object->pcg_type = GETPOST('pcg_type', 'alpha');
$object->account_number = $account_number;
$object->account_parent = $account_parent;
$object->account_category = GETPOST('account_category', 'alpha');
$object->label = GETPOST('label', 'alpha');
$object->labelshort = GETPOST('labelshort', 'alpha');
$object->active = 1;
$res = $object->create($user); // To manage zero or not at the end of the accounting account
if ($res == - 3) { if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1) {
$error = 1; $account_number = $account_number;
$action = "create"; } else {
setEventMessages($object->error, $object->errors, 'errors'); $account_number = clean_account($account_number);
} elseif ($res == - 4) { }
$error = 2;
$action = "create"; if (GETPOST('account_parent', 'int') <= 0) {
setEventMessages($object->error, $object->errors, 'errors'); $account_parent = 0;
} elseif ($res < 0) } else {
{ $account_parent = GETPOST('account_parent', 'int');
$error++; }
setEventMessages($object->error, $object->errors, 'errors');
$action = "create"; $object->fk_pcg_version = $obj->pcg_version;
} $object->pcg_type = GETPOST('pcg_type', 'alpha');
if (!$error) $object->account_number = $account_number;
{ $object->account_parent = $account_parent;
setEventMessages("RecordCreatedSuccessfully", null, 'mesgs'); $object->account_category = GETPOST('account_category', 'alpha');
$urltogo = $backtopage ? $backtopage : dol_buildpath('/accountancy/admin/account.php', 1); $object->label = $label;
header("Location: ".$urltogo); $object->labelshort = GETPOST('labelshort', 'alpha');
exit; $object->active = 1;
$res = $object->create($user);
if ($res == -3) {
$error = 1;
$action = "create";
setEventMessages($object->error, $object->errors, 'errors');
} elseif ($res == -4) {
$error = 2;
$action = "create";
setEventMessages($object->error, $object->errors, 'errors');
} elseif ($res < 0) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
$action = "create";
}
if (!$error) {
setEventMessages("RecordCreatedSuccessfully", null, 'mesgs');
$urltogo = $backtopage ? $backtopage : dol_buildpath('/accountancy/admin/account.php', 1);
header("Location: " . $urltogo);
exit;
}
} }
} }
} elseif ($action == 'edit' && $user->rights->accounting->chartofaccount) { } elseif ($action == 'edit' && $user->rights->accounting->chartofaccount) {
if (!$cancel) { if (!$cancel) {
$result = $object->fetch($id); if (!$account_number)
$sql = 'SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$conf->global->CHARTOFACCOUNTS;
dol_syslog('accountancy/admin/card.php:: $sql='.$sql);
$result2 = $db->query($sql);
$obj = $db->fetch_object($result2);
// Clean code
// To manage zero or not at the end of the accounting account
if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1)
{ {
$account_number = GETPOST('account_number', 'string'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors');
} else { $action = 'update';
$account_number = clean_account(GETPOST('account_number', 'string')); } elseif (!$label)
}
if (GETPOST('account_parent', 'int') <= 0)
{ {
$account_parent = 0; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
$action = 'update';
} else { } else {
$account_parent = GETPOST('account_parent', 'int'); $result = $object->fetch($id);
}
$object->fk_pcg_version = $obj->pcg_version; $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
$object->pcg_type = GETPOST('pcg_type', 'alpha');
$object->account_number = $account_number;
$object->account_parent = $account_parent;
$object->account_category = GETPOST('account_category', 'alpha');
$object->label = GETPOST('label', 'alpha');
$object->labelshort = GETPOST('labelshort', 'alpha');
$result = $object->update($user); dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
$result2 = $db->query($sql);
$obj = $db->fetch_object($result2);
if ($result > 0) { // Clean code
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id);
header("Location: ".$urltogo); // To manage zero or not at the end of the accounting account
exit(); if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1) {
} else { $account_number = $account_number;
$mesg = $object->error; } else {
$account_number = clean_account($account_number);
}
if (GETPOST('account_parent', 'int') <= 0) {
$account_parent = 0;
} else {
$account_parent = GETPOST('account_parent', 'int');
}
$object->fk_pcg_version = $obj->pcg_version;
$object->pcg_type = GETPOST('pcg_type', 'alpha');
$object->account_number = $account_number;
$object->account_parent = $account_parent;
$object->account_category = GETPOST('account_category', 'alpha');
$object->label = $label;
$object->labelshort = GETPOST('labelshort', 'alpha');
$result = $object->update($user);
if ($result > 0) {
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"] . "?id=" . $id);
header("Location: " . $urltogo);
exit();
} else {
$mesg = $object->error;
}
} }
} else { } else {
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id); $urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id);
@ -222,7 +238,7 @@ if ($action == 'create') {
// Account number // Account number
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("AccountNumber").'</span></td>'; print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("AccountNumber").'</span></td>';
print '<td><input name="account_number" size="30" value="'.$accountingaccount.'"></td></tr>'; print '<td><input name="account_number" size="30" value="'.$account_number.'"></td></tr>';
// Label // Label
print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td>'; print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td>';
@ -238,18 +254,18 @@ if ($action == 'create') {
print $formaccounting->select_account($object->account_parent, 'account_parent', 1, null, 0, 0, 'minwidth200'); print $formaccounting->select_account($object->account_parent, 'account_parent', 1, null, 0, 0, 'minwidth200');
print '</td></tr>'; print '</td></tr>';
// Category
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
print '<td>';
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1);
print '</td></tr>';
// Chart of accounts type // Chart of accounts type
print '<tr><td>'.$langs->trans("Pcgtype").'</td>'; print '<tr><td>'.$langs->trans("Pcgtype").'</td>';
print '<td>'; print '<td>';
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">'; print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
print '</td></tr>'; print '</td></tr>';
// Category
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
print '<td>';
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1);
print '</td></tr>';
print '</table>'; print '</table>';
print dol_get_fiche_end(); print dol_get_fiche_end();
@ -300,18 +316,18 @@ if ($action == 'create') {
print $formaccounting->select_account($object->account_parent, 'account_parent', 1); print $formaccounting->select_account($object->account_parent, 'account_parent', 1);
print '</td></tr>'; print '</td></tr>';
// Category
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
print '<td>';
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
print '</td></tr>';
// Chart of accounts type // Chart of accounts type
print '<tr><td>'.$langs->trans("Pcgtype").'</td>'; print '<tr><td>'.$langs->trans("Pcgtype").'</td>';
print '<td>'; print '<td>';
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">'; print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
print '</td></tr>'; print '</td></tr>';
// Category
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
print '<td>';
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
print '</td></tr>';
print '</table>'; print '</table>';
print dol_get_fiche_end(); print dol_get_fiche_end();

View File

@ -37,8 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->loadLangs(array("compta", "bills", "admin", "accountancy", "other")); $langs->loadLangs(array("compta", "bills", "admin", "accountancy", "other"));
// Security access // Security access
if (empty($user->rights->accounting->chartofaccount)) if (empty($user->rights->accounting->chartofaccount)) {
{
accessforbidden(); accessforbidden();
} }
@ -48,8 +47,9 @@ $action = GETPOST('action', 'aZ09');
$list = array( $list = array(
'ACCOUNTING_LENGTH_GACCOUNT', 'ACCOUNTING_LENGTH_GACCOUNT',
'ACCOUNTING_LENGTH_AACCOUNT', 'ACCOUNTING_LENGTH_AACCOUNT',
// 'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc // 'ACCOUNTING_LIMIT_LIST_VENTILATION' // there is already a global parameter to define the nb of records in lists, we must use it in priority. Having one parameter for nb of record for each page is deprecated.
// 'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc // 'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc
// 'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc
); );
$list_binding = array( $list_binding = array(
@ -64,10 +64,8 @@ $list_binding = array(
if ($action == 'update') { if ($action == 'update') {
$error = 0; $error = 0;
if (!$error) if (!$error) {
{ foreach ($list as $constname) {
foreach ($list as $constname)
{
$constvalue = GETPOST($constname, 'alpha'); $constvalue = GETPOST($constname, 'alpha');
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
@ -78,8 +76,7 @@ if ($action == 'update') {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
foreach ($list_binding as $constname) foreach ($list_binding as $constname) {
{
$constvalue = GETPOST($constname, 'alpha'); $constvalue = GETPOST($constname, 'alpha');
if ($constname == 'ACCOUNTING_DATE_START_BINDING') { if ($constname == 'ACCOUNTING_DATE_START_BINDING') {
@ -103,8 +100,9 @@ if ($action == 'update') {
if ($action == 'setlistsorttodo') { if ($action == 'setlistsorttodo') {
$setlistsorttodo = GETPOST('value', 'int'); $setlistsorttodo = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity);
if (!$res > 0) if (!$res > 0) {
$error++; $error++;
}
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
@ -116,8 +114,9 @@ if ($action == 'setlistsorttodo') {
if ($action == 'setlistsortdone') { if ($action == 'setlistsortdone') {
$setlistsortdone = GETPOST('value', 'int'); $setlistsortdone = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity);
if (!$res > 0) if (!$res > 0) {
$error++; $error++;
}
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -128,8 +127,9 @@ if ($action == 'setlistsortdone') {
if ($action == 'setmanagezero') { if ($action == 'setmanagezero') {
$setmanagezero = GETPOST('value', 'int'); $setmanagezero = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity);
if (!$res > 0) if (!$res > 0) {
$error++; $error++;
}
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -140,8 +140,9 @@ if ($action == 'setmanagezero') {
if ($action == 'setdisabledirectinput') { if ($action == 'setdisabledirectinput') {
$setdisabledirectinput = GETPOST('value', 'int'); $setdisabledirectinput = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity);
if (!$res > 0) if (!$res > 0) {
$error++; $error++;
}
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -152,8 +153,9 @@ if ($action == 'setdisabledirectinput') {
if ($action == 'setenabledraftexport') { if ($action == 'setenabledraftexport') {
$setenabledraftexport = GETPOST('value', 'int'); $setenabledraftexport = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport, 'yesno', 0, '', $conf->entity);
if (!$res > 0) if (!$res > 0) {
$error++; $error++;
}
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -164,8 +166,9 @@ if ($action == 'setenabledraftexport') {
if ($action == 'setenablesubsidiarylist') { if ($action == 'setenablesubsidiarylist') {
$setenablesubsidiarylist = GETPOST('value', 'int'); $setenablesubsidiarylist = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTANCY_COMBO_FOR_AUX", $setenablesubsidiarylist, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTANCY_COMBO_FOR_AUX", $setenablesubsidiarylist, 'yesno', 0, '', $conf->entity);
if (!$res > 0) if (!$res > 0) {
$error++; $error++;
}
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -176,8 +179,9 @@ if ($action == 'setenablesubsidiarylist') {
if ($action == 'setdisablebindingonsales') { if ($action == 'setdisablebindingonsales') {
$setdisablebindingonsales = GETPOST('value', 'int'); $setdisablebindingonsales = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_SALES", $setdisablebindingonsales, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_SALES", $setdisablebindingonsales, 'yesno', 0, '', $conf->entity);
if (!$res > 0) if (!$res > 0) {
$error++; $error++;
}
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -188,8 +192,9 @@ if ($action == 'setdisablebindingonsales') {
if ($action == 'setdisablebindingonpurchases') { if ($action == 'setdisablebindingonpurchases') {
$setdisablebindingonpurchases = GETPOST('value', 'int'); $setdisablebindingonpurchases = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_PURCHASES", $setdisablebindingonpurchases, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_PURCHASES", $setdisablebindingonpurchases, 'yesno', 0, '', $conf->entity);
if (!$res > 0) if (!$res > 0) {
$error++; $error++;
}
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -200,8 +205,9 @@ if ($action == 'setdisablebindingonpurchases') {
if ($action == 'setdisablebindingonexpensereports') { if ($action == 'setdisablebindingonexpensereports') {
$setdisablebindingonexpensereports = GETPOST('value', 'int'); $setdisablebindingonexpensereports = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS", $setdisablebindingonexpensereports, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS", $setdisablebindingonexpensereports, 'yesno', 0, '', $conf->entity);
if (!$res > 0) if (!$res > 0) {
$error++; $error++;
}
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -288,11 +294,12 @@ if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
print '</tr>'; print '</tr>';
// Param a user $user->rights->accounting->chartofaccount can access // Param a user $user->rights->accounting->chartofaccount can access
foreach ($list as $key) foreach ($list as $key) {
{
print '<tr class="oddeven value">'; print '<tr class="oddeven value">';
if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) continue; if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) {
continue;
}
// Param // Param
$label = $langs->trans($key); $label = $langs->trans($key);
@ -341,8 +348,7 @@ if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) {
print '</tr>'; print '</tr>';
// Param a user $user->rights->accounting->chartofaccount can access // Param a user $user->rights->accounting->chartofaccount can access
foreach ($list_binding as $key) foreach ($list_binding as $key) {
{
print '<tr class="oddeven value">'; print '<tr class="oddeven value">';
// Param // Param

View File

@ -372,26 +372,26 @@ if ($result)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Options').'</td><td>'.$langs->trans('Description').'</td>'; print '<td>'.$langs->trans('Options').'</td><td>'.$langs->trans('Description').'</td>';
print "</tr>\n"; print "</tr>\n";
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL"'.($accounting_product_mode == 'ACCOUNTANCY_SELL' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSell').'</td>'; print '<tr class="oddeven"><td><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL"'.($accounting_product_mode == 'ACCOUNTANCY_SELL' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSell').'</td>';
print '<td>'.$langs->trans('OptionModeProductSellDesc'); print '<td>'.$langs->trans('OptionModeProductSellDesc');
print "</td></tr>\n"; print "</td></tr>\n";
if ($mysoc->isInEEC()) if ($mysoc->isInEEC())
{ {
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_INTRA"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSellIntra').'</td>'; print '<tr class="oddeven"><td><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_INTRA"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSellIntra').'</td>';
print '<td>'.$langs->trans('OptionModeProductSellIntraDesc'); print '<td>'.$langs->trans('OptionModeProductSellIntraDesc');
print "</td></tr>\n"; print "</td></tr>\n";
} }
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_EXPORT"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSellExport').'</td>'; print '<tr class="oddeven"><td><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_EXPORT"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSellExport').'</td>';
print '<td>'.$langs->trans('OptionModeProductSellExportDesc'); print '<td>'.$langs->trans('OptionModeProductSellExportDesc');
print "</td></tr>\n"; print "</td></tr>\n";
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"'.($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuy').'</td>'; print '<tr class="oddeven"><td><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"'.($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuy').'</td>';
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n"; print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
if ($mysoc->isInEEC()) if ($mysoc->isInEEC())
{ {
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_INTRA"'.($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuyIntra').'</td>'; print '<tr class="oddeven"><td><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_INTRA"'.($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuyIntra').'</td>';
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n"; print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
} }
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_EXPORT"'.($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuyExport').'</td>'; print '<tr class="oddeven"><td><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_EXPORT"'.($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuyExport').'</td>';
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n"; print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
print "</table>\n"; print "</table>\n";

View File

@ -37,7 +37,7 @@ 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';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("accountancy")); $langs->loadLangs(array("accountancy", "compta"));
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha');
@ -78,7 +78,7 @@ $form = new Form($db);
if (empty($search_date_start) && !GETPOSTISSET('formfilteraction')) if (empty($search_date_start) && !GETPOSTISSET('formfilteraction'))
{ {
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; $sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'"; $sql .= " WHERE date_start < '".$db->idate(dol_now())."' AND date_end > '".$db->idate(dol_now())."'";
$sql .= $db->plimit(1); $sql .= $db->plimit(1);
$res = $db->query($sql); $res = $db->query($sql);
if ($res->num_rows > 0) { if ($res->num_rows > 0) {
@ -88,6 +88,7 @@ if (empty($search_date_start) && !GETPOSTISSET('formfilteraction'))
} else { } else {
$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');
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
$year_end = $year_start + 1; $year_end = $year_start + 1;
$month_end = $month_start - 1; $month_end = $month_start - 1;
if ($month_end < 1) if ($month_end < 1)
@ -242,10 +243,12 @@ if ($action != 'export_csv')
print '</div>'; print '</div>';
} }
$colspan = (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE) ? 5 : 4);
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">'; print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
print '<td class="liste_titre" colspan="5">'; print '<td class="liste_titre" colspan="'.$colspan.'">';
print $langs->trans('From'); print $langs->trans('From');
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, ''); print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, '');
print ' '; print ' ';
@ -261,7 +264,7 @@ if ($action != 'export_csv')
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("OpeningBalance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder); if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print_liste_field_titre("OpeningBalance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder);
@ -278,22 +281,30 @@ if ($action != 'export_csv')
$accountingaccountstatic = new AccountingAccount($db); $accountingaccountstatic = new AccountingAccount($db);
$sql = "SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance"; // TODO Debug - This feature is dangerous, it takes all the entries and adds all the accounts
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t"; // without time and class limits (Class 6 and 7 accounts ???) and does not take into account the "a-nouveau" journal.
$sql .= " WHERE t.entity = ".$conf->entity; // Never do sharing into accounting features if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
$sql .= " AND t.doc_date < '".$db->idate($search_date_start)."'"; $sql = "SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance";
$sql .= " GROUP BY t.numero_compte"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
$sql .= " WHERE t.entity = " . $conf->entity; // Never do sharing into accounting features
$sql .= " AND t.doc_date < '" . $db->idate($search_date_start) . "'";
$sql .= " GROUP BY t.numero_compte";
$resql = $db->query($sql); $resql = $db->query($sql);
$nrows = $resql->num_rows; $nrows = $resql->num_rows;
$opening_balances = array(); $opening_balances = array();
for ($i = 0; $i < $nrows; $i++) { for ($i = 0; $i < $nrows; $i++) {
$arr = $resql->fetch_array(); $arr = $resql->fetch_array();
$opening_balances["'".$arr['numero_compte']."'"] = $arr['opening_balance']; $opening_balances["'" . $arr['numero_compte'] . "'"] = $arr['opening_balance'];
}
} }
foreach ($object->lines as $line) foreach ($object->lines as $line)
{ {
// reset before the fetch (in case of the fetch fails)
$accountingaccountstatic->id = 0;
$accountingaccountstatic->account_number = '';
$accountingaccountstatic->fetch(null, $line->numero_compte, true); $accountingaccountstatic->fetch(null, $line->numero_compte, true);
if (!empty($accountingaccountstatic->account_number)) { if (!empty($accountingaccountstatic->account_number)) {
$accounting_account = $accountingaccountstatic->getNomUrl(0, 1); $accounting_account = $accountingaccountstatic->getNomUrl(0, 1);
@ -311,10 +322,11 @@ if ($action != 'export_csv')
$root_account_description = $tmparrayforrootaccount['label']; $root_account_description = $tmparrayforrootaccount['label'];
$root_account_number = $tmparrayforrootaccount['account_number']; $root_account_number = $tmparrayforrootaccount['account_number'];
if (empty($accountingaccountstatic->account_number)) { if (empty($accountingaccountstatic->label) && $accountingaccountstatic->id > 0) {
$link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?action=create&accountingaccount='.length_accountg($line->numero_compte).'">'.img_edit_add().'</a>'; $link = '<a class="editfielda reposition" href="' . DOL_URL_ROOT . '/accountancy/admin/card.php?action=update&token=' . newToken() . '&id=' . $accountingaccountstatic->id . '">' . img_edit() . '</a>';
} elseif (empty($tmparrayforrootaccount['label'])) {
$link = '<a href="' . DOL_URL_ROOT . '/accountancy/admin/card.php?action=create&token=' . newToken() . '&accountingaccount=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>';
} }
print '<tr class="oddeven">';
if (!empty($show_subgroup)) if (!empty($show_subgroup))
{ {
@ -323,17 +335,22 @@ if ($action != 'export_csv')
// Show subtotal per accounting account // Show subtotal per accounting account
if ($displayed_account != "") { if ($displayed_account != "") {
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td class="right" colspan="2">'.$langs->trans("SubTotal").':</td>'; print '<td class="right">'.$langs->trans("SubTotal").':</td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowrap right">'.price($sous_total_opening_balance).'</td>';
print '<td class="nowrap right">'.price($sous_total_debit).'</td>'; print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
print '<td class="nowrap right">'.price($sous_total_credit).'</td>'; print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
print '<td class="nowrap right">'.price(price2num($sous_total_opening_balance + $sous_total_credit - $sous_total_debit)).'</td>'; if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
print '<td class="nowrap right">'.price(price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit)).'</td>';
} else {
print '<td class="nowrap right">'.price(price2num($sous_total_debit - $sous_total_credit)).'</td>';
}
print "<td></td>\n"; print "<td></td>\n";
print '</tr>'; print '</tr>';
} }
// Show first line of a break // Show first line of a break
print '<tr class="trforbreak">'; print '<tr class="trforbreak">';
print '<td colspan="6" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>'; print '<td colspan="'.($colspan+1).'" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
print '</tr>'; print '</tr>';
$displayed_account = $root_account_number; $displayed_account = $root_account_number;
@ -343,11 +360,16 @@ if ($action != 'export_csv')
} }
} }
print '<tr class="oddeven">';
print '<td>'.$accounting_account.'</td>'; print '<td>'.$accounting_account.'</td>';
print '<td class="nowraponall right">'.price($opening_balance).'</td>'; if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowraponall right">'.price($opening_balance).'</td>';
print '<td class="nowraponall right">'.price($line->debit).'</td>'; print '<td class="nowraponall right">'.price($line->debit).'</td>';
print '<td class="nowraponall right">'.price($line->credit).'</td>'; print '<td class="nowraponall right">'.price($line->credit).'</td>';
print '<td class="nowraponall right">'.price(price2num($opening_balance + $line->debit - $line->credit, 'MT')).'</td>'; if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
print '<td class="nowraponall right">'.price(price2num($opening_balance + $line->debit - $line->credit, 'MT')).'</td>';
} else {
print '<td class="nowraponall right">'.price(price2num($line->debit - $line->credit, 'MT')).'</td>';
}
print '<td class="center">'.$link; print '<td class="center">'.$link;
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
@ -360,12 +382,28 @@ if ($action != 'export_csv')
if (!empty($show_subgroup)) if (!empty($show_subgroup))
{ {
print '<tr class="liste_total"><td class="right" colspan="2">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td><td class="nowrap right">'.price(price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit, 'MT')).'</td>'; print '<tr class="liste_total"><td class="right">'.$langs->trans("SubTotal").':</td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowrap right">'.price($sous_total_opening_balance).'</td>';
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
print '<td class="nowrap right">' . price(price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit, 'MT')) . '</td>';
} else {
print '<td class="nowrap right">' . price(price2num($sous_total_debit - $sous_total_credit, 'MT')) . '</td>';
}
print "<td></td>\n"; print "<td></td>\n";
print '</tr>'; print '</tr>';
} }
print '<tr class="liste_total"><td class="right" colspan="2">'.$langs->trans("AccountBalance").':</td><td class="nowrap right">'.price($total_debit).'</td><td class="nowrap right">'.price($total_credit).'</td><td class="nowrap right">'.price(price2num($total_opening_balance + $total_debit - $total_credit, 'MT')).'</td>'; print '<tr class="liste_total"><td class="right">'.$langs->trans("AccountBalance").':</td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowrap right">'.price($total_opening_balance).'</td>';
print '<td class="nowrap right">'.price($total_debit).'</td>';
print '<td class="nowrap right">'.price($total_credit).'</td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
print '<td class="nowrap right">' . price(price2num($total_opening_balance + $total_debit - $total_credit, 'MT')) . '</td>';
} else {
print '<td class="nowrap right">' . price(price2num($total_debit - $total_credit, 'MT')) . '</td>';
}
print "<td></td>\n"; print "<td></td>\n";
print '</tr>'; print '</tr>';

View File

@ -224,9 +224,10 @@ if ($action == "confirm_update") {
$action = 'create'; $action = 'create';
$error++; $error++;
} }
if (!GETPOST('next_num_mvt', 'alpha')) if (!GETPOST('doc_ref', 'alpha'))
{ {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumPiece")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Piece")), null, 'errors');
$action = 'create';
$error++; $error++;
} }
@ -371,7 +372,7 @@ if ($action == 'create')
print '</tr>'; print '</tr>';
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("Piece").'</td>'; print '<td class="fieldrequired">'.$langs->trans("Piece").'</td>';
print '<td><input type="text" class="minwidth200" name="doc_ref" value="'.GETPOST('doc_ref', 'alpha').'"></td>'; print '<td><input type="text" class="minwidth200" name="doc_ref" value="'.GETPOST('doc_ref', 'alpha').'"></td>';
print '</tr>'; print '</tr>';
@ -594,7 +595,8 @@ if ($action == 'create')
print '<input type="hidden" name="fk_docdet" value="'.$object->fk_docdet.'">'."\n"; print '<input type="hidden" name="fk_docdet" value="'.$object->fk_docdet.'">'."\n";
print '<input type="hidden" name="mode" value="'.$mode.'">'."\n"; print '<input type="hidden" name="mode" value="'.$mode.'">'."\n";
print "<table class=\"noborder\" width=\"100%\">"; print '<table class="noborder centpercent">';
if (count($object->linesmvt) > 0) { if (count($object->linesmvt) > 0) {
$total_debit = 0; $total_debit = 0;
$total_credit = 0; $total_credit = 0;
@ -616,18 +618,21 @@ if ($action == 'create')
$total_credit += $line->credit; $total_credit += $line->credit;
if ($action == 'update' && $line->id == $id) { if ($action == 'update' && $line->id == $id) {
print '<!-- td columns in edit mode -->';
print '<td>'; print '<td>';
print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, ''); print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, '');
print '</td>'; print '</td>';
print '<td>'; print '<td>';
// TODO For the moment we keep a free 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:
// use setup of keypress to select thirdparty and this hang browser on large database. // It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases.
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) // Also, it is not possible to use a value that is not in the list.
{ // Also, the label is not automatically filled when a value is selected.
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1); print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1);
} else { } else {
print '<input type="text" class="maxwidth150" name="subledger_account" value="'.(GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account).'">'; print '<input type="text" class="maxwidth150" name="subledger_account" value="'.(GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account).'">';
} }
// TODO Add also the label
print '</td>'; print '</td>';
print '<td><input type="text" class="minwidth200" name="label_operation" value="'.(GETPOSTISSET("label_operation") ? GETPOST("label_operation", "alpha") : $line->label_operation).'"></td>'; print '<td><input type="text" class="minwidth200" name="label_operation" value="'.(GETPOSTISSET("label_operation") ? GETPOST("label_operation", "alpha") : $line->label_operation).'"></td>';
print '<td class="right"><input type="text" size="6" class="right" name="debit" value="'.(GETPOSTISSET("debit") ? GETPOST("debit", "alpha") : price($line->debit)).'"></td>'; print '<td class="right"><input type="text" size="6" class="right" name="debit" value="'.(GETPOSTISSET("debit") ? GETPOST("debit", "alpha") : price($line->debit)).'"></td>';
@ -671,18 +676,21 @@ if ($action == 'create')
if ($action == "" || $action == 'add') { if ($action == "" || $action == 'add') {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<!-- td columns in add mode -->';
print '<td>'; print '<td>';
print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, ''); print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, '');
print '</td>'; print '</td>';
print '<td>'; print '<td>';
// TODO For the moment we keep a free 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:
// use setup of keypress to select thirdparty and this hang browser on large database. // It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases.
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) // Also, it is not possible to use a value that is not in the list.
{ // Also, the label is not automatically filled when a value is selected.
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
print $formaccounting->select_auxaccount('', 'subledger_account', 1); print $formaccounting->select_auxaccount('', 'subledger_account', 1);
} else { } else {
print '<input type="text" class="maxwidth150" name="subledger_account" value="">'; print '<input type="text" class="maxwidth150" name="subledger_account" value="">';
} }
// TODO Add also the label
print '</td>'; print '</td>';
print '<td><input type="text" class="minwidth200" name="label_operation" value="'.$label_operation.'"/></td>'; print '<td><input type="text" class="minwidth200" name="label_operation" value="'.$label_operation.'"/></td>';
print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>'; print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>';

View File

@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("accountancy")); $langs->loadLangs(array("accountancy", "compta"));
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
@ -85,7 +85,7 @@ $search_mvt_label = GETPOST('search_mvt_label', 'alpha');
$search_direction = GETPOST('search_direction', 'alpha'); $search_direction = GETPOST('search_direction', 'alpha');
$search_debit = GETPOST('search_debit', 'alpha'); $search_debit = GETPOST('search_debit', 'alpha');
$search_credit = GETPOST('search_credit', 'alpha'); $search_credit = GETPOST('search_credit', 'alpha');
$search_ledger_code = GETPOST('search_ledger_code', 'alpha'); $search_ledger_code = GETPOST('search_ledger_code', 'array');
$search_lettering_code = GETPOST('search_lettering_code', 'alpha'); $search_lettering_code = GETPOST('search_lettering_code', 'alpha');
$search_not_reconciled = GETPOST('search_reconciled_option', 'alpha'); $search_not_reconciled = GETPOST('search_reconciled_option', 'alpha');
@ -140,6 +140,7 @@ if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GE
$arrayfields = array( $arrayfields = array(
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1), 't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1), 't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1), 't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1), 't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1),
@ -148,7 +149,6 @@ $arrayfields = array(
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1), 't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1), 't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1), 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0), 't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0), 't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1), 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
@ -192,7 +192,7 @@ if (empty($reshook))
$search_accountancy_aux_code_end = ''; $search_accountancy_aux_code_end = '';
$search_mvt_label = ''; $search_mvt_label = '';
$search_direction = ''; $search_direction = '';
$search_ledger_code = ''; $search_ledger_code = array();
$search_date_start = ''; $search_date_start = '';
$search_date_end = ''; $search_date_end = '';
$search_date_creation_start = ''; $search_date_creation_start = '';
@ -267,7 +267,9 @@ if (empty($reshook))
} }
if (!empty($search_ledger_code)) { if (!empty($search_ledger_code)) {
$filter['t.code_journal'] = $search_ledger_code; $filter['t.code_journal'] = $search_ledger_code;
$param .= '&search_ledger_code='.urlencode($search_ledger_code); foreach ($search_ledger_code as $code) {
$param .= '&search_ledger_code[]='.urlencode($code);
}
} }
if (!empty($search_mvt_num)) { if (!empty($search_mvt_num)) {
$filter['t.piece_num'] = $search_mvt_num; $filter['t.piece_num'] = $search_mvt_num;
@ -447,6 +449,8 @@ if (count($filter) > 0) {
$sqlwhere[] = natural_search($key, $value, 1, 1); $sqlwhere[] = natural_search($key, $value, 1, 1);
} elseif ($key == 't.reconciled_option') { } elseif ($key == 't.reconciled_option') {
$sqlwhere[] = 't.lettering_code IS NULL'; $sqlwhere[] = 't.lettering_code IS NULL';
} elseif ($key == 't.code_journal' && !empty($value)) {
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
} else { } else {
$sqlwhere[] = natural_search($key, $value, 0, 1); $sqlwhere[] = natural_search($key, $value, 0, 1);
} }
@ -467,7 +471,7 @@ if (!empty($sortfield)) {
// Export into a file with format defined into setup (FEC, CSV, ...) // Export into a file with format defined into setup (FEC, CSV, ...)
// Must be after definition of $sql // Must be after definition of $sql
if ($action == 'export_file' && $user->rights->accounting->mouvements->export) { if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->export) {
// TODO Replace the fetchAll + ->export later that consume too much memory on large export with the query($sql) and loop on each line to export them. // TODO Replace the fetchAll + ->export later that consume too much memory on large export with the query($sql) and loop on each line to export them.
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT); $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT);
@ -495,6 +499,7 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping"; $sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
$sql .= " SET date_export = '".$db->idate($now)."'"; $sql .= " SET date_export = '".$db->idate($now)."'";
$sql .= " , date_validated = '".$db->idate($now)."'";
$sql .= " WHERE rowid = ".$movement->id; $sql .= " WHERE rowid = ".$movement->id;
dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=".$sql, LOG_DEBUG); dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=".$sql, LOG_DEBUG);
@ -566,7 +571,25 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
llxHeader('', $title_page); llxHeader('', $title_page);
if ($action == 'export_file') {
$form_question = array();
$form_question['notifiedexportdate'] = array(
'name' => 'notifiedexportdate',
'type' => 'checkbox',
'label' => $langs->trans('NotifiedExportDate'),
'value' => (!empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) ? 'false' : 'true'),
);
$form_question['notifiedvalidationdate'] = array(
'name' => 'notifiedvalidationdate',
'type' => 'checkbox', // We don't use select here, the journal_array is already a select html component
'label' => $langs->trans('NotifiedValidationDate'),
'value' => (!empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE) ? 'false' : 'true'),
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 300);
print $formconfirm;
}
if ($action == 'delmouv') { if ($action == 'delmouv') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?mvt_num='.GETPOST('mvt_num').$param, $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;
@ -638,10 +661,11 @@ if (empty($reshook)) {
} }
$newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>'; $newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>';
$newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param ? '&'.$param : ''), $user->rights->accounting->mouvements->export); if (!empty($user->rights->accounting->mouvements->export)) $newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param ? '&'.$param : ''), $user->rights->accounting->mouvements->export);
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly')); $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
$url = './card.php?action=create'; $url = './card.php?action=create';
if (!empty($socid)) $url .= '&socid='.$socid; if (!empty($socid)) $url .= '&socid='.$socid;
@ -664,11 +688,17 @@ print '<table class="tagtable liste centpercent">';
// Filters lines // Filters lines
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
// Movement number // Movement number
if (!empty($arrayfields['t.piece_num']['checked'])) if (!empty($arrayfields['t.piece_num']['checked']))
{ {
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).'"></td>'; print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).'"></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="'.(is_array($search_ledger_code) ? join('|', $search_ledger_code) : $search_ledger_code).'"></td>';
}
// Date document // Date document
if (!empty($arrayfields['t.doc_date']['checked'])) if (!empty($arrayfields['t.doc_date']['checked']))
{ {
@ -757,11 +787,6 @@ if (!empty($arrayfields['t.lettering_code']['checked']))
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>'; print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
print '</td>'; 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>';
}
// Fields from hook // Fields from hook
$parameters = array('arrayfields'=>$arrayfields); $parameters = array('arrayfields'=>$arrayfields);
@ -813,6 +838,7 @@ print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['t.numero_compte']['checked'])) print_liste_field_titre($arrayfields['t.numero_compte']['label'], $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['t.numero_compte']['checked'])) print_liste_field_titre($arrayfields['t.numero_compte']['label'], $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
@ -821,7 +847,6 @@ if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_tit
if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
// Hook fields // Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
@ -887,6 +912,16 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// 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 class="center">'.$journaltoshow.'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Document date // Document date
if (!empty($arrayfields['t.doc_date']['checked'])) if (!empty($arrayfields['t.doc_date']['checked']))
{ {
@ -936,6 +971,11 @@ while ($i < min($num, $limit))
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} elseif ($line->doc_type == 'bank')
{
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$objectstatic = new AccountLine($db);
$objectstatic->fetch($line->fk_doc);
} else { } else {
// Other type // Other type
} }
@ -950,6 +990,10 @@ while ($i < min($num, $limit))
{ {
print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1); print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
print $documentlink; print $documentlink;
} elseif ($line->doc_type == 'bank') {
print $objectstatic->getNomUrl(1);
$bank_ref = strstr($line->doc_ref, '-');
print " " . $bank_ref;
} else { } else {
print $line->doc_ref; print $line->doc_ref;
} }
@ -1005,16 +1049,6 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// 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 class="center">'.$journaltoshow.'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Fields from hook // Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$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

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2016 Neil Orley <neil.orley@oeris.fr> /* Copyright (C) 2016 Neil Orley <neil.orley@oeris.fr>
* 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-2020 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
@ -22,7 +22,7 @@
/** /**
* \file htdocs/accountancy/bookkeeping/listbyaccount.php * \file htdocs/accountancy/bookkeeping/listbyaccount.php
* \ingroup Accountancy (Double entries) * \ingroup Accountancy (Double entries)
* \brief List operation of book keeping ordered by account number * \brief List operation of ledger ordered by account number
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
@ -39,9 +39,23 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->loadLangs(array("accountancy", "compta")); $langs->loadLangs(array("accountancy", "compta"));
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); $search_date_startyear = GETPOST('search_date_startyear', 'int');
$search_date_end = dol_mktime(0, 0, 0, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); $search_date_startmonth = GETPOST('search_date_startmonth', 'int');
$search_date_startday = GETPOST('search_date_startday', 'int');
$search_date_endyear = GETPOST('search_date_endyear', 'int');
$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
$search_date_endday = GETPOST('search_date_endday', 'int');
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
$search_date_end = dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear);
$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_export_startyear = GETPOST('search_date_export_startyear', 'int');
$search_date_export_startmonth = GETPOST('search_date_export_startmonth', 'int');
$search_date_export_startday = GETPOST('search_date_export_startday', 'int');
$search_date_export_endyear = GETPOST('search_date_export_endyear', 'int');
$search_date_export_endmonth = GETPOST('search_date_export_endmonth', 'int');
$search_date_export_endday = GETPOST('search_date_export_endday', 'int');
$search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
$search_date_export_end = dol_mktime(0, 0, 0, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
$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');
@ -56,7 +70,7 @@ $search_doc_ref = GETPOST('search_doc_ref', 'alpha');
$search_label_operation = GETPOST('search_label_operation', 'alpha'); $search_label_operation = GETPOST('search_label_operation', 'alpha');
$search_mvt_num = GETPOST('search_mvt_num', 'int'); $search_mvt_num = GETPOST('search_mvt_num', 'int');
$search_direction = GETPOST('search_direction', 'alpha'); $search_direction = GETPOST('search_direction', 'alpha');
$search_ledger_code = GETPOST('search_ledger_code', 'alpha'); $search_ledger_code = GETPOST('search_ledger_code', 'array');
$search_debit = GETPOST('search_debit', 'alpha'); $search_debit = GETPOST('search_debit', 'alpha');
$search_credit = GETPOST('search_credit', 'alpha'); $search_credit = GETPOST('search_credit', 'alpha');
$search_lettering_code = GETPOST('search_lettering_code', 'alpha'); $search_lettering_code = GETPOST('search_lettering_code', 'alpha');
@ -114,21 +128,37 @@ if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('searc
$arrayfields = array( $arrayfields = array(
// 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1), // 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1), 't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1), 't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1), 't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1), 't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1), 't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1), 't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1), 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
); );
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']); if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']);
if ($search_date_start && empty($search_date_startyear)) {
$tmparray = dol_getdate($search_date_start);
$search_date_startyear = $tmparray['year'];
$search_date_startmonth = $tmparray['mon'];
$search_date_startday = $tmparray['mday'];
}
if ($search_date_end && empty($search_date_endyear)) {
$tmparray = dol_getdate($search_date_end);
$search_date_endyear = $tmparray['year'];
$search_date_endmonth = $tmparray['mon'];
$search_date_endday = $tmparray['mday'];
}
/* /*
* Action * Action
*/ */
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 = ''; }
@ -151,7 +181,7 @@ if (empty($reshook))
$search_label_operation = ''; $search_label_operation = '';
$search_mvt_num = ''; $search_mvt_num = '';
$search_direction = ''; $search_direction = '';
$search_ledger_code = ''; $search_ledger_code = array();
$search_date_start = ''; $search_date_start = '';
$search_date_end = ''; $search_date_end = '';
$search_date_startyear = ''; $search_date_startyear = '';
@ -160,6 +190,14 @@ if (empty($reshook))
$search_date_endyear = ''; $search_date_endyear = '';
$search_date_endmonth = ''; $search_date_endmonth = '';
$search_date_endday = ''; $search_date_endday = '';
$search_date_export_start = '';
$search_date_export_end = '';
$search_date_export_startyear = '';
$search_date_export_startmonth = '';
$search_date_export_startday = '';
$search_date_export_endyear = '';
$search_date_export_endmonth = '';
$search_date_export_endday = '';
$search_debit = ''; $search_debit = '';
$search_credit = ''; $search_credit = '';
$search_lettering_code = ''; $search_lettering_code = '';
@ -172,11 +210,11 @@ if (empty($reshook))
if (!empty($search_date_start)) { if (!empty($search_date_start)) {
$filter['t.doc_date>='] = $search_date_start; $filter['t.doc_date>='] = $search_date_start;
$param .= '&search_date_startmonth='.GETPOST('search_date_startmonth', 'int').'&search_date_startday='.GETPOST('search_date_startday', 'int').'&search_date_startyear='.GETPOST('search_date_startyear', 'int'); $param .= '&search_date_startmonth='.$search_date_startmonth.'&search_date_startday='.$search_date_startday.'&search_date_startyear='.$search_date_startyear;
} }
if (!empty($search_date_end)) { if (!empty($search_date_end)) {
$filter['t.doc_date<='] = $search_date_end; $filter['t.doc_date<='] = $search_date_end;
$param .= '&search_date_endmonth='.GETPOST('search_date_endmonth', 'int').'&search_date_endday='.GETPOST('search_date_endday', 'int').'&search_date_endyear='.GETPOST('search_date_endyear', 'int'); $param .= '&search_date_endmonth='.$search_date_endmonth.'&search_date_endday='.$search_date_endday.'&search_date_endyear='.$search_date_endyear;
} }
if (!empty($search_doc_date)) { if (!empty($search_doc_date)) {
$filter['t.doc_date'] = $search_doc_date; $filter['t.doc_date'] = $search_doc_date;
@ -212,7 +250,9 @@ if (empty($reshook))
} }
if (!empty($search_ledger_code)) { if (!empty($search_ledger_code)) {
$filter['t.code_journal'] = $search_ledger_code; $filter['t.code_journal'] = $search_ledger_code;
$param .= '&search_ledger_code='.urlencode($search_ledger_code); foreach ($search_ledger_code as $code) {
$param .= '&search_ledger_code[]='.urlencode($code);
}
} }
if (!empty($search_debit)) { if (!empty($search_debit)) {
$filter['t.debit'] = $search_debit; $filter['t.debit'] = $search_debit;
@ -230,6 +270,14 @@ if (empty($reshook))
$filter['t.reconciled_option'] = $search_not_reconciled; $filter['t.reconciled_option'] = $search_not_reconciled;
$param .= '&search_not_reconciled='.urlencode($search_not_reconciled); $param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
} }
if (!empty($search_date_export_start)) {
$filter['t.date_export>='] = $search_date_export_start;
$param .= '&search_date_export_startmonth='.$search_date_export_startmonth.'&search_date_export_startday='.$search_date_export_startday.'&search_date_export_startyear='.$search_date_export_startyear;
}
if (!empty($search_date_export_end)) {
$filter['t.date_export<='] = $search_date_export_end;
$param .= '&search_date_export_endmonth='.$search_date_export_endmonth.'&search_date_export_endday='.$search_date_export_endday.'&search_date_export_endyear='.$search_date_export_endyear;
}
} }
if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) { if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) {
@ -242,7 +290,7 @@ if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->suppri
} }
// Make a redirect to avoid to launch the delete later after a back button // Make a redirect to avoid to launch the delete later after a back button
header("Location: listbyaccount.php".($param ? '?'.$param : '')); header("Location: ".$_SERVER["PHP_SELF"].($param ? '?'.$param : ''));
exit; exit;
} }
} }
@ -267,7 +315,7 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme
} }
// Make a redirect to avoid to launch the delete later after a back button // Make a redirect to avoid to launch the delete later after a back button
header("Location: listbyaccount.php".($param ? '?'.$param : '')); header("Location: ".$_SERVER["PHP_SELF"].($param ? '?'.$param : ''));
exit; exit;
} else { } else {
setEventMessages("NoRecordDeleted", null, 'warnings'); setEventMessages("NoRecordDeleted", null, 'warnings');
@ -284,7 +332,7 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
} }
header("Location: listbyaccount.php?noreset=1".($param ? '&'.$param : '')); header("Location: ".$_SERVER["PHP_SELF"]."?noreset=1".($param ? '&'.$param : ''));
exit; exit;
} }
} }
@ -303,7 +351,6 @@ $title_page = $langs->trans("Operations").' - '.$langs->trans("VueByAccountAccou
llxHeader('', $title_page); llxHeader('', $title_page);
// List // List
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
@ -380,10 +427,8 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) { if (empty($reshook)) {
$newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param); $newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
$newcardbutton .= dolGetButtonTitle($langs->trans('VueByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
$newcardbutton .= ' &nbsp; ';
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create'); $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
} }
@ -428,9 +473,16 @@ print '<table class="tagtable liste centpercent">';
// Filters lines // Filters lines
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
// Movement number
if (!empty($arrayfields['t.piece_num']['checked']))
{
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
}
// Code journal // Code journal
if (!empty($arrayfields['t.code_journal']['checked'])) { if (!empty($arrayfields['t.code_journal']['checked'])) {
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="'.dol_escape_htmltag($search_ledger_code).'"></td>'; print '<td class="liste_titre center">';
print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1);
print '</td>';
} }
// Date document // Date document
if (!empty($arrayfields['t.doc_date']['checked'])) { if (!empty($arrayfields['t.doc_date']['checked'])) {
@ -443,11 +495,6 @@ if (!empty($arrayfields['t.doc_date']['checked'])) {
print '</div>'; print '</div>';
print '</td>'; print '</td>';
} }
// Movement number
if (!empty($arrayfields['t.piece_num']['checked']))
{
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
}
// Ref document // Ref document
if (!empty($arrayfields['t.doc_ref']['checked'])) { if (!empty($arrayfields['t.doc_ref']['checked'])) {
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_doc_ref" value="'.dol_escape_htmltag($search_doc_ref).'"/></td>'; print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_doc_ref" value="'.dol_escape_htmltag($search_doc_ref).'"/></td>';
@ -472,6 +519,17 @@ if (!empty($arrayfields['t.lettering_code']['checked']))
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>'; print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
print '</td>'; print '</td>';
} }
// Date export
if (!empty($arrayfields['t.date_export']['checked'])) {
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $form->selectDate($search_date_export_start, 'search_date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search_date_export_end, 'search_date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
print '</div>';
print '</td>';
}
// Fields from hook // Fields from hook
$parameters = array('arrayfields'=>$arrayfields); $parameters = array('arrayfields'=>$arrayfields);
@ -486,14 +544,15 @@ print '</td>';
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.date_export']['checked'])) print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center ');
// Hook fields // Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
@ -524,8 +583,14 @@ while ($i < min($num, $limit))
// Is it a break ? // Is it a break ?
if ($accountg != $displayed_account_number || !isset($displayed_account_number)) { if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
$colspan = $totalarray['nbfield'] - 3; $colnumber = 5;
$colspanend = $totalarray['nbfield'] - 7; $colnumberend = 7;
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) $colnumber--;
if (empty($arrayfields['t.date_export']['checked'])) $colnumber--;
$colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend;
// Show a subtotal by accounting account // Show a subtotal by accounting account
if (isset($displayed_account_number)) { if (isset($displayed_account_number)) {
print '<tr class="liste_total">'; print '<tr class="liste_total">';
@ -556,7 +621,7 @@ while ($i < min($num, $limit))
// Show the break account // Show the break account
print "<tr>"; print "<tr>";
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 9).'" style="font-weight:bold; border-bottom: 1pt solid black;">'; print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 10).'" style="font-weight:bold; border-bottom: 1pt solid black;">';
if ($line->numero_compte != "" && $line->numero_compte != '-1') print length_accountg($line->numero_compte).' : '.$object->get_compte_desc($line->numero_compte); if ($line->numero_compte != "" && $line->numero_compte != '-1') print length_accountg($line->numero_compte).' : '.$object->get_compte_desc($line->numero_compte);
else print '<span class="error">'.$langs->trans("Unknown").'</span>'; else print '<span class="error">'.$langs->trans("Unknown").'</span>';
print '</td>'; print '</td>';
@ -572,6 +637,17 @@ while ($i < min($num, $limit))
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Piece number
if (!empty($arrayfields['t.piece_num']['checked']))
{
print '<td>';
$object->id = $line->id;
$object->piece_num = $line->piece_num;
print $object->getNomUrl(1, '', 0, '', 1);
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Journal code // Journal code
if (!empty($arrayfields['t.code_journal']['checked'])) if (!empty($arrayfields['t.code_journal']['checked']))
{ {
@ -589,17 +665,6 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Piece number
if (!empty($arrayfields['t.piece_num']['checked']))
{
print '<td>';
$object->id = $line->id;
$object->piece_num = $line->piece_num;
print $object->getNomUrl(1, '', 0, '', 1);
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Document ref // Document ref
if (!empty($arrayfields['t.doc_ref']['checked'])) if (!empty($arrayfields['t.doc_ref']['checked']))
{ {
@ -642,20 +707,29 @@ while ($i < min($num, $limit))
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} elseif ($line->doc_type == 'bank')
{
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$objectstatic = new AccountLine($db);
$objectstatic->fetch($line->fk_doc);
} else { } else {
// Other type // Other type
} }
print '<td class="nowrap">'; print '<td class="maxwidth400">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
// Picto + Ref // Picto + Ref
print '<td class="nobordernopadding nowrap">'; print '<td class="nobordernopadding">';
if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report') if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report')
{ {
print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1); print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
print $documentlink; print $documentlink;
} elseif ($line->doc_type == 'bank') {
print $objectstatic->getNomUrl(1);
$bank_ref = strstr($line->doc_ref, '-');
print " " . $bank_ref;
} else { } else {
print $line->doc_ref; print $line->doc_ref;
} }
@ -697,6 +771,13 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Exported operation date
if (!empty($arrayfields['t.date_export']['checked']))
{
print '<td class="center">'.dol_print_date($line->date_export, 'dayhour').'</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
@ -724,33 +805,34 @@ while ($i < min($num, $limit))
$i++; $i++;
} }
// Show sub-total of last shown account if ($num > 0) {
$colspan = $totalarray['nbfield'] - 3; $colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - 8; $colspanend = $totalarray['nbfield'] - $colnumberend;
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>'; print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>';
print '<td class="nowrap right">'.price($sous_total_debit).'</td>'; print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
print '<td class="nowrap right">'.price($sous_total_credit).'</td>'; print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
print '<td colspan="'.$colspanend.'"></td>'; print '<td colspan="'.$colspanend.'"></td>';
print '</tr>'; print '</tr>';
// Show balance of last shown account // Show balance of last shown account
$balance = $sous_total_debit - $sous_total_credit; $balance = $sous_total_debit - $sous_total_credit;
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>'; print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
if ($balance > 0) if ($balance > 0)
{ {
print '<td class="nowraponall right">'; print '<td class="nowraponall right">';
print price($sous_total_debit - $sous_total_credit); print price($sous_total_debit - $sous_total_credit);
print '</td>'; print '</td>';
print '<td></td>'; print '<td></td>';
} else { } else {
print '<td></td>'; print '<td></td>';
print '<td class="nowraponall right">'; print '<td class="nowraponall right">';
print price($sous_total_credit - $sous_total_debit); print price($sous_total_credit - $sous_total_debit);
print '</td>'; print '</td>';
}
print '<td colspan="'.$colspanend.'"></td>';
print '</tr>';
} }
print '<td colspan="'.$colspanend.'"></td>';
print '</tr>';
// Show total line // Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';

View File

@ -1,9 +1,9 @@
<?php <?php
/* Copyright (C) 2016 Neil Orley <neil.orley@oeris.fr> /* Copyright (C) 2016 Neil Orley <neil.orley@oeris.fr>
* 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-2020 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 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
@ -39,9 +39,23 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->loadLangs(array("accountancy", "compta")); $langs->loadLangs(array("accountancy", "compta"));
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); $search_date_startyear = GETPOST('search_date_startyear', 'int');
$search_date_end = dol_mktime(0, 0, 0, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); $search_date_startmonth = GETPOST('search_date_startmonth', 'int');
$search_date_startday = GETPOST('search_date_startday', 'int');
$search_date_endyear = GETPOST('search_date_endyear', 'int');
$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
$search_date_endday = GETPOST('search_date_endday', 'int');
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
$search_date_end = dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear);
$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_export_startyear = GETPOST('search_date_export_startyear', 'int');
$search_date_export_startmonth = GETPOST('search_date_export_startmonth', 'int');
$search_date_export_startday = GETPOST('search_date_export_startday', 'int');
$search_date_export_endyear = GETPOST('search_date_export_endyear', 'int');
$search_date_export_endmonth = GETPOST('search_date_export_endmonth', 'int');
$search_date_export_endday = GETPOST('search_date_export_endday', 'int');
$search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
$search_date_export_end = dol_mktime(0, 0, 0, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
$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');
@ -56,7 +70,7 @@ $search_doc_ref = GETPOST('search_doc_ref', 'alpha');
$search_label_operation = GETPOST('search_label_operation', 'alpha'); $search_label_operation = GETPOST('search_label_operation', 'alpha');
$search_mvt_num = GETPOST('search_mvt_num', 'int'); $search_mvt_num = GETPOST('search_mvt_num', 'int');
$search_direction = GETPOST('search_direction', 'alpha'); $search_direction = GETPOST('search_direction', 'alpha');
$search_ledger_code = GETPOST('search_ledger_code', 'alpha'); $search_ledger_code = GETPOST('search_ledger_code', 'array');
$search_debit = GETPOST('search_debit', 'alpha'); $search_debit = GETPOST('search_debit', 'alpha');
$search_credit = GETPOST('search_credit', 'alpha'); $search_credit = GETPOST('search_credit', 'alpha');
$search_lettering_code = GETPOST('search_lettering_code', 'alpha'); $search_lettering_code = GETPOST('search_lettering_code', 'alpha');
@ -67,16 +81,22 @@ if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_
} }
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $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;
if ($sortorder == "") $sortorder = "ASC"; if ($sortorder == "") {
if ($sortfield == "") $sortfield = "t.doc_date,t.rowid"; $sortorder = "ASC";
}
if ($sortfield == "") {
$sortfield = "t.doc_date,t.rowid";
}
// 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
$object = new BookKeeping($db); $object = new BookKeeping($db);
@ -99,11 +119,12 @@ if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('searc
} else { } else {
$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');
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year if (dol_print_date(dol_now(), '%m') < $month_start) {
$year_start--; // If current month is lower that starting fiscal month, we start last year
}
$year_end = $year_start + 1; $year_end = $year_start + 1;
$month_end = $month_start - 1; $month_end = $month_start - 1;
if ($month_end < 1) if ($month_end < 1) {
{
$month_end = 12; $month_end = 12;
$year_end--; $year_end--;
} }
@ -114,34 +135,55 @@ if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('searc
$arrayfields = array( $arrayfields = array(
// 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1), // 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1), 't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1), 't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1), 't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1), 't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1), 't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1), 't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1), 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
); );
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']); if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
unset($arrayfields['t.lettering_code']);
}
if ($search_date_start && empty($search_date_startyear)) {
$tmparray = dol_getdate($search_date_start);
$search_date_startyear = $tmparray['year'];
$search_date_startmonth = $tmparray['mon'];
$search_date_startday = $tmparray['mday'];
}
if ($search_date_end && empty($search_date_endyear)) {
$tmparray = dol_getdate($search_date_end);
$search_date_endyear = $tmparray['year'];
$search_date_endmonth = $tmparray['mon'];
$search_date_endday = $tmparray['mday'];
}
/* /*
* Action * Action
*/ */
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } if (GETPOST('cancel', 'alpha')) {
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } $action = 'list'; $massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
}
$parameters = array('socid'=>$socid); $parameters = array('socid'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $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 ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) if (empty($reshook)) {
{
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; 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_doc_date = ''; $search_doc_date = '';
$search_accountancy_code = ''; $search_accountancy_code = '';
$search_accountancy_code_start = ''; $search_accountancy_code_start = '';
@ -151,7 +193,7 @@ if (empty($reshook))
$search_label_operation = ''; $search_label_operation = '';
$search_mvt_num = ''; $search_mvt_num = '';
$search_direction = ''; $search_direction = '';
$search_ledger_code = ''; $search_ledger_code = array();
$search_date_start = ''; $search_date_start = '';
$search_date_end = ''; $search_date_end = '';
$search_date_startyear = ''; $search_date_startyear = '';
@ -160,6 +202,14 @@ if (empty($reshook))
$search_date_endyear = ''; $search_date_endyear = '';
$search_date_endmonth = ''; $search_date_endmonth = '';
$search_date_endday = ''; $search_date_endday = '';
$search_date_export_start = '';
$search_date_export_end = '';
$search_date_export_startyear = '';
$search_date_export_startmonth = '';
$search_date_export_startday = '';
$search_date_export_endyear = '';
$search_date_export_endmonth = '';
$search_date_export_endday = '';
$search_debit = ''; $search_debit = '';
$search_credit = ''; $search_credit = '';
$search_lettering_code = ''; $search_lettering_code = '';
@ -172,11 +222,11 @@ if (empty($reshook))
if (!empty($search_date_start)) { if (!empty($search_date_start)) {
$filter['t.doc_date>='] = $search_date_start; $filter['t.doc_date>='] = $search_date_start;
$param .= '&search_date_startmonth='.GETPOST('search_date_startmonth', 'int').'&search_date_startday='.GETPOST('search_date_startday', 'int').'&search_date_startyear='.GETPOST('search_date_startyear', 'int'); $param .= '&search_date_startmonth='.$search_date_startmonth.'&search_date_startday='.$search_date_startday.'&search_date_startyear='.$search_date_startyear;
} }
if (!empty($search_date_end)) { if (!empty($search_date_end)) {
$filter['t.doc_date<='] = $search_date_end; $filter['t.doc_date<='] = $search_date_end;
$param .= '&search_date_endmonth='.GETPOST('search_date_endmonth', 'int').'&search_date_endday='.GETPOST('search_date_endday', 'int').'&search_date_endyear='.GETPOST('search_date_endyear', 'int'); $param .= '&search_date_endmonth='.$search_date_endmonth.'&search_date_endday='.$search_date_endday.'&search_date_endyear='.$search_date_endyear;
} }
if (!empty($search_doc_date)) { if (!empty($search_doc_date)) {
$filter['t.doc_date'] = $search_doc_date; $filter['t.doc_date'] = $search_doc_date;
@ -212,7 +262,9 @@ if (empty($reshook))
} }
if (!empty($search_ledger_code)) { if (!empty($search_ledger_code)) {
$filter['t.code_journal'] = $search_ledger_code; $filter['t.code_journal'] = $search_ledger_code;
$param .= '&search_ledger_code='.urlencode($search_ledger_code); foreach ($search_ledger_code as $code) {
$param .= '&search_ledger_code[]='.urlencode($code);
}
} }
if (!empty($search_debit)) { if (!empty($search_debit)) {
$filter['t.debit'] = $search_debit; $filter['t.debit'] = $search_debit;
@ -230,6 +282,14 @@ if (empty($reshook))
$filter['t.reconciled_option'] = $search_not_reconciled; $filter['t.reconciled_option'] = $search_not_reconciled;
$param .= '&search_not_reconciled='.urlencode($search_not_reconciled); $param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
} }
if (!empty($search_date_export_start)) {
$filter['t.date_export>='] = $search_date_export_start;
$param .= '&search_date_export_startmonth='.$search_date_export_startmonth.'&search_date_export_startday='.$search_date_export_startday.'&search_date_export_startyear='.$search_date_export_startyear;
}
if (!empty($search_date_export_end)) {
$filter['t.date_export<='] = $search_date_export_end;
$param .= '&search_date_export_endmonth='.$search_date_export_endmonth.'&search_date_export_endday='.$search_date_export_endday.'&search_date_export_endyear='.$search_date_export_endyear;
}
} }
if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) { if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) {
@ -242,7 +302,7 @@ if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->suppri
} }
// Make a redirect to avoid to launch the delete later after a back button // Make a redirect to avoid to launch the delete later after a back button
header("Location: listbyaccount.php".($param ? '?'.$param : '')); header("Location: ".$_SERVER["PHP_SELF"].($param ? '?'.$param : ''));
exit; exit;
} }
} }
@ -257,8 +317,7 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme
$deljournal = 0; $deljournal = 0;
} }
if (!empty($delmonth) || !empty($delyear) || !empty($deljournal)) if (!empty($delmonth) || !empty($delyear) || !empty($deljournal)) {
{
$result = $object->deleteByYearAndJournal($delyear, $deljournal, '', ($delmonth > 0 ? $delmonth : 0)); $result = $object->deleteByYearAndJournal($delyear, $deljournal, '', ($delmonth > 0 ? $delmonth : 0));
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
@ -267,7 +326,7 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme
} }
// Make a redirect to avoid to launch the delete later after a back button // Make a redirect to avoid to launch the delete later after a back button
header("Location: listbysubaccount.php".($param ? '?'.$param : '')); header("Location: ".$_SERVER["PHP_SELF"].($param ? '?'.$param : ''));
exit; exit;
} else { } else {
setEventMessages("NoRecordDeleted", null, 'warnings'); setEventMessages("NoRecordDeleted", null, 'warnings');
@ -284,7 +343,7 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
} }
header("Location: listbysubaccount.php?noreset=1".($param ? '&'.$param : '')); header("Location: ".$_SERVER["PHP_SELF"]."?noreset=1".($param ? '&'.$param : ''));
exit; exit;
} }
} }
@ -371,7 +430,9 @@ if ($action == 'delbookkeepingyear') {
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
@ -380,22 +441,35 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) { if (empty($reshook)) {
$newcardbutton = dolGetButtonTitle($langs->trans('ViewAccountList'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php', '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); $newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create'); $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
} }
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); $param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit); print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
print info_admin($langs->trans("WarningRecordWithoutSubledgerAreExcluded"));
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); if ($massactionbutton) {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
}
// Reverse sort order // Reverse sort order
if (preg_match('/^asc/i', $sortorder)) $sortorder = "asc"; if (preg_match('/^asc/i', $sortorder)) {
else $sortorder = "desc"; $sortorder = "asc";
} else {
$sortorder = "desc";
}
$moreforfilter = ''; $moreforfilter = '';
@ -412,8 +486,11 @@ $moreforfilter .= '</div>';
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; if (empty($reshook)) {
else $moreforfilter = $hookmanager->resPrint; $moreforfilter .= $hookmanager->resPrint;
} else {
$moreforfilter = $hookmanager->resPrint;
}
print '<div class="liste_titre liste_titre_bydiv centpercent">'; print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter; print $moreforfilter;
@ -425,9 +502,16 @@ print '<table class="tagtable liste centpercent">';
// Filters lines // Filters lines
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
// Movement number
if (!empty($arrayfields['t.piece_num']['checked']))
{
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
}
// Code journal // Code journal
if (!empty($arrayfields['t.code_journal']['checked'])) { if (!empty($arrayfields['t.code_journal']['checked'])) {
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="'.dol_escape_htmltag($search_ledger_code).'"></td>'; print '<td class="liste_titre center">';
print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1);
print '</td>';
} }
// Date document // Date document
if (!empty($arrayfields['t.doc_date']['checked'])) { if (!empty($arrayfields['t.doc_date']['checked'])) {
@ -440,11 +524,6 @@ if (!empty($arrayfields['t.doc_date']['checked'])) {
print '</div>'; print '</div>';
print '</td>'; print '</td>';
} }
// Movement number
if (!empty($arrayfields['t.piece_num']['checked']))
{
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
}
// Ref document // Ref document
if (!empty($arrayfields['t.doc_ref']['checked'])) { if (!empty($arrayfields['t.doc_ref']['checked'])) {
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_doc_ref" value="'.dol_escape_htmltag($search_doc_ref).'"/></td>'; print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_doc_ref" value="'.dol_escape_htmltag($search_doc_ref).'"/></td>';
@ -462,13 +541,23 @@ if (!empty($arrayfields['t.credit']['checked'])) {
print '<td class="liste_titre right"><input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'"></td>'; print '<td class="liste_titre right"><input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'"></td>';
} }
// Lettering code // Lettering code
if (!empty($arrayfields['t.lettering_code']['checked'])) if (!empty($arrayfields['t.lettering_code']['checked'])) {
{
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>'; print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>';
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>'; print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
print '</td>'; print '</td>';
} }
// Date export
if (!empty($arrayfields['t.date_export']['checked'])) {
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $form->selectDate($search_date_export_start, 'search_date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search_date_export_end, 'search_date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
print '</div>';
print '</td>';
}
// Fields from hook // Fields from hook
$parameters = array('arrayfields'=>$arrayfields); $parameters = array('arrayfields'=>$arrayfields);
@ -483,14 +572,33 @@ print '</td>';
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (!empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['t.piece_num']['checked'])) {
if (!empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder); }
if (!empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['t.code_journal']['checked'])) {
if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder); print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right '); }
if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['t.doc_date']['checked'])) {
if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
}
if (!empty($arrayfields['t.doc_ref']['checked'])) {
print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
}
if (!empty($arrayfields['t.label_operation']['checked'])) {
print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
}
if (!empty($arrayfields['t.debit']['checked'])) {
print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
}
if (!empty($arrayfields['t.credit']['checked'])) {
print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
}
if (!empty($arrayfields['t.lettering_code']['checked'])) {
print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
}
if (!empty($arrayfields['t.date_export']['checked'])) {
print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center ');
}
// Hook fields // Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
@ -509,8 +617,7 @@ $displayed_account_number = null; // Start with undefined to be able to distingu
// -------------------------------------------------------------------- // --------------------------------------------------------------------
$i = 0; $i = 0;
$totalarray = array(); $totalarray = array();
while ($i < min($num, $limit)) while ($i < min($num, $limit)) {
{
$line = $object->lines[$i]; $line = $object->lines[$i];
$total_debit += $line->debit; $total_debit += $line->debit;
@ -521,8 +628,15 @@ while ($i < min($num, $limit))
// Is it a break ? // Is it a break ?
if ($accountg != $displayed_account_number || !isset($displayed_account_number)) { if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
$colspan = $totalarray['nbfield'] - 3; $colnumber = 5;
$colspanend = $totalarray['nbfield'] - 7; $colnumberend = 7;
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) $colnumber--;
if (empty($arrayfields['t.date_export']['checked'])) $colnumber--;
$colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend;
// Show a subtotal by accounting account // Show a subtotal by accounting account
if (isset($displayed_account_number)) { if (isset($displayed_account_number)) {
print '<tr class="liste_total">'; print '<tr class="liste_total">';
@ -535,8 +649,7 @@ while ($i < min($num, $limit))
$balance = $sous_total_debit - $sous_total_credit; $balance = $sous_total_debit - $sous_total_credit;
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>'; print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
if ($balance > 0) if ($balance > 0) {
{
print '<td class="nowraponall right">'; print '<td class="nowraponall right">';
print price($sous_total_debit - $sous_total_credit); print price($sous_total_debit - $sous_total_credit);
print '</td>'; print '</td>';
@ -553,9 +666,21 @@ while ($i < min($num, $limit))
// Show the break account // Show the break account
print "<tr>"; print "<tr>";
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 9).'" style="font-weight:bold; border-bottom: 1pt solid black;">'; print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 10).'" style="font-weight:bold; border-bottom: 1pt solid black;">';
if ($line->subledger_account != "" && $line->subledger_account != '-1') print length_accounta($line->subledger_account).' : '.$object->get_compte_desc($line->numero_compte); if ($line->subledger_account != "" && $line->subledger_account != '-1') {
else print '<span class="error">'.$langs->trans("Unknown").'</span>'; print $object->get_compte_desc($line->numero_compte).' : '.length_accounta($line->subledger_account);
} else {
// Should not happen: subledger account must be null or a non empty value
print '<span class="error">'.$langs->trans("Unknown");
if ($line->subledger_label) {
print ' ('.$line->subledger_label.')';
$htmltext = 'EmptyStringForSubledgerAccountButSubledgerLabelDefined';
} else {
$htmltext = 'EmptyStringForSubledgerAccountAndSubledgerLabel';
}
print $form->textwithpicto('', $htmltext);
print '</span>';
}
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -569,39 +694,40 @@ while ($i < min($num, $limit))
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// 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 class="center">'.$journaltoshow.'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Document date
if (!empty($arrayfields['t.doc_date']['checked']))
{
print '<td class="center">'.dol_print_date($line->doc_date, 'day').'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Piece number // Piece number
if (!empty($arrayfields['t.piece_num']['checked'])) if (!empty($arrayfields['t.piece_num']['checked'])) {
{
print '<td>'; print '<td>';
$object->id = $line->id; $object->id = $line->id;
$object->piece_num = $line->piece_num; $object->piece_num = $line->piece_num;
print $object->getNomUrl(1, '', 0, '', 1); print $object->getNomUrl(1, '', 0, '', 1);
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) {
$totalarray['nbfield']++;
}
}
// 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 class="center">'.$journaltoshow.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Document date
if (!empty($arrayfields['t.doc_date']['checked'])) {
print '<td class="center">'.dol_print_date($line->doc_date, 'day').'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
} }
// Document ref // Document ref
if (!empty($arrayfields['t.doc_ref']['checked'])) if (!empty($arrayfields['t.doc_ref']['checked'])) {
{ if ($line->doc_type == 'customer_invoice') {
if ($line->doc_type == 'customer_invoice')
{
$langs->loadLangs(array('bills')); $langs->loadLangs(array('bills'));
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
@ -613,8 +739,7 @@ while ($i < min($num, $limit))
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} elseif ($line->doc_type == 'supplier_invoice') } elseif ($line->doc_type == 'supplier_invoice') {
{
$langs->loadLangs(array('bills')); $langs->loadLangs(array('bills'));
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
@ -626,8 +751,7 @@ while ($i < min($num, $limit))
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
$subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); $subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir); $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
} elseif ($line->doc_type == 'expense_report') } elseif ($line->doc_type == 'expense_report') {
{
$langs->loadLangs(array('trips')); $langs->loadLangs(array('trips'));
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
@ -639,27 +763,36 @@ while ($i < min($num, $limit))
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} elseif ($line->doc_type == 'bank') {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$objectstatic = new AccountLine($db);
$objectstatic->fetch($line->fk_doc);
} else { } else {
// Other type // Other type
} }
print '<td class="nowrap">'; print '<td class="maxwidth400">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
// Picto + Ref // Picto + Ref
print '<td class="nobordernopadding nowrap">'; print '<td class="nobordernopadding">';
if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report') if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report') {
{
print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1); print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
print $documentlink; print $documentlink;
} elseif ($line->doc_type == 'bank') {
print $objectstatic->getNomUrl(1);
$bank_ref = strstr($line->doc_ref, '-');
print " " . $bank_ref;
} else { } else {
print $line->doc_ref; print $line->doc_ref;
} }
print '</td></tr></table>'; print '</td></tr></table>';
print "</td>\n"; print "</td>\n";
if (!$i) $totalarray['nbfield']++; if (!$i) {
$totalarray['nbfield']++;
}
} }
// Label operation // Label operation
@ -667,30 +800,47 @@ while ($i < min($num, $limit))
// Affiche un lien vers la facture client/fournisseur // Affiche un lien vers la facture client/fournisseur
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref); $doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>'.$line->label_operation.'</td>' : '<td>'.$line->label_operation.'<br><span style="font-size:0.8em">('.length_accounta($line->subledger_account).')</span></td>'; print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>'.$line->label_operation.'</td>' : '<td>'.$line->label_operation.'<br><span style="font-size:0.8em">('.length_accounta($line->subledger_account).')</span></td>';
if (!$i) $totalarray['nbfield']++; if (!$i) {
$totalarray['nbfield']++;
}
} }
// Amount debit // Amount debit
if (!empty($arrayfields['t.debit']['checked'])) if (!empty($arrayfields['t.debit']['checked'])) {
{
print '<td class="nowrap right">'.($line->debit ? price($line->debit) : '').'</td>'; print '<td class="nowrap right">'.($line->debit ? price($line->debit) : '').'</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) {
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totaldebit'; $totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'totaldebit';
}
$totalarray['val']['totaldebit'] += $line->debit; $totalarray['val']['totaldebit'] += $line->debit;
} }
// Amount credit // Amount credit
if (!empty($arrayfields['t.credit']['checked'])) { if (!empty($arrayfields['t.credit']['checked'])) {
print '<td class="nowrap right">'.($line->credit ? price($line->credit) : '').'</td>'; print '<td class="nowrap right">'.($line->credit ? price($line->credit) : '').'</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) {
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalcredit'; $totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'totalcredit';
}
$totalarray['val']['totalcredit'] += $line->credit; $totalarray['val']['totalcredit'] += $line->credit;
} }
// Lettering code // Lettering code
if (!empty($arrayfields['t.lettering_code']['checked'])) if (!empty($arrayfields['t.lettering_code']['checked'])) {
{
print '<td class="center">'.$line->lettering_code.'</td>'; print '<td class="center">'.$line->lettering_code.'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Exported operation date
if (!empty($arrayfields['t.date_export']['checked']))
{
print '<td class="center">'.dol_print_date($line->date_export, 'dayhour').'</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
@ -710,7 +860,9 @@ while ($i < min($num, $limit))
} }
} }
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) {
$totalarray['nbfield']++;
}
// Comptabilise le sous-total // Comptabilise le sous-total
$sous_total_debit += $line->debit; $sous_total_debit += $line->debit;
@ -721,33 +873,33 @@ while ($i < min($num, $limit))
$i++; $i++;
} }
// Show sub-total of last shown account if ($num > 0) {
$colspan = $totalarray['nbfield'] - 3; $colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - 8; $colspanend = $totalarray['nbfield'] - $colnumberend;
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>'; print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>';
print '<td class="nowrap right">'.price($sous_total_debit).'</td>'; print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
print '<td class="nowrap right">'.price($sous_total_credit).'</td>'; print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
print '<td colspan="'.$colspanend.'"></td>'; print '<td colspan="'.$colspanend.'"></td>';
print '</tr>'; print '</tr>';
// Show balance of last shown account // Show balance of last shown account
$balance = $sous_total_debit - $sous_total_credit; $balance = $sous_total_debit - $sous_total_credit;
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>'; print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
if ($balance > 0) if ($balance > 0) {
{ print '<td class="nowraponall right">';
print '<td class="nowraponall right">'; print price($sous_total_debit - $sous_total_credit);
print price($sous_total_debit - $sous_total_credit); print '</td>';
print '</td>'; print '<td></td>';
print '<td></td>'; } else {
} else { print '<td></td>';
print '<td></td>'; print '<td class="nowraponall right">';
print '<td class="nowraponall right">'; print price($sous_total_credit - $sous_total_debit);
print price($sous_total_credit - $sous_total_debit); print '</td>';
print '</td>'; }
print '<td colspan="'.$colspanend.'"></td>';
print '</tr>';
} }
print '<td colspan="'.$colspanend.'"></td>';
print '</tr>';
// Show total line // Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';

View File

@ -4,7 +4,7 @@
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 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
@ -37,14 +37,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("compta", "accountancy")); $langs->loadLangs(array("compta", "accountancy"));
$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');
$socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int'); // $socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int');
// Security check
$socid = GETPOSTINT("socid");
// if ($user->socid) $socid=$user->socid;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOSTISSET('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@ -54,10 +57,12 @@ if (empty($page) || $page == - 1) {
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if ($sortorder == "") if ($sortorder == "") {
$sortorder = "ASC"; $sortorder = "ASC";
if ($sortfield == "") }
if ($sortfield == "") {
$sortfield = "bk.doc_date"; $sortfield = "bk.doc_date";
}
/* /*
$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'));
@ -74,23 +79,18 @@ if (!empty($lettering)) {
/* /*
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_date_start = ''; $search_date_start = '';
$search_date_end = ''; $search_date_end = '';
//$search_doc_type = ''; //$search_doc_type = '';
$search_doc_ref = ''; $search_doc_ref = '';
} }
*/ */
// Security check
$socid = GETPOST("socid", 'int');
// if ($user->socid) $socid=$user->socid;
$lettering = new Lettering($db); $lettering = new Lettering($db);
$object = new Societe($db); $object = new Societe($db);
$object->id = $socid; $object->id = $socid;
$result = $object->fetch($socid); $result = $object->fetch($socid);
if ($result < 0) if ($result < 0) {
{
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
@ -208,30 +208,30 @@ if ($resql) {
print '<table class="liste centpercent">'."\n"; print '<table class="liste centpercent">'."\n";
/* /*
print '<tr class="liste_titre">'; 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_doc_type" value="' . $search_doc_type . '"></td>';
// Date // Date
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print '<div class="nowrap">'; print '<div class="nowrap">';
print $langs->trans('From') . ' '; print $langs->trans('From') . ' ';
print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1); print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
print '</div>'; print '</div>';
print '<div class="nowrap">'; print '<div class="nowrap">';
print $langs->trans('to') . ' '; print $langs->trans('to') . ' ';
print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1); print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
print '</div>'; print '</div>';
print '</td>'; print '</td>';
// Piece // Piece
print '<td><input type="text" name="search_doc_ref" value="' . $search_doc_ref . '"></td>'; print '<td><input type="text" name="search_doc_ref" value="' . $search_doc_ref . '"></td>';
print '<td colspan="6">&nbsp;</td>'; print '<td colspan="6">&nbsp;</td>';
print '<td class="right">'; print '<td class="right">';
$searchpicto = $form->showFilterButtons(); $searchpicto = $form->showFilterButtons();
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
*/ */
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -251,7 +251,9 @@ if ($resql) {
$tmp = ''; $tmp = '';
while ($obj = $db->fetch_object($resql)) { while ($obj = $db->fetch_object($resql)) {
if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code; if ($tmp != $obj->lettering_code || empty($tmp)) {
$tmp = $obj->lettering_code;
}
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit); /*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
print '<tr class="oddeven">'; print '<tr class="oddeven">';

View File

@ -41,7 +41,11 @@ $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');
$socid = GETPOST('socid', 'int') ? ((int) GETPOST('socid', 'int')) : ((int) GETPOST('id', 'int')); // $socid = GETPOST('socid', 'int') ? ((int) GETPOST('socid', 'int')) : ((int) GETPOST('id', 'int'));
// Security check
$socid = GETPOSTINT("socid");
// if ($user->socid) $socid=$user->socid;
$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');
@ -53,10 +57,12 @@ if (empty($page) || $page == - 1) {
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if ($sortorder == "") if ($sortorder == "") {
$sortorder = "ASC"; $sortorder = "ASC";
if ($sortfield == "") }
if ($sortfield == "") {
$sortfield = "bk.doc_date"; $sortfield = "bk.doc_date";
}
/* /*
$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'));
@ -73,24 +79,18 @@ if (!empty($lettering)) {
/* /*
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_date_start = ''; $search_date_start = '';
$search_date_end = ''; $search_date_end = '';
//$search_doc_type=''; //$search_doc_type='';
$search_doc_ref=''; $search_doc_ref='';
} }
*/ */
// Security check
$socid = GETPOST("socid", 'int');
// if ($user->socid) $socid=$user->socid;
$lettering = new Lettering($db); $lettering = new Lettering($db);
$object = new Societe($db); $object = new Societe($db);
$object->id = $socid; $object->id = $socid;
$result = $object->fetch($socid); $result = $object->fetch($socid);
if ($result < 0) if ($result < 0) {
{
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
@ -159,8 +159,7 @@ $solde = 0;
// Count total nb of records and calc total sum // Count total nb of records and calc total sum
$nbtotalofrecords = ''; $nbtotalofrecords = '';
$resql = $db->query($sql); $resql = $db->query($sql);
if (!$resql) if (!$resql) {
{
dol_print_error($db); dol_print_error($db);
exit; exit;
} }
@ -206,30 +205,30 @@ if ($resql) {
print '<table class="liste centpercent">'."\n"; print '<table class="liste centpercent">'."\n";
/* /*
print '<tr class="liste_titre">'; 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_doc_type" value="' . $search_doc_type . '"></td>';
// Date // Date
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print '<div class="nowrap">'; print '<div class="nowrap">';
print $langs->trans('From') . ' '; print $langs->trans('From') . ' ';
print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1); print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
print '</div>'; print '</div>';
print '<div class="nowrap">'; print '<div class="nowrap">';
print $langs->trans('to') . ' '; print $langs->trans('to') . ' ';
print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1); print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
print '</div>'; print '</div>';
print '</td>'; print '</td>';
// Piece // Piece
print '<td><input type="text" name="search_doc_ref" value="' . $search_doc_ref . '"></td>'; print '<td><input type="text" name="search_doc_ref" value="' . $search_doc_ref . '"></td>';
print '<td colspan="6">&nbsp;</td>'; print '<td colspan="6">&nbsp;</td>';
print '<td class="right">'; print '<td class="right">';
$searchpicto = $form->showFilterButtons(); $searchpicto = $form->showFilterButtons();
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
*/ */
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -248,7 +247,9 @@ if ($resql) {
$solde = 0; $solde = 0;
$tmp = ''; $tmp = '';
while ($obj = $db->fetch_object($resql)) { while ($obj = $db->fetch_object($resql)) {
if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code; if ($tmp != $obj->lettering_code || empty($tmp)) {
$tmp = $obj->lettering_code;
}
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit); /*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
print '<tr class="oddeven">'; print '<tr class="oddeven">';

View File

@ -60,6 +60,7 @@ class AccountancyExport
public static $EXPORT_TYPE_GESTINUMV3 = 130; public static $EXPORT_TYPE_GESTINUMV3 = 130;
public static $EXPORT_TYPE_GESTINUMV5 = 135; public static $EXPORT_TYPE_GESTINUMV5 = 135;
public static $EXPORT_TYPE_FEC = 1000; public static $EXPORT_TYPE_FEC = 1000;
public static $EXPORT_TYPE_FEC2 = 1010;
/** /**
@ -121,6 +122,7 @@ class AccountancyExport
self::$EXPORT_TYPE_GESTINUMV3 => $langs->trans('Modelcsv_Gestinum_v3'), self::$EXPORT_TYPE_GESTINUMV3 => $langs->trans('Modelcsv_Gestinum_v3'),
self::$EXPORT_TYPE_GESTINUMV5 => $langs->trans('Modelcsv_Gestinum_v5'), self::$EXPORT_TYPE_GESTINUMV5 => $langs->trans('Modelcsv_Gestinum_v5'),
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'), self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
self::$EXPORT_TYPE_FEC2 => $langs->trans('Modelcsv_FEC2'),
); );
ksort($listofexporttypes, SORT_NUMERIC); ksort($listofexporttypes, SORT_NUMERIC);
@ -155,6 +157,7 @@ class AccountancyExport
self::$EXPORT_TYPE_GESTINUMV3 => 'gestinumv3', self::$EXPORT_TYPE_GESTINUMV3 => 'gestinumv3',
self::$EXPORT_TYPE_GESTINUMV5 => 'gestinumv5', self::$EXPORT_TYPE_GESTINUMV5 => 'gestinumv5',
self::$EXPORT_TYPE_FEC => 'fec', self::$EXPORT_TYPE_FEC => 'fec',
self::$EXPORT_TYPE_FEC2 => 'fec2',
); );
return $formatcode[$type]; return $formatcode[$type];
@ -234,6 +237,10 @@ class AccountancyExport
'label' => $langs->trans('Modelcsv_FEC'), 'label' => $langs->trans('Modelcsv_FEC'),
'ACCOUNTING_EXPORT_FORMAT' => 'txt', 'ACCOUNTING_EXPORT_FORMAT' => 'txt',
), ),
self::$EXPORT_TYPE_FEC2 => array(
'label' => $langs->trans('Modelcsv_FEC2'),
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
),
), ),
'cr'=> array( 'cr'=> array(
'1' => $langs->trans("Unix"), '1' => $langs->trans("Unix"),
@ -322,6 +329,9 @@ class AccountancyExport
case self::$EXPORT_TYPE_FEC : case self::$EXPORT_TYPE_FEC :
$this->exportFEC($TData); $this->exportFEC($TData);
break; break;
case self::$EXPORT_TYPE_FEC2 :
$this->exportFEC2($TData);
break;
default: default:
$this->errors[] = $langs->trans('accountancy_error_modelnotfound'); $this->errors[] = $langs->trans('accountancy_error_modelnotfound');
break; break;
@ -505,9 +515,9 @@ class AccountancyExport
$end_line = "\r\n"; $end_line = "\r\n";
//We should use dol_now function not time however this is wrong date to transfert in accounting // 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(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 // $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))
@ -519,36 +529,46 @@ class AccountancyExport
$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';
//We use invoice date $data->doc_date not $date_ecriture which is the transfert date // 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 ? // 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'] = $date_ecriture;
$Tab['date_ecriture'] = dol_print_date($data->doc_date, '%d%m%y'); $Tab['date_ecriture'] = dol_print_date($data->doc_date, '%d%m%y');
$Tab['filler'] = ' '; $Tab['filler'] = ' ';
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 20), 20); $Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 20), 20);
$Tab['sens'] = $data->sens; // C or D
$Tab['signe_montant'] = '+';
//elarifr le montant doit etre en centimes sans point decimal ! // Credit invoice - invert sens
$Tab['montant'] = str_pad(abs($data->montant * 100), 12, '0', STR_PAD_LEFT); // TODO manage negative amount if ($data->montant < 0) {
// $Tab['montant'] = str_pad(abs($data->montant), 12, '0', STR_PAD_LEFT); // TODO manage negative amount if ($data->sens == 'C') {
$Tab['sens'] = 'D';
} else {
$Tab['sens'] = 'C';
}
$Tab['signe_montant'] = '-';
} else {
$Tab['sens'] = $data->sens; // C or D
$Tab['signe_montant'] = '+';
}
// The amount must be in centimes without decimal points.
$Tab['montant'] = str_pad(abs($data->montant * 100), 12, '0', STR_PAD_LEFT);
$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 // Force date format : %d%m%y
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 $Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%y'); // Format must be ddmmyy
} else { } else {
$Tab['date_echeance'] = '000000'; $Tab['date_echeance'] = '000000';
} }
//elarifr please keep quadra named field lettrage(2) + codestat(3) instead of fake lettrage(5) // Please keep quadra named field lettrage(2) + codestat(3) instead of fake lettrage(5)
//$Tab['lettrage'] = str_repeat(' ', 5); // $Tab['lettrage'] = str_repeat(' ', 5);
$Tab['lettrage'] = str_repeat(' ', 2); $Tab['lettrage'] = str_repeat(' ', 2);
$Tab['codestat'] = str_repeat(' ', 3); $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);
//elarifr keep correct quadra named field instead of anon filler // Keep correct quadra named field instead of anon filler
//$Tab['filler2'] = str_repeat(' ', 20); // $Tab['filler2'] = str_repeat(' ', 20);
$Tab['affaire'] = str_repeat(' ', 10); $Tab['affaire'] = str_repeat(' ', 10);
$Tab['quantity1'] = 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);
@ -556,17 +576,17 @@ class AccountancyExport
$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);
//elarifr keep correct quadra named field instead of anon filler libelle_ecriture2 is 30 char not 32 !!!! // 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 // 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: we should filter more than only accent to avoid wrong line size
//TODO: remove invoice number doc_ref in libelle, // 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 // 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->doc_ref) . ' ' . dol_string_unaccent($data->label_operation), 30), 30);
$Tab['libelle_ecriture2'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 30), 30); $Tab['libelle_ecriture2'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 30), 30);
$Tab['codetva'] = str_repeat(' ', 2); $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 // 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'] = str_pad(self::trunc($data->piece_num, 10), 10);
$Tab['num_piece3'] = substr(self::trunc($data->doc_ref, 20), -10); $Tab['num_piece3'] = substr(self::trunc($data->doc_ref, 20), -10);
$Tab['filler4'] = str_repeat(' ', 73); $Tab['filler4'] = str_repeat(' ', 73);
@ -800,6 +820,8 @@ class AccountancyExport
*/ */
public function exportFEC($objectLines) public function exportFEC($objectLines)
{ {
global $langs;
$separator = "\t"; $separator = "\t";
$end_line = "\r\n"; $end_line = "\r\n";
@ -820,71 +842,182 @@ class AccountancyExport
print "DateLet".$separator; print "DateLet".$separator;
print "ValidDate".$separator; print "ValidDate".$separator;
print "Montantdevise".$separator; print "Montantdevise".$separator;
print "Idevise"; print "Idevise".$separator;
print "DateLimitReglmt";
print $end_line;
foreach ($objectLines as $line) {
if ($line->debit == 0 && $line->credit == 0) {
unset($array[$line]);
} else {
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
$date_lettering = dol_print_date($line->date_lettering, '%Y%m%d');
$date_validation = dol_print_date($line->date_validated, '%Y%m%d');
$date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d');
// FEC:JournalCode
print $line->code_journal . $separator;
// FEC:JournalLib
print dol_string_unaccent($langs->transnoentities($line->journal_label)) . $separator;
// FEC:EcritureNum
print $line->piece_num . $separator;
// FEC:EcritureDate
print $date_document . $separator;
// FEC:CompteNum
print $line->numero_compte . $separator;
// FEC:CompteLib
print dol_string_unaccent($line->label_compte) . $separator;
// FEC:CompAuxNum
print $line->subledger_account . $separator;
// FEC:CompAuxLib
print dol_string_unaccent($line->subledger_label) . $separator;
// FEC:PieceRef
print $line->doc_ref . $separator;
// FEC:PieceDate
print dol_string_unaccent($date_creation) . $separator;
// FEC:EcritureLib
print dol_string_unaccent($line->label_operation) . $separator;
// FEC:Debit
print price2fec($line->debit) . $separator;
// FEC:Credit
print price2fec($line->credit) . $separator;
// FEC:EcritureLet
print $line->lettering_code . $separator;
// FEC:DateLet
print $date_lettering . $separator;
// FEC:ValidDate
print $date_validation . $separator;
// FEC:Montantdevise
print $line->multicurrency_amount . $separator;
// FEC:Idevise
print $line->multicurrency_code.$separator;
// FEC_suppl:DateLimitReglmt
print $date_limit_payment;
print $end_line;
}
}
}
/**
* Export format : FEC2
*
* @param array $objectLines data
* @return void
*/
public function exportFEC2($objectLines)
{
global $langs;
$separator = "\t";
$end_line = "\r\n";
print "JournalCode".$separator;
print "JournalLib".$separator;
print "EcritureNum".$separator;
print "EcritureDate".$separator;
print "CompteNum".$separator;
print "CompteLib".$separator;
print "CompAuxNum".$separator;
print "CompAuxLib".$separator;
print "PieceRef".$separator;
print "PieceDate".$separator;
print "EcritureLib".$separator;
print "Debit".$separator;
print "Credit".$separator;
print "EcritureLet".$separator;
print "DateLet".$separator;
print "ValidDate".$separator;
print "Montantdevise".$separator;
print "Idevise".$separator;
print "DateLimitReglmt";
print $end_line; print $end_line;
foreach ($objectLines as $line) { foreach ($objectLines as $line) {
if ($line->debit == 0 && $line->credit == 0) { if ($line->debit == 0 && $line->credit == 0) {
unset($array[$line]); unset($array[$line]);
} else { } else {
$date_creation = dol_print_date($line->date_creation, '%Y%m%d'); $date_creation = dol_print_date($line->date_creation, '%Y%m%d');
$date_document = dol_print_date($line->doc_date, '%Y%m%d'); $date_document = dol_print_date($line->doc_date, '%Y%m%d');
$date_lettering = dol_print_date($line->date_lettering, '%Y%m%d'); $date_lettering = dol_print_date($line->date_lettering, '%Y%m%d');
$date_validation = dol_print_date($line->date_validated, '%Y%m%d'); $date_validation = dol_print_date($line->date_validated, '%Y%m%d');
$date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d');
// FEC:JournalCode // FEC:JournalCode
print $line->code_journal.$separator; print $line->code_journal . $separator;
// FEC:JournalLib // FEC:JournalLib
print $line->journal_label.$separator; print dol_string_unaccent($langs->transnoentities($line->journal_label)) . $separator;
// FEC:EcritureNum // FEC:EcritureNum
print $line->piece_num.$separator; print $line->piece_num . $separator;
// FEC:EcritureDate // FEC:EcritureDate
print $date_document.$separator; print $date_creation . $separator;
// FEC:CompteNum // FEC:CompteNum
print $line->numero_compte.$separator; print length_accountg($line->numero_compte) . $separator;
// FEC:CompteLib // FEC:CompteLib
print dol_string_unaccent($line->label_compte).$separator; print dol_string_unaccent($line->label_compte) . $separator;
// FEC:CompAuxNum // FEC:CompAuxNum
print $line->subledger_account.$separator; print length_accounta($line->subledger_account) . $separator;
// FEC:CompAuxLib // FEC:CompAuxLib
print dol_string_unaccent($line->subledger_label).$separator; print dol_string_unaccent($line->subledger_label) . $separator;
// FEC:PieceRef // FEC:PieceRef
print $line->doc_ref.$separator; print $line->doc_ref . $separator;
// FEC:PieceDate // FEC:PieceDate
print dol_string_unaccent($date_creation).$separator; print $date_document . $separator;
// FEC:EcritureLib // FEC:EcritureLib
print dol_string_unaccent($line->label_operation).$separator; print dol_string_unaccent($line->label_operation) . $separator;
// FEC:Debit // FEC:Debit
print price2fec($line->debit).$separator; print price2fec($line->debit) . $separator;
// FEC:Credit // FEC:Credit
print price2fec($line->credit).$separator; print price2fec($line->credit) . $separator;
// FEC:EcritureLet // FEC:EcritureLet
print $line->lettering_code.$separator; print $line->lettering_code . $separator;
// FEC:DateLet // FEC:DateLet
print $date_lettering.$separator; print $date_lettering . $separator;
// FEC:ValidDate // FEC:ValidDate
print $date_validation.$separator; print $date_validation . $separator;
// FEC:Montantdevise // FEC:Montantdevise
print $line->multicurrency_amount.$separator; print $line->multicurrency_amount . $separator;
// FEC:Idevise // FEC:Idevise
print $line->multicurrency_code; print $line->multicurrency_code . $separator;
// FEC_suppl:DateLimitReglmt
print $date_limit_payment;
print $end_line; print $end_line;
} }
@ -1515,15 +1648,15 @@ class AccountancyExport
($line->doc_type == 'supplier_invoice' && !isset($supplier_invoices_infos[$line->fk_doc]))) { ($line->doc_type == 'supplier_invoice' && !isset($supplier_invoices_infos[$line->fk_doc]))) {
if ($line->doc_type == 'customer_invoice') { if ($line->doc_type == 'customer_invoice') {
// Get new customer invoice ref and company name // Get new customer invoice ref and company name
$sql = 'SELECT f.facnumber, s.nom FROM ' . MAIN_DB_PREFIX . 'facture as f'; $sql = 'SELECT f.ref, s.nom FROM ' . MAIN_DB_PREFIX . 'facture as f';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON f.fk_soc = s.rowid'; $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON f.fk_soc = s.rowid';
$sql .= ' WHERE f.rowid = ' . $line->fk_doc; $sql .= ' WHERE f.rowid = ' . $line->fk_doc;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
if ($obj = $this->db->fetch_object($resql)) { if ($obj = $this->db->fetch_object($resql)) {
// Save invoice infos // Save invoice infos
$invoices_infos[$line->fk_doc] = array('ref' => $obj->facnumber, 'company_name' => $obj->nom); $invoices_infos[$line->fk_doc] = array('ref' => $obj->ref, 'company_name' => $obj->nom);
$invoice_ref = $obj->facnumber; $invoice_ref = $obj->ref;
$company_name = $obj->nom; $company_name = $obj->nom;
} }
} }

View File

@ -126,7 +126,7 @@ class AccountingJournal extends CommonObject
$this->rowid = $obj->rowid; $this->rowid = $obj->rowid;
$this->code = $obj->code; $this->code = $obj->code;
$this->ref = $obj->code; $this->ref = $obj->code;
$this->label = $obj->label; $this->label = $obj->label;
$this->nature = $obj->nature; $this->nature = $obj->nature;
$this->active = $obj->active; $this->active = $obj->active;

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2014-2017 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2014-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-2017 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2015-2020 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 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
@ -315,6 +315,7 @@ class BookKeeping extends CommonObject
$objnum = $this->db->fetch_object($resqlnum); $objnum = $this->db->fetch_object($resqlnum);
$this->piece_num = $objnum->piece_num; $this->piece_num = $objnum->piece_num;
} }
dol_syslog(get_class($this).":: create this->piece_num=".$this->piece_num, LOG_DEBUG); dol_syslog(get_class($this).":: create this->piece_num=".$this->piece_num, LOG_DEBUG);
if (empty($this->piece_num)) { if (empty($this->piece_num)) {
$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum"; $sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
@ -327,8 +328,8 @@ class BookKeeping extends CommonObject
$objnum = $this->db->fetch_object($resqlnum); $objnum = $this->db->fetch_object($resqlnum);
$this->piece_num = $objnum->maxpiecenum; $this->piece_num = $objnum->maxpiecenum;
} }
dol_syslog(get_class($this).":: create this->piece_num=".$this->piece_num, LOG_DEBUG);
} }
dol_syslog(get_class($this).":: create this->piece_num=".$this->piece_num, LOG_DEBUG);
if (empty($this->piece_num)) { if (empty($this->piece_num)) {
$this->piece_num = 1; $this->piece_num = 1;
} }
@ -383,7 +384,6 @@ class BookKeeping extends CommonObject
$sql .= ", ".(!isset($this->entity) ? $conf->entity : $this->entity); $sql .= ", ".(!isset($this->entity) ? $conf->entity : $this->entity);
$sql .= ")"; $sql .= ")";
dol_syslog(get_class($this).":: create sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); $id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
@ -795,7 +795,7 @@ class BookKeeping extends CommonObject
$sql .= " t.label_operation,"; $sql .= " t.label_operation,";
$sql .= " t.debit,"; $sql .= " t.debit,";
$sql .= " t.credit,"; $sql .= " t.credit,";
$sql .= " t.montant,"; $sql .= " t.montant as amount,";
$sql .= " t.sens,"; $sql .= " t.sens,";
$sql .= " t.multicurrency_amount,"; $sql .= " t.multicurrency_amount,";
$sql .= " t.multicurrency_code,"; $sql .= " t.multicurrency_code,";
@ -806,7 +806,8 @@ class BookKeeping extends CommonObject
$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 .= " t.date_creation,";
$sql .= " t.date_export";
// Manage filter // Manage filter
$sqlwhere = array(); $sqlwhere = array();
if (count($filter) > 0) { if (count($filter) > 0) {
@ -823,8 +824,18 @@ class BookKeeping extends CommonObject
$sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\''; $sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\'';
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') { } elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\''; $sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.credit' || $key == 't.debit') { } elseif ($key == 't.credit' || $key == 't.debit') {
$sqlwhere[] = natural_search($key, $value, 1, 1); $sqlwhere[] = natural_search($key, $value, 1, 1);
} elseif ($key == 't.reconciled_option') {
$sqlwhere[] = 't.lettering_code IS NULL';
} elseif ($key == 't.code_journal' && !empty($value)) {
if (is_array($value)) {
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
} else {
$sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
}
} else { } else {
$sqlwhere[] = natural_search($key, $value, 0, 1); $sqlwhere[] = natural_search($key, $value, 0, 1);
} }
@ -874,7 +885,8 @@ class BookKeeping extends CommonObject
$line->label_operation = $obj->label_operation; $line->label_operation = $obj->label_operation;
$line->debit = $obj->debit; $line->debit = $obj->debit;
$line->credit = $obj->credit; $line->credit = $obj->credit;
$line->montant = $obj->montant; $line->montant = $obj->amount; // deprecated
$line->amount = $obj->amount;
$line->sens = $obj->sens; $line->sens = $obj->sens;
$line->multicurrency_amount = $obj->multicurrency_amount; $line->multicurrency_amount = $obj->multicurrency_amount;
$line->multicurrency_code = $obj->multicurrency_code; $line->multicurrency_code = $obj->multicurrency_code;
@ -885,7 +897,8 @@ 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; $line->date_creation = $this->db->jdate($obj->date_creation);
$line->date_export = $this->db->jdate($obj->date_export);
$this->lines[] = $line; $this->lines[] = $line;
@ -937,7 +950,7 @@ class BookKeeping extends CommonObject
$sql .= " t.credit,"; $sql .= " t.credit,";
$sql .= " t.lettering_code,"; $sql .= " t.lettering_code,";
$sql .= " t.date_lettering,"; $sql .= " t.date_lettering,";
$sql .= " t.montant,"; $sql .= " t.montant as amount,";
$sql .= " t.sens,"; $sql .= " t.sens,";
$sql .= " t.fk_user_author,"; $sql .= " t.fk_user_author,";
$sql .= " t.import_key,"; $sql .= " t.import_key,";
@ -1015,7 +1028,8 @@ class BookKeeping extends CommonObject
$line->label_operation = $obj->label_operation; $line->label_operation = $obj->label_operation;
$line->debit = $obj->debit; $line->debit = $obj->debit;
$line->credit = $obj->credit; $line->credit = $obj->credit;
$line->montant = $obj->montant; $line->montant = $obj->amount; // deprecated
$line->amount = $obj->amount;
$line->sens = $obj->sens; $line->sens = $obj->sens;
$line->lettering_code = $obj->lettering_code; $line->lettering_code = $obj->lettering_code;
$line->date_lettering = $obj->date_lettering; $line->date_lettering = $obj->date_lettering;

View File

@ -25,11 +25,16 @@
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "other", "main", "accountancy")); $langs->loadLangs(array("compta", "bills", "other", "main", "accountancy"));
$socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'aZ09');
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (empty($conf->accounting->enabled)) {
accessforbidden(); accessforbidden();
@ -39,6 +44,7 @@ if ($user->socid > 0)
if (!$user->rights->accounting->fiscalyear->write) if (!$user->rights->accounting->fiscalyear->write)
accessforbidden(); accessforbidden();
$object = new BookKeeping($db);
$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);
if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int'); if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
@ -60,14 +66,91 @@ $year_current = $year_start;
/* /*
* Actions * Actions
*/ */
if ($action == 'validate_movements_confirm' && $user->rights->accounting->fiscalyear->write) {
$result = $object->fetchAll();
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
} else {
// Specify as export : update field date_validated on selected month/year
$error = 0;
$db->begin();
$date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
$date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
if (is_array($object->lines))
{
foreach ($object->lines as $movement)
{
$now = dol_now();
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
$sql .= " SET date_validated = '".$db->idate($now)."'";
$sql .= " WHERE rowid = ".$movement->id;
$sql .= " AND doc_date >= '" . dol_print_date($date_start, 'dayrfc') . "'";
$sql .= " AND doc_date <= '" . dol_print_date($date_end, 'dayrfc') . "'";
dol_syslog("/accountancy/closure/index.php :: Function validate_movement_confirm Specify movements as validated sql=".$sql, LOG_DEBUG);
$result = $db->query($sql);
if (!$result)
{
$error++;
break;
}
}
}
if (!$error)
{
$db->commit();
setEventMessages($langs->trans("AllMovementsWereRecordedAsValidated"), null, 'mesgs');
} else {
$error++;
$db->rollback();
setEventMessages($langs->trans("NotAllMovementsCouldBeRecordedAsValidated"), null, 'errors');
}
header("Location: ".$_SERVER['PHP_SELF']."?year=".$year_start);
exit;
}
}
/* /*
* View * View
*/ */
$form = new Form($db);
$formaccounting = new FormAccounting($db);
llxHeader('', $langs->trans("Closure")); llxHeader('', $langs->trans("Closure"));
if ($action == 'validate_movements') {
$form_question = array();
$month = isset($conf->global->SOCIETE_FISCAL_MONTH_START) ? intval($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
$date_start = new DateTime(sprintf('%04d-%02d-%02d', $year_start, $month, 1));
$date_end = new DateTime(sprintf('%04d-%02d-%02d', $year_start, $month, 1));
$date_end->add(new DateInterval('P1Y'));
$date_end->sub(new DateInterval('P1D'));
$form_question['date_start'] = array(
'name' => 'date_start',
'type' => 'date',
'label' => $langs->trans('DateStart'),
'value' => $date_start->format('Y-m-d')
);
$form_question['date_end'] = array(
'name' => 'date_end',
'type' => 'date',
'label' => $langs->trans('DateEnd'),
'value' => $date_end->format('Y-m-d')
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?year='.$year_start, $langs->trans('ValidateMovements'), $langs->trans('DescValidateMovements', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'validate_movements_confirm', $form_question, '', 1, 300);
print $formconfirm;
}
$textprevyear = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current - 1).'">'.img_previous().'</a>'; $textprevyear = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current - 1).'">'.img_previous().'</a>';
$textnextyear = '&nbsp;<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>'; $textnextyear = '&nbsp;<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>';
@ -80,9 +163,9 @@ print '<br>';
$y = $year_current; $y = $year_current;
$buttonbind = '<a class="butAction" href="./validate.php">'.$langs->trans("ValidateMovements").'</a>'; $buttonvalidate = '<a class="butAction" name="button_validate_movements" href="'.$_SERVER["PHP_SELF"].'?action=validate_movements&year='.$year_start.'">'.$langs->trans("ValidateMovements").'</a>';
print_barre_liste($langs->trans("OverviewOfMovementsNotValidated"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1); print_barre_liste($langs->trans("OverviewOfMovementsNotValidated"), '', '', '', '', '', '', -1, '', '', 0, $buttonvalidate, '', 0, 1, 1);
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
@ -104,6 +187,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
$sql .= " WHERE b.doc_date >= '".$db->idate($search_date_start)."'"; $sql .= " WHERE b.doc_date >= '".$db->idate($search_date_start)."'";
$sql .= " AND b.doc_date <= '".$db->idate($search_date_end)."'"; $sql .= " AND b.doc_date <= '".$db->idate($search_date_end)."'";
$sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy $sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy
$sql .= " AND date_validated IS NULL";
dol_syslog('htdocs/accountancy/closure/index.php sql='.$sql, LOG_DEBUG); dol_syslog('htdocs/accountancy/closure/index.php sql='.$sql, LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);

View File

@ -1,156 +0,0 @@
<?php
/* Copyright (C) 2019 Open-DSI <support@open-dsi.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/accountancy/closure/validate.php
* \ingroup Accountancy
* \brief Validate entries page
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
// Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "other", "main", "accountancy"));
// Security check
if (empty($conf->accounting->enabled)) {
accessforbidden();
}
if ($user->socid > 0)
accessforbidden();
if (!$user->rights->accounting->fiscalyear->write)
accessforbidden();
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
else {
$year_start = dol_print_date(dol_now(), '%Y');
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
}
$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);
$year_current = $year_start;
/*
* Actions
*/
if ($action == 'validate')
{
$now = dol_now();
// Update database
$db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
$sql .= " SET b.date_validated = '".$db->idate($now)."'";
$sql .= ' WHERE b.date_validated IS NULL';
dol_syslog("htdocs/accountancy/closure/validate.php validate", LOG_DEBUG);
$resql = $db->query($sql);
if (!$resql1) {
$error++;
$db->rollback();
setEventMessages($db->lasterror(), null, 'errors');
} else {
$db->commit();
}
// End clean database
}
/*
* View
*/
llxHeader('', $langs->trans("ValidateMovements"));
$textprevyear = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current - 1).'">'.img_previous().'</a>';
$textnextyear = '&nbsp;<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>';
print load_fiche_titre($langs->trans("ValidateMovements")." ".$textprevyear." ".$langs->trans("Year")." ".$year_start." ".$textnextyear, '', 'title_accountancy');
print $langs->trans("DescValidateMovements").'<br>';
print '<br>';
$y = $year_current;
print_barre_liste($langs->trans("SelectMonthAndValidate"), '', '', '', '', '', '', -1, '', '', 0, '', 'class="right"', 0, 1, 1);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="oddeven">';
for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) $j -= 12;
print '<td class="center">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
}
print '<td><b>'.$langs->trans("Total").'</b></td></tr>';
print '<tr class="oddeven">';
$sql = "SELECT COUNT(b.rowid) as detail,";
for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) $j -= 12;
$sql .= " SUM(".$db->ifsql('MONTH(b.doc_date)='.$j, '1', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
}
$sql .= " COUNT(b.rowid) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
$sql .= " WHERE b.doc_date >= '".$db->idate($search_date_start)."'";
$sql .= " AND b.doc_date <= '".$db->idate($search_date_end)."'";
$sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy
dol_syslog('htdocs/accountancy/closure/index.php sql='.$sql, LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
while ($row = $db->fetch_row($resql)) {
for ($i = 1; $i <= 12; $i++) {
print '<td class="nowrap center">'.$row[$i].'<br><br>';
print '<input id="cb'.$row[$i].'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$row[$i].'"'.($selected ? ' checked="checked"' : '').'>';
print '</td>';
}
print '<td class="valigntop"><b>'.$row[13].'</b></td>';
}
$db->free($resql);
} else {
print $db->lasterror(); // Show last sql error
}
print '</tr>';
print "</table>\n";
print '<br><div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?month='.$year_current.'&action=validate"">'.$langs->trans("ValidateMovements").'</a></div>';
print '</div>';
// End of page
llxFooter();
$db->close();

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* 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>
* *
@ -123,9 +123,9 @@ if ($action == 'validatehistory') {
$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.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.tva_tx as tva_tx_prod,";
$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,"; $sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,"; $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,";
$sql .= " co.code as country_code, co.label as country_label,"; $sql .= " co.code as country_code, co.label as country_label,";
$sql .= " s.tva_intra"; $sql .= " s.tva_intra, s.accountancy_code_sell as company_code_sell";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
@ -134,6 +134,7 @@ if ($action == 'validatehistory') {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON s.accountancy_code_sell = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql .= " AND l.product_type <= 2"; $sql .= " AND l.product_type <= 2";
@ -153,7 +154,7 @@ if ($action == 'validatehistory') {
$isBuyerInEEC = isInEEC($objp); $isBuyerInEEC = isInEEC($objp);
// Search suggested account for product/service (similar code exists in page list.php to make manual binding) // Level 2: Search suggested account for product/service (similar code exists in page list.php to make manual binding)
$suggestedaccountingaccountfor = ''; $suggestedaccountingaccountfor = '';
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_sell_p = $objp->code_sell; $objp->code_sell_p = $objp->code_sell;
@ -179,6 +180,13 @@ if ($action == 'validatehistory') {
} }
} }
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($objp->company_code_sell)) {
$objp->code_sell_t = $objp->company_code_sell;
$objp->aarowid_suggest = $objp->aarowid_thirdparty;
$suggestedaccountingaccountfor = '';
}
if ($objp->aarowid_suggest > 0) if ($objp->aarowid_suggest > 0)
{ {
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facturedet"; $sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facturedet";

View File

@ -176,7 +176,8 @@ print '<script type="text/javascript">
$sql = "SELECT f.rowid as facid, f.ref as ref, f.type, f.datef, f.ref_client,"; $sql = "SELECT f.rowid as facid, f.ref as ref, f.type, f.datef, f.ref_client,";
$sql .= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,"; $sql .= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
$sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,"; $sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell,"; $sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.tobuy, p.tosell,";
$sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,";
$sql .= " aa.rowid as fk_compte, aa.account_number, aa.label, aa.labelshort,"; $sql .= " aa.rowid as fk_compte, aa.account_number, aa.label, aa.labelshort,";
$sql .= " fd.situation_percent,"; $sql .= " fd.situation_percent,";
$sql .= " co.code as country_code, co.label as country,"; $sql .= " co.code as country_code, co.label as country,";
@ -326,7 +327,7 @@ if ($result) {
//print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">'; //print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
print '</td>'; print '</td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
print '<td class="liste_titre center"><input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).'"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).'"></td>';
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
$searchpicto = $form->showFilterButtons(); $searchpicto = $form->showFilterButtons();
print $searchpicto; print $searchpicto;
@ -377,6 +378,11 @@ if ($result) {
$productstatic->id = $objp->product_id; $productstatic->id = $objp->product_id;
$productstatic->label = $objp->product_label; $productstatic->label = $objp->product_label;
$productstatic->type = $objp->line_type; $productstatic->type = $objp->line_type;
$productstatic->status = $objp->tosell;
$productstatic->status_buy = $objp->tobuy;
$productstatic->accountancy_code_sell = $objp->accountancy_code_sell;
$productstatic->accountancy_code_sell_intra = $objp->accountancy_code_sell_intra;
$productstatic->accountancy_code_sell_export = $objp->accountancy_code_sell_export;
$accountingaccountstatic->rowid = $objp->fk_compte; $accountingaccountstatic->rowid = $objp->fk_compte;
$accountingaccountstatic->label = $objp->label; $accountingaccountstatic->label = $objp->label;
@ -424,11 +430,12 @@ if ($result) {
print '<td>'.$objp->tva_intra.'</td>'; print '<td>'.$objp->tva_intra.'</td>';
print '<td class="center">'; print '<td>';
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1); print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
print ' <a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">'; print ' <a class="editfielda" 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 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>';

View File

@ -211,9 +211,9 @@ $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label,
$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,"; $sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,"; $sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,";
$sql .= " p.tosell as status, p.tobuy as status_buy,"; $sql .= " p.tosell as status, p.tobuy as status_buy,";
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,"; $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,";
$sql .= " co.code as country_code, co.label as country_label,"; $sql .= " co.code as country_code, co.label as country_label,";
$sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur"; $sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur, s.accountancy_code_sell as company_code_sell";
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint; $sql .= $hookmanager->resPrint;
@ -225,6 +225,7 @@ $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_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON s.accountancy_code_sell = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql .= " AND l.product_type <= 2"; $sql .= " AND l.product_type <= 2";
// Define begin binding date // Define begin binding date
@ -456,11 +457,12 @@ if ($result) {
$facture_static->type = $objp->ftype; $facture_static->type = $objp->ftype;
$code_sell_p_notset = ''; $code_sell_p_notset = '';
$code_sell_t_notset = '';
$objp->aarowid_suggest = ''; // Will be set later $objp->aarowid_suggest = ''; // Will be set later
$isBuyerInEEC = isInEEC($objp); $isBuyerInEEC = isInEEC($objp);
// Search suggested default account for product/service // Level 1: Search suggested default account for product/service
$suggestedaccountingaccountbydefaultfor = ''; $suggestedaccountingaccountbydefaultfor = '';
if ($objp->type_l == 1) { if ($objp->type_l == 1) {
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
@ -503,7 +505,7 @@ if ($result) {
} }
if ($objp->code_sell_l == -1) $objp->code_sell_l = ''; if ($objp->code_sell_l == -1) $objp->code_sell_l = '';
// Search suggested account for product/service (similar code exists in page index.php to make automatic binding) // Level 2: Search suggested account for product/service (similar code exists in page index.php to make automatic binding)
$suggestedaccountingaccountfor = ''; $suggestedaccountingaccountfor = '';
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_sell_p = $objp->code_sell; $objp->code_sell_p = $objp->code_sell;
@ -529,6 +531,15 @@ if ($result) {
} }
} }
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
if (!empty($objp->company_code_sell)) {
$objp->code_sell_t = $objp->company_code_sell;
$objp->aarowid_suggest = $objp->aarowid_thirdparty;
$suggestedaccountingaccountfor = '';
}
}
// Manage Deposit // Manage Deposit
if ($objp->description == "(DEPOSIT)") { if ($objp->description == "(DEPOSIT)") {
$accountdeposittoventilated = new AccountingAccount($db); $accountdeposittoventilated = new AccountingAccount($db);
@ -547,6 +558,7 @@ if ($result) {
// $objp->code_sell_l is now default code of product/service // $objp->code_sell_l is now default code of product/service
// $objp->code_sell_p is now code of product/service // $objp->code_sell_p is now code of product/service
// $objp->code_sell_t is now code of thirdparty
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -596,7 +608,7 @@ if ($result) {
// Found accounts // Found accounts
print '<td>'; print '<td>';
$s = '<span class="small">'.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': </span>'; $s = '<span class="small">1. '.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': </span>';
$shelp = ''; $shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC"); if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport"); elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport");
@ -605,24 +617,38 @@ if ($result) {
if ($objp->product_id > 0) if ($objp->product_id > 0)
{ {
print '<br>'; print '<br>';
$s = '<span class="small">'.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': </span>'; $s = '<span class="small">2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': </span>';
$shelp = ''; $shelp = ''; $ttype = 'help';
if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC"); if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountfor == 'eecwithvat') $shelp = $langs->trans("SaleEECWithVAT"); elseif ($suggestedaccountingaccountfor == 'eecwithvat') $shelp = $langs->trans("SaleEECWithVAT");
elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') $shelp = $langs->trans("SaleEECWithoutVATNumber"); elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') {
$shelp = $langs->trans("SaleEECWithoutVATNumber");
$ttype = 'warning';
}
elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport"); elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport");
$s .= (empty($objp->code_sell_p) ? '<span style="'.$code_sell_p_notset.'">'.$langs->trans("NotDefined").'</span>' : length_accountg($objp->code_sell_p)); $s .= (empty($objp->code_sell_p) ? '<span style="'.$code_sell_p_notset.'">'.$langs->trans("NotDefined").'</span>' : length_accountg($objp->code_sell_p));
print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
} else {
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
print '<br>';
$s = '<span class="small">2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': </span>';
$shelp = '';
$s .= $langs->trans("NotDefined");
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
}
}
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
print '<br>';
$s = '<span class="small">3. '.(($objp->type_l == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': </span>';
$shelp = '';
$s .= ($objp->code_sell_t > 0 ? length_accountg($objp->code_sell_t) : '<span style="'.$code_sell_t_notset.'">'.$langs->trans("NotDefined").'</span>');
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
} }
print '</td>'; print '</td>';
// Suggested accounting account // Suggested accounting account
// $objp->code_sell_l = default (it takes the country into consideration), $objp->code_sell_p is value for product (it takes the country into consideration too)
print '<td>'; print '<td>';
$suggestedid = $objp->aarowid_suggest; $suggestedid = $objp->aarowid_suggest;
/*var_dump($suggestedid);
var_dump($objp->code_sell_p);
var_dump($objp->code_sell_l);*/
if (empty($suggestedid) && empty($objp->code_sell_p) && !empty($objp->code_sell_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC)) if (empty($suggestedid) && empty($objp->code_sell_p) && !empty($objp->code_sell_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC))
{ {
if (empty($accountingaccount_codetotid_cache[$objp->code_sell_l])) if (empty($accountingaccount_codetotid_cache[$objp->code_sell_l]))
@ -642,7 +668,6 @@ if ($result) {
// Column with checkbox // Column with checkbox
print '<td class="center">'; print '<td class="center">';
//var_dump($objp->aarowid);var_dump($objp->aarowid_intra);var_dump($objp->aarowid_export);var_dump($objp->aarowid_suggest);
$ischecked = $objp->aarowid_suggest; $ischecked = $objp->aarowid_suggest;
if ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') $ischecked = 0; if ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') $ischecked = 0;
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="'.$objp->rowid."_".$i.'"'.($ischecked ? "checked" : "").'/>'; print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="'.$objp->rowid."_".$i.'"'.($ischecked ? "checked" : "").'/>';

View File

@ -549,7 +549,7 @@ if (!$error && $action == 'writebookkeeping') {
$bookkeeping->debit = ($mt >= 0 ? $mt : 0); $bookkeeping->debit = ($mt >= 0 ? $mt : 0);
$bookkeeping->credit = ($mt < 0 ? -$mt : 0); $bookkeeping->credit = ($mt < 0 ? -$mt : 0);
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->date_creation = $now; $bookkeeping->date_creation = $now;
@ -605,7 +605,7 @@ if (!$error && $action == 'writebookkeeping') {
$bookkeeping->debit = ($mt < 0 ? -$mt : 0); $bookkeeping->debit = ($mt < 0 ? -$mt : 0);
$bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->date_creation = $now; $bookkeeping->date_creation = $now;
@ -737,7 +737,7 @@ if (!$error && $action == 'writebookkeeping') {
$bookkeeping->debit = ($mt < 0 ? -$mt : 0); $bookkeeping->debit = ($mt < 0 ? -$mt : 0);
$bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->date_creation = $now; $bookkeeping->date_creation = $now;
$bookkeeping->label_compte = ''; $bookkeeping->label_compte = '';

View File

@ -223,7 +223,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0; $bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->credit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt > 0) ? $mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity; $bookkeeping->entity = $conf->entity;
@ -271,7 +271,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0; $bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity; $bookkeeping->entity = $conf->entity;
@ -329,7 +329,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0; $bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity; $bookkeeping->entity = $conf->entity;

View File

@ -322,7 +322,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0; $bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->credit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt > 0) ? $mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity; $bookkeeping->entity = $conf->entity;
@ -372,7 +372,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0; $bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity; $bookkeeping->entity = $conf->entity;
@ -433,7 +433,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0; $bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity; $bookkeeping->entity = $conf->entity;
@ -484,7 +484,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0; $bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity; $bookkeeping->entity = $conf->entity;

View File

@ -333,7 +333,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt >= 0) ? $mt : 0; $bookkeeping->debit = ($mt >= 0) ? $mt : 0;
$bookkeeping->credit = ($mt < 0) ? -$mt : 0; $bookkeeping->credit = ($mt < 0) ? -$mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity; $bookkeeping->entity = $conf->entity;
@ -383,7 +383,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt < 0) ? -$mt : 0; $bookkeeping->debit = ($mt < 0) ? -$mt : 0;
$bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity; $bookkeeping->entity = $conf->entity;
@ -443,7 +443,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt < 0) ? -$mt : 0; $bookkeeping->debit = ($mt < 0) ? -$mt : 0;
$bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $langs->transnoentities($journal_label);
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity; $bookkeeping->entity = $conf->entity;

View File

@ -120,9 +120,9 @@ if ($action == 'validatehistory') {
$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,"; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type,";
$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export, p.tva_tx as tva_tx_prod,"; $sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export, p.tva_tx as tva_tx_prod,";
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,"; $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,";
$sql .= " co.code as country_code, co.label as country_label,"; $sql .= " co.code as country_code, co.label as country_label,";
$sql .= " s.tva_intra"; $sql .= " s.tva_intra, s.accountancy_code_buy as company_code_buy";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
@ -131,6 +131,7 @@ if ($action == 'validatehistory') {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON s.accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql .= " AND l.product_type <= 2"; $sql .= " AND l.product_type <= 2";
@ -151,7 +152,7 @@ if ($action == 'validatehistory') {
$isSellerInEEC = isInEEC($objp); $isSellerInEEC = isInEEC($objp);
// Search suggested account for product/service // Level 2: Search suggested account for product/service (similar code exists in page list.php to make manual binding)
$suggestedaccountingaccountfor = ''; $suggestedaccountingaccountfor = '';
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_buy_p = $objp->code_buy; $objp->code_buy_p = $objp->code_buy;
@ -169,6 +170,13 @@ if ($action == 'validatehistory') {
} }
} }
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($objp->company_code_buy)) {
$objp->code_buy_t = $objp->company_code_buy;
$objp->aarowid_suggest = $objp->aarowid_thirdparty;
$suggestedaccountingaccountfor = '';
}
if ($objp->aarowid_suggest > 0) if ($objp->aarowid_suggest > 0)
{ {
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det"; $sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";

View File

@ -178,7 +178,8 @@ print '<script type="text/javascript">
$sql = "SELECT f.rowid as facid, f.ref as ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.fk_soc,"; $sql = "SELECT f.rowid as facid, f.ref as ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.fk_soc,";
$sql .= " l.rowid, l.fk_product, l.product_type as line_type, l.description, l.total_ht , l.qty, l.tva_tx, l.vat_src_code,"; $sql .= " l.rowid, l.fk_product, l.product_type as line_type, l.description, l.total_ht , l.qty, l.tva_tx, l.vat_src_code,";
$sql .= " aa.label, aa.labelshort, aa.account_number,"; $sql .= " aa.label, aa.labelshort, aa.account_number,";
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.fk_product_type as type,"; $sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tobuy, p.tosell,";
$sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,";
$sql .= " co.code as country_code, co.label as country,"; $sql .= " co.code as country_code, co.label as country,";
$sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur"; $sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur";
$parameters = array(); $parameters = array();
@ -376,6 +377,11 @@ if ($result) {
$productstatic->id = $objp->product_id; $productstatic->id = $objp->product_id;
$productstatic->label = $objp->product_label; $productstatic->label = $objp->product_label;
$productstatic->type = $objp->line_type; $productstatic->type = $objp->line_type;
$productstatic->status = $objp->tosell;
$productstatic->status_buy = $objp->tobuy;
$productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_sell_buy;
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_sell_buy;
$accountingaccountstatic->rowid = $objp->fk_compte; $accountingaccountstatic->rowid = $objp->fk_compte;
$accountingaccountstatic->label = $objp->label; $accountingaccountstatic->label = $objp->label;

View File

@ -30,6 +30,7 @@ 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';
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.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
@ -215,9 +216,9 @@ $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label,
$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,"; $sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,"; $sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,";
$sql .= " p.tosell as status, p.tobuy as status_buy,"; $sql .= " p.tosell as status, p.tobuy as status_buy,";
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,"; $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,";
$sql .= " co.code as country_code, co.label as country_label,"; $sql .= " co.code as country_code, co.label as country_label,";
$sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur"; $sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur, s.accountancy_code_buy as company_code_buy";
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint; $sql .= $hookmanager->resPrint;
@ -229,6 +230,7 @@ $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 AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON s.accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql .= " AND l.product_type <= 2"; $sql .= " AND l.product_type <= 2";
// Define begin binding date // Define begin binding date
@ -460,10 +462,12 @@ if ($result) {
$facturefourn_static->label = $objp->invoice_label; $facturefourn_static->label = $objp->invoice_label;
$code_buy_p_notset = ''; $code_buy_p_notset = '';
$code_buy_t_notset = '';
$objp->aarowid_suggest = ''; // Will be set later $objp->aarowid_suggest = ''; // Will be set later
$isSellerInEEC = isInEEC($objp); $isSellerInEEC = isInEEC($objp);
// Level 1: Search suggested default account for product/service
$suggestedaccountingaccountbydefaultfor = ''; $suggestedaccountingaccountbydefaultfor = '';
if ($objp->type_l == 1) { if ($objp->type_l == 1) {
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
@ -494,7 +498,7 @@ if ($result) {
} }
if ($objp->code_sell_l == -1) $objp->code_sell_l = ''; if ($objp->code_sell_l == -1) $objp->code_sell_l = '';
// Search suggested account for product/service // Level 2: Search suggested account for product/service (similar code exists in page index.php to make automatic binding)
$suggestedaccountingaccountfor = ''; $suggestedaccountingaccountfor = '';
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_buy_p = $objp->code_buy; $objp->code_buy_p = $objp->code_buy;
@ -512,6 +516,13 @@ if ($result) {
} }
} }
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($objp->company_code_buy)) {
$objp->code_buy_t = $objp->company_code_buy;
$objp->aarowid_suggest = $objp->aarowid_thirdparty;
$suggestedaccountingaccountfor = '';
}
if (!empty($objp->code_buy_p)) { if (!empty($objp->code_buy_p)) {
// Value was defined previously // Value was defined previously
} else { } else {
@ -521,6 +532,7 @@ if ($result) {
// $objp->code_buy_l is now default code of product/service // $objp->code_buy_l is now default code of product/service
// $objp->code_buy_p is now code of product/service // $objp->code_buy_p is now code of product/service
// $objp->code_buy_t is now code of thirdparty
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -576,7 +588,7 @@ if ($result) {
// Found accounts // Found accounts
print '<td>'; print '<td>';
$s = '<span class="small">'.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': </span>'; $s = '<span class="small">1. '.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': </span>';
$shelp = ''; $shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC"); if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport"); elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport");
@ -585,13 +597,24 @@ if ($result) {
if ($objp->product_id > 0) if ($objp->product_id > 0)
{ {
print '<br>'; print '<br>';
$s = '<span class="small">'.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': </span>'; $s = '<span class="small">2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': </span>';
$shelp = ''; $shelp = '';
if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC"); if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport"); elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport");
$s .= (empty($objp->code_buy_p) ? '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>' : length_accountg($objp->code_buy_p)); $s .= (empty($objp->code_buy_p) ? '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>' : length_accountg($objp->code_buy_p));
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
} else {
print '<br>';
$s = '<span class="small">2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': </span>';
$shelp = '';
$s .= $langs->trans("NotDefined");
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
} }
print '<br>';
$s = '<span class="small">3. '.(($objp->type_l == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': </span>';
$shelp = '';
$s .= ($objp->code_buy_t > 0 ? length_accountg($objp->code_buy_t) : '<span style="'.$code_buy_t_notset.'">'.$langs->trans("NotDefined").'</span>');
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
print '</td>'; print '</td>';
// Suggested accounting account // Suggested accounting account

View File

@ -1064,7 +1064,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<table class="border centpercent">'; print '<table class="border centpercent">';
// Ref // Ref
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td class="valeur">'.$object->id.'</td></tr>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td class="valeur">'.$object->ref.'</td></tr>';
// Login // Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
@ -1761,7 +1761,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem; if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
*/ */
// Shon online payment link // Show online payment link
$useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled)); $useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled));
if ($useonlinepayment) { if ($useonlinepayment) {

View File

@ -63,19 +63,24 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
$arrayofmembers = array(); $arrayofmembers = array();
// request taking into account member with up to date subscriptions // request taking into account member with up to date subscriptions
$sql = "SELECT d.rowid, d.firstname, d.lastname, d.login, d.societe as company, d.datefin,"; $sql = "SELECT d.rowid, d.ref, d.firstname, d.lastname, d.login, d.societe as company, d.datefin,";
$sql .= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,"; $sql .= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,";
$sql .= " t.libelle as type,"; $sql .= " t.libelle as type,";
$sql .= " c.code as country_code, c.label as country"; $sql .= " c.code as country_code, c.label as country";
// Add fields from extrafields // Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
}
}
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)";
}
$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1"; $sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
$sql .= " AND d.entity IN (".getEntity('adherent').")"; $sql .= " AND d.entity IN (".getEntity('adherent').")";
if (is_numeric($foruserid)) $sql .= " AND d.rowid=".$foruserid; if (is_numeric($foruserid)) $sql .= " AND d.rowid=".(int) $foruserid;
if ($foruserlogin) $sql .= " AND d.login='".$db->escape($foruserlogin)."'"; if ($foruserlogin) $sql .= " AND d.login='".$db->escape($foruserlogin)."'";
$sql .= " ORDER BY d.rowid ASC"; $sql .= " ORDER BY d.rowid ASC";
@ -90,6 +95,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
if ($objp->country == '-') $objp->country = ''; if ($objp->country == '-') $objp->country = '';
$adherentstatic->id = $objp->rowid; $adherentstatic->id = $objp->rowid;
$adherentstatic->ref = $objp->ref;
$adherentstatic->lastname = $objp->lastname; $adherentstatic->lastname = $objp->lastname;
$adherentstatic->firstname = $objp->firstname; $adherentstatic->firstname = $objp->firstname;
@ -110,6 +116,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
// List of values to scan for a replacement // List of values to scan for a replacement
$substitutionarray = array( $substitutionarray = array(
'__ID__'=>$objp->rowid, '__ID__'=>$objp->rowid,
'__REF__'=>$objp->ref,
'__LOGIN__'=>$objp->login, '__LOGIN__'=>$objp->login,
'__FIRSTNAME__'=>$objp->firstname, '__FIRSTNAME__'=>$objp->firstname,
'__LASTNAME__'=>$objp->lastname, '__LASTNAME__'=>$objp->lastname,
@ -149,6 +156,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
'textfooter'=>$textfooter, 'textfooter'=>$textfooter,
'textright'=>$textright, 'textright'=>$textright,
'id'=>$objp->rowid, 'id'=>$objp->rowid,
'ref'=>$objp->ref,
'photo'=>$objp->photo 'photo'=>$objp->photo
); );
} }
@ -159,6 +167,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
'textfooter'=>$textfooter, 'textfooter'=>$textfooter,
'textright'=>$textright, 'textright'=>$textright,
'id'=>$objp->rowid, 'id'=>$objp->rowid,
'ref'=>$objp->ref,
'photo'=>$objp->photo 'photo'=>$objp->photo
); );
} }
@ -172,12 +181,15 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
$textfooter = ''; $textfooter = '';
$textright = ''; $textright = '';
$arrayofmembers[] = array('textleft'=>$textleft, $arrayofmembers[] = array(
'textheader'=>$textheader, 'textleft'=>$textleft,
'textfooter'=>$textfooter, 'textheader'=>$textheader,
'textright'=>$textright, 'textfooter'=>$textfooter,
'id'=>$objp->rowid, 'textright'=>$textright,
'photo'=>$objp->photo); 'id'=>$objp->rowid,
'ref'=>$objp->ref,
'photo'=>$objp->photo,
);
} }
$i++; $i++;

View File

@ -288,6 +288,7 @@ class Adherent extends CommonObject
*/ */
public $fields = array( public $fields = array(
'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10),
'ref' => array('type' => 'varchar(30)', 'label' => 'Ref', 'default' => 1, 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 12, 'index' => 1),
'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1),
'ref_ext' => array('type' => 'varchar(128)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 0, 'position' => 20), 'ref_ext' => array('type' => 'varchar(128)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 0, 'position' => 20),
'civility' => array('type' => 'varchar(6)', 'label' => 'Civility', 'enabled' => 1, 'visible' => -1, 'position' => 25), 'civility' => array('type' => 'varchar(6)', 'label' => 'Civility', 'enabled' => 1, 'visible' => -1, 'position' => 25),
@ -417,6 +418,7 @@ class Adherent extends CommonObject
$infos = ''; $infos = '';
if ($this->civility_id) $infos .= $langs->transnoentities("UserTitle").": ".$this->getCivilityLabel()."\n"; if ($this->civility_id) $infos .= $langs->transnoentities("UserTitle").": ".$this->getCivilityLabel()."\n";
$infos .= $langs->transnoentities("id").": ".$this->id."\n"; $infos .= $langs->transnoentities("id").": ".$this->id."\n";
$infos .= $langs->transnoentities("ref").": ".$this->ref."\n";
$infos .= $langs->transnoentities("Lastname").": ".$this->lastname."\n"; $infos .= $langs->transnoentities("Lastname").": ".$this->lastname."\n";
$infos .= $langs->transnoentities("Firstname").": ".$this->firstname."\n"; $infos .= $langs->transnoentities("Firstname").": ".$this->firstname."\n";
$infos .= $langs->transnoentities("Company").": ".$this->company."\n"; $infos .= $langs->transnoentities("Company").": ".$this->company."\n";
@ -438,15 +440,20 @@ class Adherent extends CommonObject
// Substitutions // Substitutions
$substitutionarray = array( $substitutionarray = array(
'__ID__' => $this->id, '__MEMBER_ID__' => $this->id, '__CIVILITY__' => $this->getCivilityLabel(), '__ID__' => $this->id,
'__REF__' => $this->ref,
'__MEMBER_ID__' => $this->id,
'__CIVILITY__' => $this->getCivilityLabel(),
'__FIRSTNAME__' => $msgishtml ? dol_htmlentitiesbr($this->firstname) : ($this->firstname ? $this->firstname : ''), '__FIRSTNAME__' => $msgishtml ? dol_htmlentitiesbr($this->firstname) : ($this->firstname ? $this->firstname : ''),
'__LASTNAME__' => $msgishtml ? dol_htmlentitiesbr($this->lastname) : ($this->lastname ? $this->lastname : ''), '__LASTNAME__' => $msgishtml ? dol_htmlentitiesbr($this->lastname) : ($this->lastname ? $this->lastname : ''),
'__FULLNAME__' => $msgishtml ? dol_htmlentitiesbr($this->getFullName($langs)) : $this->getFullName($langs), '__FULLNAME__' => $msgishtml ? dol_htmlentitiesbr($this->getFullName($langs)) : $this->getFullName($langs),
'__COMPANY__' => $msgishtml ? dol_htmlentitiesbr($this->company) : ($this->company ? $this->company : ''), '__COMPANY__' => $msgishtml ? dol_htmlentitiesbr($this->company) : ($this->company ? $this->company : ''),
'__ADDRESS__' => $msgishtml ? dol_htmlentitiesbr($this->address) : ($this->address ? $this->address : ''), '__ADDRESS__' => $msgishtml ? dol_htmlentitiesbr($this->address) : ($this->address ? $this->address : ''),
'__ZIP__' => $msgishtml ? dol_htmlentitiesbr($this->zip) : ($this->zip ? $this->zip : ''), '__TOWN__' => $msgishtml ? dol_htmlentitiesbr($this->town) : ($this->town ? $this->town : ''), '__ZIP__' => $msgishtml ? dol_htmlentitiesbr($this->zip) : ($this->zip ? $this->zip : ''),
'__TOWN__' => $msgishtml ? dol_htmlentitiesbr($this->town) : ($this->town ? $this->town : ''),
'__COUNTRY__' => $msgishtml ? dol_htmlentitiesbr($this->country) : ($this->country ? $this->country : ''), '__COUNTRY__' => $msgishtml ? dol_htmlentitiesbr($this->country) : ($this->country ? $this->country : ''),
'__EMAIL__' => $msgishtml ? dol_htmlentitiesbr($this->email) : ($this->email ? $this->email : ''), '__BIRTH__' => $msgishtml ? dol_htmlentitiesbr($birthday) : ($birthday ? $birthday : ''), '__EMAIL__' => $msgishtml ? dol_htmlentitiesbr($this->email) : ($this->email ? $this->email : ''),
'__BIRTH__' => $msgishtml ? dol_htmlentitiesbr($birthday) : ($birthday ? $birthday : ''),
'__PHOTO__' => $msgishtml ? dol_htmlentitiesbr($this->photo) : ($this->photo ? $this->photo : ''), '__PHOTO__' => $msgishtml ? dol_htmlentitiesbr($this->photo) : ($this->photo ? $this->photo : ''),
'__LOGIN__' => $msgishtml ? dol_htmlentitiesbr($this->login) : ($this->login ? $this->login : ''), '__LOGIN__' => $msgishtml ? dol_htmlentitiesbr($this->login) : ($this->login ? $this->login : ''),
'__PASSWORD__' => $msgishtml ? dol_htmlentitiesbr($this->pass) : ($this->pass ? $this->pass : ''), '__PASSWORD__' => $msgishtml ? dol_htmlentitiesbr($this->pass) : ($this->pass ? $this->pass : ''),
@ -519,9 +526,10 @@ class Adherent extends CommonObject
// Insert member // Insert member
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent";
$sql .= " (datec,login,fk_user_author,fk_user_mod,fk_user_valid,morphy,fk_adherent_type,entity,import_key)"; $sql .= " (ref, datec,login,fk_user_author,fk_user_mod,fk_user_valid,morphy,fk_adherent_type,entity,import_key)";
$sql .= " VALUES ("; $sql .= " VALUES (";
$sql .= " '".$this->db->idate($this->datec)."'"; $sql .= " '(PROV)'";
$sql .= ", '".$this->db->idate($this->datec)."'";
$sql .= ", ".($this->login ? "'".$this->db->escape($this->login)."'" : "null"); $sql .= ", ".($this->login ? "'".$this->db->escape($this->login)."'" : "null");
$sql .= ", ".($user->id > 0 ? $user->id : "null"); // Can be null because member can be created by a guest or a script $sql .= ", ".($user->id > 0 ? $user->id : "null"); // Can be null because member can be created by a guest or a script
$sql .= ", null, null, '".$this->db->escape($this->morphy)."'"; $sql .= ", null, null, '".$this->db->escape($this->morphy)."'";
@ -635,7 +643,8 @@ class Adherent extends CommonObject
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
$sql .= " civility = ".($this->civility_id ? "'".$this->db->escape($this->civility_id)."'" : "null"); $sql .= " ref = '".$this->db->escape($this->ref)."'";
$sql .= ", civility = ".($this->civility_id ? "'".$this->db->escape($this->civility_id)."'" : "null");
$sql .= ", firstname = ".($this->firstname ? "'".$this->db->escape($this->firstname)."'" : "null"); $sql .= ", firstname = ".($this->firstname ? "'".$this->db->escape($this->firstname)."'" : "null");
$sql .= ", lastname = ".($this->lastname ? "'".$this->db->escape($this->lastname)."'" : "null"); $sql .= ", lastname = ".($this->lastname ? "'".$this->db->escape($this->lastname)."'" : "null");
$sql .= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman' $sql .= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman'
@ -752,6 +761,7 @@ class Adherent extends CommonObject
// If option ADHERENT_LOGIN_NOT_REQUIRED is on, there is no login of member, so we do not overwrite user login to keep existing one. // If option ADHERENT_LOGIN_NOT_REQUIRED is on, there is no login of member, so we do not overwrite user login to keep existing one.
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $luser->login = $this->login; if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $luser->login = $this->login;
$luser->ref = $this->ref;
$luser->civility_id = $this->civility_id; $luser->civility_id = $this->civility_id;
$luser->firstname = $this->firstname; $luser->firstname = $this->firstname;
$luser->lastname = $this->lastname; $luser->lastname = $this->lastname;
@ -1242,7 +1252,8 @@ class Adherent extends CommonObject
{ {
global $langs; global $langs;
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_code, d.gender, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,"; $sql = "SELECT d.rowid, d.ref, d.ref_ext, d.civility as civility_code, d.gender, d.firstname, d.lastname,";
$sql .= " d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,";
$sql .= " d.note_public,"; $sql .= " d.note_public,";
$sql .= " d.email, d.socialnetworks, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,"; $sql .= " d.email, d.socialnetworks, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,";
$sql .= " d.photo, d.fk_adherent_type, d.morphy, d.entity,"; $sql .= " d.photo, d.fk_adherent_type, d.morphy, d.entity,";
@ -1268,7 +1279,7 @@ class Adherent extends CommonObject
} elseif ($ref || $fk_soc) { } elseif ($ref || $fk_soc) {
$sql .= " AND d.entity IN (".getEntity('adherent').")"; $sql .= " AND d.entity IN (".getEntity('adherent').")";
if ($ref) { if ($ref) {
$sql .= " AND d.rowid='".$this->db->escape($ref)."'"; $sql .= " AND d.ref='".$this->db->escape($ref)."'";
} elseif ($fk_soc > 0) { } elseif ($fk_soc > 0) {
$sql .= " AND d.fk_soc=".((int) $fk_soc); $sql .= " AND d.fk_soc=".((int) $fk_soc);
} }
@ -1283,8 +1294,8 @@ class Adherent extends CommonObject
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->entity = $obj->entity; $this->entity = $obj->entity;
$this->ref = $obj->rowid;
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->ref;
$this->ref_ext = $obj->ref_ext; $this->ref_ext = $obj->ref_ext;
$this->civility_id = $obj->civility_code; // Bad. Kept for backard compatibility $this->civility_id = $obj->civility_code; // Bad. Kept for backard compatibility
@ -2072,7 +2083,7 @@ class Adherent extends CommonObject
if ($mode == 'login') { if ($mode == 'login') {
$result .= dol_trunc($this->login, $maxlen); $result .= dol_trunc($this->login, $maxlen);
} elseif ($mode == 'ref') { } elseif ($mode == 'ref') {
$result .= $this->id; $result .= $this->ref;
} else { } else {
$result .= $this->getFullName($langs, '', ($mode == 'firstname' ? 2 : ($mode == 'lastname' ? 4 : -1)), $maxlen); $result .= $this->getFullName($langs, '', ($mode == 'firstname' ? 2 : ($mode == 'lastname' ? 4 : -1)), $maxlen);
} }
@ -2317,6 +2328,7 @@ class Adherent extends CommonObject
// Initialise parametres // Initialise parametres
$this->id = 0; $this->id = 0;
$this->ref = 'ABC001';
$this->entity = 1; $this->entity = 1;
$this->specimen = 1; $this->specimen = 1;
$this->civility_id = 0; $this->civility_id = 0;
@ -2585,38 +2597,8 @@ class Adherent extends CommonObject
*/ */
public function setCategories($categories) public function setCategories($categories)
{ {
// Handle single category
if (!is_array($categories)) {
$categories = array($categories);
}
// Get current categories
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$c = new Categorie($this->db); return parent::setCategoriesCommon($categories, Categorie::TYPE_MEMBER);
$existing = $c->containing($this->id, Categorie::TYPE_MEMBER, 'id');
// Diff
if (is_array($existing)) {
$to_del = array_diff($existing, $categories);
$to_add = array_diff($categories, $existing);
} else {
$to_del = array(); // Nothing to delete
$to_add = $categories;
}
// Process
foreach ($to_del as $del) {
if ($c->fetch($del) > 0) {
$c->del_type($this, Categorie::TYPE_MEMBER);
}
}
foreach ($to_add as $add) {
if ($c->fetch($add) > 0) {
$c->add_type($this, Categorie::TYPE_MEMBER);
}
}
return;
} }
/** /**

View File

@ -87,7 +87,7 @@ class Subscriptions extends DolibarrApi
*/ */
public function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') public function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{ {
global $db, $conf; global $conf;
$obj_ret = array(); $obj_ret = array();
@ -183,7 +183,9 @@ class Subscriptions extends DolibarrApi
} }
foreach ($request_data as $field => $value) { foreach ($request_data as $field => $value) {
if ($field == 'id') continue; if ($field == 'id') {
continue;
}
$subscription->$field = $value; $subscription->$field = $value;
} }
@ -236,8 +238,9 @@ class Subscriptions extends DolibarrApi
{ {
$subscription = array(); $subscription = array();
foreach (Subscriptions::$FIELDS as $field) { foreach (Subscriptions::$FIELDS as $field) {
if (!isset($data[$field])) if (!isset($data[$field])) {
throw new RestException(400, "$field field missing"); throw new RestException(400, "$field field missing");
}
$subscription[$field] = $data[$field]; $subscription[$field] = $data[$field];
} }
return $subscription; return $subscription;

View File

@ -84,8 +84,15 @@ class Subscription extends CommonObject
* @var int ID * @var int ID
*/ */
public $fk_type; public $fk_type;
/**
* @var int Member ID
*/
public $fk_adherent; public $fk_adherent;
/**
* @var double amount subscription
*/
public $amount; public $amount;
/** /**
@ -140,7 +147,9 @@ class Subscription extends CommonObject
$this->error = $langs->trans("ErrorBadValueForDate"); $this->error = $langs->trans("ErrorBadValueForDate");
return -1; return -1;
} }
if (empty($this->datec)) $this->datec = $now; if (empty($this->datec)) {
$this->datec = $now;
}
$this->db->begin(); $this->db->begin();
@ -177,7 +186,9 @@ class Subscription extends CommonObject
$this->context = array('member' => $member); $this->context = array('member' => $member);
// Call triggers // Call triggers
$result = $this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user); $result = $this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user);
if ($result < 0) { $error++; } if ($result < 0) {
$error++;
}
// End call triggers // End call triggers
} }
@ -278,7 +289,9 @@ class Subscription extends CommonObject
$this->context = array('member'=>$member); $this->context = array('member'=>$member);
// Call triggers // Call triggers
$result = $this->call_trigger('MEMBER_SUBSCRIPTION_MODIFY', $user); $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 if ($result < 0) {
$error++;
} //Do also here what you must do to rollback action if trigger fail
// End call triggers // End call triggers
} }
} else { } else {
@ -320,7 +333,9 @@ class Subscription extends CommonObject
if (!$notrigger) { if (!$notrigger) {
// Call triggers // Call triggers
$result = $this->call_trigger('MEMBER_SUBSCRIPTION_DELETE', $user); $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 if ($result < 0) {
$error++;
} // Do also here what you must do to rollback action if trigger fail
// End call triggers // End call triggers
} }
} }
@ -407,16 +422,24 @@ class Subscription extends CommonObject
if ($option != 'nolink') { if ($option != 'nolink') {
// Add param to save lastsearch_values or not // Add param to save lastsearch_values or not
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; $add_save_lastsearch_values = 1;
}
if ($add_save_lastsearch_values) {
$url .= '&save_lastsearch_values=1';
}
} }
$linkstart = '<a href="'.$url.'" class="classfortooltip" title="'.dol_escape_htmltag($label, 1).'">'; $linkstart = '<a href="'.$url.'" class="classfortooltip" title="'.dol_escape_htmltag($label, 1).'">';
$linkend = '</a>'; $linkend = '</a>';
$result .= $linkstart; $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) {
if ($withpicto != 2) $result .= $this->ref; $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 .= $this->ref;
}
$result .= $linkend; $result .= $linkend;
return $result; return $result;

View File

@ -85,9 +85,15 @@ if ($result) {
$adhtype->label = $objp->label; $adhtype->label = $objp->label;
$AdherentType[$objp->rowid] = $adhtype; $AdherentType[$objp->rowid] = $adhtype;
if ($objp->statut == -1) { $MemberToValidate[$objp->rowid] = $objp->somme; } if ($objp->statut == -1) {
if ($objp->statut == 1) { $MembersValidated[$objp->rowid] = $objp->somme; } $MemberToValidate[$objp->rowid] = $objp->somme;
if ($objp->statut == 0) { $MembersResiliated[$objp->rowid] = $objp->somme; } }
if ($objp->statut == 1) {
$MembersValidated[$objp->rowid] = $objp->somme;
}
if ($objp->statut == 0) {
$MembersResiliated[$objp->rowid] = $objp->somme;
}
$i++; $i++;
} }
@ -136,10 +142,14 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is usel
print '<table class="noborder nohover centpercent">'; print '<table class="noborder nohover centpercent">';
$i = 0; $i = 0;
foreach ($listofsearchfields as $key => $value) { foreach ($listofsearchfields as $key => $value) {
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>'; if ($i == 0) {
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
}
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>'; print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>'; if ($i == 0) {
print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
}
print '</tr>'; print '</tr>';
$i++; $i++;
} }
@ -284,7 +294,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
*/ */
$max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT; $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
$sql = "SELECT a.rowid, a.statut as status, a.lastname, a.firstname, a.societe as company, a.fk_soc,"; $sql = "SELECT a.rowid, a.ref, a.statut as status, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
$sql .= " a.gender, a.email, a.photo, a.morphy,"; $sql .= " a.gender, a.email, a.photo, a.morphy,";
$sql .= " a.tms as datem, a.datefin as date_end_subscription,"; $sql .= " a.tms as datem, a.datefin as date_end_subscription,";
$sql .= " ta.rowid as typeid, ta.libelle as label, ta.subscription as need_subscription"; $sql .= " ta.rowid as typeid, ta.libelle as label, ta.subscription as need_subscription";
@ -308,7 +318,7 @@ if ($resql) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$staticmember->id = $obj->rowid; $staticmember->id = $obj->rowid;
$staticmember->ref = $obj->rowid; $staticmember->ref = $obj->ref;
$staticmember->lastname = $obj->lastname; $staticmember->lastname = $obj->lastname;
$staticmember->firstname = $obj->firstname; $staticmember->firstname = $obj->firstname;
$staticmember->gender = $obj->gender; $staticmember->gender = $obj->gender;

View File

@ -101,7 +101,7 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
// List of fields to search into when doing a "search in all" // List of fields to search into when doing a "search in all"
$fieldstosearchall = array( $fieldstosearchall = array(
'd.rowid'=>'Ref', 'd.ref'=>'Ref',
'd.login'=>'Login', 'd.login'=>'Login',
'd.lastname'=>'Lastname', 'd.lastname'=>'Lastname',
'd.firstname'=>'Firstname', 'd.firstname'=>'Firstname',
@ -146,12 +146,7 @@ $arrayfields = array(
'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000) 'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000)
); );
// Extra fields // Extra fields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
}
}
/* /*
@ -235,6 +230,7 @@ if (empty($reshook)) {
$objectlabel = 'Members'; $objectlabel = 'Members';
$permissiontoread = $user->rights->adherent->lire; $permissiontoread = $user->rights->adherent->lire;
$permissiontodelete = $user->rights->adherent->supprimer; $permissiontodelete = $user->rights->adherent->supprimer;
$permissiontoadd = $user->rights->adherent->creer;
$uploaddir = $conf->adherent->dir_output; $uploaddir = $conf->adherent->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
} }
@ -251,7 +247,7 @@ $memberstatic = new Adherent($db);
$now = dol_now(); $now = dol_now();
$sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.gender, d.societe as company, d.fk_soc,"; $sql = "SELECT d.rowid, d.ref, d.login, d.lastname, d.firstname, d.gender, d.societe as company, d.fk_soc,";
$sql .= " d.civility, d.datefin, d.address, d.zip, d.town, d.state_id, d.country,"; $sql .= " d.civility, d.datefin, d.address, d.zip, d.town, d.state_id, d.country,";
$sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,"; $sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,";
$sql .= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,"; $sql .= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
@ -268,8 +264,13 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint); $sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql = preg_replace('/,\s*$/', '', $sql); $sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
if (!empty($search_categ) || !empty($catid)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member"; // We need this table joined to the select in order to filter by categ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)";
}
if (!empty($search_categ) || !empty($catid)) {
// We need this table joined to the select in order to filter by categ
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member";
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = d.country)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = d.country)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = d.state_id)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = d.state_id)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on (s.rowid = d.fk_soc)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on (s.rowid = d.fk_soc)";
@ -285,10 +286,12 @@ if ($search_type > 0) $sql .= " AND t.rowid=".$db->escape($search_type);
if ($search_filter == 'withoutsubscription') $sql .= " AND (datefin IS NULL OR t.subscription = 0)"; if ($search_filter == 'withoutsubscription') $sql .= " AND (datefin IS NULL OR t.subscription = 0)";
if ($search_filter == 'uptodate') $sql .= " AND (datefin >= '".$db->idate($now)."' OR t.subscription = 0)"; if ($search_filter == 'uptodate') $sql .= " AND (datefin >= '".$db->idate($now)."' OR t.subscription = 0)";
if ($search_filter == 'outofdate') $sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)"; if ($search_filter == 'outofdate') $sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)";
if ($search_status != '') $sql .= " AND d.statut in (".$db->sanitize($db->escape($search_status)).")"; // Peut valoir un nombre ou liste de nombre separes par virgules if ($search_status != '') {
// Peut valoir un nombre ou liste de nombre separes par virgules
$sql .= " AND d.statut in (".$db->sanitize($db->escape($search_status)).")";
}
if ($search_ref) { if ($search_ref) {
if (is_numeric($search_ref)) $sql .= " AND (d.rowid = ".$db->escape($search_ref).")"; $sql .= natural_search("d.ref", $search_ref);
else $sql .= " AND 1 = 2"; // Always wrong
} }
if ($search_civility) $sql .= natural_search("d.civility", $search_civility); if ($search_civility) $sql .= natural_search("d.civility", $search_civility);
if ($search_firstname) $sql .= natural_search("d.firstname", $search_firstname); if ($search_firstname) $sql .= natural_search("d.firstname", $search_firstname);
@ -404,7 +407,8 @@ $arrayofmassactions = array(
); );
if ($user->rights->adherent->creer) $arrayofmassactions['close'] = $langs->trans("Resiliate"); if ($user->rights->adherent->creer) $arrayofmassactions['close'] = $langs->trans("Resiliate");
if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete"); if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); if ($user->rights->societe->creer) $arrayofmassactions['preaffecttag'] = '<span class="fa fa-tag paddingrightonly"></span>'.$langs->trans("AffectTag");
if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) $arrayofmassactions = array();
$massactionbutton = $form->selectMassAction('', $arrayofmassactions); $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$newcardbutton = ''; $newcardbutton = '';
@ -607,7 +611,7 @@ print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) print_liste_field_titre("ID", $_SERVER["PHP_SELF"], '', '', $param, 'align="center"', $sortfield, $sortorder); if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) print_liste_field_titre("ID", $_SERVER["PHP_SELF"], '', '', $param, 'align="center"', $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.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], 'd.ref', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['d.civility']['checked'])) print_liste_field_titre($arrayfields['d.civility']['label'], $_SERVER["PHP_SELF"], 'd.civility', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['d.civility']['checked'])) print_liste_field_titre($arrayfields['d.civility']['label'], $_SERVER["PHP_SELF"], 'd.civility', '', $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);
@ -647,7 +651,7 @@ while ($i < min($num, $limit)) {
$datefin = $db->jdate($obj->datefin); $datefin = $db->jdate($obj->datefin);
$memberstatic->id = $obj->rowid; $memberstatic->id = $obj->rowid;
$memberstatic->ref = $obj->rowid; $memberstatic->ref = $obj->ref;
$memberstatic->civility_id = $obj->civility; $memberstatic->civility_id = $obj->civility;
$memberstatic->lastname = $obj->lastname; $memberstatic->lastname = $obj->lastname;
$memberstatic->firstname = $obj->firstname; $memberstatic->firstname = $obj->firstname;

View File

@ -300,57 +300,75 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
if (!$error) { if (!$error) {
// Send confirmation Email // Send confirmation Email
if ($object->email && $sendalsoemail) { // $object is 'Adherent' if ($object->email && $sendalsoemail) { // $object is 'Adherent'
$subject = ''; $parameters = array(
$msg = ''; 'datesubscription' => $datesubscription,
'amount' => $amount,
// Send subscription email 'ccountid' => $accountid,
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; 'operation' => $operation,
$formmail = new FormMail($db); 'label' => $label,
// Set output language 'num_chq' => $num_chq,
$outputlangs = new Translate('', $conf); 'emetteur_nom' => $emetteur_nom,
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); 'emetteur_banque' => $emetteur_banque,
// Load traductions files required by page 'datesubend' => $datesubend
$outputlangs->loadLangs(array("main", "members")); );
$reshook = $hookmanager->executeHooks('sendMail', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
// Get email content from template if ($reshook < 0) {
$arraydefaultmessage = null; setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION;
if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
$subject = $arraydefaultmessage->topic;
$msg = $arraydefaultmessage->content;
} }
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); if (empty($reshook)) {
complete_substitutions_array($substitutionarray, $outputlangs, $object); $subject = '';
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); $msg = '';
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnSubscription()), $substitutionarray, $outputlangs);
// Attach a file ? // Send subscription email
$file = ''; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$listofpaths = array(); $formmail = new FormMail($db);
$listofnames = array(); // Set output language
$listofmimes = array(); $outputlangs = new Translate('', $conf);
if (is_object($object->invoice) && (!is_object($arraydefaultmessage) || intval($arraydefaultmessage->joinfiles))) { $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
$invoicediroutput = $conf->facture->dir_output; // Load traductions files required by page
$fileparams = dol_most_recent_file($invoicediroutput.'/'.$object->invoice->ref, preg_quote($object->invoice->ref, '/').'[^\-]+'); $outputlangs->loadLangs(array("main", "members"));
$file = $fileparams['fullname'];
$listofpaths = array($file); // Get email content from template
$listofnames = array(basename($file)); $arraydefaultmessage = null;
$listofmimes = array(dol_mimetype($file)); $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION;
}
$moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/subscription.php'."\r\n"; if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
$result = $object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1, '', $moreinheader); if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
if ($result < 0) { $subject = $arraydefaultmessage->topic;
$errmsg = $object->error; $msg = $arraydefaultmessage->content;
setEventMessages($object->error, $object->errors, 'errors'); }
} else {
setEventMessages($langs->trans("EmailSentToMember", $object->email), null, 'mesgs'); $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnSubscription()), $substitutionarray, $outputlangs);
// Attach a file ?
$file = '';
$listofpaths = array();
$listofnames = array();
$listofmimes = array();
if (is_object($object->invoice) && (!is_object($arraydefaultmessage) || intval($arraydefaultmessage->joinfiles))) {
$invoicediroutput = $conf->facture->dir_output;
$fileparams = dol_most_recent_file($invoicediroutput.'/'.$object->invoice->ref, preg_quote($object->invoice->ref, '/').'[^\-]+');
$file = $fileparams['fullname'];
$listofpaths = array($file);
$listofnames = array(basename($file));
$listofmimes = array(dol_mimetype($file));
}
$moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/subscription.php'."\r\n";
$result = $object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1, '', $moreinheader);
if ($result < 0) {
$errmsg = $object->error;
setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessages($langs->trans("EmailSentToMember", $object->email), null, 'mesgs');
}
} }
} else { } else {
setEventMessages($langs->trans("NoEmailSentToMember"), null, 'mesgs'); setEventMessages($langs->trans("NoEmailSentToMember"), null, 'mesgs');

View File

@ -66,6 +66,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
if ($action != 'updateedit' && !$error) if ($action != 'updateedit' && !$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} }
@ -114,57 +115,57 @@ print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans(
// Name // Name
print '<tr class="oddeven"><td><label for="name">'.$langs->trans("CompanyName").'</label></td><td>'; print '<tr class="oddeven"><td><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
print '<input name="nom" id="name" class="minwidth200" value="'.($conf->global->MAIN_INFO_ACCOUNTANT_NAME ? $conf->global->MAIN_INFO_ACCOUNTANT_NAME : GETPOST("nom", 'nohtml')).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n"; print '<input name="nom" id="name" class="minwidth200" value="'.(GETPOSTISSET('nom') ? GETPOST('nom', 'nohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_NAME) ? $conf->global->MAIN_INFO_ACCOUNTANT_NAME : '')).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
// Address // Address
print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>'; print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'.($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS ? $conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS : GETPOST("address", 'nohtml')).'</textarea></td></tr>'."\n"; print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'.(GETPOSTISSET('address') ? GETPOST('address', 'nohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS) ? $conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS : '')).'</textarea></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>'; print '<tr class="oddeven"><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>';
print '<input class="minwidth100" name="zipcode" id="zipcode" value="'.($conf->global->MAIN_INFO_ACCOUNTANT_ZIP ? $conf->global->MAIN_INFO_ACCOUNTANT_ZIP : GETPOST("zipcode", 'alpha')).'"></td></tr>'."\n"; print '<input class="minwidth100" name="zipcode" id="zipcode" value="'.(GETPOSTISSET('zipcode') ? GETPOST('zipcode', 'alpha') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_ZIP) ? $conf->global->MAIN_INFO_ACCOUNTANT_ZIP : '')).'"></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>'; print '<tr class="oddeven"><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>';
print '<input name="town" class="minwidth100" id="town" value="'.($conf->global->MAIN_INFO_ACCOUNTANT_TOWN ? $conf->global->MAIN_INFO_ACCOUNTANT_TOWN : GETPOST("town", 'nohtml')).'"></td></tr>'."\n"; print '<input name="town" class="minwidth100" id="town" value="'.(GETPOSTISSET('town') ? GETPOST('town', 'nohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_TOWN) ? $conf->global->MAIN_INFO_ACCOUNTANT_TOWN : '')).'"></td></tr>'."\n";
// Country // Country
print '<tr class="oddeven"><td><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">'; print '<tr class="oddeven"><td><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
print img_picto('', 'globe-americas', 'class="paddingrightonly"'); print img_picto('', 'globe-americas', 'class="paddingrightonly"');
print $form->select_country($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'country_id'); print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY) ? $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY : '')), 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">'; print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">';
$formcompany->select_departement($conf->global->MAIN_INFO_ACCOUNTANT_STATE, $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'state_id'); $formcompany->select_departement((GETPOSTISSET('state_id') ? GETPOST('state_id', 'alpha') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_STATE) ? $conf->global->MAIN_INFO_ACCOUNTANT_STATE : '')), (GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY) ? $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY : '')), 'state_id');
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>'; print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright'); print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright');
print '<input name="tel" id="phone" value="'.$conf->global->MAIN_INFO_ACCOUNTANT_PHONE.'"></td></tr>'; print '<input name="tel" id="phone" value="'.(GETPOSTISSET('tel') ? GETPOST('tel', 'alpha') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_PHONE) ? $conf->global->MAIN_INFO_ACCOUNTANT_PHONE : '')).'"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>'; print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright'); print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright');
print '<input name="fax" id="fax" value="'.$conf->global->MAIN_INFO_ACCOUNTANT_FAX.'"></td></tr>'; print '<input name="fax" id="fax" value="'.(GETPOSTISSET('fax') ? GETPOST('fax', 'alpha') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_FAX) ? $conf->global->MAIN_INFO_ACCOUNTANT_FAX : '')).'"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>'; print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright'); print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright');
print '<input name="mail" id="email" class="minwidth200" value="'.$conf->global->MAIN_INFO_ACCOUNTANT_MAIL.'"></td></tr>'; print '<input name="mail" id="email" class="minwidth200" value="'.(GETPOSTISSET('mail') ? GETPOST('mail', 'alpha') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_MAIL) ? $conf->global->MAIN_INFO_ACCOUNTANT_MAIL : '')).'"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Web // Web
print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>'; print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
print img_picto('', 'globe', '', false, 0, 0, '', 'paddingright'); print img_picto('', 'globe', '', false, 0, 0, '', 'paddingright');
print '<input name="web" id="web" class="minwidth300" value="'.$conf->global->MAIN_INFO_ACCOUNTANT_WEB.'"></td></tr>'; print '<input name="web" id="web" class="minwidth300" value="'.(GETPOSTISSET('web') ? GETPOST('web', 'alpha') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_WEB) ? $conf->global->MAIN_INFO_ACCOUNTANT_WEB : '')).'"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Code // Code
print '<tr class="oddeven"><td><label for="code">'.$langs->trans("AccountantFileNumber").'</label></td><td>'; print '<tr class="oddeven"><td><label for="code">'.$langs->trans("AccountantFileNumber").'</label></td><td>';
print '<input name="code" id="code" class="minwidth100" value="'.($conf->global->MAIN_INFO_ACCOUNTANT_CODE ? $conf->global->MAIN_INFO_ACCOUNTANT_CODE : GETPOST("code", 'nohtml')).'"></td></tr>'."\n"; print '<input name="code" id="code" class="minwidth100" value="'.(GETPOSTISSET('code') ? GETPOST('code', 'nohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_CODE) ? $conf->global->MAIN_INFO_ACCOUNTANT_CODE : '')).'"></td></tr>'."\n";
// Note // Note
print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>'; print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';
print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOSTISSET('note') ? GETPOST('note', 'restricthtml') : $conf->global->MAIN_INFO_ACCOUNTANT_NOTE).'</textarea></td></tr>'; print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOSTISSET('note') ? GETPOST('note', 'restricthtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_NOTE) ? $conf->global->MAIN_INFO_ACCOUNTANT_NOTE : '')).'</textarea></td></tr>';
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';

View File

@ -187,10 +187,18 @@ print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right">'."\n"; print '<td class="right">'."\n";
if (empty($conf->global->AGENDA_REMINDER_BROWSER)) { if (empty($conf->global->AGENDA_REMINDER_BROWSER)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_REMINDER_BROWSER&amp;token='.newToken().'">'.img_picto($langs->trans('Disabled'), 'switch_off').'</a>'; if (!isHTTPS()) {
$langs->load("errors");
print img_warning($langs->trans("WarningAvailableOnlyForHTTPSServers"), '', 'valignmiddle size15x').' ';
}
print '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_REMINDER_BROWSER&amp;token='.newToken().'">'.img_picto($langs->trans('Disabled'), 'switch_off').'</a>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} else { } else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_REMINDER_BROWSER&amp;token='.newToken().'">'.img_picto($langs->trans('Enabled'), 'switch_on').'</a>'; if (!isHTTPS()) {
$langs->load("errors");
print img_warning($langs->trans("WarningAvailableOnlyForHTTPSServers"), '', 'valignmiddle size15x').' ';
}
print '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_REMINDER_BROWSER&amp;token='.newToken().'">'.img_picto($langs->trans('Enabled'), 'switch_on').'</a>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '<tr class="oddeven">'."\n"; print '<tr class="oddeven">'."\n";

View File

@ -446,14 +446,14 @@ print '<td>';
print $langs->trans("MaxNbOfLinesForBoxes"); print $langs->trans("MaxNbOfLinesForBoxes");
print '</td>'."\n"; print '</td>'."\n";
print '<td>'; print '<td>';
print '<input type="text" class="flat" size="6" name="MAIN_BOXES_MAXLINES" value="'.$conf->global->MAIN_BOXES_MAXLINES.'">'; print '<input type="text" class="flat" size="6" name="MAIN_BOXES_MAXLINES" value="'.(!empty($conf->global->MAIN_BOXES_MAXLINES) ? $conf->global->MAIN_BOXES_MAXLINES : '').'">';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Activate FileCache - Developement // Activate FileCache - Developement
if ($conf->global->MAIN_FEATURES_LEVEL == 2 || !empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { if ($conf->global->MAIN_FEATURES_LEVEL == 2 || !empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
print '<tr class="oddeven"><td width="35%">'.$langs->trans("EnableFileCache").'</td><td>'; print '<tr class="oddeven"><td width="35%">'.$langs->trans("EnableFileCache").'</td><td>';
print $form->selectyesno('MAIN_ACTIVATE_FILECACHE', $conf->global->MAIN_ACTIVATE_FILECACHE, 1); print $form->selectyesno('MAIN_ACTIVATE_FILECACHE', (!empty($conf->global->MAIN_ACTIVATE_FILECACHE) ? $conf->global->MAIN_ACTIVATE_FILECACHE : 0), 1);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }

View File

@ -111,11 +111,9 @@ if ($action == 'updateMask')
} }
// Activate a model // Activate a model
elseif ($action == 'set') elseif ($action == 'set') {
{
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} elseif ($action == 'del') } elseif ($action == 'del') {
{
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
{ {
@ -124,8 +122,7 @@ elseif ($action == 'set')
} }
// Set default model // Set default model
elseif ($action == 'setdoc') elseif ($action == 'setdoc') {
{
if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity))
{ {
// The constant that was read before the new set // The constant that was read before the new set
@ -139,8 +136,7 @@ elseif ($action == 'setdoc')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
} elseif ($action == 'setmod') } elseif ($action == 'setmod') {
{
// TODO Check if numbering module chosen can be activated // TODO Check if numbering module chosen can be activated
// by calling method canBeActivated // by calling method canBeActivated
@ -254,6 +250,7 @@ print dol_get_fiche_head($head, 'general', $langs->trans("Orders"), -1, 'order')
print load_fiche_titre($langs->trans("OrdersNumberingModules"), '', ''); print load_fiche_titre($langs->trans("OrdersNumberingModules"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>'; print '<td>'.$langs->trans("Name").'</td>';
@ -346,7 +343,7 @@ foreach ($dirmodels as $reldir)
} }
} }
} }
print "</table><br>\n"; print "</table></div><br>\n";
/* /*
@ -377,6 +374,7 @@ if ($resql)
} }
print '<div class="div-table-responsive-no-min">';
print "<table class=\"noborder\" width=\"100%\">\n"; print "<table class=\"noborder\" width=\"100%\">\n";
print "<tr class=\"liste_titre\">\n"; print "<tr class=\"liste_titre\">\n";
print '<td>'.$langs->trans("Name").'</td>'; print '<td>'.$langs->trans("Name").'</td>';
@ -501,6 +499,7 @@ foreach ($dirmodels as $reldir)
} }
print '</table>'; print '</table>';
print '</div>';
/* /*

View File

@ -236,6 +236,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
$db->commit(); $db->commit();
} else { } else {
$db->rollback(); $db->rollback();
@ -393,18 +394,18 @@ print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans(
// Name // Name
print '<tr class="oddeven"><td class="fieldrequired wordbreak"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>'; print '<tr class="oddeven"><td class="fieldrequired wordbreak"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
print '<input name="nom" id="name" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM ? $conf->global->MAIN_INFO_SOCIETE_NOM : GETPOST("nom", 'nohtml')).'"'.(empty($conf->global->MAIN_INFO_SOCIETE_NOM) ? ' autofocus="autofocus"' : '').'></td></tr>'."\n"; print '<input name="nom" id="name" class="minwidth200" value="'.dol_escape_htmltag((GETPOSTISSET('nom') ? GETPOST('nom', 'nohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_NOM) ? $conf->global->MAIN_INFO_SOCIETE_NOM : ''))).'"'.(empty($conf->global->MAIN_INFO_SOCIETE_NOM) ? ' autofocus="autofocus"' : '').'></td></tr>'."\n";
// Address // Address
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ADDRESS">'.$langs->trans("CompanyAddress").'</label></td><td>'; print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ADDRESS">'.$langs->trans("CompanyAddress").'</label></td><td>';
print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="'.ROWS_3.'">'.($conf->global->MAIN_INFO_SOCIETE_ADDRESS ? $conf->global->MAIN_INFO_SOCIETE_ADDRESS : GETPOST("MAIN_INFO_SOCIETE_ADDRESS", 'nohtml')).'</textarea></td></tr>'."\n"; print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="'.ROWS_3.'">'.(GETPOSTISSET('MAIN_INFO_SOCIETE_ADDRESS') ? GETPOST('MAIN_INFO_SOCIETE_ADDRESS', 'nohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_ADDRESS) ? $conf->global->MAIN_INFO_SOCIETE_ADDRESS : '')).'</textarea></td></tr>'."\n";
// Zip // Zip
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ZIP">'.$langs->trans("CompanyZip").'</label></td><td>'; print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ZIP">'.$langs->trans("CompanyZip").'</label></td><td>';
print '<input class="width100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ZIP ? $conf->global->MAIN_INFO_SOCIETE_ZIP : GETPOST("MAIN_INFO_SOCIETE_ZIP", 'alpha')).'"></td></tr>'."\n"; print '<input class="width100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_ZIP') ? GETPOST('MAIN_INFO_SOCIETE_ZIP', 'alpha') : (!empty($conf->global->MAIN_INFO_SOCIETE_ZIP) ? $conf->global->MAIN_INFO_SOCIETE_ZIP : ''))).'"></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->trans("CompanyTown").'</label></td><td>'; print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->trans("CompanyTown").'</label></td><td>';
print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth200" id="MAIN_INFO_SOCIETE_TOWN" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TOWN ? $conf->global->MAIN_INFO_SOCIETE_TOWN : GETPOST("MAIN_INFO_SOCIETE_TOWN", 'nohtml')).'"></td></tr>'."\n"; print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth200" id="MAIN_INFO_SOCIETE_TOWN" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_TOWN') ? GETPOST('MAIN_INFO_SOCIETE_TOWN', 'nohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_TOWN) ? $conf->global->MAIN_INFO_SOCIETE_TOWN : ''))).'"></td></tr>'."\n";
// Country // Country
print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">'; print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
@ -431,25 +432,25 @@ print '</td></tr>'."\n";
// Phone // Phone
print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>'; print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright'); print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright');
print '<input name="tel" id="phone" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TEL).'"></td></tr>'; print '<input name="tel" id="phone" value="'.dol_escape_htmltag((GETPOSTISSET('tel') ? GETPOST('tel', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_TEL) ? $conf->global->MAIN_INFO_SOCIETE_TEL : ''))).'"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Fax // Fax
print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>'; print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright'); print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright');
print '<input name="fax" id="fax" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_FAX).'"></td></tr>'; print '<input name="fax" id="fax" value="'.dol_escape_htmltag((GETPOSTISSET('fax') ? GETPOST('fax', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_FAX) ? $conf->global->MAIN_INFO_SOCIETE_FAX : ''))).'"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Email // Email
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>'; print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright'); print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright');
print '<input name="mail" id="email" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL).'"></td></tr>'; print '<input name="mail" id="email" class="minwidth200" value="'.dol_escape_htmltag((GETPOSTISSET('mail') ? GETPOST('mail', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $conf->global->MAIN_INFO_SOCIETE_MAIL : ''))).'"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Web // Web
print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>'; print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
print img_picto('', 'globe', '', false, 0, 0, '', 'paddingright'); print img_picto('', 'globe', '', false, 0, 0, '', 'paddingright');
print '<input name="web" id="web" class="minwidth300" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_WEB).'"></td></tr>'; print '<input name="web" id="web" class="minwidth300" value="'.dol_escape_htmltag((GETPOSTISSET('web') ? GETPOST('web', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_WEB) ? $conf->global->MAIN_INFO_SOCIETE_WEB : ''))).'"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Barcode // Barcode
@ -457,7 +458,7 @@ if (!empty($conf->barcode->enabled)) {
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print '<label for="barcode">'.$langs->trans("Gencod").'</label></td><td>'; print '<label for="barcode">'.$langs->trans("Gencod").'</label></td><td>';
print '<span class="fa paddingright fa-barcode"></span>'; print '<span class="fa paddingright fa-barcode"></span>';
print '<input name="barcode" id="barcode" class="minwidth150" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_GENCOD).'"></td></tr>'; print '<input name="barcode" id="barcode" class="minwidth150" value="'.dol_escape_htmltag((GETPOSTISSET('barcode') ? GETPOST('barcode', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_GENCODE) ? $conf->global->MAIN_INFO_SOCIETE_GENCODE : ''))).'"></td></tr>';
print '</td></tr>'; print '</td></tr>';
} }
@ -534,7 +535,7 @@ print '</td></tr>';
// Note // Note
print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>'; print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';
print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOSTISSET('note') ? GETPOST('note', 'restricthtml') : $conf->global->MAIN_INFO_SOCIETE_NOTE).'</textarea></td></tr>'; print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOSTISSET('note') ? GETPOST('note', 'restricthtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? $conf->global->MAIN_INFO_SOCIETE_NOTE : '')).'</textarea></td></tr>';
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
@ -549,17 +550,17 @@ $langs->load("companies");
// Managing Director(s) // Managing Director(s)
print '<tr class="oddeven"><td><label for="director">'.$langs->trans("ManagingDirectors").'</label></td><td>'; print '<tr class="oddeven"><td><label for="director">'.$langs->trans("ManagingDirectors").'</label></td><td>';
print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="directors" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MANAGERS).'"></td></tr>'; print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="directors" class="minwidth200" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_MANAGERS') ? GETPOST('MAIN_INFO_SOCIETE_MANAGERS', 'nohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_MANAGERS) ? $conf->global->MAIN_INFO_SOCIETE_MANAGERS : ''))).'"></td></tr>';
// GDPR contact // GDPR contact
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc")); print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc"));
print '</td><td>'; print '</td><td>';
print '<input name="MAIN_INFO_GDPR" id="infodirector" class="minwidth500" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_GDPR).'"></td></tr>'; print '<input name="MAIN_INFO_GDPR" id="infodirector" class="minwidth500" value="'.dol_escape_htmltag((GETPOSTISSET("MAIN_INFO_GDPR") ? GETPOST("MAIN_INFO_GDPR", 'nohtml') : (!empty($conf->global->MAIN_INFO_GDPR) ? $conf->global->MAIN_INFO_GDPR : ''))).'"></td></tr>';
// Capital // Capital
print '<tr class="oddeven"><td><label for="capital">'.$langs->trans("Capital").'</label></td><td>'; print '<tr class="oddeven"><td><label for="capital">'.$langs->trans("Capital").'</label></td><td>';
print '<input name="capital" id="capital" class="maxwidth100" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_CAPITAL).'"></td></tr>'; print '<input name="capital" id="capital" class="maxwidth100" value="'.dol_escape_htmltag((GETPOSTISSET('capital') ? GETPOST('capital', 'nohtml') : (!empty($conf->global->MAIN_INFO_CAPITAL) ? $conf->global->MAIN_INFO_CAPITAL : ''))).'"></td></tr>';
// Juridical Status // Juridical Status
print '<tr class="oddeven"><td><label for="forme_juridique_code">'.$langs->trans("JuridicalStatus").'</label></td><td>'; print '<tr class="oddeven"><td><label for="forme_juridique_code">'.$langs->trans("JuridicalStatus").'</label></td><td>';

View File

@ -117,11 +117,11 @@ foreach ($listofnetworks as $key => $value) {
$networkconstname = 'MAIN_INFO_SOCIETE_'.strtoupper($key).'_URL'; $networkconstname = 'MAIN_INFO_SOCIETE_'.strtoupper($key).'_URL';
$networkconstid = 'MAIN_INFO_SOCIETE_'.strtoupper($key); $networkconstid = 'MAIN_INFO_SOCIETE_'.strtoupper($key);
print '<td><span class="fa paddingright '.($value['icon'] ? $value['icon'] : 'fa-link').'"></span>'; print '<td><span class="fa paddingright '.($value['icon'] ? $value['icon'] : 'fa-link').'"></span>';
print '<input name="'.$key.'url" id="'.$key.'url" class="minwidth300" value="'.dol_escape_htmltag($conf->global->$networkconstname).'">'; print '<input name="'.$key.'url" id="'.$key.'url" class="minwidth300" value="'.(!empty($conf->global->$networkconstname) ? dol_escape_htmltag($conf->global->$networkconstname) : '').'">';
print '</td><td>'; print '</td><td>';
print '<input name="'.$key.'" id="'.$key.'" class="minwidth300" value="'.dol_escape_htmltag($conf->global->$networkconstid).'">'; print '<input name="'.$key.'" id="'.$key.'" class="minwidth300" value="'.(!empty($conf->global->$networkconstid) ? dol_escape_htmltag($conf->global->$networkconstid) : '').'">';
print '</td>'; print '</td>';
print '<td>'.dol_print_socialnetworks($conf->global->$networkconstid, 0, 0, $key, $listofnetworks).'</td>'; print '<td>'.dol_print_socialnetworks((!empty($conf->global->$networkconstid) ? dol_escape_htmltag($conf->global->$networkconstid) : ''), 0, 0, $key, $listofnetworks).'</td>';
print '</tr>'."\n"; print '</tr>'."\n";
} }
} }

View File

@ -172,13 +172,13 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai
// Show message // Show message
$message = ''; $message = '';
$url = '<a href="'.$urlwithroot.'/dav/fileserver.php" target="_blank">'.$urlwithroot.'/dav/fileserver.php</a>'; $url = '<a href="'.$urlwithroot.'/dav/fileserver.php" target="_blank">'.$urlwithroot.'/dav/fileserver.php</a>';
$message .= img_picto('', 'globe').' '.$langs->trans("WebDavServer", 'WebDAV', $url); $message .= img_picto('', 'globe').' '.str_replace('{url}', $url, $langs->trans("WebDavServer", 'WebDAV', '{url}'));
$message .= '<br>'; $message .= '<br>';
if (!empty($conf->global->DAV_ALLOW_PUBLIC_DIR)) if (!empty($conf->global->DAV_ALLOW_PUBLIC_DIR))
{ {
$urlEntity = (!empty($conf->multicompany->enabled) ? '?entity='.$conf->entity : ''); $urlEntity = (!empty($conf->multicompany->enabled) ? '?entity='.$conf->entity : '');
$url = '<a href="'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'" target="_blank">'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'</a>'; $url = '<a href="'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'" target="_blank">'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'</a>';
$message .= img_picto('', 'globe').' '.$langs->trans("WebDavServer", 'WebDAV public', $url); $message .= img_picto('', 'globe').' '.str_replace('{url}', $url, $langs->trans("WebDavServer", 'WebDAV public', '{url}'));
$message .= '<br>'; $message .= '<br>';
} }
print $message; print $message;

View File

@ -72,9 +72,9 @@ $hookmanager->initHooks(array('admindefaultvalues', 'globaladmin'));
*/ */
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') && !empty($massaction) && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
$parameters = array('socid'=>$socid); $parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $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 ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -186,7 +186,7 @@ llxHeader('', $langs->trans("Setup"), $wikihelp);
$param = '&mode='.$mode; $param = '&mode='.$mode;
$enabledisablehtml .= $langs->trans("EnableDefaultValues").' '; $enabledisablehtml = $langs->trans("EnableDefaultValues").' ';
if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES))
{ {
// Button off, click to enable // Button off, click to enable
@ -213,7 +213,7 @@ if ($defaultkey) $param .= '&defaultkey='.urlencode($defaultkey);
if ($defaultvalue) $param .= '&defaultvalue='.urlencode($defaultvalue); if ($defaultvalue) $param .= '&defaultvalue='.urlencode($defaultvalue);
print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && $debug) ? '?debug=1' : '').'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && !empty($debug)) ? '?debug=1' : '').'" method="POST">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';

View File

@ -35,127 +35,127 @@ if (!$user->admin) accessforbidden();
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$modules = array( $modules = array(
'agenda' => array( 'agenda' => array(
array( array(
'code' => 'MAIN_DELAY_ACTIONS_TODO', 'code' => 'MAIN_DELAY_ACTIONS_TODO',
'img' => 'action' 'img' => 'action'
) )
), ),
'projet' => array( 'projet' => array(
array( array(
'code' => 'MAIN_DELAY_PROJECT_TO_CLOSE', 'code' => 'MAIN_DELAY_PROJECT_TO_CLOSE',
'img' => 'project' 'img' => 'project'
), ),
array( array(
'code' => 'MAIN_DELAY_TASKS_TODO', 'code' => 'MAIN_DELAY_TASKS_TODO',
'img' => 'projecttask' 'img' => 'projecttask'
) )
), ),
'propal' => array( 'propal' => array(
array( array(
'code' => 'MAIN_DELAY_PROPALS_TO_CLOSE', 'code' => 'MAIN_DELAY_PROPALS_TO_CLOSE',
'img' => 'propal' 'img' => 'propal'
), ),
array( array(
'code' => 'MAIN_DELAY_PROPALS_TO_BILL', 'code' => 'MAIN_DELAY_PROPALS_TO_BILL',
'img' => 'propal' 'img' => 'propal'
) )
), ),
'commande' => array( 'commande' => array(
array( array(
'code' => 'MAIN_DELAY_ORDERS_TO_PROCESS', 'code' => 'MAIN_DELAY_ORDERS_TO_PROCESS',
'img' => 'order' 'img' => 'order'
) )
), ),
'facture' => array( 'facture' => array(
array( array(
'code' => 'MAIN_DELAY_CUSTOMER_BILLS_UNPAYED', 'code' => 'MAIN_DELAY_CUSTOMER_BILLS_UNPAYED',
'img' => 'bill' 'img' => 'bill'
) )
), ),
'fournisseur' => array( 'fournisseur' => array(
array( array(
'code' => 'MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS', 'code' => 'MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS',
'img' => 'order' 'img' => 'order'
), ),
array( array(
'code' => 'MAIN_DELAY_SUPPLIER_BILLS_TO_PAY', 'code' => 'MAIN_DELAY_SUPPLIER_BILLS_TO_PAY',
'img' => 'bill' 'img' => 'bill'
) )
), ),
'service' => array( 'service' => array(
array( array(
'code' => 'MAIN_DELAY_NOT_ACTIVATED_SERVICES', 'code' => 'MAIN_DELAY_NOT_ACTIVATED_SERVICES',
'img' => 'service' 'img' => 'service'
), ),
array( array(
'code' => 'MAIN_DELAY_RUNNING_SERVICES', 'code' => 'MAIN_DELAY_RUNNING_SERVICES',
'img' => 'service' 'img' => 'service'
) )
), ),
'banque' => array( 'banque' => array(
array( array(
'code' => 'MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE', 'code' => 'MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE',
'img' => 'account' 'img' => 'account'
), ),
array( array(
'code' => 'MAIN_DELAY_CHEQUES_TO_DEPOSIT', 'code' => 'MAIN_DELAY_CHEQUES_TO_DEPOSIT',
'img' => 'account' 'img' => 'account'
) )
), ),
'adherent' => array( 'adherent' => array(
array( array(
'code' => 'MAIN_DELAY_MEMBERS', 'code' => 'MAIN_DELAY_MEMBERS',
'img' => 'user' 'img' => 'user'
) )
), ),
'expensereport' => array( 'expensereport' => array(
array( array(
'code' => 'MAIN_DELAY_EXPENSEREPORTS', 'code' => 'MAIN_DELAY_EXPENSEREPORTS',
'img' => 'trip' 'img' => 'trip'
), ),
/* TODO Enable this /* TODO Enable this
array( array(
'code' => 'MAIN_DELAY_EXPENSEREPORTS_TO_PAY', 'code' => 'MAIN_DELAY_EXPENSEREPORTS_TO_PAY',
'img' => 'trip' 'img' => 'trip'
)*/ )*/
), ),
'holiday' => array( 'holiday' => array(
array( array(
'code' => 'MAIN_DELAY_HOLIDAYS', 'code' => 'MAIN_DELAY_HOLIDAYS',
'img' => 'holiday' 'img' => 'holiday'
), ),
), ),
); );
$labelmeteo = array(0=>$langs->trans("No"), 1=>$langs->trans("Yes"), 2=>$langs->trans("OnMobileOnly")); $labelmeteo = array(0=>$langs->trans("No"), 1=>$langs->trans("Yes"), 2=>$langs->trans("OnMobileOnly"));
if (!isset($conf->global->MAIN_DELAY_PROJECT_TO_CLOSE)) { if (!isset($conf->global->MAIN_DELAY_PROJECT_TO_CLOSE)) {
$conf->global->MAIN_DELAY_PROJECT_TO_CLOSE = 7; // Must be same value than into conf.class.php $conf->global->MAIN_DELAY_PROJECT_TO_CLOSE = 7; // Must be same value than into conf.class.php
} }
if (!isset($conf->global->MAIN_DELAY_TASKS_TODO)) { if (!isset($conf->global->MAIN_DELAY_TASKS_TODO)) {
$conf->global->MAIN_DELAY_TASKS_TODO = 7; // Must be same value than into conf.class.php $conf->global->MAIN_DELAY_TASKS_TODO = 7; // Must be same value than into conf.class.php
} }
if (!isset($conf->global->MAIN_DELAY_MEMBERS)) { if (!isset($conf->global->MAIN_DELAY_MEMBERS)) {
$conf->global->MAIN_DELAY_MEMBERS = 0; // Must be same value than into conf.class.php $conf->global->MAIN_DELAY_MEMBERS = 0; // Must be same value than into conf.class.php
} }
if (!isset($conf->global->MAIN_DELAY_ACTIONS_TODO)) { if (!isset($conf->global->MAIN_DELAY_ACTIONS_TODO)) {
$conf->global->MAIN_DELAY_ACTIONS_TODO = 7; // Must be same value than into conf.class.php $conf->global->MAIN_DELAY_ACTIONS_TODO = 7; // Must be same value than into conf.class.php
} }
if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) { if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
$conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
} }
if (!isset($conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)) { if (!isset($conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)) {
$conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS = 7; $conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS = 7;
} }
if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) { if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
$conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
} }
if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) { if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
$conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
} }
if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) { if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
$conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2;
} }
@ -166,30 +166,30 @@ if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
if ($action == 'update') if ($action == 'update')
{ {
foreach ($modules as $module => $delays) foreach ($modules as $module => $delays)
{ {
if (!empty($conf->$module->enabled)) if (!empty($conf->$module->enabled))
{ {
foreach ($delays as $delay) foreach ($delays as $delay)
{ {
if (GETPOST($delay['code']) != '') if (GETPOST($delay['code']) != '')
{ {
dolibarr_set_const($db, $delay['code'], GETPOST($delay['code']), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, $delay['code'], GETPOST($delay['code']), 'chaine', 0, '', $conf->entity);
} }
} }
} }
} }
dolibarr_set_const($db, "MAIN_DISABLE_METEO", $_POST["MAIN_DISABLE_METEO"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_DISABLE_METEO", $_POST["MAIN_DISABLE_METEO"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_USE_METEO_WITH_PERCENTAGE", GETPOST("MAIN_USE_METEO_WITH_PERCENTAGE"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_USE_METEO_WITH_PERCENTAGE", GETPOST("MAIN_USE_METEO_WITH_PERCENTAGE"), 'chaine', 0, '', $conf->entity);
// For update value with percentage // For update value with percentage
$plus = ''; $plus = '';
if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $plus = '_PERCENTAGE'; if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $plus = '_PERCENTAGE';
// Update values // Update values
for ($i = 0; $i < 4; $i++) { for ($i = 0; $i < 4; $i++) {
if (GETPOSTISSET('MAIN_METEO'.$plus.'_LEVEL'.$i)) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'), 'chaine', 0, '', $conf->entity); if (GETPOSTISSET('MAIN_METEO'.$plus.'_LEVEL'.$i)) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'), 'chaine', 0, '', $conf->entity);
} }
} }
@ -209,156 +209,156 @@ print "<br>\n";
if ($action == 'edit') if ($action == 'edit')
{ {
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" name="form_index">'; print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" name="form_index">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
foreach ($modules as $module => $delays) foreach ($modules as $module => $delays)
{ {
if (!empty($conf->$module->enabled)) if (!empty($conf->$module->enabled))
{ {
foreach ($delays as $delay) foreach ($delays as $delay)
{ {
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0); $value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td width="20px">'.img_object('', $delay['img']).'</td>'; print '<td width="20px">'.img_object('', $delay['img']).'</td>';
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td><td class="nowraponall">'; print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td><td class="nowraponall">';
print '<input class="right maxwidth75" type="number" name="'.$delay['code'].'" value="'.$value.'"> '.$langs->trans("days").'</td></tr>'; print '<input class="right maxwidth75" type="number" name="'.$delay['code'].'" value="'.$value.'"> '.$langs->trans("days").'</td></tr>';
} }
} }
} }
print '</table>'; print '</table>';
print '<br>'; print '<br>';
// Show if meteo is enabled // Show if meteo is enabled
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">'; print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">';
print $form->selectarray('MAIN_DISABLE_METEO', $labelmeteo, (empty($conf->global->MAIN_DISABLE_METEO) ? 0 : $conf->global->MAIN_DISABLE_METEO)); print $form->selectarray('MAIN_DISABLE_METEO', $labelmeteo, (empty($conf->global->MAIN_DISABLE_METEO) ? 0 : $conf->global->MAIN_DISABLE_METEO));
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
} else { } else {
/* /*
* Show parameters * Show parameters
*/ */
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
foreach ($modules as $module => $delays) foreach ($modules as $module => $delays)
{ {
if (!empty($conf->$module->enabled)) if (!empty($conf->$module->enabled))
{ {
foreach ($delays as $delay) foreach ($delays as $delay)
{ {
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0); $value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td width="20px">'.img_object('', $delay['img']).'</td>'; print '<td width="20px">'.img_object('', $delay['img']).'</td>';
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td>'; print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td>';
print '<td class="right">'.$value.' '.$langs->trans("days").'</td></tr>'; print '<td class="right">'.$value.' '.$langs->trans("days").'</td></tr>';
} }
} }
} }
print '</table>'; print '</table>';
print '<br>'; print '<br>';
// Show if meteo is enabled // Show if meteo is enabled
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">'; print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">';
print $labelmeteo[$conf->global->MAIN_DISABLE_METEO]; print $labelmeteo[$conf->global->MAIN_DISABLE_METEO];
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
} }
print '<br>'; print '<br>';
if ($conf->global->MAIN_DISABLE_METEO != 1) { if ($conf->global->MAIN_DISABLE_METEO != 1) {
// Show logo for weather // Show logo for weather
print '<span class="opacitymedium">'.$langs->trans("DescWeather").'</span> '; print '<span class="opacitymedium">'.$langs->trans("DescWeather").'</span> ';
if ($action == 'edit') { if ($action == 'edit') {
$str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoPercentageMod')); $str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoPercentageMod'));
$str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoStdMod')); $str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoStdMod'));
if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std; if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std;
else $str_mode_enabled = $str_mode_percentage; else $str_mode_enabled = $str_mode_percentage;
print '<a href="#" onclick="return false;" id="change_mode">'.$str_mode_enabled.'</a>'; print '<a href="#" onclick="return false;" id="change_mode">'.$str_mode_enabled.'</a>';
print '<input type="hidden" id="MAIN_USE_METEO_WITH_PERCENTAGE" name="MAIN_USE_METEO_WITH_PERCENTAGE" value="'.$conf->global->MAIN_USE_METEO_WITH_PERCENTAGE.'" />'; print '<input type="hidden" id="MAIN_USE_METEO_WITH_PERCENTAGE" name="MAIN_USE_METEO_WITH_PERCENTAGE" value="'.$conf->global->MAIN_USE_METEO_WITH_PERCENTAGE.'" />';
print '<br><br>'; print '<br><br>';
} else { } else {
if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) print $langs->trans('MeteoStdModEnabled'); if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) print $langs->trans('MeteoStdModEnabled');
else print $langs->trans('MeteoPercentageModEnabled'); else print $langs->trans('MeteoPercentageModEnabled');
print '<br><br>'; print '<br><br>';
} }
$offset = 0; $offset = 0;
$cursor = 10; // By default $cursor = 10; // By default
//if (! empty($conf->global->MAIN_METEO_OFFSET)) $offset=$conf->global->MAIN_METEO_OFFSET; //if (! empty($conf->global->MAIN_METEO_OFFSET)) $offset=$conf->global->MAIN_METEO_OFFSET;
//if (! empty($conf->global->MAIN_METEO_GAP)) $cursor=$conf->global->MAIN_METEO_GAP; //if (! empty($conf->global->MAIN_METEO_GAP)) $cursor=$conf->global->MAIN_METEO_GAP;
$level0 = $offset; if (!empty($conf->global->MAIN_METEO_LEVEL0)) $level0 = $conf->global->MAIN_METEO_LEVEL0; $level0 = $offset; if (!empty($conf->global->MAIN_METEO_LEVEL0)) $level0 = $conf->global->MAIN_METEO_LEVEL0;
$level1 = $offset + 1 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL1)) $level1 = $conf->global->MAIN_METEO_LEVEL1; $level1 = $offset + 1 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL1)) $level1 = $conf->global->MAIN_METEO_LEVEL1;
$level2 = $offset + 2 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL2)) $level2 = $conf->global->MAIN_METEO_LEVEL2; $level2 = $offset + 2 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL2)) $level2 = $conf->global->MAIN_METEO_LEVEL2;
$level3 = $offset + 3 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL3)) $level3 = $conf->global->MAIN_METEO_LEVEL3; $level3 = $offset + 3 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL3)) $level3 = $conf->global->MAIN_METEO_LEVEL3;
$text = ''; $options = 'class="valignmiddle" height="60px"'; $text = ''; $options = 'class="valignmiddle" height="60px"';
if ($action == 'edit') { if ($action == 'edit') {
print '<div id="standard" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '' : 'style="display:none;"').'>'; print '<div id="standard" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '' : 'style="display:none;"').'>';
print '<div>'; print '<div>';
print '<div class="inline-block" style="padding-right: 20px">'; print '<div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 0, $options); print img_weather($text, 0, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_LEVEL0" value="'.$level0.'"/></td>'; print ' &lt;= <input type="text" size="2" name="MAIN_METEO_LEVEL0" value="'.$level0.'"/></td>';
print '</div><div class="inline-block" style="padding-right: 20px">'; print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 1, $options); print img_weather($text, 1, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_LEVEL1" value="'.$level1.'"/></td>'; print ' &lt;= <input type="text" size="2" name="MAIN_METEO_LEVEL1" value="'.$level1.'"/></td>';
print '</div><div class="inline-block" style="padding-right: 20px">'; print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 2, $options); print img_weather($text, 2, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_LEVEL2" value="'.$level2.'"/></td>'; print ' &lt;= <input type="text" size="2" name="MAIN_METEO_LEVEL2" value="'.$level2.'"/></td>';
print '</div><div class="inline-block" style="padding-right: 20px">'; print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 3, $options); print img_weather($text, 3, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_LEVEL3" value="'.$level3.'"/></td>'; print ' &lt;= <input type="text" size="2" name="MAIN_METEO_LEVEL3" value="'.$level3.'"/></td>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '<div id="percentage" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'style="display:none;"' : '').'>'; print '<div id="percentage" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'style="display:none;"' : '').'>';
print '<div>'; print '<div>';
print '<div class="inline-block" style="padding-right: 20px">'; print '<div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 0, $options); print img_weather($text, 0, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.'"/>&nbsp;%</td>'; print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.'"/>&nbsp;%</td>';
print '</div><div class="inline-block" style="padding-right: 20px">'; print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 1, $options); print img_weather($text, 1, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL1" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.'"/>&nbsp;%</td>'; print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL1" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.'"/>&nbsp;%</td>';
print '</div><div class="inline-block" style="padding-right: 20px">'; print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 2, $options); print img_weather($text, 2, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL2" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.'"/>&nbsp;%</td>'; print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL2" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.'"/>&nbsp;%</td>';
print '</div><div class="inline-block" style="padding-right: 20px">'; print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 3, $options); print img_weather($text, 3, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL3" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.'"/>&nbsp;%</td>'; print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL3" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.'"/>&nbsp;%</td>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
?> ?>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -8,7 +8,7 @@
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com> * Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
* Copyright (C) 2011-2019 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2011-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr>
@ -205,7 +205,7 @@ $tabsql[17] = "SELECT id as rowid, code, label, accountancy_code, active FR
$tabsql[18] = "SELECT rowid as rowid, code, libelle, tracking, active FROM ".MAIN_DB_PREFIX."c_shipment_mode"; $tabsql[18] = "SELECT rowid as rowid, code, libelle, tracking, active FROM ".MAIN_DB_PREFIX."c_shipment_mode";
$tabsql[19] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_effectif"; $tabsql[19] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_effectif";
$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, c.code, c.label, c.active, c.position 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, 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[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";
@ -250,7 +250,7 @@ $tabsqlsort[17] = "code ASC";
$tabsqlsort[18] = "code ASC, libelle ASC"; $tabsqlsort[18] = "code ASC, libelle ASC";
$tabsqlsort[19] = "id ASC"; $tabsqlsort[19] = "id ASC";
$tabsqlsort[20] = "code ASC, libelle ASC"; $tabsqlsort[20] = "code ASC, libelle ASC";
$tabsqlsort[21] = "code ASC, label ASC"; $tabsqlsort[21] = "code ASC, label ASC, position ASC";
$tabsqlsort[22] = "code ASC, label ASC"; $tabsqlsort[22] = "code ASC, label ASC";
$tabsqlsort[23] = "country ASC, taux ASC"; $tabsqlsort[23] = "country ASC, taux ASC";
$tabsqlsort[24] = "code ASC, label ASC"; $tabsqlsort[24] = "code ASC, label ASC";
@ -295,7 +295,7 @@ $tabfield[17] = "code,label,accountancy_code";
$tabfield[18] = "code,libelle,tracking"; $tabfield[18] = "code,libelle,tracking";
$tabfield[19] = "code,libelle"; $tabfield[19] = "code,libelle";
$tabfield[20] = "code,libelle"; $tabfield[20] = "code,libelle";
$tabfield[21] = "code,label"; $tabfield[21] = "code,label,position";
$tabfield[22] = "code,label"; $tabfield[22] = "code,label";
$tabfield[23] = "country_id,country,taux,revenuestamp_type,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";
@ -340,7 +340,7 @@ $tabfieldvalue[17] = "code,label,accountancy_code";
$tabfieldvalue[18] = "code,libelle,tracking"; $tabfieldvalue[18] = "code,libelle,tracking";
$tabfieldvalue[19] = "code,libelle"; $tabfieldvalue[19] = "code,libelle";
$tabfieldvalue[20] = "code,libelle"; $tabfieldvalue[20] = "code,libelle";
$tabfieldvalue[21] = "code,label"; $tabfieldvalue[21] = "code,label,position";
$tabfieldvalue[22] = "code,label"; $tabfieldvalue[22] = "code,label";
$tabfieldvalue[23] = "country,taux,revenuestamp_type,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";
@ -385,7 +385,7 @@ $tabfieldinsert[17] = "code,label,accountancy_code";
$tabfieldinsert[18] = "code,libelle,tracking"; $tabfieldinsert[18] = "code,libelle,tracking";
$tabfieldinsert[19] = "code,libelle"; $tabfieldinsert[19] = "code,libelle";
$tabfieldinsert[20] = "code,libelle"; $tabfieldinsert[20] = "code,libelle";
$tabfieldinsert[21] = "code,label"; $tabfieldinsert[21] = "code,label,position";
$tabfieldinsert[22] = "code,label"; $tabfieldinsert[22] = "code,label";
$tabfieldinsert[23] = "fk_pays,taux,revenuestamp_type,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";
@ -523,7 +523,7 @@ $tabhelp[17] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[18] = array('code'=>$langs->trans("EnterAnyCode"), 'tracking'=>$langs->trans("UrlTrackingDesc")); $tabhelp[18] = array('code'=>$langs->trans("EnterAnyCode"), 'tracking'=>$langs->trans("UrlTrackingDesc"));
$tabhelp[19] = array('code'=>$langs->trans("EnterAnyCode")); $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"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[22] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[22] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[23] = array('revenuestamp_type'=>'FixedOrPercent'); $tabhelp[23] = array('revenuestamp_type'=>'FixedOrPercent');
$tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
@ -621,6 +621,7 @@ if ($id == 11)
// 'contract' => $langs->trans('Contract'), // 'contract' => $langs->trans('Contract'),
'project' => $langs->trans('Project'), 'project' => $langs->trans('Project'),
'project_task' => $langs->trans('Task'), 'project_task' => $langs->trans('Task'),
'ticket' => $langs->trans('Ticket'),
'agenda' => $langs->trans('Agenda'), 'agenda' => $langs->trans('Agenda'),
'dolresource' => $langs->trans('Resource'), 'dolresource' => $langs->trans('Resource'),
// old deprecated // old deprecated
@ -692,7 +693,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
if ($value == 'sortorder') continue; // For a column name 'sortorder', we use the field name 'position' if ($value == 'sortorder') continue; // For a column name 'sortorder', we use the field name 'position'
if ((!GETPOSTISSET($value) || GETPOST($value) == '') if ((!GETPOSTISSET($value) || GETPOST($value) == '')
&& (!in_array($listfield[$f], array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto')) // Fields that are not mandatory && (!in_array($listfield[$f], array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto')) // Fields that are not mandatory
&& (!($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10 && ($id != 10 || ($listfield[$f] != 'code' && $listfield[$f] != 'note')) // Field code and note is not mandatory for dictionary table 10
) )
) { ) {
$ok = 0; $ok = 0;
@ -757,9 +758,9 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"] = ''; // If empty, we force to null if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"] = ''; // If empty, we force to null
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"] = ''; // If empty, we force to null if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"] = ''; // If empty, we force to null
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"] = ''; // If empty, we force to null if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"] = ''; // If empty, we force to null
if ($id == 10 && GETPOSTISSET("code")) // Spaces are not allowed into code if ($id == 10 && GETPOSTISSET("code")) // Spaces are not allowed into code for tax dictionary
{ {
$_POST["code"] = preg_replace('/\s/', '', $_POST["code"]); $_POST["code"] = preg_replace('/[^a-zA-Z0-9\-\+]/', '', $_POST["code"]);
} }
// If check ok and action add, add the line // If check ok and action add, add the line
@ -826,8 +827,13 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$result = $db->query($sql); $result = $db->query($sql);
if ($result) // Add is ok if ($result) // Add is ok
{ {
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); setEventMessages($langs->transnoentities("RecordCreatedSuccessfully"), null, 'mesgs');
$_POST = array('id'=>$id); // Clean $_POST array, we keep only
// Clean $_POST array, we keep only id of dictionary
if ($id == 10 && GETPOST('country', 'int') > 0) {
$search_country_id = GETPOST('country', 'int');
}
$_POST = array('id'=>$id);
} else { } else {
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
@ -1487,11 +1493,9 @@ if ($id)
continue; continue;
} }
if ($value == 'element') if ($value == 'element') {
{
$valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow; $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
} elseif ($value == 'source') } elseif ($value == 'source') {
{
$valuetoshow = isset($sourceList[$valuetoshow]) ? $sourceList[$valuetoshow] : $valuetoshow; $valuetoshow = isset($sourceList[$valuetoshow]) ? $sourceList[$valuetoshow] : $valuetoshow;
} elseif ($valuetoshow == 'all') { } elseif ($valuetoshow == 'all') {
$valuetoshow = $langs->trans('All'); $valuetoshow = $langs->trans('All');

View File

@ -135,12 +135,13 @@ if ($action == 'deletefilter')
{ {
$emailcollectorfilter = new EmailCollectorFilter($db); $emailcollectorfilter = new EmailCollectorFilter($db);
$emailcollectorfilter->fetch(GETPOST('filterid', 'int')); $emailcollectorfilter->fetch(GETPOST('filterid', 'int'));
$result = $emailcollectorfilter->delete($user); if ($emailcollectorfilter->id > 0) {
if ($result > 0) $result = $emailcollectorfilter->delete($user);
{ if ($result > 0) {
$object->fetchFilters(); $object->fetchFilters();
} else { } else {
setEventMessages($emailcollectorfilter->errors, $emailcollectorfilter->error, 'errors'); setEventMessages($emailcollectorfilter->errors, $emailcollectorfilter->error, 'errors');
}
} }
} }
@ -153,13 +154,26 @@ if (GETPOST('addoperation', 'alpha'))
$emailcollectoroperation->status = 1; $emailcollectoroperation->status = 1;
$emailcollectoroperation->position = 50; $emailcollectoroperation->position = 50;
$result = $emailcollectoroperation->create($user); if ($emailcollectoroperation->type == '-1') {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Operation")), null, 'errors');
}
if ($result > 0) if (in_array($emailcollectoroperation->type, array('loadthirdparty', 'loadandcreatethirdparty'))
{ && empty($emailcollectoroperation->actionparam)) {
$object->fetchActions(); $error++;
} else { setEventMessages($langs->trans("ErrorAParameterIsRequiredForThisOperation"), null, 'errors');
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); }
if (!$error) {
$result = $emailcollectoroperation->create($user);
if ($result > 0) {
$object->fetchActions();
} else {
$error++;
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors');
}
} }
} }
@ -170,25 +184,35 @@ if ($action == 'updateoperation')
$emailcollectoroperation->actionparam = GETPOST('operationparam2', 'restricthtml'); $emailcollectoroperation->actionparam = GETPOST('operationparam2', 'restricthtml');
$result = $emailcollectoroperation->update($user); if (in_array($emailcollectoroperation->type, array('loadthirdparty', 'loadandcreatethirdparty'))
&& empty($emailcollectoroperation->actionparam)) {
$error++;
setEventMessages($langs->trans("ErrorAParameterIsRequiredForThisOperation"), null, 'errors');
}
if ($result > 0) if (!$error) {
{ $result = $emailcollectoroperation->update($user);
$object->fetchActions();
} else { if ($result > 0)
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); {
$object->fetchActions();
} else {
$error++;
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors');
}
} }
} }
if ($action == 'deleteoperation') if ($action == 'deleteoperation')
{ {
$emailcollectoroperation = new EmailCollectorAction($db); $emailcollectoroperation = new EmailCollectorAction($db);
$emailcollectoroperation->fetch(GETPOST('operationid', 'int')); $emailcollectoroperation->fetch(GETPOST('operationid', 'int'));
$result = $emailcollectoroperation->delete($user); if ($emailcollectoroperation->id > 0) {
if ($result > 0) $result = $emailcollectoroperation->delete($user);
{ if ($result > 0) {
$object->fetchActions(); $object->fetchActions();
} else { } else {
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors');
}
} }
} }
@ -458,7 +482,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="border centpercent tableforfield">'; print '<table class="border centpercent tableforfield">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Filters").'</td><td></td><td></td>'; print '<td>'.$form->textwithpicto($langs->trans("Filters"), $langs->trans("EmailCollectorFilterDesc")).'</td><td></td><td></td>';
print '</tr>'; print '</tr>';
// Add filter // Add filter
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -491,7 +515,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
'isnotanswer'=>array('label'=>'IsNotAnAnswer', 'data-noparam'=>1), 'isnotanswer'=>array('label'=>'IsNotAnAnswer', 'data-noparam'=>1),
'isanswer'=>array('label'=>'IsAnAnswer', 'data-noparam'=>1) 'isanswer'=>array('label'=>'IsAnAnswer', 'data-noparam'=>1)
); );
print $form->selectarray('filtertype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth500', 0, '', 2); print $form->selectarray('filtertype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth500', 1, '', 2);
print "\n"; print "\n";
print '<script>'; print '<script>';
@ -544,7 +568,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table id="tablelines" class="noborder noshadow tableforfield">'; print '<table id="tablelines" class="noborder noshadow tableforfield">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("EmailcollectorOperations").'</td><td></td><td></td><td></td>'; print '<td>'.$form->textwithpicto($langs->trans("EmailcollectorOperations"), $langs->trans("EmailcollectorOperationsDesc")).'</td><td></td><td></td><td></td>';
print '</tr>'; print '</tr>';
// Add operation // Add operation
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -561,13 +585,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$parameters = array('arrayoftypes' => $arrayoftypes); $parameters = array('arrayoftypes' => $arrayoftypes);
$res = $hookmanager->executeHooks('addMoreActionsEmailCollector', $parameters, $object, $action); $res = $hookmanager->executeHooks('addMoreActionsEmailCollector', $parameters, $object, $action);
if ($res) if ($res) {
$arrayoftypes = $hookmanager->resArray; $arrayoftypes = $hookmanager->resArray;
else foreach ($hookmanager->resArray as $k=>$desc) } else {
foreach ($hookmanager->resArray as $k=>$desc) {
$arrayoftypes[$k] = $desc; $arrayoftypes[$k] = $desc;
}
}
print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth300', 1);
print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth300');
print '</td><td>'; print '</td><td>';
print '<input type="text" name="operationparam">'; print '<input type="text" name="operationparam">';
print '</td>'; print '</td>';

View File

@ -37,7 +37,9 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('admin', 'errors', 'trips', 'other')); $langs->loadLangs(array('admin', 'errors', 'trips', 'other'));
if (!$user->admin) accessforbidden(); if (!$user->admin) {
accessforbidden();
}
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
@ -52,51 +54,47 @@ $type = 'expensereport';
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask') if ($action == 'updateMask') {
{
$maskconst = GETPOST('maskconst', 'alpha'); $maskconst = GETPOST('maskconst', 'alpha');
$maskvalue = GETPOST('maskvalue', 'alpha'); $maskvalue = GETPOST('maskvalue', 'alpha');
if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); if ($maskconst) {
$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) $error++; if (!$res > 0) {
$error++;
}
if (!$error) if (!$error) {
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} elseif ($action == 'specimen') // For fiche inter } elseif ($action == 'specimen') { // For fiche expensereport
{
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
$inter = new ExpenseReport($db); $expensespecimen = new ExpenseReport($db);
$inter->initAsSpecimen(); $expensespecimen->initAsSpecimen();
$inter->status = 0; // Force statut draft to show watermark $expensespecimen->status = 0; // Force statut draft to show watermark
$inter->fk_statut = 0; // Force statut draft to show watermark
// Search template files // Search template files
$file = ''; $classname = ''; $filefound = 0; $file = ''; $classname = ''; $filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) foreach ($dirmodels as $reldir) {
{
$file = dol_buildpath($reldir."core/modules/expensereport/doc/pdf_".$modele.".modules.php", 0); $file = dol_buildpath($reldir."core/modules/expensereport/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) if (file_exists($file)) {
{
$filefound = 1; $filefound = 1;
$classname = "pdf_".$modele; $classname = "pdf_".$modele;
break; break;
} }
} }
if ($filefound) if ($filefound) {
{
require_once $file; require_once $file;
$module = new $classname($db); $module = new $classname($db);
if ($module->write_file($inter, $langs) > 0) if ($module->write_file($expensespecimen, $langs) > 0) {
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=expensereport&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=expensereport&file=SPECIMEN.pdf");
return; return;
} else { } else {
@ -107,30 +105,22 @@ if ($action == 'updateMask')
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} } elseif ($action == 'set') {
// Activate a model
// Activate a model
elseif ($action == 'set')
{
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
if ($ret > 0 && empty($conf->global->EXPENSEREPORT_ADDON_PDF)) if ($ret > 0 && empty($conf->global->EXPENSEREPORT_ADDON_PDF)) {
{
dolibarr_set_const($db, 'EXPENSEREPORT_ADDON_PDF', $value, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'EXPENSEREPORT_ADDON_PDF', $value, 'chaine', 0, '', $conf->entity);
} }
} elseif ($action == 'del') } elseif ($action == 'del') {
{
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0) {
{ if ($conf->global->EXPENSEREPORT_ADDON_PDF == "$value") {
if ($conf->global->EXPENSEREPORT_ADDON_PDF == "$value") dolibarr_del_const($db, 'EXPENSEREPORT_ADDON_PDF', $conf->entity); dolibarr_del_const($db, 'EXPENSEREPORT_ADDON_PDF', $conf->entity);
}
} }
} } elseif ($action == 'setdoc') {
// Set default model
// Set default model if (dolibarr_set_const($db, "EXPENSEREPORT_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) {
elseif ($action == 'setdoc')
{
if (dolibarr_set_const($db, "EXPENSEREPORT_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity))
{
// La constante qui a ete lue en avant du nouveau set // La constante qui a ete lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coherent // on passe donc par une variable pour avoir un affichage coherent
$conf->global->EXPENSEREPORT_ADDON_PDF = $value; $conf->global->EXPENSEREPORT_ADDON_PDF = $value;
@ -138,18 +128,15 @@ elseif ($action == 'setdoc')
// On active le modele // On active le modele
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0) {
{
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
} elseif ($action == 'setmod') } elseif ($action == 'setmod') {
{
// TODO Verifier si module numerotation choisi peut etre active // TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated // par appel methode canBeActivated
dolibarr_set_const($db, "EXPENSEREPORT_ADDON", $value, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "EXPENSEREPORT_ADDON", $value, 'chaine', 0, '', $conf->entity);
} elseif ($action == 'setoptions') } elseif ($action == 'setoptions') {
{
$db->begin(); $db->begin();
$freetext = GETPOST('EXPENSEREPORT_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string $freetext = GETPOST('EXPENSEREPORT_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string
@ -158,10 +145,11 @@ elseif ($action == 'setdoc')
$draft = GETPOST('EXPENSEREPORT_DRAFT_WATERMARK', 'alpha'); $draft = GETPOST('EXPENSEREPORT_DRAFT_WATERMARK', 'alpha');
$res2 = dolibarr_set_const($db, "EXPENSEREPORT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); $res2 = dolibarr_set_const($db, "EXPENSEREPORT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (!$res1 > 0 || !$res2 > 0) $error++; if (!$res1 > 0 || !$res2 > 0) {
$error++;
}
if (!$error) if (!$error) {
{
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -206,19 +194,14 @@ print '</tr>'."\n";
clearstatcache(); clearstatcache();
foreach ($dirmodels as $reldir) foreach ($dirmodels as $reldir) {
{
$dir = dol_buildpath($reldir."core/modules/expensereport/"); $dir = dol_buildpath($reldir."core/modules/expensereport/");
if (is_dir($dir)) if (is_dir($dir)) {
{
$handle = opendir($dir); $handle = opendir($dir);
if (is_resource($handle)) if (is_resource($handle)) {
{ while (($file = readdir($handle)) !== false) {
while (($file = readdir($handle)) !== false) if (substr($file, 0, 18) == 'mod_expensereport_' && substr($file, dol_strlen($file) - 3, 3) == 'php') {
{
if (substr($file, 0, 18) == 'mod_expensereport_' && substr($file, dol_strlen($file) - 3, 3) == 'php')
{
$file = substr($file, 0, dol_strlen($file) - 4); $file = substr($file, 0, dol_strlen($file) - 4);
require_once $dir.$file.'.php'; require_once $dir.$file.'.php';
@ -226,11 +209,14 @@ foreach ($dirmodels as $reldir)
$module = new $file($db); $module = new $file($db);
// Show modules according to features level // Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; continue;
}
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
continue;
}
if ($module->isEnabled()) if ($module->isEnabled()) {
{
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n"; print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
print $module->info(); print $module->info();
print '</td>'; print '</td>';
@ -241,13 +227,15 @@ foreach ($dirmodels as $reldir)
if (preg_match('/^Error/', $tmp)) { if (preg_match('/^Error/', $tmp)) {
$langs->load("errors"); $langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>'; print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') print $langs->trans($tmp); } elseif ($tmp == 'NotConfigured') {
else print $tmp; print $langs->trans($tmp);
} else {
print $tmp;
}
print '</td>'."\n"; print '</td>'."\n";
print '<td class="center">'; print '<td class="center">';
if ($conf->global->EXPENSEREPORT_ADDON == $file) if ($conf->global->EXPENSEREPORT_ADDON == $file) {
{
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} else { } else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;token='.newToken().'&amp;value='.urlencode($file).'">'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;token='.newToken().'&amp;value='.urlencode($file).'">';
@ -266,8 +254,9 @@ foreach ($dirmodels as $reldir)
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': '; $htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) { if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
$nextval = $langs->trans($nextval); $nextval = $langs->trans($nextval);
}
$htmltooltip .= $nextval.'<br>'; $htmltooltip .= $nextval.'<br>';
} else { } else {
$htmltooltip .= $langs->trans($module->error).'<br>'; $htmltooltip .= $langs->trans($module->error).'<br>';
@ -289,7 +278,7 @@ foreach ($dirmodels as $reldir)
print "</table><br>\n"; print "</table><br>\n";
/* /*
* Documents models for Interventions * Documents models for ExpenseReport
*/ */
print load_fiche_titre($langs->trans("TemplatePDFExpenseReports"), '', ''); print load_fiche_titre($langs->trans("TemplatePDFExpenseReports"), '', '');
@ -302,12 +291,10 @@ $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
$sql .= " WHERE type = '".$db->escape($type)."'"; $sql .= " WHERE type = '".$db->escape($type)."'";
$sql .= " AND entity = ".$conf->entity; $sql .= " AND entity = ".$conf->entity;
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$i = 0; $i = 0;
$num_rows = $db->num_rows($resql); $num_rows = $db->num_rows($resql);
while ($i < $num_rows) while ($i < $num_rows) {
{
$array = $db->fetch_array($resql); $array = $db->fetch_array($resql);
array_push($def, $array[0]); array_push($def, $array[0]);
$i++; $i++;
@ -328,28 +315,21 @@ print "</tr>\n";
clearstatcache(); clearstatcache();
foreach ($dirmodels as $reldir) foreach ($dirmodels as $reldir) {
{
$dir = dol_buildpath($reldir."core/modules/expensereport/doc"); $dir = dol_buildpath($reldir."core/modules/expensereport/doc");
if (is_dir($dir)) if (is_dir($dir)) {
{
$handle = opendir($dir); $handle = opendir($dir);
if (is_resource($handle)) if (is_resource($handle)) {
{ while (($file = readdir($handle)) !== false) {
while (($file = readdir($handle)) !== false)
{
$filelist[] = $file; $filelist[] = $file;
} }
closedir($handle); closedir($handle);
arsort($filelist); arsort($filelist);
foreach ($filelist as $file) foreach ($filelist as $file) {
{ if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) if (file_exists($dir.'/'.$file)) {
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16); $name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12); $classname = substr($file, 0, dol_strlen($file) - 12);
@ -357,21 +337,26 @@ foreach ($dirmodels as $reldir)
$module = new $classname($db); $module = new $classname($db);
$modulequalified = 1; $modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0; if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0; $modulequalified = 0;
}
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
$modulequalified = 0;
}
if ($modulequalified) if ($modulequalified) {
{
print '<tr class="oddeven"><td width="100">'; print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name); print (empty($module->name) ? $name : $module->name);
print "</td><td>\n"; print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs); if (method_exists($module, 'info')) {
else print $module->description; print $module->info($langs);
} else {
print $module->description;
}
print '</td>'; print '</td>';
// Active // Active
if (in_array($name, $def)) if (in_array($name, $def)) {
{
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
@ -385,8 +370,7 @@ foreach ($dirmodels as $reldir)
// Default // Default
print '<td class="center">'; print '<td class="center">';
if ($conf->global->EXPENSEREPORT_ADDON_PDF == "$name") if ($conf->global->EXPENSEREPORT_ADDON_PDF == "$name") {
{
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} else { } else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
@ -409,8 +393,7 @@ foreach ($dirmodels as $reldir)
// Preview // Preview
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf') {
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else { } else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
@ -451,14 +434,15 @@ print "</tr>\n";
$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); $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("FreeLegalTextOnExpenseReports"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>'; print $form->textwithpicto($langs->trans("FreeLegalTextOnExpenseReports"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename = 'EXPENSEREPORT_FREE_TEXT'; $variablename = 'EXPENSEREPORT_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} else { } else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';

View File

@ -20,7 +20,7 @@
/** /**
* \file htdocs/admin/expensereport_ik.php * \file htdocs/admin/expensereport_rules.php
* \ingroup expensereport * \ingroup expensereport
* \brief Page to display expense tax ik * \brief Page to display expense tax ik
*/ */
@ -34,7 +34,9 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_rule.class.ph
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin", "other", "trips", "errors", "dict")); $langs->loadLangs(array("admin", "other", "trips", "errors", "dict"));
if (!$user->admin) accessforbidden(); if (!$user->admin) {
accessforbidden();
}
//Init error //Init error
$error = false; $error = false;
@ -55,15 +57,15 @@ $amount = GETPOST('amount');
$restrictive = GETPOST('restrictive'); $restrictive = GETPOST('restrictive');
$object = new ExpenseReportRule($db); $object = new ExpenseReportRule($db);
if (!empty($id)) if (!empty($id)) {
{
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result < 0) dol_print_error('', $object->error, $object->errors); if ($result < 0) {
dol_print_error('', $object->error, $object->errors);
}
} }
// TODO do action // TODO do action
if ($action == 'save') if ($action == 'save') {
{
$error = 0; $error = 0;
// check parameters // check parameters
@ -92,8 +94,7 @@ if ($action == 'save')
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportLimitAmount")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportLimitAmount")), null, 'errors');
} }
if (empty($error)) if (empty($error)) {
{
$object->setValues($_POST); $object->setValues($_POST);
if ($apply_to == 'U') { if ($apply_to == 'U') {
@ -116,18 +117,22 @@ if ($action == 'save')
$object->entity = $conf->entity; $object->entity = $conf->entity;
$res = $object->create($user); $res = $object->create($user);
if ($res > 0) setEventMessages($langs->trans('ExpenseReportRuleSave'), null); if ($res > 0) {
else dol_print_error($object->db); setEventMessages($langs->trans('ExpenseReportRuleSave'), null);
} else {
dol_print_error($object->db);
}
header('Location: '.$_SERVER['PHP_SELF']); header('Location: '.$_SERVER['PHP_SELF']);
exit; exit;
} }
} elseif ($action == 'delete') } elseif ($action == 'delete') {
{
// TODO add confirm // TODO add confirm
$res = $object->delete($user); $res = $object->delete($user);
if ($res < 0) dol_print_error($object->db); if ($res < 0) {
dol_print_error($object->db);
}
header('Location: '.$_SERVER['PHP_SELF']); header('Location: '.$_SERVER['PHP_SELF']);
exit; exit;
@ -135,8 +140,17 @@ if ($action == 'save')
$rules = ExpenseReportRule::getAllRule(); $rules = ExpenseReportRule::getAllRule();
$tab_apply = array('A' => $langs->trans('All'), 'G' => $langs->trans('Group'), 'U' => $langs->trans('User')); $tab_apply = array(
$tab_rules_type = array('EX_DAY' => $langs->trans('Day'), 'EX_MON' => $langs->trans('Month'), 'EX_YEA' => $langs->trans('Year'), 'EX_EXP' => $langs->trans('OnExpense')); 'A' => $langs->trans('All'),
'G' => $langs->trans('Group'),
'U' => $langs->trans('User')
);
$tab_rules_type = array(
'EX_DAY' => $langs->trans('Day'),
'EX_MON' => $langs->trans('Month'),
'EX_YEA' => $langs->trans('Year'),
'EX_EXP' => $langs->trans('OnExpense')
);
/* /*
@ -156,8 +170,7 @@ print dol_get_fiche_head($head, 'expenserules', $langs->trans("ExpenseReportsRul
echo '<span class="opacitymedium">'.$langs->trans('ExpenseReportRulesDesc').'</span>'; echo '<span class="opacitymedium">'.$langs->trans('ExpenseReportRulesDesc').'</span>';
print '<br><br>'; print '<br><br>';
if ($action != 'edit') if ($action != 'edit') {
{
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">'; echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
echo '<input type="hidden" name="token" value="'.newToken().'" />'; echo '<input type="hidden" name="token" value="'.newToken().'" />';
echo '<input type="hidden" name="action" value="save" />'; echo '<input type="hidden" name="action" value="save" />';
@ -199,8 +212,7 @@ if ($action != 'edit')
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">'; echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
echo '<input type="hidden" name="token" value="'.newToken().'" />'; echo '<input type="hidden" name="token" value="'.newToken().'" />';
if ($action == 'edit') if ($action == 'edit') {
{
echo '<input type="hidden" name="id" value="'.$object->id.'" />'; echo '<input type="hidden" name="id" value="'.$object->id.'" />';
echo '<input type="hidden" name="action" value="save" />'; echo '<input type="hidden" name="action" value="save" />';
} }
@ -218,43 +230,47 @@ echo '<th>'.$langs->trans('ExpenseReportRestrictive').'</th>';
echo '<th>&nbsp;</th>'; echo '<th>&nbsp;</th>';
echo '</tr>'; echo '</tr>';
foreach ($rules as $rule) foreach ($rules as $rule) {
{
echo '<tr class="oddeven">'; echo '<tr class="oddeven">';
echo '<td>'; echo '<td>';
if ($action == 'edit' && $object->id == $rule->id) if ($action == 'edit' && $object->id == $rule->id) {
{
$selected = ($object->is_for_all > 0) ? 'A' : ($object->fk_usergroup > 0 ? 'G' : 'U'); $selected = ($object->is_for_all > 0) ? 'A' : ($object->fk_usergroup > 0 ? 'G' : 'U');
echo '<div class="float">'.$form->selectarray('apply_to', $tab_apply, $selected, 0).'</div>'; echo '<div class="float">'.$form->selectarray('apply_to', $tab_apply, $selected, 0).'</div>';
echo '<div id="user" class="float">'.$form->select_dolusers($object->fk_user, 'fk_user').'</div>'; echo '<div id="user" class="float">'.$form->select_dolusers($object->fk_user, 'fk_user').'</div>';
echo '<div id="group" class="float">'.$form->select_dolgroups($object->fk_usergroup, 'fk_usergroup').'</div>'; echo '<div id="group" class="float">'.$form->select_dolgroups($object->fk_usergroup, 'fk_usergroup').'</div>';
} else { } else {
if ($rule->is_for_all > 0) echo $tab_apply['A']; if ($rule->is_for_all > 0) {
elseif ($rule->fk_usergroup > 0) echo $tab_apply['G'].' ('.$rule->getGroupLabel().')'; echo $tab_apply['A'];
elseif ($rule->fk_user > 0) echo $tab_apply['U'].' ('.$rule->getUserName().')'; } elseif ($rule->fk_usergroup > 0) {
} echo $tab_apply['G'].' ('.$rule->getGroupLabel().')';
echo '</td>'; } elseif ($rule->fk_user > 0) {
echo $tab_apply['U'].' ('.$rule->getUserName().')';
echo '<td>';
if ($action == 'edit' && $object->id == $rule->id)
{
echo $form->selectExpense($object->fk_c_type_fees, 'fk_c_type_fees', 0, 1, 1);
} else {
if ($rule->fk_c_type_fees == -1) echo $langs->trans('AllExpenseReport');
else {
$key = getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id');
if ($key != $langs->trans($key)) echo $langs->trans($key);
else echo $langs->trans(getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id')); // TODO check to return trans of 'code'
} }
} }
echo '</td>'; echo '</td>';
echo '<td>'; echo '<td>';
if ($action == 'edit' && $object->id == $rule->id) if ($action == 'edit' && $object->id == $rule->id) {
{ echo $form->selectExpense($object->fk_c_type_fees, 'fk_c_type_fees', 0, 1, 1);
} else {
if ($rule->fk_c_type_fees == -1) {
echo $langs->trans('AllExpenseReport');
} else {
$key = getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id');
if ($key != $langs->trans($key)) {
echo $langs->trans($key);
} else {
echo $langs->trans(getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id')); // TODO check to return trans of 'code'
}
}
}
echo '</td>';
echo '<td>';
if ($action == 'edit' && $object->id == $rule->id) {
echo $form->selectarray('code_expense_rules_type', $tab_rules_type, $object->code_expense_rules_type, 0); echo $form->selectarray('code_expense_rules_type', $tab_rules_type, $object->code_expense_rules_type, 0);
} else { } else {
echo $tab_rules_type[$rule->code_expense_rules_type]; echo $tab_rules_type[$rule->code_expense_rules_type];
@ -263,8 +279,7 @@ foreach ($rules as $rule)
echo '<td>'; echo '<td>';
if ($action == 'edit' && $object->id == $rule->id) if ($action == 'edit' && $object->id == $rule->id) {
{
print $form->selectDate(strtotime(date('Y-m-d', $object->dates)), 'start', '', '', 0, '', 1, 0); print $form->selectDate(strtotime(date('Y-m-d', $object->dates)), 'start', '', '', 0, '', 1, 0);
} else { } else {
echo dol_print_date($rule->dates, 'day'); echo dol_print_date($rule->dates, 'day');
@ -273,8 +288,7 @@ foreach ($rules as $rule)
echo '<td>'; echo '<td>';
if ($action == 'edit' && $object->id == $rule->id) if ($action == 'edit' && $object->id == $rule->id) {
{
print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0); print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0);
} else { } else {
echo dol_print_date($rule->datee, 'day'); echo dol_print_date($rule->datee, 'day');
@ -283,8 +297,7 @@ foreach ($rules as $rule)
echo '<td>'; echo '<td>';
if ($action == 'edit' && $object->id == $rule->id) if ($action == 'edit' && $object->id == $rule->id) {
{
echo '<input type="text" value="'.price2num($object->amount).'" name="amount" class="amount" />'.$conf->currency; echo '<input type="text" value="'.price2num($object->amount).'" name="amount" class="amount" />'.$conf->currency;
} else { } else {
echo price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency); echo price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency);
@ -293,8 +306,7 @@ foreach ($rules as $rule)
echo '<td>'; echo '<td>';
if ($action == 'edit' && $object->id == $rule->id) if ($action == 'edit' && $object->id == $rule->id) {
{
echo $form->selectyesno('restrictive', $object->restrictive, 1); echo $form->selectyesno('restrictive', $object->restrictive, 1);
} else { } else {
echo yn($rule->restrictive, 1, 1); echo yn($rule->restrictive, 1, 1);
@ -303,8 +315,7 @@ foreach ($rules as $rule)
echo '<td class="center">'; echo '<td class="center">';
if ($object->id != $rule->id) if ($object->id != $rule->id) {
{
echo '<a class="editfielda paddingright paddingleft" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&id='.$rule->id.'">'.img_edit().'</a>&nbsp;'; echo '<a class="editfielda paddingright paddingleft" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&id='.$rule->id.'">'.img_edit().'</a>&nbsp;';
echo '<a class="paddingright paddingleft" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$rule->id.'">'.img_delete().'</a>'; echo '<a class="paddingright paddingleft" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$rule->id.'">'.img_delete().'</a>';
} else { } else {

View File

@ -21,7 +21,7 @@
/** /**
* \file htdocs/admin/fckeditor.php * \file htdocs/admin/fckeditor.php
* \ingroup fckeditor * \ingroup fckeditor
* \brief Page d'activation du module FCKeditor dans les autres modules * \brief Activation page for the FCKeditor module in the other modules
*/ */
require '../main.inc.php'; require '../main.inc.php';
@ -43,35 +43,41 @@ $mode = GETPOST('mode') ?GETPOST('mode', 'alpha') : 'dolibarr_notes';
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
// Constante et traduction de la description du module // Constant and translation of the module description
$modules = array( $modules = array(
'SOCIETE' => 'FCKeditorForCompany', 'SOCIETE' => 'FCKeditorForCompany',
'PRODUCTDESC' => 'FCKeditorForProduct', 'PRODUCTDESC' => 'FCKeditorForProduct',
'DETAILS' => 'FCKeditorForProductDetails', 'DETAILS' => 'FCKeditorForProductDetails',
'USERSIGN' => 'FCKeditorForUserSignature', 'USERSIGN' => 'FCKeditorForUserSignature',
'MAILING' => 'FCKeditorForMailing', 'MAILING' => 'FCKeditorForMailing',
'MAIL' => 'FCKeditorForMail', 'MAIL' => 'FCKeditorForMail',
'TICKET' => 'FCKeditorForTicket' 'TICKET' => 'FCKeditorForTicket',
'NOTE_PUBLIC' => 'FCKeditorForNotePublic',
'NOTE_PRIVATE' => 'FCKeditorForNotePrivate',
); );
// Conditions pour que l'option soit proposee // Conditions for the option to be offered
$conditions = array( $conditions = array(
'SOCIETE' => 1, 'SOCIETE' => 1,
'PRODUCTDESC' => (!empty($conf->product->enabled) || !empty($conf->service->enabled)), 'PRODUCTDESC' => (!empty($conf->product->enabled) || !empty($conf->service->enabled)),
'DETAILS' => (!empty($conf->facture->enabled) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->supplier_proposal->enabled) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)), 'DETAILS' => (!empty($conf->facture->enabled) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->supplier_proposal->enabled) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)),
'USERSIGN' => 1, 'USERSIGN' => 1,
'MAILING' => !empty($conf->mailing->enabled), 'MAILING' => !empty($conf->mailing->enabled),
'MAIL' => (!empty($conf->facture->enabled) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled)), 'MAIL' => (!empty($conf->facture->enabled) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled)),
'TICKET' => !empty($conf->ticket->enabled) 'TICKET' => !empty($conf->ticket->enabled),
'NOTE_PUBLIC' => 1,
'NOTE_PRIVATE' => 1,
); );
// Picto // Picto
$picto = array( $picto = array(
'SOCIETE' => 'generic', 'SOCIETE' => 'generic',
'PRODUCTDESC' => 'product', 'PRODUCTDESC' => 'product',
'DETAILS' => 'product', 'DETAILS' => 'product',
'USERSIGN' => 'user', 'USERSIGN' => 'user',
'MAILING' => 'email', 'MAILING' => 'email',
'MAIL' => 'email', 'MAIL' => 'email',
'TICKET' => 'ticket' 'TICKET' => 'ticket',
'NOTE_PUBLIC' => 'generic',
'NOTE_PRIVATE' => 'generic',
); );
@ -85,7 +91,7 @@ foreach ($modules as $const => $desc)
if ($action == 'activate_'.strtolower($const)) if ($action == 'activate_'.strtolower($const))
{ {
dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1", 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1", 'chaine', 0, '', $conf->entity);
// Si fckeditor est active dans la description produit/service, on l'active dans les formulaires // If fckeditor is active in the product/service description, it is activated in the forms
if ($const == 'PRODUCTDESC' && !empty($conf->global->PRODUIT_DESC_IN_FORM)) if ($const == 'PRODUCTDESC' && !empty($conf->global->PRODUIT_DESC_IN_FORM))
{ {
dolibarr_set_const($db, "FCKEDITOR_ENABLE_DETAILS", "1", 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "FCKEDITOR_ENABLE_DETAILS", "1", 'chaine', 0, '', $conf->entity);
@ -154,7 +160,7 @@ if (empty($conf->use_javascript_ajax))
// Modules // Modules
foreach ($modules as $const => $desc) foreach ($modules as $const => $desc)
{ {
// Si condition non remplie, on ne propose pas l'option // If this condition is not met, the option is not offered
if (!$conditions[$const]) continue; if (!$conditions[$const]) continue;
print '<tr class="oddeven">'; print '<tr class="oddeven">';

View File

@ -163,7 +163,7 @@ if ($action == 'edit')
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly")); print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td><input class="flat" name="'.$mainroundingruletot.'" size="3" value="'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : $conf->global->MAIN_ROUNDING_RULE_TOT).'"></td></tr>'; print '</td><td><input class="flat" name="'.$mainroundingruletot.'" size="3" value="'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : (!empty($conf->global->MAIN_ROUNDING_RULE_TOT) ? $conf->global->MAIN_ROUNDING_RULE_TOT : '')).'"></td></tr>';
print '</table>'; print '</table>';
@ -193,7 +193,7 @@ if ($action == 'edit')
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly")); print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td align="right">'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : $conf->global->MAIN_ROUNDING_RULE_TOT).'</td></tr>'; print '</td><td align="right">'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : (!empty($conf->global->MAIN_ROUNDING_RULE_TOT) ? $conf->global->MAIN_ROUNDING_RULE_TOT : '')).'</td></tr>';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
@ -299,7 +299,7 @@ if (empty($mysoc->country_code))
print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU'); print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
print " x ".$langs->trans("Quantity").": ".$qty; print " x ".$langs->trans("Quantity").": ".$qty;
print " - ".$langs->trans("VAT").": ".$vat.'%'; print " - ".$langs->trans("VAT").": ".$vat.'%';
print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n"; print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
$s = 10 / 3; $qty = 2; $vat = 10; $s = 10 / 3; $qty = 2; $vat = 10;
$tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array); $tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);

View File

@ -34,7 +34,7 @@ if (!$user->admin) accessforbidden();
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$form = new Form($db);
/* /*
* Actions * Actions
@ -49,6 +49,7 @@ if ($action == 'setvalue')
$checkread = GETPOST('value', 'alpha'); $checkread = GETPOST('value', 'alpha');
$checkread_key = GETPOST('MAILING_EMAIL_UNSUBSCRIBE_KEY', 'alpha'); $checkread_key = GETPOST('MAILING_EMAIL_UNSUBSCRIBE_KEY', 'alpha');
$mailingdelay = GETPOST('MAILING_DELAY', 'int'); $mailingdelay = GETPOST('MAILING_DELAY', 'int');
$contactbulkdefault = GETPOST('MAILING_CONTACT_DEFAULT_BULK_STATUS', 'int');
$res = dolibarr_set_const($db, "MAILING_EMAIL_FROM", $mailfrom, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MAILING_EMAIL_FROM", $mailfrom, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!$res > 0) $error++;
@ -56,11 +57,14 @@ if ($action == 'setvalue')
if (!$res > 0) $error++; if (!$res > 0) $error++;
$res = dolibarr_set_const($db, "MAILING_DELAY", $mailingdelay, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MAILING_DELAY", $mailingdelay, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!$res > 0) $error++;
$res = dolibarr_set_const($db, "MAILING_CONTACT_DEFAULT_BULK_STATUS", $contactbulkdefault, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
// Create temporary encryption key if nedded // Create temporary encryption key if nedded
$res = dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE_KEY", $checkread_key, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE_KEY", $checkread_key, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!$res > 0) $error++;
if (!$error) if (!$error)
{ {
$db->commit(); $db->commit();
@ -70,7 +74,17 @@ if ($action == 'setvalue')
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
if ($action == 'setonsearchandlistgooncustomerorsuppliercard') {
$setonsearchandlistgooncustomerorsuppliercard = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD", $setonsearchandlistgooncustomerorsuppliercard, 'yesno', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
/* /*
* View * View
@ -123,7 +137,7 @@ print '</td></tr>';
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $langs->trans("MailingDelay").'</td><td>'; print $langs->trans("MailingDelay").'</td><td>';
print '<input size="32" type="text" name="MAILING_DELAY" value="'.$conf->global->MAILING_DELAY.'">'; print '<input class="width75" type="text" name="MAILING_DELAY" value="'.$conf->global->MAILING_DELAY.'">';
print '</td></tr>'; print '</td></tr>';
@ -136,6 +150,16 @@ print '<input size="32" type="text" name="MAILING_EMAIL_UNSUBSCRIBE_KEY" id="MAI
if (!empty($conf->use_javascript_ajax)) print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"'); if (!empty($conf->use_javascript_ajax)) print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
print '</td></tr>'; print '</td></tr>';
// default blacklist from mailing
print '<tr class="oddeven">';
print '<td>' . $langs->trans("DefaultBlacklistMailingStatus") . '</td>';
print '<td>';
$blacklist_setting=array(0=>$langs->trans('No'),1=>$langs->trans('Yes'),-1=>$langs->trans('DefaultStatusEmptyMandatory'));
print $form->selectarray("MAILING_CONTACT_DEFAULT_BULK_STATUS", $blacklist_setting, $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS);
print '</td>';
print '</tr>';
if (!empty($conf->use_javascript_ajax) && $conf->global->MAIN_FEATURES_LEVEL >= 1) { if (!empty($conf->use_javascript_ajax) && $conf->global->MAIN_FEATURES_LEVEL >= 1) {
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $langs->trans("MailAdvTargetRecipients").'</td><td>'; print $langs->trans("MailAdvTargetRecipients").'</td><td>';

View File

@ -131,8 +131,12 @@ if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') $
$form = new Form($db); $form = new Form($db);
$linuxlike = 1; $linuxlike = 1;
if (preg_match('/^win/i', PHP_OS)) $linuxlike = 0; if (preg_match('/^win/i', PHP_OS)) {
if (preg_match('/^mac/i', PHP_OS)) $linuxlike = 0; $linuxlike = 0;
}
if (preg_match('/^mac/i', PHP_OS)) {
$linuxlike = 0;
}
if (empty($conf->global->MAIN_MAIL_SENDMODE)) $conf->global->MAIN_MAIL_SENDMODE = 'mail'; if (empty($conf->global->MAIN_MAIL_SENDMODE)) $conf->global->MAIN_MAIL_SENDMODE = 'mail';
$port = !empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : ini_get('smtp_port'); $port = !empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : ini_get('smtp_port');

View File

@ -290,6 +290,11 @@ if ($action == 'create') {
// Id // Id
$parent_rowid = GETPOST('menuId', 'int'); $parent_rowid = GETPOST('menuId', 'int');
$parent_mainmenu = '';
$parent_leftmenu = '';
$parent_langs = '';
$parent_level = '';
if (GETPOST('menuId', 'int')) { if (GETPOST('menuId', 'int')) {
$sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".GETPOST('menuId', 'int'); $sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".GETPOST('menuId', 'int');
$res = $db->query($sql); $res = $db->query($sql);
@ -328,8 +333,8 @@ if ($action == 'create') {
} else { } else {
print '<select name="type" class="flat" id="topleft">'; print '<select name="type" class="flat" id="topleft">';
print '<option value="">&nbsp;</option>'; print '<option value="">&nbsp;</option>';
print '<option value="top"'.($_POST["type"] && $_POST["type"] == 'top' ? ' selected' : '').'>'.$langs->trans('Top').'</option>'; print '<option value="top"'.(!empty($_POST["type"]) && $_POST["type"] == 'top' ? ' selected' : '').'>'.$langs->trans('Top').'</option>';
print '<option value="left"'.($_POST["type"] && $_POST["type"] == 'left' ? ' selected' : '').'>'.$langs->trans('Left').'</option>'; print '<option value="left"'.(!empty($_POST["type"]) && $_POST["type"] == 'left' ? ' selected' : '').'>'.$langs->trans('Left').'</option>';
print '</select>'; print '</select>';
} }
print '</td><td>'.$langs->trans('DetailType').'</td></tr>'; print '</td><td>'.$langs->trans('DetailType').'</td></tr>';
@ -370,8 +375,8 @@ if ($action == 'create') {
// Target // Target
print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">'; print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">';
print '<option value=""'.($menu->target == "" ? ' selected' : '').'>&nbsp;</option>'; print '<option value=""'.(isset($menu->target) && $menu->target == "" ? ' selected' : '').'>&nbsp;</option>';
print '<option value="_blank"'.($menu->target == "_blank" ? ' selected' : '').'>'.$langs->trans('_blank').'</option>'; print '<option value="_blank"'.(isset($menu->target) && $menu->target == "_blank" ? ' selected' : '').'>'.$langs->trans('_blank').'</option>';
print '</select></td></td><td>'.$langs->trans('DetailTarget').'</td></tr>'; print '</select></td></td><td>'.$langs->trans('DetailTarget').'</td></tr>';
// Enabled // Enabled

View File

@ -367,7 +367,7 @@ if ($conf->use_javascript_ajax)
$remainingdata = array(); $remainingdata = array();
foreach ($data as $datar) foreach ($data as $datar)
{ {
if (empty($datar['rowid']) || $tree_recur_alreadyadded[$datar['rowid']]) continue; if (empty($datar['rowid']) || !empty($tree_recur_alreadyadded[$datar['rowid']])) continue;
$remainingdata[] = $datar; $remainingdata[] = $datar;
} }

View File

@ -475,35 +475,39 @@ print load_fiche_titre($langs->trans("ModulesSetup"), '', 'title_setup');
if ($mode == 'common' || $mode == 'commonkanban') { if ($mode == 'common' || $mode == 'commonkanban') {
$desc = $langs->trans("ModulesDesc", '{picto}'); $desc = $langs->trans("ModulesDesc", '{picto}');
$desc = str_replace('{picto}', img_picto('', 'switch_off'), $desc); $desc = str_replace('{picto}', img_picto('', 'switch_off'), $desc);
print '<span class="opacitymedium hideonsmartphone">'.$desc."<br></span>\n"; print '<span class="opacitymedium hideonsmartphone">'.$desc."<br><br></span>\n";
} }
if ($mode == 'marketplace') { if ($mode == 'marketplace') {
print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesMarketPlaceDesc")."<br></span>\n"; print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesMarketPlaceDesc")."<br><br></span>\n";
} }
if ($mode == 'deploy') { if ($mode == 'deploy') {
print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."<br></span>\n"; print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."<br><br></span>\n";
} }
if ($mode == 'develop') { if ($mode == 'develop') {
print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesDevelopDesc")."<br></span>\n"; print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesDevelopDesc")."<br><br></span>\n";
} }
$head = modules_prepare_head(); $head = modules_prepare_head();
print "<br>\n";
if ($mode == 'common' || $mode == 'commonkanban') { if ($mode == 'common' || $mode == 'commonkanban') {
dol_set_focus('#search_keyword'); dol_set_focus('#search_keyword');
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="token" value="'.newToken().'">';
if (isset($optioncss) && $optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
} }
print '<input type="hidden" name="token" value="'.newToken().'">'; if (isset($sortfield) && $sortfield != '') {
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; }
print '<input type="hidden" name="page" value="'.$page.'">'; if (isset($sortorder) && $sortorder != '') {
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
}
if (isset($page) && $page != '') {
print '<input type="hidden" name="page" value="'.$page.'">';
}
print '<input type="hidden" name="mode" value="'.$mode.'">'; print '<input type="hidden" name="mode" value="'.$mode.'">';
print dol_get_fiche_head($head, 'modules', '', -1); print dol_get_fiche_head($head, 'modules', '', -1);
@ -1001,7 +1005,7 @@ if ($mode == 'marketplace') {
<div id="listing-content"> <div id="listing-content">
<table summary="list_of_modules" id="list_of_modules" class="productlist centpercent"> <table summary="list_of_modules" id="list_of_modules" class="productlist centpercent">
<tbody id="listOfModules"> <tbody id="listOfModules">
<?php echo $dolistore->get_products($categorie); ?> <?php echo $dolistore->get_products(!empty($categorie) ? $categorie: ''); ?>
</tbody> </tbody>
</table> </table>
</div> </div>
@ -1082,28 +1086,36 @@ if ($mode == 'deploy') {
$max = $conf->global->MAIN_UPLOAD_DOC; // In Kb $max = $conf->global->MAIN_UPLOAD_DOC; // In Kb
$maxphp = @ini_get('upload_max_filesize'); // In unknown $maxphp = @ini_get('upload_max_filesize'); // In unknown
if (preg_match('/k$/i', $maxphp)) { if (preg_match('/k$/i', $maxphp)) {
$maxphp = preg_replace('/k$/i', '', $maxphp);
$maxphp = $maxphp * 1; $maxphp = $maxphp * 1;
} }
if (preg_match('/m$/i', $maxphp)) { if (preg_match('/m$/i', $maxphp)) {
$maxphp = preg_replace('/m$/i', '', $maxphp);
$maxphp = $maxphp * 1024; $maxphp = $maxphp * 1024;
} }
if (preg_match('/g$/i', $maxphp)) { if (preg_match('/g$/i', $maxphp)) {
$maxphp = preg_replace('/g$/i', '', $maxphp);
$maxphp = $maxphp * 1024 * 1024; $maxphp = $maxphp * 1024 * 1024;
} }
if (preg_match('/t$/i', $maxphp)) { if (preg_match('/t$/i', $maxphp)) {
$maxphp = preg_replace('/t$/i', '', $maxphp);
$maxphp = $maxphp * 1024 * 1024 * 1024; $maxphp = $maxphp * 1024 * 1024 * 1024;
} }
$maxphp2 = @ini_get('post_max_size'); // In unknown $maxphp2 = @ini_get('post_max_size'); // In unknown
if (preg_match('/k$/i', $maxphp2)) { if (preg_match('/k$/i', $maxphp2)) {
$maxphp2 = preg_replace('/k$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1; $maxphp2 = $maxphp2 * 1;
} }
if (preg_match('/m$/i', $maxphp2)) { if (preg_match('/m$/i', $maxphp2)) {
$maxphp2 = preg_replace('/m$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024; $maxphp2 = $maxphp2 * 1024;
} }
if (preg_match('/g$/i', $maxphp2)) { if (preg_match('/g$/i', $maxphp2)) {
$maxphp2 = preg_replace('/g$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024 * 1024; $maxphp2 = $maxphp2 * 1024 * 1024;
} }
if (preg_match('/t$/i', $maxphp2)) { if (preg_match('/t$/i', $maxphp2)) {
$maxphp2 = preg_replace('/t$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024 * 1024 * 1024; $maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
} }
// Now $max and $maxphp and $maxphp2 are in Kb // Now $max and $maxphp and $maxphp2 are in Kb
@ -1139,7 +1151,7 @@ if ($mode == 'deploy') {
print '<input class="flat minwidth400" type="file" name="fileinstall" id="fileinstall"> '; print '<input class="flat minwidth400" type="file" name="fileinstall" id="fileinstall"> ';
print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">'; print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Upload")).'" class="button">';
if (!empty($conf->global->MAIN_UPLOAD_DOC)) { if (!empty($conf->global->MAIN_UPLOAD_DOC)) {
if ($user->admin) { if ($user->admin) {

View File

@ -57,6 +57,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
if ($action != 'updateedit' && !$error) if ($action != 'updateedit' && !$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} }
@ -95,37 +96,37 @@ if (empty($action) || $action == 'edit' || $action == 'updateedit')
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Monday"), $langs->trans("OpeningHoursFormatDesc")); print $form->textwithpicto($langs->trans("Monday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>'; print '</td><td>';
print '<input name="monday" id="monday" class="minwidth100" value="'.($conf->global->MAIN_INFO_OPENINGHOURS_MONDAY ? $conf->global->MAIN_INFO_OPENINGHOURS_MONDAY : GETPOST("monday", 'alpha')).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n"; print '<input name="monday" id="monday" class="minwidth100" value="'.(!empty($conf->global->MAIN_INFO_OPENINGHOURS_MONDAY) ? $conf->global->MAIN_INFO_OPENINGHOURS_MONDAY : GETPOST("monday", 'alpha')).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Tuesday"), $langs->trans("OpeningHoursFormatDesc")); print $form->textwithpicto($langs->trans("Tuesday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>'; print '</td><td>';
print '<input name="tuesday" id="tuesday" class="minwidth100" value="'.($conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY ? $conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY : GETPOST("tuesday", 'alpha')).'"></td></tr>'."\n"; print '<input name="tuesday" id="tuesday" class="minwidth100" value="'.(!empty($conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY) ? $conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY : GETPOST("tuesday", 'alpha')).'"></td></tr>'."\n";
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Wednesday"), $langs->trans("OpeningHoursFormatDesc")); print $form->textwithpicto($langs->trans("Wednesday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>'; print '</td><td>';
print '<input name="wednesday" id="wednesday" class="minwidth100" value="'.($conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY ? $conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY : GETPOST("wednesday", 'alpha')).'"></td></tr>'."\n"; print '<input name="wednesday" id="wednesday" class="minwidth100" value="'.(!empty($conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY) ? $conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY : GETPOST("wednesday", 'alpha')).'"></td></tr>'."\n";
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Thursday"), $langs->trans("OpeningHoursFormatDesc")); print $form->textwithpicto($langs->trans("Thursday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>'; print '</td><td>';
print '<input name="thursday" id="thursday" class="minwidth100" value="'.($conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY ? $conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY : GETPOST("thursday", 'alpha')).'"></td></tr>'."\n"; print '<input name="thursday" id="thursday" class="minwidth100" value="'.(!empty($conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY) ? $conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY : GETPOST("thursday", 'alpha')).'"></td></tr>'."\n";
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Friday"), $langs->trans("OpeningHoursFormatDesc")); print $form->textwithpicto($langs->trans("Friday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>'; print '</td><td>';
print '<input name="friday" id="friday" class="minwidth100" value="'.($conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY ? $conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY : GETPOST("friday", 'alpha')).'"></td></tr>'."\n"; print '<input name="friday" id="friday" class="minwidth100" value="'.(!empty($conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY) ? $conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY : GETPOST("friday", 'alpha')).'"></td></tr>'."\n";
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Saturday"), $langs->trans("OpeningHoursFormatDesc")); print $form->textwithpicto($langs->trans("Saturday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>'; print '</td><td>';
print '<input name="saturday" id="saturday" class="minwidth100" value="'.($conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY ? $conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY : GETPOST("saturday", 'alpha')).'"></td></tr>'."\n"; print '<input name="saturday" id="saturday" class="minwidth100" value="'.(!empty($conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY) ? $conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY : GETPOST("saturday", 'alpha')).'"></td></tr>'."\n";
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("Sunday"), $langs->trans("OpeningHoursFormatDesc")); print $form->textwithpicto($langs->trans("Sunday"), $langs->trans("OpeningHoursFormatDesc"));
print '</td><td>'; print '</td><td>';
print '<input name="sunday" id="sunday" class="minwidth100" value="'.($conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY ? $conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY : GETPOST("sunday", 'alpha')).'"></td></tr>'."\n"; print '<input name="sunday" id="sunday" class="minwidth100" value="'.(!empty($conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY) ? $conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY : GETPOST("sunday", 'alpha')).'"></td></tr>'."\n";
print '</table>'; print '</table>';

View File

@ -71,10 +71,10 @@ if ($action == "set")
if (! $res > 0) $error++; if (! $res > 0) $error++;
*/ */
} else $error++; } else $error++;
/* Moved to account
$res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_ICS", GETPOST("PAYMENTBYBANKTRANSFER_ICS"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_ICS", GETPOST("PAYMENTBYBANKTRANSFER_ICS"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!$res > 0) $error++;
*/
if (GETPOST("PAYMENTBYBANKTRANSFER_USER") > 0) if (GETPOST("PAYMENTBYBANKTRANSFER_USER") > 0)
{ {
$res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_USER", GETPOST("PAYMENTBYBANKTRANSFER_USER"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_USER", GETPOST("PAYMENTBYBANKTRANSFER_USER"), 'chaine', 0, '', $conf->entity);
@ -156,11 +156,13 @@ print '<td class="left">';
$form->select_comptes($conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT, 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT', 0, "courant=1", 1); $form->select_comptes($conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT, 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT', 0, "courant=1", 1);
print '</td></tr>'; print '</td></tr>';
/* Moved to bank account data
// ICS // ICS
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("ICS").'</td>'; print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("ICS").'</td>';
print '<td class="left">'; print '<td class="left">';
print '<input type="text" name="PAYMENTBYBANKTRANSFER_ICS" value="'.$conf->global->PAYMENTBYBANKTRANSFER_ICS.'" size="15" ></td>'; print '<input type="text" name="PAYMENTBYBANKTRANSFER_ICS" value="'.$conf->global->PAYMENTBYBANKTRANSFER_ICS.'" size="15" ></td>';
print '</td></tr>'; print '</td></tr>';
*/
//User //User
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("ResponsibleUser").'</td>'; print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("ResponsibleUser").'</td>';

View File

@ -161,7 +161,7 @@ print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder centpercent">'; print '<table summary="more" class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
$selected = $conf->global->MAIN_PDF_FORMAT; $selected = (isset($conf->global->MAIN_PDF_FORMAT) ? $conf->global->MAIN_PDF_FORMAT : '');
if (empty($selected)) $selected = dol_getDefaultFormat(); if (empty($selected)) $selected = dol_getDefaultFormat();
// Show pdf format // Show pdf format
@ -320,13 +320,13 @@ print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td>';
print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS); print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS : 0));
print '</td></tr>'; print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PDF_USE_ALSO_LANGUAGE_CODE").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("PDF_USE_ALSO_LANGUAGE_CODE").'</td><td>';
//if (! empty($conf->global->MAIN_MULTILANGS)) //if (! empty($conf->global->MAIN_MULTILANGS))
//{ //{
print $formadmin->select_language(GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : $conf->global->PDF_USE_ALSO_LANGUAGE_CODE, 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1); print $formadmin->select_language(GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) ? $conf->global->PDF_USE_ALSO_LANGUAGE_CODE : 0), 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1);
//} else { //} else {
// print '<span class="opacitymedium">'.$langs->trans("MultiLangNotEnabled").'</span>'; // print '<span class="opacitymedium">'.$langs->trans("MultiLangNotEnabled").'</span>';
//} //}

View File

@ -166,7 +166,7 @@ if ($result)
if (is_object($modules[$obj->module]) && ($modules[$obj->module]->module_position > 0)) if (is_object($modules[$obj->module]) && ($modules[$obj->module]->module_position > 0))
{ {
// TODO Define familyposition // TODO Define familyposition
$family = $modules[$obj->module]->family_position; $family = (!empty($modules[$obj->module]->family_position) ? $modules[$obj->module]->family_position : '');
$familyposition = 0; $familyposition = 0;
$sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."rights_def SET module_position = ".$modules[$obj->module]->module_position.","; $sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."rights_def SET module_position = ".$modules[$obj->module]->module_position.",";
$sqlupdate .= " family_position = ".$familyposition; $sqlupdate .= " family_position = ".$familyposition;
@ -214,7 +214,7 @@ if ($result)
print '</tr>'."\n"; print '</tr>'."\n";
} }
$perm_libelle = ($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $obj->label)); $perm_libelle = (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $obj->label));
print '<tr class="oddeven">'; print '<tr class="oddeven">';

View File

@ -39,6 +39,8 @@ if (!$user->admin) accessforbidden();
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$type = 'paymentorder'; $type = 'paymentorder';
$error = 0;
/* /*
* Actions * Actions
@ -72,31 +74,28 @@ if ($action == "set")
*/ */
} else $error++; } else $error++;
/* Moved to account
$res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!$res > 0) $error++;
*/
if (GETPOST("PRELEVEMENT_USER") > 0) if (GETPOST("PRELEVEMENT_USER") > 0) {
{
$res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!$res > 0) $error++;
} }
if (GETPOST("PRELEVEMENT_END_TO_END") || GETPOST("PRELEVEMENT_END_TO_END") == "") if (GETPOST("PRELEVEMENT_END_TO_END") || GETPOST("PRELEVEMENT_END_TO_END") == "") {
{
$res = dolibarr_set_const($db, "PRELEVEMENT_END_TO_END", GETPOST("PRELEVEMENT_END_TO_END"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PRELEVEMENT_END_TO_END", GETPOST("PRELEVEMENT_END_TO_END"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!$res > 0) $error++;
} }
if (GETPOST("PRELEVEMENT_USTRD") || GETPOST("PRELEVEMENT_USTRD") == "") if (GETPOST("PRELEVEMENT_USTRD") || GETPOST("PRELEVEMENT_USTRD") == "") {
{
$res = dolibarr_set_const($db, "PRELEVEMENT_USTRD", GETPOST("PRELEVEMENT_USTRD"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PRELEVEMENT_USTRD", GETPOST("PRELEVEMENT_USTRD"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!$res > 0) $error++;
} }
if (GETPOST("PRELEVEMENT_ADDDAYS") || GETPOST("PRELEVEMENT_ADDDAYS") == "") $res = dolibarr_set_const($db, "PRELEVEMENT_ADDDAYS", GETPOST("PRELEVEMENT_ADDDAYS"), 'chaine', 0, '', $conf->entity);
{ if (! ($res > 0)) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_ADDDAYS", GETPOST("PRELEVEMENT_ADDDAYS"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (! $error) {
} elseif (!$error)
{
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -149,13 +148,16 @@ print '<td class="titlefieldcreate">'.$langs->trans("Parameter").'</td>';
print '<td>'.$langs->trans("Value").'</td>'; print '<td>'.$langs->trans("Value").'</td>';
print "</tr>"; print "</tr>";
// Bank account (from Banks module) // Bank account (from Banks module)
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("BankToReceiveWithdraw").'</td>'; print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("BankToReceiveWithdraw").'</td>';
print '<td class="left">'; print '<td class="left">';
$form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT, 'PRELEVEMENT_ID_BANKACCOUNT', 0, "courant=1", 1); $form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT, 'PRELEVEMENT_ID_BANKACCOUNT', 0, "courant=1", 1);
print '</td></tr>'; print '</td></tr>';
/* Moved to bank account data
// ICS // ICS
print '<tr class="oddeven"><td class="fieldrequired">'; print '<tr class="oddeven"><td class="fieldrequired">';
$htmltext = $langs->trans("AskThisIDToYourBank"); $htmltext = $langs->trans("AskThisIDToYourBank");
print $form->textwithpicto($langs->trans("ICS"), $htmltext); print $form->textwithpicto($langs->trans("ICS"), $htmltext);
@ -164,6 +166,7 @@ print '<td class="left">';
print '<input type="text" name="PRELEVEMENT_ICS" value="'.$conf->global->PRELEVEMENT_ICS.'" size="15" >'; print '<input type="text" name="PRELEVEMENT_ICS" value="'.$conf->global->PRELEVEMENT_ICS.'" size="15" >';
print '</td>'; print '</td>';
print '</td></tr>'; print '</td></tr>';
*/
//User //User
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("ResponsibleUser").'</td>'; print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("ResponsibleUser").'</td>';
@ -193,9 +196,10 @@ print '</td></tr>';
//ADDDAYS //ADDDAYS
print '<tr class="oddeven"><td>'.$langs->trans("ADDDAYS").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("ADDDAYS").'</td>';
print '<td class="left">'; print '<td class="left">';
if (!$conf->global->PRELEVEMENT_ADDDAYS) $conf->global->PRELEVEMENT_ADDDAYS = 0; if (empty($conf->global->PRELEVEMENT_ADDDAYS)) $conf->global->PRELEVEMENT_ADDDAYS = 0;
print '<input type="text" name="PRELEVEMENT_ADDDAYS" value="'.$conf->global->PRELEVEMENT_ADDDAYS.'" size="5" ></td>'; print '<input type="text" name="PRELEVEMENT_ADDDAYS" value="'.$conf->global->PRELEVEMENT_ADDDAYS.'" size="5" ></td>';
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '<br>'; print '<br>';

View File

@ -155,7 +155,7 @@ print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_PROXY_USE").'</td><td class="right">'; print '<td>'.$langs->trans("MAIN_PROXY_USE").'</td><td class="right">';
print '</td>'; print '</td>';
print '<td class="nowrap">'; print '<td class="nowrap">';
print $form->selectyesno('MAIN_PROXY_USE', $conf->global->MAIN_PROXY_USE, 1); print $form->selectyesno('MAIN_PROXY_USE', (!empty($conf->global->MAIN_PROXY_USE) ? $conf->global->MAIN_PROXY_USE : 0), 1);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -164,7 +164,7 @@ print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_PROXY_HOST").'</td><td class="right">'; print '<td>'.$langs->trans("MAIN_PROXY_HOST").'</td><td class="right">';
print '</td>'; print '</td>';
print '<td class="nowrap">'; print '<td class="nowrap">';
print '<input class="flat" name="MAIN_PROXY_HOST" type="text" size="16" value="'.$conf->global->MAIN_PROXY_HOST.'">'; print '<input class="flat" name="MAIN_PROXY_HOST" type="text" size="16" value="'.(!empty($conf->global->MAIN_PROXY_HOST) ? $conf->global->MAIN_PROXY_HOST : '').'">';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -173,7 +173,7 @@ print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_PROXY_PORT").'</td><td class="right">'; print '<td>'.$langs->trans("MAIN_PROXY_PORT").'</td><td class="right">';
print '</td>'; print '</td>';
print '<td class="nowrap">'; print '<td class="nowrap">';
print '<input class="flat" name="MAIN_PROXY_PORT" type="text" size="4" value="'.$conf->global->MAIN_PROXY_PORT.'">'; print '<input class="flat" name="MAIN_PROXY_PORT" type="text" size="4" value="'.(!empty($conf->global->MAIN_PROXY_PORT) ? $conf->global->MAIN_PROXY_PORT : '').'">';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -182,7 +182,7 @@ print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_PROXY_USER").'</td><td class="right">'; print '<td>'.$langs->trans("MAIN_PROXY_USER").'</td><td class="right">';
print '</td>'; print '</td>';
print '<td class="nowrap">'; print '<td class="nowrap">';
print '<input class="flat" name="MAIN_PROXY_USER" type="text" size="16" value="'.$conf->global->MAIN_PROXY_USER.'">'; print '<input class="flat" name="MAIN_PROXY_USER" type="text" size="16" value="'.(!empty($conf->global->MAIN_PROXY_USER) ? $conf->global->MAIN_PROXY_USER : '').'">';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -191,7 +191,7 @@ print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_PROXY_PASS").'</td><td class="right">'; print '<td>'.$langs->trans("MAIN_PROXY_PASS").'</td><td class="right">';
print '</td>'; print '</td>';
print '<td class="nowrap">'; print '<td class="nowrap">';
print '<input class="flat" name="MAIN_PROXY_PASS" type="text" size="16" value="'.$conf->global->MAIN_PROXY_PASS.'">'; print '<input class="flat" name="MAIN_PROXY_PASS" type="text" size="16" value="'.(!empty($conf->global->MAIN_PROXY_PASS) ? $conf->global->MAIN_PROXY_PASS : '').'">';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -241,8 +241,8 @@ print '</tr>';
foreach ($arrayhandler as $key => $module) foreach ($arrayhandler as $key => $module)
{ {
// Show modules according to features level // Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if (!empty($module->version) && $module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; if (!empty($module->version) && $module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled()) if ($module->isEnabled())
{ {

View File

@ -116,7 +116,7 @@ print '</tr>';
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td colspan="2">'.$langs->trans("MaxSizeForUploadedFiles").'.'; print '<td colspan="2">'.$langs->trans("MaxSizeForUploadedFiles").'.';
$max = @ini_get('upload_max_filesize'); $max = @ini_get('upload_max_filesize');
if ($max) print ' '.$langs->trans("MustBeLowerThanPHPLimit", $max * 1024, $langs->trans("Kb")).'.'; if (isset($max)) print ' '.$langs->trans("MustBeLowerThanPHPLimit", ((int) $max) * 1024, $langs->trans("Kb")).'.';
else print ' '.$langs->trans("NoMaxSizeByPHPLimit").'.'; else print ' '.$langs->trans("NoMaxSizeByPHPLimit").'.';
print '</td>'; print '</td>';
print '<td class="nowrap">'; print '<td class="nowrap">';
@ -153,7 +153,7 @@ if (ini_get('safe_mode') && !empty($conf->global->MAIN_ANTIVIRUS_COMMAND))
dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING); dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING);
} }
} }
print '<input type="text" '.(defined('MAIN_ANTIVIRUS_COMMAND') ? 'disabled' : '').' name="MAIN_ANTIVIRUS_COMMAND" class="minwidth500imp" value="'.(!empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ?dol_escape_htmltag($conf->global->MAIN_ANTIVIRUS_COMMAND) : '').'">'; print '<input type="text" '.(defined('MAIN_ANTIVIRUS_COMMAND') ? 'disabled ' : '').'name="MAIN_ANTIVIRUS_COMMAND" class="minwidth500imp" value="'.(!empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ?dol_escape_htmltag($conf->global->MAIN_ANTIVIRUS_COMMAND) : '').'">';
if (defined('MAIN_ANTIVIRUS_COMMAND')) { if (defined('MAIN_ANTIVIRUS_COMMAND')) {
print '<br><span class="opacitymedium">'.$langs->trans("ValueIsForcedBySystem").'</span>'; print '<br><span class="opacitymedium">'.$langs->trans("ValueIsForcedBySystem").'</span>';
} }
@ -167,7 +167,7 @@ print '<td colspan="2">'.$langs->trans("AntiVirusParam").'<br>';
print '<span class="opacitymedium">'.$langs->trans("AntiVirusParamExample").'</span>'; print '<span class="opacitymedium">'.$langs->trans("AntiVirusParamExample").'</span>';
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print '<input type="text" name="MAIN_ANTIVIRUS_PARAM" class="minwidth500imp" value="'.(!empty($conf->global->MAIN_ANTIVIRUS_PARAM) ?dol_escape_htmltag($conf->global->MAIN_ANTIVIRUS_PARAM) : '').'">'; print '<input type="text" '.(defined('MAIN_ANTIVIRUS_PARAM') ? 'disabled ' : '').'name="MAIN_ANTIVIRUS_PARAM" class="minwidth500imp" value="'.(!empty($conf->global->MAIN_ANTIVIRUS_PARAM) ?dol_escape_htmltag($conf->global->MAIN_ANTIVIRUS_PARAM) : '').'">';
if (defined('MAIN_ANTIVIRUS_PARAM')) { if (defined('MAIN_ANTIVIRUS_PARAM')) {
print '<br><span class="opacitymedium">'.$langs->trans("ValueIsForcedBySystem").'</span>'; print '<br><span class="opacitymedium">'.$langs->trans("ValueIsForcedBySystem").'</span>';
} }

View File

@ -29,7 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("companies", "admin", "products", "sms", "other", "errors")); $langs->loadLangs(array("companies", "admin", "products", "sms", "other", "errors"));
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
if (!$user->admin) { if (!$user->admin) {
accessforbidden(); accessforbidden();
@ -43,8 +44,6 @@ $substitutionarrayfortest = array(
'__FIRSTNAME__' => 'TESTFirstname' '__FIRSTNAME__' => 'TESTFirstname'
); );
$action = GETPOST('action', 'aZ09');
/* /*
* Actions * Actions
@ -62,9 +61,7 @@ if ($action == 'update' && !$cancel) {
} }
/* // Send sms
* Send sms
*/
if ($action == 'send' && !$_POST['cancel']) { if ($action == 'send' && !$_POST['cancel']) {
$error = 0; $error = 0;
@ -135,6 +132,8 @@ if ($action == 'send' && !$_POST['cancel']) {
* View * View
*/ */
$form = new Form($db);
$linuxlike = 1; $linuxlike = 1;
if (preg_match('/^win/i', PHP_OS)) { if (preg_match('/^win/i', PHP_OS)) {
$linuxlike = 0; $linuxlike = 0;
@ -162,8 +161,6 @@ if (!count($listofmethods)) {
} }
if ($action == 'edit') { if ($action == 'edit') {
$form = new Form($db);
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
@ -274,30 +271,6 @@ if ($action == 'edit') {
} }
print '</div>'; print '</div>';
// Run the test to connect
/*
if ($_GET["action"] == 'testconnect')
{
print '<br>';
print load_fiche_titre($langs->trans("DoTestServerAvailability"));
// If we use SSL/TLS
if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $server='ssl://'.$server;
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mail = new CSMSFile('','','','');
$result=$mail->check_server_port($server,$port);
if ($result) print '<div class="ok">'.$langs->trans("ServerAvailableOnIPOrPort",$server,$port).'</div>';
else
{
print '<div class="error">'.$langs->trans("ServerNotAvailableOnIPOrPort",$server,$port);
if ($mail->error) print ' - '.$mail->error;
print '</div>';
}
print '<br>';
}*/
// Affichage formulaire de TEST simple // Affichage formulaire de TEST simple
if ($action == 'test') { if ($action == 'test') {
print '<br>'; print '<br>';
@ -308,12 +281,12 @@ if ($action == 'edit') {
$formsms = new FormSms($db); $formsms = new FormSms($db);
$formsms->fromtype = 'user'; $formsms->fromtype = 'user';
$formsms->fromid = $user->id; $formsms->fromid = $user->id;
$formsms->fromsms = (GETPOSTISSET('fromsms') ? $_POST['fromsms'] : ($conf->global->MAIN_MAIL_SMS_FROM ? $conf->global->MAIN_MAIL_SMS_FROM : $user->user_mobile)); $formsms->fromsms = (GETPOSTISSET('fromsms') ? GETPOST('fromsms') : ($conf->global->MAIN_MAIL_SMS_FROM ? $conf->global->MAIN_MAIL_SMS_FROM : $user->user_mobile));
$formsms->withfromreadonly = 0; $formsms->withfromreadonly = 0;
$formsms->withsubstit = 0; $formsms->withsubstit = 0;
$formsms->withfrom = 1; $formsms->withfrom = 1;
$formsms->withto = (GETPOSTISSET('sendto') ? $_POST['sendto'] : ($user->user_mobile ? $user->user_mobile : 1)); $formsms->withto = (GETPOSTISSET('sendto') ? GETPOST('sendto') : ($user->user_mobile ? $user->user_mobile : 1));
$formsms->withbody = (GETPOSTISSET('message') ? (empty($_POST['message']) ? 1 : $_POST['message']) : $langs->trans("ThisIsATestMessage")); $formsms->withbody = (GETPOSTISSET('message') ? (!GETPOST('message') ? 1 : GETPOST('message')) : $langs->trans("ThisIsATestMessage"));
$formsms->withbodyreadonly = 0; $formsms->withbodyreadonly = 0;
$formsms->withcancel = 1; $formsms->withcancel = 1;
// Tableau des substitutions // Tableau des substitutions

View File

@ -1,118 +0,0 @@
<?php
/* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/socialnetworks.php
* \ingroup socialnetworks
* \brief Page to setup the module Social Networks
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/mailmanspip.lib.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
// Load translation files required by the page
$langs->loadLangs(array("admin", "errors"));
if (!$user->admin) accessforbidden();
$type = array('yesno', 'texte', 'chaine');
$action = GETPOST('action', 'aZ09');
/*
* Action
*/
if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
{
$code = $reg[1];
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
} else {
dol_print_error($db);
}
}
if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg))
{
$code = $reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
} else {
dol_print_error($db);
}
}
/*
* View
*/
$help_url = '';
llxHeader('', $langs->trans("SocialNetworkSetup"), $help_url);
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("SocialNetworkSetup"), $linkback, 'title_setup');
//$head = socialnetworks_admin_prepare_head();
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/admin/socialnetworks.php';
$head[$h][1] = $langs->trans("Setup");
$head[$h][2] = 'setup';
$h++;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print dol_get_fiche_head($head, 'setup', '', 0, 'user');
print '<br>';
$arrayofsocialnetworks = array('jabber'=>'Jabber', 'skype'=>'Skype', 'twitter'=>'Twitter', 'facebook'=>'Facebook', 'linkedin'=>'LinkedIn');
foreach ($arrayofsocialnetworks as $snkey => $snlabel) {
$consttocheck = 'SOCIALNETWORKS_'.strtoupper($snkey);
if ($conf->use_javascript_ajax) {
$link = ajax_constantonoff($consttocheck);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
$link = $form->selectarray($consttocheck, $arrval, $conf->global->$consttocheck);
}
print $langs->trans('EnableFeatureFor', $snlabel).' '.$link.'<br><br>';
}
print dol_get_fiche_end();
print '</form>';
// End of page
llxFooter();
$db->close();

View File

@ -707,7 +707,15 @@ if (!empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) {
print "</td>\n"; print "</td>\n";
print "</tr>\n"; print "</tr>\n";
} }
print '<tr class="oddeven">';
print '<td>'.$langs->trans("WarehouseAskWarehouseDuringPropal").'</td>';
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL);
}
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("WarehouseAskWarehouseDuringOrder").'</td>'; print '<td>'.$langs->trans("WarehouseAskWarehouseDuringOrder").'</td>';
print '<td class="right">'; print '<td class="right">';

View File

@ -45,15 +45,15 @@ print load_fiche_titre($langs->trans("InfoDatabase"), '', 'title_setup');
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Database").'</td></tr>'."\n"; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Database").'</td></tr>'."\n";
print '<tr '.$bc[0].'><td width="300">'.$langs->trans("Version").'</td><td>'.$db::LABEL.' '.$db->getVersion().'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("Version").'</td><td>'.$db::LABEL.' '.$db->getVersion().'</td></tr>'."\n";
print '<tr '.$bc[1].'><td width="300">'.$langs->trans("DatabaseServer").'</td><td>'.$conf->db->host.'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("DatabaseServer").'</td><td>'.$conf->db->host.'</td></tr>'."\n";
print '<tr '.$bc[0].'><td width="300">'.$langs->trans("DatabasePort").'</td><td>'.(empty($conf->db->port) ? $langs->trans("Default") : $conf->db->port).'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("DatabasePort").'</td><td>'.(empty($conf->db->port) ? $langs->trans("Default") : $conf->db->port).'</td></tr>'."\n";
print '<tr '.$bc[1].'><td width="300">'.$langs->trans("DatabaseName").'</td><td>'.$conf->db->name.'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("DatabaseName").'</td><td>'.$conf->db->name.'</td></tr>'."\n";
print '<tr '.$bc[0].'><td width="300">'.$langs->trans("DriverType").'</td><td>'.$conf->db->type.($db->getDriverInfo() ? ' ('.$db->getDriverInfo().')' : '').'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("DriverType").'</td><td>'.$conf->db->type.($db->getDriverInfo() ? ' ('.$db->getDriverInfo().')' : '').'</td></tr>'."\n";
print '<tr '.$bc[1].'><td width="300">'.$langs->trans("User").'</td><td>'.$conf->db->user.'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("User").'</td><td>'.$conf->db->user.'</td></tr>'."\n";
print '<tr '.$bc[0].'><td width="300">'.$langs->trans("Password").'</td><td>'.preg_replace('/./i', '*', $dolibarr_main_db_pass).'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("Password").'</td><td>'.preg_replace('/./i', '*', $dolibarr_main_db_pass).'</td></tr>'."\n";
print '<tr '.$bc[1].'><td width="300">'.$langs->trans("DBStoringCharset").'</td><td>'.$db->getDefaultCharacterSetDatabase().'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("DBStoringCharset").'</td><td>'.$db->getDefaultCharacterSetDatabase().'</td></tr>'."\n";
print '<tr '.$bc[0].'><td width="300">'.$langs->trans("DBSortingCharset").'</td><td>'.$db->getDefaultCollationDatabase().'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("DBSortingCharset").'</td><td>'.$db->getDefaultCollationDatabase().'</td></tr>'."\n";
print '</table>'; print '</table>';
print '</div>'; print '</div>';
@ -62,7 +62,7 @@ print '<br>';
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Tables").'</td></tr>'."\n"; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Tables").'</td></tr>'."\n";
print '<tr '.$bc[0].'><td width="300"><a href="'.DOL_URL_ROOT.'/admin/system/database-tables.php?mainmenu=home">'.$langs->trans("List").'</a></td></tr>'."\n"; print '<tr class="oddeven"><td width="300"><a href="'.DOL_URL_ROOT.'/admin/system/database-tables.php?mainmenu=home">'.$langs->trans("List").'</a></td></tr>'."\n";
print '</table>'; print '</table>';
print '</div>'; print '</div>';
@ -104,7 +104,7 @@ if (!count($listofvars) && !count($listofstatus))
print '<td>'; print '<td>';
print $param; print $param;
print '</td>'; print '</td>';
print '<td>'; print '<td class="wordbreak">';
$show = 0; $text = ''; $show = 0; $text = '';
foreach ($arraytest as $key => $val) foreach ($arraytest as $key => $val)
{ {

View File

@ -224,7 +224,7 @@ if (($thousand != ',' && $thousand != '.') || ($thousand != ' '))
print '<tr class="oddeven"><td>&nbsp; => price(1234.56)</td><td>'.price(1234.56).'</td></tr>'."\n"; print '<tr class="oddeven"><td>&nbsp; => price(1234.56)</td><td>'.price(1234.56).'</td></tr>'."\n";
// Timezone // Timezone
$txt = $langs->trans("OSTZ").' (variable system TZ): '.(!empty($_ENV["TZ"]) ? $_ENV["TZ"] : $langs->trans("NotDefined")).'<br>'."\n"; $txt = $langs->trans("OSTZ").' (variable system TZ): '.(!empty($_ENV["TZ"]) ? $_ENV["TZ"] : $langs->trans("NotDefined")).'<br>'."\n";
$txt .= $langs->trans("PHPTZ").' (php.ini date.timezone): '.(ini_get("date.timezone") ?ini_get("date.timezone") : $langs->trans("NotDefined")).''."<br>\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php $txt .= $langs->trans("PHPTZ").' (date_default_timezone_get() / php.ini date.timezone): '.(getServerTimeZoneString()." / ".(ini_get("date.timezone") ? ini_get("date.timezone") : $langs->trans("NotDefined")))."<br>\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
$txt .= $langs->trans("Dolibarr constant MAIN_SERVER_TZ").': '.(empty($conf->global->MAIN_SERVER_TZ) ? $langs->trans("NotDefined") : $conf->global->MAIN_SERVER_TZ); $txt .= $langs->trans("Dolibarr constant MAIN_SERVER_TZ").': '.(empty($conf->global->MAIN_SERVER_TZ) ? $langs->trans("NotDefined") : $conf->global->MAIN_SERVER_TZ);
print '<tr class="oddeven"><td>'.$langs->trans("CurrentTimeZone").'</td><td>'; // Timezone server PHP print '<tr class="oddeven"><td>'.$langs->trans("CurrentTimeZone").'</td><td>'; // Timezone server PHP
$a = getServerTimeZoneInt('now'); $a = getServerTimeZoneInt('now');

View File

@ -264,7 +264,7 @@ if (!$error && $xml)
$out .= "</tr>\n"; $out .= "</tr>\n";
} }
} else { } else {
$out .= '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>'; $out .= '<tr class="oddeven"><td colspan="4" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
} }
$out .= '</table>'; $out .= '</table>';
$out .= '</div>'; $out .= '</div>';
@ -317,7 +317,7 @@ if (!$error && $xml)
$out .= '<td class="right"></td>'."\n"; $out .= '<td class="right"></td>'."\n";
$out .= "</tr>\n"; $out .= "</tr>\n";
} else { } else {
$out .= '<tr class="oddeven"><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>'; $out .= '<tr class="oddeven"><td colspan="7" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
} }
$out .= '</table>'; $out .= '</table>';
$out .= '</div>'; $out .= '</div>';
@ -370,12 +370,11 @@ if (!$error && $xml)
$out .= '<td class="right"></td>'."\n"; $out .= '<td class="right"></td>'."\n";
$out .= "</tr>\n"; $out .= "</tr>\n";
} else { } else {
$out .= '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>'; $out .= '<tr class="oddeven"><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
} }
$out .= '</table>'; $out .= '</table>';
$out .= '</div>'; $out .= '</div>';
// Show warning // Show warning
if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3)) if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3))
{ {

View File

@ -473,7 +473,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."product as p";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$limitforoptim = 10000; $limitforoptim = 100000;
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$nb = $obj->nb; $nb = $obj->nb;

View File

@ -51,15 +51,39 @@ if (isset($title))
// Check PHP setup is OK // Check PHP setup is OK
$maxphp = @ini_get('upload_max_filesize'); // In unknown $maxphp = @ini_get('upload_max_filesize'); // In unknown
if (preg_match('/k$/i', $maxphp)) $maxphp = $maxphp * 1; if (preg_match('/k$/i', $maxphp)) {
if (preg_match('/m$/i', $maxphp)) $maxphp = $maxphp * 1024; $maxphp = preg_replace('/k$/i', '', $maxphp);
if (preg_match('/g$/i', $maxphp)) $maxphp = $maxphp * 1024 * 1024; $maxphp = $maxphp * 1;
if (preg_match('/t$/i', $maxphp)) $maxphp = $maxphp * 1024 * 1024 * 1024; }
if (preg_match('/m$/i', $maxphp)) {
$maxphp = preg_replace('/m$/i', '', $maxphp);
$maxphp = $maxphp * 1024;
}
if (preg_match('/g$/i', $maxphp)) {
$maxphp = preg_replace('/g$/i', '', $maxphp);
$maxphp = $maxphp * 1024 * 1024;
}
if (preg_match('/t$/i', $maxphp)) {
$maxphp = preg_replace('/t$/i', '', $maxphp);
$maxphp = $maxphp * 1024 * 1024 * 1024;
}
$maxphp2 = @ini_get('post_max_size'); // In unknown $maxphp2 = @ini_get('post_max_size'); // In unknown
if (preg_match('/k$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1; if (preg_match('/k$/i', $maxphp2)) {
if (preg_match('/m$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1024; $maxphp2 = preg_replace('/k$/i', '', $maxphp2);
if (preg_match('/g$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1024 * 1024; $maxphp2 = $maxphp2 * 1;
if (preg_match('/t$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1024 * 1024 * 1024; }
if (preg_match('/m$/i', $maxphp2)) {
$maxphp2 = preg_replace('/m$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024;
}
if (preg_match('/g$/i', $maxphp2)) {
$maxphp2 = preg_replace('/g$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024 * 1024;
}
if (preg_match('/t$/i', $maxphp2)) {
$maxphp2 = preg_replace('/t$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
}
if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2) if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2)
{ {
$langs->load("errors"); $langs->load("errors");

View File

@ -44,10 +44,13 @@ $type = 'ticket';
$error = 0; $error = 0;
/* /*
* Actions * Actions
*/ */
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask') { if ($action == 'updateMask') {
$maskconstticket = GETPOST('maskconstticket', 'alpha'); $maskconstticket = GETPOST('maskconstticket', 'alpha');
$maskticket = GETPOST('maskticket', 'alpha'); $maskticket = GETPOST('maskticket', 'alpha');
@ -66,7 +69,37 @@ if ($action == 'updateMask') {
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} elseif ($action == 'setmod') { }
// Activate a model
elseif ($action == 'set') {
$ret = addDocumentModel($value, $type, $label, $scandir);
} elseif ($action == 'del') {
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->TICKET_ADDON_PDF == "$value") dolibarr_del_const($db, 'TICKET_ADDON_PDF', $conf->entity);
}
}
// Set default model
elseif ($action == 'setdoc') {
if (dolibarr_set_const($db, "TICKET_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity))
{
// The constant that was read before the new set
// We therefore requires a variable to have a coherent view
$conf->global->TICKET_ADDON_PDF = $value;
}
// On active le modele
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
}
elseif ($action == 'setmod') {
// TODO Verifier si module numerotation choisi peut etre active // TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated // par appel methode canBeActivated
@ -190,7 +223,7 @@ print dol_get_fiche_end();
/* /*
* Projects Numbering model * Tickets numbering model
*/ */
print load_fiche_titre($langs->trans("TicketNumberingModules"), '', ''); print load_fiche_titre($langs->trans("TicketNumberingModules"), '', '');
@ -291,6 +324,162 @@ print '</table>';
print '</div>'; print '</div>';
print '<br>'; print '<br>';
/*
* Document templates generators
*/
print load_fiche_titre($langs->trans("TicketsModelModule"), '', '');
// Load array def with activated templates
$def = array();
$sql = "SELECT nom";
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
$sql .= " WHERE type = '".$db->escape($type)."'";
$sql .= " AND entity = ".$conf->entity;
$resql = $db->query($sql);
if ($resql)
{
$i = 0;
$num_rows = $db->num_rows($resql);
while ($i < $num_rows)
{
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
} else {
dol_print_error($db);
}
print '<div class="div-table-responsive-no-min">';
print "<table class=\"noborder\" width=\"100%\">\n";
print "<tr class=\"liste_titre\">\n";
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
print "</tr>\n";
clearstatcache();
foreach ($dirmodels as $reldir)
{
foreach (array('', '/doc') as $valdir)
{
$realpath = $reldir."core/modules/ticket".$valdir;
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
if ($modulequalified)
{
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Default
print '<td class="center">';
if ($conf->global->TICKET_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
//$htmltooltip .= '<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
//$htmltooltip .= '<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
//$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
}
}
}
}
print '</table>';
print '</div><br>';
if (!$conf->use_javascript_ajax) { if (!$conf->use_javascript_ajax) {
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >'; print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';

View File

@ -92,7 +92,15 @@ $date_endday = $tmp['mday'];
$date_endmonth = $tmp['mon']; $date_endmonth = $tmp['mon'];
$date_endyear = $tmp['year']; $date_endyear = $tmp['year'];
$arrayfields = array(); // Add prefix session
$arrayfields = array(
'e.prefix_session' => array(
'label'=>'UserAgent',
'checked'=>(empty($conf->global->AUDIT_ENABLE_PREFIX_SESSION) ? 0 : 1),
'enabled'=>(empty($conf->global->AUDIT_ENABLE_PREFIX_SESSION) ? 0 : 1),
'position'=>110
)
);
/* /*
@ -211,7 +219,7 @@ if ($result)
if ($search_user) $param .= '&search_user='.urlencode($search_user); if ($search_user) $param .= '&search_user='.urlencode($search_user);
if ($search_desc) $param .= '&search_desc='.urlencode($search_desc); if ($search_desc) $param .= '&search_desc='.urlencode($search_desc);
if ($search_ua) $param .= '&search_ua='.urlencode($search_ua); if ($search_ua) $param .= '&search_ua='.urlencode($search_ua);
if ($search_prefix_sessiona) $param .= '&search_prefix_session='.urlencode($search_prefix_session); if ($search_prefix_session) $param .= '&search_prefix_session='.urlencode($search_prefix_session);
if ($date_startmonth) $param .= "&date_startmonth=".urlencode($date_startmonth); if ($date_startmonth) $param .= "&date_startmonth=".urlencode($date_startmonth);
if ($date_startday) $param .= "&date_startday=".urlencode($date_startday); if ($date_startday) $param .= "&date_startday=".urlencode($date_startday);
if ($date_startyear) $param .= "&date_startyear=".urlencode($date_startyear); if ($date_startyear) $param .= "&date_startyear=".urlencode($date_startyear);

View File

@ -91,7 +91,7 @@ print '<table class="border centpercent">';
print '<tr class="border"><td style="padding: 4px">'; print '<tr class="border"><td style="padding: 4px">';
if (!empty($conf->syslog->enabled)) { if (!empty($conf->syslog->enabled)) {
print '<input type="radio" name="choice" value="logfile"'; print '<input type="radio" name="choice" id="choicelogfile" value="logfile"';
print ($choice && $choice == 'logfile') ? ' checked' : ''; print ($choice && $choice == 'logfile') ? ' checked' : '';
$filelogparam = $filelog; $filelogparam = $filelog;
if ($user->admin && preg_match('/^dolibarr.*\.log$/', basename($filelog))) { if ($user->admin && preg_match('/^dolibarr.*\.log$/', basename($filelog))) {
@ -101,17 +101,17 @@ if (!empty($conf->syslog->enabled)) {
} }
$desc = $langs->trans("PurgeDeleteLogFile", '{filelogparam}'); $desc = $langs->trans("PurgeDeleteLogFile", '{filelogparam}');
$desc = str_replace('{filelogparam}', $filelogparam, $desc); $desc = str_replace('{filelogparam}', $filelogparam, $desc);
print '> '.$desc; print '> <label for="choicelogfile">'.$desc.'</label>';
print '<br><br>'; print '<br><br>';
} }
print '<input type="radio" name="choice" value="tempfiles"'; print '<input type="radio" name="choice" id="choicetempfiles" value="tempfiles"';
print (!$choice || $choice == 'tempfiles' || $choice == 'allfiles') ? ' checked' : ''; print (!$choice || $choice == 'tempfiles' || $choice == 'allfiles') ? ' checked' : '';
print '> '.$langs->trans("PurgeDeleteTemporaryFiles").'<br><br>'; print '> <label for="choicetempfiles">'.$langs->trans("PurgeDeleteTemporaryFiles").'</label><br><br>';
print '<input type="radio" name="choice" value="confirm_allfiles"'; print '<input type="radio" name="choice" id="choiceallfiles" value="confirm_allfiles"';
print ($choice && $choice == 'confirm_allfiles') ? ' checked' : ''; print ($choice && $choice == 'confirm_allfiles') ? ' checked' : '';
print '> '.$langs->trans("PurgeDeleteAllFilesInDocumentsDir", $dolibarr_main_data_root).'<br>'; print '> <label for="choiceallfiles">'.$langs->trans("PurgeDeleteAllFilesInDocumentsDir", $dolibarr_main_data_root).'</label><br>';
print '</td></tr></table>'; print '</td></tr></table>';

View File

@ -40,9 +40,9 @@ $transkey = GETPOST('transkey', 'alphanohtml');
$transvalue = GETPOST('transvalue', 'restricthtml'); $transvalue = GETPOST('transvalue', 'restricthtml');
$mode = GETPOST('mode', 'aZ09') ?GETPOST('mode', 'aZ09') : 'searchkey'; $mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'searchkey';
$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 = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@ -62,9 +62,9 @@ $hookmanager->initHooks(array('admintranslation', 'globaladmin'));
*/ */
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') && !empty($massaction) && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
$parameters = array('socid'=>$socid); $parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $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 ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -190,7 +190,7 @@ $formadmin = new FormAdmin($db);
$wikihelp = 'EN:Setup Translation|FR:Paramétrage traduction|ES:Configuración'; $wikihelp = 'EN:Setup Translation|FR:Paramétrage traduction|ES:Configuración';
llxHeader('', $langs->trans("Setup"), $wikihelp); llxHeader('', $langs->trans("Setup"), $wikihelp);
$param = '&mode='.$mode; $param = '&mode='.urlencode($mode);
$enabledisablehtml = ''; $enabledisablehtml = '';
$enabledisablehtml .= $langs->trans("EnableOverwriteTranslation").' '; $enabledisablehtml .= $langs->trans("EnableOverwriteTranslation").' ';
@ -217,14 +217,14 @@ print '<br>';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); if (isset($optioncss) && $optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
if ($langcode) $param .= '&langcode='.urlencode($langcode); if ($langcode) $param .= '&langcode='.urlencode($langcode);
if ($transkey) $param .= '&transkey='.urlencode($transkey); if ($transkey) $param .= '&transkey='.urlencode($transkey);
if ($transvalue) $param .= '&transvalue='.urlencode($transvalue); if ($transvalue) $param .= '&transvalue='.urlencode($transvalue);
print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && $debug) ? '?debug=1' : '').'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && !empty($debug)) ? '?debug=1' : '').'" method="POST">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if (isset($optioncss) && $optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
@ -246,7 +246,7 @@ if ($mode == 'overwrite')
print '<div class="justify"><span class="opacitymedium">'; print '<div class="justify"><span class="opacitymedium">';
print img_info().' '.$langs->trans("SomeTranslationAreUncomplete"); print img_info().' '.$langs->trans("SomeTranslationAreUncomplete");
$urlwikitranslatordoc = 'https://wiki.dolibarr.org/index.php/Translator_documentation'; $urlwikitranslatordoc = 'https://wiki.dolibarr.org/index.php/Translator_documentation';
print ' ('.$langs->trans("SeeAlso", '<a href="'.$urlwikitranslatordoc.'" target="_blank">'.$langs->trans("Here").'</a>').')<br>'; print ' ('.str_replace('{s1}', '<a href="'.$urlwikitranslatordoc.'" target="_blank">'.$langs->trans("Here").'</a>', $langs->trans("SeeAlso", '{s1}')).')<br>';
print $langs->trans("TranslationOverwriteDesc", $langs->transnoentitiesnoconv("Language"), $langs->transnoentitiesnoconv("Key"), $langs->transnoentitiesnoconv("NewTranslationStringToShow"))."\n"; print $langs->trans("TranslationOverwriteDesc", $langs->transnoentitiesnoconv("Language"), $langs->transnoentitiesnoconv("Key"), $langs->transnoentitiesnoconv("NewTranslationStringToShow"))."\n";
print ' ('.$langs->trans("TranslationOverwriteDesc2").').'."<br>\n"; print ' ('.$langs->trans("TranslationOverwriteDesc2").').'."<br>\n";
print '</span></div>'; print '</span></div>';
@ -338,16 +338,15 @@ if ($mode == 'overwrite')
print '</td>'; print '</td>';
print '<td class="center">'; print '<td class="center">';
if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int')) if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int')) {
{
print '<input type="hidden" class="button" name="rowid" value="'.$obj->rowid.'">'; print '<input type="hidden" class="button" name="rowid" value="'.$obj->rowid.'">';
print '<input type="submit" class="button buttongen button-save" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">'; print '<input type="submit" class="button buttongen button-save" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
print ' &nbsp; '; print ' &nbsp; ';
print '<input type="submit" class="button buttongen button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; print '<input type="submit" class="button buttongen button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
} else { } else {
print '<a class="reposition editfielda paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=edit'.((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>'; print '<a class="reposition editfielda paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.urlencode($mode).'&action=edit'.((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>';
print ' &nbsp; '; print ' &nbsp; ';
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>'; print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.urlencode($mode).'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
} }
print '</td>'; print '</td>';
@ -473,7 +472,7 @@ if ($mode == 'searchkey')
print '</td>'; print '</td>';
// Action column // Action column
print '<td class="nowrap right">'; print '<td class="nowrap right">';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); $searchpicto = $form->showFilterAndCheckAddButtons(!empty($massactionbutton) ? 1 : 0, 'checkforselect', 1);
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -493,14 +492,12 @@ if ($mode == 'searchkey')
print '<tr class="oddeven"><td>'.$langcode.'</td><td>'.$key.'</td><td>'; print '<tr class="oddeven"><td>'.$langcode.'</td><td>'.$key.'</td><td>';
print dol_escape_htmltag($val); print dol_escape_htmltag($val);
print '</td><td class="right nowraponall">'; print '</td><td class="right nowraponall">';
if (!empty($newlangfileonly->tab_translate[$key])) if (!empty($newlangfileonly->tab_translate[$key])) {
{ if ($val != $newlangfileonly->tab_translate[$key]) {
if ($val != $newlangfileonly->tab_translate[$key])
{
// retrieve rowid // retrieve rowid
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."overwrite_trans"; $sql .= " FROM ".MAIN_DB_PREFIX."overwrite_trans";
$sql .= " WHERE transkey = '".$key."'"; $sql .= " WHERE transkey = '".$db->escape($key)."'";
$sql .= " AND entity IN (".getEntity('overwrite_trans').")"; $sql .= " AND entity IN (".getEntity('overwrite_trans').")";
dol_syslog("translation::select from table", LOG_DEBUG); dol_syslog("translation::select from table", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
@ -508,16 +505,15 @@ if ($mode == 'searchkey')
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
} }
print '<a class="editfielda reposition paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&action=edit">'.img_edit().'</a>'; print '<a class="editfielda reposition marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&mode=overwrite&action=edit">'.img_edit().'</a>';
print ' '; print ' ';
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&action=delete&token='.newToken().'">'.img_delete().'</a>'; print '<a class="marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&mode='.urlencode($mode).'&action=delete&mode='.urlencode($mode).'&token='.newToken().'">'.img_delete().'</a>';
print '&nbsp;&nbsp;'; print '&nbsp;&nbsp;';
$htmltext = $langs->trans("OriginalValueWas", '<i>'.$newlangfileonly->tab_translate[$key].'</i>'); $htmltext = $langs->trans("OriginalValueWas", '<i>'.$newlangfileonly->tab_translate[$key].'</i>');
print $form->textwithpicto('', $htmltext, 1, 'info'); print $form->textwithpicto('', $htmltext, 1, 'info');
} elseif (!empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) } elseif (!empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) {
{
//print $key.'-'.$val; //print $key.'-'.$val;
print '<a class="reposition paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=overwrite&amp;langcode='.$langcode.'&amp;transkey='.$key.'">'.img_edit_add($langs->trans("Overwrite")).'</a>'; print '<a class="reposition paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=overwrite&langcode='.urlencode($langcode).'&transkey='.urlencode($key).'">'.img_edit_add($langs->trans("Overwrite")).'</a>';
} }
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) if (!empty($conf->global->MAIN_FEATURES_LEVEL))

View File

@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin", "workflow", "propal", "workflow", "orders", "supplier_proposal", "receptions", "errors")); $langs->loadLangs(array("admin", "workflow", "propal", "workflow", "orders", "supplier_proposal", "receptions", "errors", 'sendings'));
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
@ -130,6 +130,14 @@ $workflowcodes = array(
'enabled'=>(!empty($conf->reception->enabled) && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))), 'enabled'=>(!empty($conf->reception->enabled) && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))),
'picto'=>'bill' 'picto'=>'bill'
), ),
// Automatic classification shipping
'WORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE' => array(
'family' => 'classify_shipping',
'position' => 66,
'enabled' => ! empty($conf->expedition->enabled) && ! empty($conf->facture->enabled),
'picto' => 'shipment'
)
); );
if (!empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow'])) { if (!empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow'])) {
@ -190,6 +198,7 @@ foreach ($workflowcodes as $key => $params) {
if ($reg[1] == 'supplier_proposal') $header .= ' - '.$langs->trans('SupplierProposal'); if ($reg[1] == 'supplier_proposal') $header .= ' - '.$langs->trans('SupplierProposal');
if ($reg[1] == 'supplier_order') $header .= ' - '.$langs->trans('SupplierOrder'); if ($reg[1] == 'supplier_order') $header .= ' - '.$langs->trans('SupplierOrder');
if ($reg[1] == 'reception') $header .= ' - '.$langs->trans('Reception'); if ($reg[1] == 'reception') $header .= ' - '.$langs->trans('Reception');
if ($reg[1] == 'shipping') $header .= ' - '.$langs->trans('Shipment');
} else { } else {
$header = $langs->trans("Description"); $header = $langs->trans("Description");
} }

513
htdocs/admin/workstation.php Executable file
View File

@ -0,0 +1,513 @@
<?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2020 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file workstation/admin/setup.php
* \ingroup workstation
* \brief Workstation setup page.
*/
// Load Dolibarr environment
require "../main.inc.php";
// Libraries
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
require_once DOL_DOCUMENT_ROOT . '/workstation/lib/workstation.lib.php';
//require_once "../class/myclass.class.php";
// Translations
$langs->loadLangs(array("admin", "workstation@workstation"));
// Access control
if (!$user->admin) accessforbidden();
// Parameters
$action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$value = GETPOST('value', 'alpha');
/*$arrayofparameters = array(
'WORKSTATION_MYPARAM1'=>array('css'=>'minwidth200', 'enabled'=>1),
'WORKSTATION_MYPARAM2'=>array('css'=>'minwidth500', 'enabled'=>1)
);*/
$error = 0;
$setupnotempty = 0;
/*
* Actions
*/
if ((float) DOL_VERSION >= 6)
{
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
}
if ($action == 'updateMask')
{
$maskconstorder = GETPOST('maskconstWorkstation', 'alpha');
$maskorder = GETPOST('maskWorkstation', 'alpha');
if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'specimen')
{
$modele = GETPOST('module', 'alpha');
$tmpobjectkey = GETPOST('object');
$tmpobject = new $tmpobjectkey($db);
$tmpobject->initAsSpecimen();
// Search template files
$file = ''; $classname = ''; $filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir)
{
$file = dol_buildpath($reldir."core/modules/workstation/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file))
{
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound)
{
require_once $file;
$module = new $classname($db);
if ($module->write_file($tmpobject, $langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
}
// Activate a model
elseif ($action == 'set')
{
$ret = addDocumentModel($value, $type, $label, $scandir);
} elseif ($action == 'del')
{
$tmpobjectkey = GETPOST('object');
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
$constforval = strtoupper($tmpobjectkey).'_ADDON_PDF';
if ($conf->global->$constforval == "$value") dolibarr_del_const($db, $constforval, $conf->entity);
}
}
// Set default model
elseif ($action == 'setdoc')
{
$tmpobjectkey = GETPOST('object');
$constforval = strtoupper($tmpobjectkey).'_ADDON_PDF';
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity))
{
// The constant that was read before the new set
// We therefore requires a variable to have a coherent view
$conf->global->$constforval = $value;
}
// On active le modele
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
} elseif ($action == 'setmod')
{
// TODO Check if numbering module chosen can be activated
// by calling method canBeActivated
$tmpobjectkey = GETPOST('object');
$constforval = 'WORKSTATION_'.strtoupper($tmpobjectkey)."_ADDON";
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
}
/*
* View
*/
$form = new Form($db);
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
$page_name = "WorkstationSetup";
llxHeader('', $langs->trans($page_name));
// Subheader
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans($page_name), $linkback, 'object_workstation@workstation');
// Configuration header
$head = workstationAdminPrepareHead();
print dol_get_fiche_head($head, 'settings', '', -1, "workstation@workstation");
// Setup page goes here
//echo '<span class="opacitymedium">'.$langs->trans("WorkstationSetupPage").'</span><br><br>';
if ($action == 'edit')
{
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $key => $val)
{
print '<tr class="oddeven"><td>';
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
print $form->textwithpicto($langs->trans($key), $tooltiphelp);
print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->$key.'"></td></tr>';
}
print '</table>';
print '<br><div class="center">';
print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">';
print '</div>';
print '</form>';
print '<br>';
} else {
if (!empty($arrayofparameters))
{
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $key => $val)
{
$setupnotempty++;
print '<tr class="oddeven"><td>';
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
print $form->textwithpicto($langs->trans($key), $tooltiphelp);
print '</td><td>'.$conf->global->$key.'</td></tr>';
}
print '</table>';
print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
print '</div>';
}/* else {
print '<br>'.$langs->trans("NothingToSetup");
}*/
}
$moduledir = 'workstation';
$myTmpObjects = array();
$myTmpObjects['workstation'] = array('includerefgeneration'=>1, 'includedocgeneration'=>0);
foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
if ($myTmpObjectKey == 'MyObject') continue;
if ($myTmpObjectArray['includerefgeneration']) {
/*
* Orders Numbering model
*/
$setupnotempty++;
print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', '');
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td class="nowrap">'.$langs->trans("Example").'</td>';
print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
print '</tr>'."\n";
clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/".$moduledir);
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php')
{
$file = substr($file, 0, dol_strlen($file) - 4);
require_once $dir.'/'.$file.'.php';
$module = new $file($db);
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
{
dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info();
print '</td>';
// Show example of numbering model
print '<td class="nowrap">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td class="center">';
$constforvar = 'WORKSTATION_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $file)
{
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>';
}
print '</td>';
$mytmpinstance = new $myTmpObjectKey($db);
$mytmpinstance->initAsSpecimen();
// Info
$htmltooltip = '';
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval = $module->getNextValue($mytmpinstance);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print "</tr>\n";
}
}
}
closedir($handle);
}
}
}
print "</table><br>\n";
}
if ($myTmpObjectArray['includedocgeneration']) {
/*
* Document templates generators
*/
$setupnotempty++;
$type = strtolower($myTmpObjectKey);
print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', '');
// Load array def with activated templates
$def = array();
$sql = "SELECT nom";
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
$sql .= " WHERE type = '".$db->escape($type)."'";
$sql .= " AND entity = ".$conf->entity;
$resql = $db->query($sql);
if ($resql)
{
$i = 0;
$num_rows = $db->num_rows($resql);
while ($i < $num_rows)
{
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
} else {
dol_print_error($db);
}
print "<table class=\"noborder\" width=\"100%\">\n";
print "<tr class=\"liste_titre\">\n";
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
print "</tr>\n";
clearstatcache();
foreach ($dirmodels as $reldir)
{
foreach (array('', '/doc') as $valdir)
{
$realpath = $reldir."core/modules/".$moduledir.$valdir;
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
if ($modulequalified)
{
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;token='.newToken().'&amp;value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Default
print '<td class="center">';
$constforvar = 'WORKSTATION_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $name)
{
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&object='.$myTmpObjectKey.'">'.img_object($langs->trans("Preview"), 'generic').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
}
}
}
}
print '</table>';
}
}
/*if (empty($setupnotempty)) {
print '<br>'.$langs->trans("NothingToSetup");
}*/
// Page end
print dol_get_fiche_end();
llxFooter();
$db->close();

View File

@ -167,7 +167,13 @@ class DolibarrApi
unset($object->libelle_statut); unset($object->libelle_statut);
unset($object->libelle_paiement); unset($object->libelle_paiement);
if ($object->table_element != 'ticket') { unset($object->prefix_comm);
unset($object->sendtoid);
unset($object->name_bis);
unset($object->newref);
if (!isset($object->table_element) || $object->table_element != 'ticket') {
unset($object->comments); unset($object->comments);
} }

View File

@ -535,13 +535,14 @@ class Documents extends DolibarrApi
* Test sample for supplier invoice: { "filename": "mynewfile.txt", "modulepart": "supplier_invoice", "ref": "FA1701-001", "subdir": "", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }. * Test sample for supplier invoice: { "filename": "mynewfile.txt", "modulepart": "supplier_invoice", "ref": "FA1701-001", "subdir": "", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }.
* Test sample for medias file: { "filename": "mynewfile.txt", "modulepart": "medias", "ref": "", "subdir": "image/mywebsite", "filecontent": "Y29udGVudCB0ZXh0Cg==", "fileencoding": "base64", "overwriteifexists": "0" }. * Test sample for medias file: { "filename": "mynewfile.txt", "modulepart": "medias", "ref": "", "subdir": "image/mywebsite", "filecontent": "Y29udGVudCB0ZXh0Cg==", "fileencoding": "base64", "overwriteifexists": "0" }.
* *
* @param string $filename Name of file to create ('FA1705-0123.txt') * @param string $filename Name of file to create ('FA1705-0123.txt')
* @param string $modulepart Name of module or area concerned by file upload ('facture', 'project', 'project_task', ...) * @param string $modulepart Name of module or area concerned by file upload ('facture', 'project', 'project_task', ...)
* @param string $ref Reference of object (This will define subdir automatically and store submited file into it) * @param string $ref Reference of object (This will define subdir automatically and store submited file into it)
* @param string $subdir Subdirectory (Only if ref not provided) * @param string $subdir Subdirectory (Only if ref not provided)
* @param string $filecontent File content (string with file content. An empty file will be created if this parameter is not provided) * @param string $filecontent File content (string with file content. An empty file will be created if this parameter is not provided)
* @param string $fileencoding File encoding (''=no encoding, 'base64'=Base 64) * @param string $fileencoding File encoding (''=no encoding, 'base64'=Base 64)
* @param int $overwriteifexists Overwrite file if exists (1 by default) * @param int $overwriteifexists Overwrite file if exists (1 by default)
* @param int $createdirifnotexists Create subdirectories if the doesn't exists (1 by default)
* @return string * @return string
* *
* @throws RestException 400 * @throws RestException 400
@ -551,7 +552,7 @@ class Documents extends DolibarrApi
* *
* @url POST /upload * @url POST /upload
*/ */
public function post($filename, $modulepart, $ref = '', $subdir = '', $filecontent = '', $fileencoding = '', $overwriteifexists = 0) public function post($filename, $modulepart, $ref = '', $subdir = '', $filecontent = '', $fileencoding = '', $overwriteifexists = 0, $createdirifnotexists = 1)
{ {
global $db, $conf; global $db, $conf;
@ -578,6 +579,8 @@ class Documents extends DolibarrApi
// Define $uploadir // Define $uploadir
$object = null; $object = null;
$entity = DolibarrApiAccess::$user->entity; $entity = DolibarrApiAccess::$user->entity;
if (empty($entity)) $entity = 1;
if ($ref) if ($ref)
{ {
$tmpreldir = ''; $tmpreldir = '';
@ -663,8 +666,7 @@ class Documents extends DolibarrApi
} }
} }
if (!($object->id > 0)) if (!($object->id > 0)) {
{
throw new RestException(404, 'The object '.$modulepart." with ref '".$ref."' was not found."); throw new RestException(404, 'The object '.$modulepart." with ref '".$ref."' was not found.");
} }
@ -681,29 +683,32 @@ class Documents extends DolibarrApi
if (empty($upload_dir) || $upload_dir == '/') if (empty($upload_dir) || $upload_dir == '/')
{ {
throw new RestException(500, 'This value of modulepart does not support yet usage of ref. Check modulepart parameter or try to use subdir parameter instead of ref.'); throw new RestException(500, 'This value of modulepart ('.$modulepart.') does not support yet usage of ref. Check modulepart parameter or try to use subdir parameter instead of ref.');
} }
} else { } else {
if ($modulepart == 'invoice') $modulepart = 'facture'; if ($modulepart == 'invoice') $modulepart = 'facture';
if ($modulepart == 'member') $modulepart = 'adherent'; if ($modulepart == 'member') $modulepart = 'adherent';
$relativefile = $subdir; $relativefile = $subdir;
$tmp = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, '', 'write'); $tmp = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, '', 'write');
$upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir $upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir
if (empty($upload_dir) || $upload_dir == '/') if (empty($upload_dir) || $upload_dir == '/') {
{ if (!empty($tmp['error'])) {
throw new RestException(500, 'This value of modulepart does not support yet usage of ref. Check modulepart parameter or try to use subdir parameter instead of ref.'); throw new RestException(401, 'Error returned by dol_check_secure_access_document: '.$tmp['error']);
} else {
throw new RestException(500, 'This value of modulepart ('.$modulepart.') is not allowed with this value of subdir ('.$relativefile.')');
}
} }
} }
// $original_file here is still value of filename without any dir. // $original_file here is still value of filename without any dir.
$upload_dir = dol_sanitizePathName($upload_dir); $upload_dir = dol_sanitizePathName($upload_dir);
if (dol_mkdir($upload_dir) < 0) // needed by products if (!empty($createdirifnotexists)) {
{ if (dol_mkdir($upload_dir) < 0) { // needed by products
throw new RestException(500, 'Error while trying to create directory.'); throw new RestException(500, 'Error while trying to create directory '.$upload_dir);
}
} }
$destfile = $upload_dir.'/'.$original_file; $destfile = $upload_dir.'/'.$original_file;
@ -715,8 +720,7 @@ class Documents extends DolibarrApi
throw new RestException(401, 'Directory not exists : '.dirname($destfile)); throw new RestException(401, 'Directory not exists : '.dirname($destfile));
} }
if (!$overwriteifexists && dol_is_file($destfile)) if (!$overwriteifexists && dol_is_file($destfile)) {
{
throw new RestException(500, "File with name '".$original_file."' already exists."); throw new RestException(500, "File with name '".$original_file."' already exists.");
} }

View File

@ -48,8 +48,8 @@ class Login
* @param int $reset Reset token (0=get current token, 1=ask a new token and canceled old token. This means access using current existing API token of user will fails: new token will be required for new access) * @param int $reset Reset token (0=get current token, 1=ask a new token and canceled old token. This means access using current existing API token of user will fails: new token will be required for new access)
* @return array Response status and user token * @return array Response status and user token
* *
* @throws RestException 403 * @throws RestException 403 Access denied
* @throws RestException 500 * @throws RestException 500 System error
* *
* @url GET / * @url GET /
* @url POST / * @url POST /
@ -109,7 +109,7 @@ class Login
} }
// Generate token for user // Generate token for user
$token = dol_hash($login.uniqid().$conf->global->MAIN_API_KEY, 1); $token = dol_hash($login.uniqid().(empty($conf->global->MAIN_API_KEY)?'':$conf->global->MAIN_API_KEY), 1);
// We store API token into database // We store API token into database
$sql = "UPDATE ".MAIN_DB_PREFIX."user"; $sql = "UPDATE ".MAIN_DB_PREFIX."user";
@ -132,7 +132,7 @@ class Login
'code' => 200, 'code' => 200,
'token' => $token, 'token' => $token,
'entity' => $tmpuser->entity, 'entity' => $tmpuser->entity,
'message' => 'Welcome '.$login.($reset ? ' - Token is new' : ' - This is your token (generated by a previous call). You can use it to make any REST API call, or enter it into the DOLAPIKEY field to use the Dolibarr API explorer.') 'message' => 'Welcome '.$login.($reset ? ' - Token is new' : ' - This is your token (recorded for your user). You can use it to make any REST API call, or enter it into the DOLAPIKEY field to use the Dolibarr API explorer.')
) )
); );
} }

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