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

This commit is contained in:
Marc de Lima Lucio 2021-01-05 16:01:31 +01:00
commit f03f5701f6
3700 changed files with 186521 additions and 270493 deletions

View File

@ -4,13 +4,14 @@ How to contribute to Dolibarr
Bug reports and feature requests
--------------------------------
<a name="not-a-support-forum"></a>*Note*: Issues are not a support forum. If you need help using the software, please use [the forums](https://www.dolibarr.org/forum).
<a name="not-a-support-forum"></a>*Note*: Issues are not a support forum. If you need help using the software, please use [the forums](https://www.dolibarr.org/forum.php). Forums exist in different languages.
Issues are managed on [GitHub](https://github.com/Dolibarr/dolibarr/issues).
Issues are managed on [GitHub](https://github.com/Dolibarr/dolibarr/issues).
Default language here is english. So please prepare your contributions in english.
1. Please [use the search engine](https://help.github.com/articles/searching-issues) to check if nobody's already reported your problem.
2. [Create an issue](https://help.github.com/articles/creating-an-issue). Choose an appropriate title. Prepend appropriately with Bug or Feature Request.
4. Tell us the version you are using!
4. Tell us the version you are using! (look at /htdocs/admin/system/dolibarr.php? and check if you are using the latest version)
3. Write a report with as much detail as possible (Use [screenshots](https://help.github.com/articles/issue-attachments) or even screencasts and provide logging and debugging informations whenever possible).
@ -26,7 +27,8 @@ Issues are managed on [GitHub](https://github.com/Dolibarr/dolibarr/issues).
4. Commit and push your changes.
5. [Make a pull request](https://help.github.com/articles/creating-a-pull-request).
### <a name="branches"></a>Branches
<span id="branches" name="branches"></span>
### Branches
Unless you're fixing a bug, all pull requests should be made against the *develop* branch.

View File

@ -13,5 +13,5 @@ jobs:
- name: Exakat
uses: docker://exakat/exakat-ga
with:
ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/WrongNumberOfArguments,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/RepeatedPrint,Structures/UselessParenthesis,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UseConstant'
ignore_dirs: '/htdocs/includes,/htdocs/build,/htdocs/dev,/htdocs/doc,/htdocs/scripts,/htdocs/test'
ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/UndefinedFunctions,Functions/WrongNumberOfArguments,Functions/WrongTypeWithCall,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Php/WrongTypeForNativeFunction,Structures/AddZero,Structures/DropElseAfterReturn,Structures/IfWithSameConditions,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/ExitUsage,Structures/RepeatedPrint,Structures/RepeatedRegex,Structures/SameConditions,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UselessParenthesis,Structures/UseConstant'
ignore_dirs: '/htdocs/includes,/build,/dev,/doc,/scripts,/test'

View File

@ -17,8 +17,10 @@ filter:
- build/*
- dev/*
- doc/*
- test/*
- documents/*
- htdocs/includes/*
- node_modules/*
- test/*
paths:
- htdocs/*
- scripts/*

View File

@ -6,8 +6,6 @@
os: linux
dist: xenial
#dist: bionic
# Deprecated: The key sudo has no effect anymore.
#sudo: required
language: php
@ -33,53 +31,28 @@ addons:
# We need pgloader for import mysql database into pgsql
- pgloader
php:
- '5.6'
- '7.0'
- '7.1'
- '7.2'
- '7.3'
- '7.4'
- nightly
env:
global:
# Set to true for very verbose output
- DEBUG=false
jobs:
# MariaDB overrides MySQL installation so it's not possible to test both yet
#- DB=mariadb
- DB=mysql
- DB=postgresql
# See https://docs.travis-ci.com/user/languages/php/#Apache-%2B-PHP
#- WS=apache
# See https://github.com/DracoBlue/travis-ci-nginx-php-fpm-test
#- WS=nginx
jobs:
fast_finish: true
allow_failures:
- php: nightly
# We exclude some combinations not usefull to save Travis CPU
exclude:
- php: '7.0'
env: DB=mysql
- php: '7.1'
env: DB=mysql
- php: '7.2'
env: DB=mysql
- php: '7.3'
env: DB=mysql
- php: '7.0'
env: DB=postgresql
- php: '7.1'
env: DB=postgresql
- php: '7.2'
env: DB=postgresql
- php: '7.3'
env: DB=postgresql
- php: nightly
env: DB=postgresql
include:
- if: type = push
php: '5.6'
env: DB=postgresql
- if: type = pull_request OR type = push
php: '7.4'
env: DB=mysql
- if: type = push AND branch = develop
php: nightly
env: DB=mysql
- if: type = push AND branch = 14.0
php: nightly
env: DB=mysql
notifications:
email:
@ -112,33 +85,48 @@ install:
echo "Updating Composer"
rm $TRAVIS_BUILD_DIR/composer.json
rm $TRAVIS_BUILD_DIR/composer.lock
composer -V
composer self-update
# To have composer making parallel downloads
composer global require hirak/prestissimo
composer -n init
composer -n config vendor-dir htdocs/includes
composer -n config -g vendor-dir htdocs/includes
echo
- |
echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer - for $TRAVIS_PHP_VERSION"
if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] \
[ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ]; then
if [ "$TRAVIS_PHP_VERSION" = '5.6' ]; then
composer -n require phpunit/phpunit ^5 \
php-parallel-lint/php-parallel-lint ^1 \
php-parallel-lint/php-console-highlighter ^0 \
squizlabs/php_codesniffer ^3
fi
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then
composer -n require phpunit/phpunit ^6 \
php-parallel-lint/php-parallel-lint ^1 \
php-parallel-lint/php-console-highlighter ^0 \
squizlabs/php_codesniffer ^3
fi
if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ]; then
composer -n require phpunit/phpunit ^7 \
php-parallel-lint/php-parallel-lint ^1.2 \
php-parallel-lint/php-console-highlighter ^0 \
squizlabs/php_codesniffer ^3
fi
# phpunit 9 is required for php 8
if [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
composer -n require --ignore-platform-reqs phpunit/phpunit ^5 \
composer -n require --ignore-platform-reqs phpunit/phpunit ^7 \
php-parallel-lint/php-parallel-lint ^1.2 \
php-parallel-lint/php-console-highlighter ^0 \
squizlabs/php_codesniffer ^3
fi
fi
echo
- |
echo "Adding path of binaries tools installed by composer to the PATH"
export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH"
echo $PATH
ls $TRAVIS_BUILD_DIR/vendor
ls $TRAVIS_BUILD_DIR/htdocs/includes/bin
echo
@ -165,15 +153,20 @@ before_script:
- |
echo "Versions information"
echo
# Check PHP
echo "PHP version"
php -i | head -
# Check PHP CodeSniffer installation
# Check Parallel-lint version
echo "Parallel-lint version"
which parallel-lint
parallel-lint -V
# Check PHP CodeSniffer version
echo "PHPCS version"
which phpcs
phpcs --version | head -
phpcs -i | head -
# Check PHPUnit installation
# Check PHPUnit version
echo "PHPUnit version"
which phpunit
phpunit --version | head -
@ -278,8 +271,8 @@ script:
# Ensure we catch errors
set -e
#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 \
--exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \
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/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/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --blame .
@ -287,12 +280,13 @@ script:
echo
- |
echo "Checking coding style (excluding Pull Requests builds)"
echo "Checking coding style (excluding Pull Requests builds to not overload travis, excluding also some jobs to avoid duplicate tests)"
# Ensure we catch errors
set -e
# Exclusions are defined in the ruleset.xml file
#phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4" ] && [ "$DB" = "mysql" ]; then
phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .;
fi
set +e
echo
@ -407,9 +401,14 @@ script:
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 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
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKETSUP,MAIN_MODULE_ACCOUNTING > $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 $?
cd -
set +e

View File

@ -21,24 +21,24 @@ Mobiledetect 2.8.34 MIT License Yes
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
ParseDown 1.6 MIT License Yes Markdown parser
PCLZip 2.8.4 LGPL-3+ Yes Library to zip/unzip files
PHPDebugBar 1.15.1 MIT License Yes Used only by the module "debugbar" for developers
PHPExcel 1.8.1 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
PHPSpreadSheet ? LGPL-2.1+ Yes Read/Write XLS files, read ODS files
php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
PSR/Logs 1.0 Library for logs (used by DebugBar)
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
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
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
JS libraries:
Ace 1.4.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
ChartJS 2.9.3 MIT License Yes JS library for graph
ChartJS 2.9.4 MIT License Yes JS library for graph
jQuery 3.5.1 MIT License Yes JS library
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css
@ -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 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
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
SwaggerUI 2.0.24 GPL-2+ Yes JS library to offer the REST API explorer

436
ChangeLog
View File

@ -4,152 +4,129 @@ English Dolibarr ChangeLog
***** ChangeLog for 13.0.0 compared to 12.0.0 *****
For users:
----------
NEW: Add module "Credit transfer SEPA" to manage payment of vendors using bank credit transfer SEPA files.
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: Several security issues after a private bug bounty campaign.
NEW: #15065 Fix formatting
NEW: #15065 Put the product label in bold in the PDF templates if configured
NEW: Accountancy - Add chart of sub accounts
NEW: Accountancy - Add options to disable binding on sales, purchases & expense reports independently of the modules
NEW: Accountancy balance - Add a input to show subtotal by group
NEW: Accountancy - Move to real ledger, real journals, menu disposition
NEW: Accountancy - On transfers, select the periodicity by default
NEW: Add 2 rules for emailcollector: Message send/not sent from Dolibarr
NEW: Add a counter of number of words of pages in website module
NEW: add alert before change thirdparty in takepos
NEW: Add a page to list Stock at a given date.
NEW: Add a start date to begin binding in accountancy
NEW: Add a stat page to list popularity of products on invoices
NEW: Add calendar selection for agenda view
NEW: add class for ticket edition (pdf or odt)
NEW: Add column payment term into list of supplier invoices.
NEW: Add column quantity in product margin page
NEW: Add column vat rate in page to define accounting account on product/service
NEW: Add common list function for available app/module page
NEW: Accountancy - add chart of sub accounts
NEW: Accountancy - add options to disable binding on sales, purchases & expense reports independently of the modules
NEW: Accountancy balance - add a menu entry to show subtotal by group
NEW: Accountancy - change menu disposition
NEW: Accountancy - on transfers, select the periodicity by default
NEW: Accountancy - Add export for Gestinum (v3 & v5)
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 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 alert before changing thirdparty in TakePOS
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 statistics page to list popularity of products on invoices
NEW: add calendar selection for agenda view
NEW: Support documents generation for ticket edition (PDF or ODT)
NEW: add column payment term into list of supplier invoices
NEW: add column quantity in product margin page
NEW: add column vat rate in page to define accounting account on product/service
NEW: add costprice in fields of products list
NEW: ADDED IMPORT TOOL FOR CUSTOMER ORDER, PO, PROPOSAL MODULE, SUPPLIER INVOICE
NEW: Added incoterms to substitution array
NEW: Add employee in expense report binding page
NEW: Add export for various payment
NEW: add extra fields labels and values in mail on create ticket
NEW: Add extrafields support on ECM module
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 formConfirm hook on product page
NEW: add an import profile for CUSTOMER ORDER, PO, PROPOSAL MODULE, SUPPLIER INVOICE
NEW: add employee link in expense report binding page
NEW: add EORI No. as ProfID5
NEW: add export for various payments
NEW: add Extrafields labels and values in mail on create ticket
NEW: add Extrafields support on ECM module
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 free text on each terminal of cash desk
NEW: Add function dolButtonToOpenUrlInDialogPopup() to be able to open
NEW: Add global search for customer payments and vendor payments
NEW: Add global search for miscellaneous payments
NEW: Add helper function for table headers with numbers
NEW: add hooks on stats pages
NEW: Add link to edit property from search result of website pages
NEW: Add link to reset qty on supplier dispatch page
NEW: add MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER const to remove header in email collector
NEW: Add Manufacturing Orders into the automatic ECM
NEW: add global search for customer payments and vendor payments
NEW: add global search for miscellaneous payments
NEW: add helper function for table headers with numbers
NEW: add link to edit property from the search result of website pages
NEW: add link to reset qty on supplier dispatch page
NEW: add MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER const to remove header stored by email collector
NEW: add Manufacturing Orders attached files into the automatic ECM view
NEW: add margin info in invoice list
NEW: Add mass action to set category on a list of website pages.
NEW: Add mass deletion for events
NEW: Add __MEMBER_TYPE__ substitution key
NEW: Add message in error_log after detection of SQL or script injection
NEW: Add module Credit transfer SEPA to manage payment of supplier using
NEW: Add more filters on monthly statement list
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 include products without alert in replenish
NEW: add mass action to set category on a list of website pages
NEW: add mass deletion for events
NEW: add mass deletion for draft invoices
NEW: add more filters on monthly statement list
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 include products without alert in replenish
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 property cssview when declaring fields of an object
NEW: Add prospect status managment for the contact with managment of custom icon
NEW: Add public note on products. This also partially fix the #14342
NEW: Add quick dropdown menu in top right menu (MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN)
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 public note on products ; this also partially fix the #14342
NEW: add quick dropdown menu in top right menu (experimental with MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN)
NEW: add region in export companies and contacts
NEW: add rights on margin info on invoice list
NEW: Add search param for close date on order list
NEW: add send context for ticket
NEW: Add show preview for mail attachement on form mail
NEW: add state origin for product
NEW: add search param for close date on order list
NEW: add show preview for mail attachement on form mail
NEW: add State/Province origin for products
NEW: Add the workflow interaction close intervention on closing ticket
NEW: Add third order printer to TakePOS
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 two hooks printFieldListFrom and printFieldSearchParam
NEW: Add __TYPE__ substitution key
NEW: Add validation of MX domain for emails
NEW: add vcard for aderent and user
NEW: add vcard for adherent and user
NEW: add week number for month view in agenda
NEW: Algeria data (tva and forme_juridique)
NEW: Allow click on all header numbers on commerce area
NEW: Allow to reopen interventions (green button)
NEW: Allow zero quality on supplier/vendor order line
NEW: Appearance tab in TakePOS with more visual parameters
NEW: Better currency rate editor
NEW: Calculate the virtual stock in transverse mode ( not on getEntity('commande'), ... but on getEntity('stock') )
NEW: Can add event to log into blockedlog module with a constant.
NEW: Can build vendor invoice from vendor orders
NEW: Can change a product in line of recurring invoice or contract
NEW: Can change size of logo on PDF documents
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 disable, from edit page, the whole web site
NEW: Algeria data (VAT and forme_juridique)
NEW: allow click on all header numbers on commerce area
NEW: allow to reopen interventions (green button)
NEW: allow zero quantity on supplier/vendor order line
NEW: appearance tab in TakePOS with more visual parameters
NEW: better currency rate editor
NEW: can build vendor invoice from vendor orders
NEW: can change a product in lines of a recurring invoice or contract
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 define date range of validity of a login during creation
NEW: can disable, from edit page, the whole web site
NEW: can edit and set sales representatives directly on thirdparty card
NEW: Can edit the list of sending email profiles.
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 container type, language and tags in the list of pages
NEW: Can force the antivirus from conf file or autoprepend ini setup.
NEW: Can hide eatby, sellby dates with option PRODUCT_DISABLE_SELLBY and PRODUCT_DISABLE_EATBY
NEW: Can import proposals, sales orders, supplier invoices
NEW: can edit the list of sending email profiles
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 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 import proposals, sales orders, supplier invoices
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 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 THEME_DARKMODEENABLED=2 for a preview of theme in dark mode
NEW: change thirdparty with barcode scan in takepos
NEW: Common behavior for monthly leave list view
NEW: conf to allow show full arbo in warehouse getnomurl
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 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: convert all subscription in datetime
NEW: create thirdparty customer from TAKEPOS
NEW: Date shipment from order accepts hours
NEW: Declinaison price level compatibility
NEW: Delayed payment in TakePOS
NEW: Development of module Recruitment
NEW: display date range if exist in takepos
NEW: display resiliate status in takepos for member
NEW: can create a thirdparty customer from TakePOS
NEW: date shipment from order accepts hours
NEW: price level compatibility for variant
NEW: delayed payment in TakePOS
NEW: display date range if exist in TakePOS
NEW: display resiliate status in TakePOS for member
NEW: display stat for BOM on "object referent"/linked Object product tab
NEW: edit and update a ticket
NEW: edit or delete dispatched lines
NEW: Email configuration - Allow auto signed certificat when smtp ssl activated
NEW: Email configuration - allow auto signed certificate when smtp ssl activated
NEW: enable free emails input with select2
NEW: endpoint getContacts and Clean results
NEW: Events in agenda for contact
NEW: Field to link website page to an other object
NEW: Fill ECM src object fields in dol_add_file_process
NEW: filter on progress column in task list
NEW: filter product list by country and/or state/province
NEW: format tickets sent by mail in public interface
NEW: add juridical status for Algeria
NEW: form to add customer/supplier into categories
NEW: Framework is ready for CSRF token protection on explicit GET URLs.
NEW: get all child recursively
NEW: Get contacts list of a given order
NEW: Framework is ready for CSRF token protection on explicit GET URLs
NEW: helper functions for export with phpspreadsheet
NEW: hide closed contract lines
NEW: hide label in pdf for variants
NEW: Hook on propal card
NEW: If specific help page is available, we change color of icon
NEW: Include the tag editor of page as a popup into website editor
NEW: Introduce constant FACTUREFOURN_REUSE_NOTES_ON_CREATE_FROM
NEW: Introducing new modal boxes in TakePOS
NEW: Keep takepos terminal when login/logout
NEW: Link on balance to the ledger
NEW: hide label in PDF for variants
NEW: if specific help page is available, we change color of icon
NEW: include the tag editor of page as a popup into website editor
NEW: introduce constant FACTUREFOURN_REUSE_NOTES_ON_CREATE_FROM
NEW: introducing new modal boxes in TakePOS
NEW: keep TakePOS terminal when login/logout
NEW: link on balance to the ledger
NEW: MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER const in email collector
NEW: manage errors on update extra fields in ticket card
NEW: mass-actions for the event list view
NEW: Module Intracomm report
NEW: More filter for "View change logs"
NEW: multicurrency total in takepos
NEW: more filter for "View change logs"
NEW: multicurrency total in TakePOS
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
@ -158,70 +135,100 @@ 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: 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: 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: restrict thirdparty to customer in takepos
NEW: Allow to edit "demand reason" field though API
NEW: restrict thirdparty to customer in TakePOS
NEW: Rule "email to" accept wildcard *
NEW: Save filter of the project homepage
NEW: Select-able columns on customer invoice paymnet list
NEW: Select-able columns on miscellaneous payments + more data columns
NEW: Select-able columns on social taxes list
NEW: Select-able columns on supplier invoice payment 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 social taxes list
NEW: send context and remove new lines on create ticket
NEW: set entity when creating invoice on takepos
NEW: Show available stock in TakePOS
NEW: Show category filter on lists only when user have rights to read categories
NEW: Show header number and make it clickable in warehouse arean, payment area, shipment area
NEW: Show image of user in the combo select of users
NEW: Show label on batch card
NEW: Show line number on intervention card (via MAIN_VIEW_LINE_NUMBER)
NEW: show available stock in TakePOS
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 image of user in the combo select of users
NEW: show label on batch card
NEW: show links for select and multi-select in category extra field
NEW: Show module and permission ids on user/group rights (only admin)
NEW: Show place from events on import calender
NEW: Show references in contract form on interventions
NEW: Show tags and status in search list of website pages
NEW: Show user on external calender events (when found)
NEW: show module and permission ids on user/group rights (only admin)
NEW: show place from events on import calender
NEW: show references in contract form on interventions
NEW: show tags and status in search list of website pages
NEW: show user on external calender events (when found)
NEW: subject title with company name instead of application title in ticket message
NEW: Support for Samba4 AD
NEW: TakePOS connector compatibility with RECEIPT PRINTERS module
NEW: TakePOS Gift Receipt
NEW: TakePOS Multicurrency compatibility
NEW: The global header of a website can also have dynamic content
NEW: the global header of a website can also have dynamic content
NEW: Third-Party 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: ticket classification on create from email collector
NEW: Ticket message notifications when edited from public interface
NEW: translate classification labels in ticket
NEW: triggers create, modify, delete
NEW: VAT for Algeria
NEW: Use preselect third-party from list on new card
NEW: Vat report - Invert constant to show by default zero vat in reports
NEW: VAT rate for Angola #15606
NEW: VAT and juridical status for Algeria
NEW: VAT report - Invert constant to show by default zero VAT in reports
NEW: website page fields selection
NEW: Weighing Scale compatibility with TakePOS connector
NEW: When creating a user from a member linked to a thirdparty, you can choose to create if as external or internal user
NEW: Add clone functionality on miscellaneous payment
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: #15065 Add option to put the product label in bold in the PDF templates if configured
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:
NEW: Can use dynamic code into the 'enabled' property of DAO fields
NEW: API Can update a payment
NEW: api get member by thirdparty
---------------
NEW: add substitution key __MEMBER_TYPE__
NEW: add substitution key __TYPE__
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: Add some fields to link website page to an other object
NEW: fill ECM src object fields in dol_add_file_process
NEW: conf to allow to show the full tree in warehouse popup
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 add event to log into blockedlog module with a constant
NEW: add property cssview when declaring fields of an object
NEW: can use dynamic code into the 'enabled' property of DAO fields
NEW: field ref_ext in llx_commandedet
NEW: field ref_ext for Attributes and Combinations
NEW: OAuth SCOPE for Admin SDK
NEW: retrieve discount from invoice from API
NEW: standardizes API thirdparties by email like other object
NEW: Thirdparty REST API: endpoint to set price level
NEW: use new category API for project list view
NEW: Triggers Attributes and Attributes values
NEW: added incoterms data into the substitution array
NEW: add send context for ticket
NEW: add a message in error_log after detection of SQL or script injection
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: Graphics can be horizontal bars
NEW: add param to not show links when output tags
APIs
NEW: API get contacts list of a given order
NEW: API endpoint getContacts and Clean results
NEW: API can update a payment
NEW: API get member by thirdparty
NEW: API get thirdparty by barcode
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: field ref_ext in llx_commandedet
NEW: fields 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: Retrieve discount from invoice from API
NEW: standardizes API thirdparties by email like other object
NEW: thirdparty REST API: endpoint to set price level
NEW: Use new category API for project list view
NEW: Triggers Attributes and Attributes values
NEW: get state dictionary by REST API
NEW: improve Product API for product variants
HOOKs
NEW: Hook on propal card
NEW: add hooks on newpayment page to allow external payment modules
NEW: add hooks on stats pages
NEW: add formConfirm hook on product page
NEW: add two hooks printFieldListFrom and printFieldSearchParam
NEW: add hook "loginCheckSecurityAccess"
WARNING:
@ -240,8 +247,106 @@ Following changes may create regressions for some external modules, but were nec
* The API addPayment for api_invoice has evolved to accept amount into a foreign currency. You must provide array(amount=>X,mutlicurrency_ammount=>Y) instead of simple amount.
* The method select_thirdparty(), deprecated since 3.8, into html.form.class.php has been removed.
* Depreciate all methods with name ->valide(). Use instead methods ->validate().
* 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"
* Library htdocs/includes/phpoffice/phpexcel as been removed (replaced with htdocs/includes/phpoffice/PhpSpreadsheet)
***** ChangeLog for 12.0.4 compared to 12.0.3 *****
FIX: make formConfirm an addreplace-type hook
FIX: regex to remove 'action' parameter: taking feedback from PR#15213 into account
FIX: remove 'action' parameter from redirect URL when reordering lines on a document
FIX: error when displaying lines on order after adding a line if both MAIN_MULTILANGS and MAIN_DISABLE_PDF_AUTOUPDATE are activated
FIX: on survey creation, entity is always set to 1 ⇒ set it to $conf->entity
FIX: set entity to $conf->entity (instead of 1 by default) when creating a survey; otherwise the survey cannot be listed from the entity it was created on unless it is the main entity
FIX: the stringent XSS protection provided by 'alphanohtml' causes problems with some clients who used basic tags (bold, italic, underline) in product labels. Using 'restricthtml' instead could be a good compromise.
FIX: third party of object is not always fetched when initiating the e-mail presend action (e.g. from an order)
FIX: when the cronjob 'params' field is empty, the cron method is called with one empty string param instead of no params at all
FIX: XSS protection too stringent -> replace 'alphanohtml' with 'restricthtml'
FIX: #13067 including opening balance in calculation of displayed balance
FIX: #14326
FIX: #14649
FIX: #14901
FIX: #14927 Change ContratLigne property type to product_type
FIX: #14979
FIX: #15074
FIX: #15111 Fix special characters output in PDF
FIX: #15161 MO translation conflict
FIX: #15163
FIX: #15199
FIX: #15208
FIX: #15303
FIX: #15365 export of extrafields for user and resources
FIX: #15374 : "New" doesn't clear total amounts
FIX: #15501
FIX: #15572
FIX: #15590
FIX: #15618
FIX: supplier proposals as linked objects of events are not correctly fetched
FIX: when users create an event from a supplier proposal, the "linked objects" section says "Deleted"
FIX: Accountancy - Some ajustments on length of the account (general & auxiliary)
FIX: admin conf selected
FIX: also check if there is a method $object->fetch_thirdparty() before calling it
FIX: autofocus on first setup
FIX: Bad rigths to send contract
FIX: Better error message with IMAP when connection fails
FIX: Can create user but not update user with activedirectory
FIX: Can receipt of a product that required lot after disabling stock and
FIX: Can't create shipment for virtual product. Add
FIX: cant empty action comm desc
FIX: CA report by product/service : subcategory filter
FIX: Clean orphan records in llx_ecm_files into repair script.
FIX: default accountancy values and posted values
FIX: Deletion of expensereport + other generated object not complete.
FIX: disabled users must not be available in sales representative list on societe edit mode
FIX: Dol print error : conf usage thirdparty propagate extrafields to
FIX: Don't display inactive users in birthday box and company card
FIX: empty value is needed on filter list
FIX: enable HTML in product labels depending on conf MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML
FIX: error 500 on cash closure
FIX: excess comma
FIX: Export FEC - Remove line at zero
FIX: extrafield required error after submit
FIX: filter on project list
FIX: force payment mode to withdraw
FIX: formating of prices with foreign languages
FIX: handling $heightforinfotot when he's superior to a page height
FIX: if no PDF default model in admin for expense report, do not create a PDF
FIX: invoice payment terms edition: error management
FIX: list of fields in list of recurring invoices was empty
FIX: load default linked options for linked sellist extra fields
FIX: Loan - Return on list when you cancel create form or delete a loan
FIX: Missing lang trans
FIX: no empty value in required extrafield
FIX: Param joinfiles not sanitized
FIX: Payment by BankTransfer
FIX: pdf_getlinetotalwithtax must show total incl tax
FIX: Problem on supplier payment card
FIX: product auto volume calculation
FIX: product customer prices: missing triggers in CRUD class
FIX: Request on purchase orders in timeout even on very small databases
FIX: set paid on total discount of a product in cash desk
FIX: several warning with the barcode use in ODT templates
FIX: SHIP MODE install v12 bug insert
FIX: stripe for connect mode
FIX: subcat filter
FIX: supplier invoice: automatically calculate payment term when modifying payment condition
FIX: SUPPLIER PROPOSAL v12 bug add
FIX: table making extrafield input too small on advance target mailing
FIX: table making extrafield too small advtagertmailing
FIX: Unable to edit extrafields in expense report
FIX: update margins rates on object line edit
FIX: uses price2numjs
FIX: various payments: bad data handling for subledger account + useless db commit/rollback
FIX: virtual products: displayed value is by unit
FIX: virtual products: supplier discount was not applied in component list
FIX: warning for purchase order delivery late.
FIX: Warning on late purchase order delivery
FIX: WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING must not consider services while STOCK_SUPPORTS_SERVICES is empty
FIX: wrong tab
FIX: Yogosha report 4425 (backport)
FIX: Yogosha report 4434 (backport)
***** ChangeLog for 12.0.3 compared to 12.0.2 *****
FIX: 10.0 - when the mime file name is different from the filesystem name, the attachment name should be the mime filename
FIX: 11.0 - expenses lines overlapping the total amounts frame
@ -268,7 +373,7 @@ FIX: Look and feel v12: First tab must be name of object
FIX: missing entity check
FIX: missing param for hook
FIX: Missing transaction on PO actions
FIX: MySql Strict mode
FIX: MySQL Strict mode
FIX: param entity in html form file
FIX: Problems on FEC format
FIX: round stock value on product list
@ -287,6 +392,7 @@ FIX: Visualization rights correction on last modified contacts box
FIX: Wrong redirection
FIX: Yogosha report 4425 (backport)
***** ChangeLog for 12.0.2 compared to 12.0.1 *****
FIX: computation of the bottom margin of <body> returns NaN because body is not loaded yet
FIX: DebugBar hides content at page bottom
@ -375,8 +481,8 @@ FIX: SQL Problem in customer invoice list
FIX: SQL Problem in social contribution list
FIX: SQL Problem in supplier invoice list
FIX: SQL syntax error when editing extrafields
FIX: Sql type
FIX: takepos 12 hook
FIX: SQL type
FIX: TakePOS 12 hook
FIX: Update form erased extrafields that were hidden
FIX: Update of extrafields date
FIX: Update of extrafiels on draft object
@ -390,7 +496,7 @@ For users:
NEW: Module MO (Manufacturing Order) is available as stable module.
NEW: Receipt printer module moved from 'development' to 'experimental'
NEW: Add option MAIN_VIEW_LINE_NUMBER_IN_LIST for some lists.
NEW: add option MAIN_VIEW_LINE_NUMBER_IN_LIST for some lists
NEW: add numbering module for TakePOS module
NEW: 2 new options when creating an invoice from time spent on a project : by period or by task
NEW: Accountancy add column thirdparty on binding page
@ -401,19 +507,19 @@ NEW: Accountancy - Add possibility to manage a short alternative label for accou
NEW: Accountancy - General ledger - Add an option to search not reconciled lines
NEW: Add accountancy code of thirdparty in contact and supplier export
NEW: support webp image format
NEW: Add checkbox "overwrite if exists" into ECM/DMS module
NEW: add checkbox "overwrite if exists" into ECM/DMS module
NEW: add a link to notes in members list
NEW: add a parameter to group same products in TakePOS
NEW: add a parameter to sort product by label in TakePOS
NEW: Add a profil to import contact categories
NEW: Add company extrafields into order export
NEW: add a profil to import contact categories
NEW: add company extrafields into order export
NEW: add const CASHDESK_FORCE_DECREASE_STOCK to force batch decrementation
NEW: add const TAKEPOS_NUMPAD_USE_PAYMENT_ICON to use icons on payment buttons
NEW: add csv separator setup in module admin
NEW: add dedicated substitutions keys for extrafields of type date and datetime
NEW: add default warehouse for dispatch
NEW: Add due date in feature "Export accounting documents"
NEW: Add duration information for fichinter
NEW: add due date in feature "Export accounting documents"
NEW: add duration information for fichinter
NEW: Start support of Dark theme into ELDY theme
NEW: Add field author public alias for blog post on website module
NEW: Add "finished" field on product list

View File

@ -1,6 +0,0 @@
INSTALL
-------
English: See README.md file.
French: Voir fichier README-FR.md.

View File

@ -6,7 +6,7 @@
Dolibarr ERP & CRM est un logiciel moderne pour gérer votre activité (société, association, auto-entrepreneurs, artisans).
Il est simple d'utilisation et modulaire, vous permettant de n'activez que les fonctions dont vous avez besoin (contacts, fournisseurs, factures, commandes, stocks, agenda, ...).
![ScreenShot](https://www.dolibarr.org/images/dolibarr_screenshot1_1920x1080.jpg)
![ScreenShot](https://www.dolibarr.org/medias/dolibarr_screenshot1_1920x1080.jpg)
## LICENCE

View File

@ -13,9 +13,9 @@ You can freely use, study, modify or distribute it according to its licence.
You can use it as a standalone application or as a web application to access it from the Internet or a LAN.
Dolibarr has a large community ready to help you, free forums and [oficially preferred partners ready to offer commercial support should you need it](https://partners.dolibarr.org)
Dolibarr has a large community ready to help you, free forums and [officially preferred partners ready to offer commercial support should you need it](https://partners.dolibarr.org)
![ScreenShot](https://www.dolibarr.org/images/dolibarr_screenshot1_1920x1080.jpg)
![ScreenShot](https://www.dolibarr.org/medias/dolibarr_screenshot1_1920x1080.jpg)
## LICENSE
@ -45,7 +45,7 @@ On GNU/Linux, first check if your distribution has already packaged Dolibarr.
#### Generic install steps:
- Check that your installed PHP version is supported [see PHP support](https://wiki.dolibarr.org/index.php/Versions).
- Check that your installed PHP version is supported [see PHP support](https://wiki.dolibarr.org/index.php/Releases).
- Uncompress the downloaded .zip archive to copy the "dolibarr/htdocs" directory and all its files inside your web server root or get the files directly from GitHub (recommanded if you know git as it makes it easier if you want to upgrade later):
@ -71,6 +71,7 @@ On GNU/Linux, first check if your distribution has already packaged Dolibarr.
- Follow the installer instructions
### Saas/Cloud setup
If you don't have time to install it yourself, you can try some commercial 'ready to use' Cloud offers (See https://saas.dolibarr.org). However, this third solution is not free.
@ -86,10 +87,12 @@ Dolibarr supports upgrading usually wihtout the need for any (commercial) suppor
- At first next access, Dolibarr will redirect you to the "install/" page to follow the upgrade process.
 If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file in the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*").
## WHAT'S NEW
See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file.
## FEATURES
### Main application/modules (all optional)
@ -139,15 +142,18 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
### Other general features
- Localization in most major languages
- Multi-Language Support
- Multi-Users and groups with finely grained rights
- Multi-currency
- Multi-company by adding of an external module
- Multi-Currency
- Multi-Company (by adding of an external module)
- Very user friendly and easy to use
- customizable Dashboard
- Highly customizable: enable only the modules you need, add user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one)
- APIs
- APIs (REST, SOAP)
- Code that is easy to understand, maintain and develop (PHP with no heavy framework; trigger and hook architecture)
- Support a lot of country specific features:
- Spanish Tax RE and ISPF
- French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM)
@ -160,15 +166,18 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- Flexible PDF & ODT generation for invoices, proposals, orders...
- …
### System Environment / Requirements
- Works with PHP 5.5+ and MariaDB 5.0.3+, MySQL 5.0.3+ or PostgreSQL 8.1.4+ (See requirements on the [Wiki](https://wiki.dolibarr.org/index.php/Prerequisite))
- Compatible with all Cloud solutions that match MySQL, PHP or PostgreSQL prerequisites.
- Works with PHP 5.6+ and MariaDB 5.0.3+, MySQL 5.0.3+ or PostgreSQL 8.1.4+ (See requirements on the [Wiki](https://wiki.dolibarr.org/index.php/Prerequisite))
- Compatible with all Cloud solutions that match PHP & MySQL or PostgreSQL prerequisites.
### Extending
Dolibarr can be extended with a lot of other external application or modules from third party developers available at the [DoliStore](https://www.dolistore.com).
## WHAT DOLIBARR CAN'T DO YET
These are features that Dolibarr does **not** yet fully support:
@ -178,22 +187,29 @@ These are features that Dolibarr does **not** yet fully support:
- No native embedded Webmail, but you can send email to contacts in Dolibarr with e.g. offers, invoices, etc.
- Dolibarr can't do coffee (yet)
## DOCUMENTATION
Administrator, user, developer and translator's documentations are available along with other community resources in the [Wiki](https://wiki.dolibarr.org).
## CONTRIBUTING
This project exists thanks to all the people who contribute. [[Contribute](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)]
This project exists thanks to all the people who contribute.
Please read the instructions how to contribute (report a bug/error, a feature request, send code ...) [[Contribute](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)]
A view on Contributors:
<a href="https://github.com/Dolibarr/dolibarr/graphs/contributors"><img src="https://opencollective.com/dolibarr/contributors.svg?width=890&button=false" /></a>
## CREDITS
Dolibarr is the work of many contributors over the years and uses some fine PHP libraries.
See [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) file.
## NEWS AND SOCIAL NETWORKS
Follow Dolibarr project on:
@ -204,6 +220,8 @@ Follow Dolibarr project on:
- [YouTube](https://www.youtube.com/user/DolibarrERPCRM)
- [GitHub](https://github.com/Dolibarr/dolibarr)
### Sponsors
Support this project by becoming a sponsor. Your logo will show up here. 🙏 [[Become a sponsor/backer](https://opencollective.com/dolibarr#backer)]

View File

@ -6,14 +6,13 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
| Version | Supported |
| --------- | ------------------ |
| <= 9.0.* | :x: |
| >= 10.0.* | :white_check_mark: |
| <= 12.* | :x: |
| >= 13.* | :white_check_mark: |
## Reporting a Vulnerability
To report a vulnerability, please send an email to security@dolibarr.org
In most cases, after fixing the security, we make an answer by email to say the issue has been fixed.
To report a vulnerability, please use GitHub security advisory (alternatively send an email to security@dolibarr.org)
## Hunting vulnerabilities on Dolibarr
@ -24,11 +23,11 @@ If you believe you've found a security bug in our service, we are happy to work
Any type of denial of service attacks is strictly forbidden, as well as any interference with network equipment and Dolibarr infrastructure.
We recommand to install Dolibarr ERP CRM on you own server (as most Open Source software, download and use is free: https://www.dolibarr.org/download) to get access on every side of application.
We recommand to install Dolibarr ERP CRM on your own server (as most Open Source software, download and use is free: https://www.dolibarr.org/download) to get access on every side of application.
### User Agent
If you try to find bug on Dolibarr, we recommend to append to your user-agent header the following value: '-BugHunting-dolibarr'.
If you try to find bug on Dolibarr, we recommend to append to your user-agent header the following value: '-securitytest-for-dolibarr'.
### Account access
@ -37,54 +36,42 @@ You can install the web application yourself on your own platform/server so you
## Eligibility and Responsible Disclosure
We are happy to thank everyone who submits valid reports which help us improve the security of Dolibarr however, only those that meet the following eligibility requirements may receive a monetary reward:
We are happy to thank everyone who submits valid reports which help us improve the security of Dolibarr however, only those that meet the following eligibility requirements will be "validated reports" (if not, we may close the report without any answer):
You must be the first reporter of a vulnerability.
The vulnerability must be a qualifying vulnerability (see below)
Any vulnerability found must be reported no later than 24 hours after discovery
You must be the first reporter of the vulnerability (duplicate reports are closed).
You must send a clear textual description of the report along with steps to reproduce the issue, include attachments such as screenshots or proof of concept code as necessary.
You must avoid tests that could cause degradation or interruption of our service (refrain from using automated tools, and limit yourself about requests per second), that's why we recommand to install softwate on your own platform.
You must not leak, manipulate, or destroy any user data.
You must not be a former or current employee of Dolibarr or one of its contractor.
Reports about vulnerabilities are examined by our security analysts.
Our analysis is always based on worst case exploitation of the vulnerability, as is the reward we pay.
No vulnerability disclosure, including partial is allowed for the moment.
You must not leak, manipulate, or destroy any user data of third parties to find your vulnerability.
## Scope for qualified vulnerabilities
ONLY vulnerabilities discovered, when the following setup on test platform is used, are accepted:
ONLY vulnerabilities discovered, when the following setup on test platform is used, are "valid":
* $dolibarr_main_prod must be set to 1 into conf.php
* $dolibarr_nocsrfcheck must be kept to the value 0 into conf.php (this is the default value)
* $dolibarr_main_force_https must be set to something else than 0.
* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 1 into backoffice menu Home - Setup - Other (this protection should be enabled soon by default)
* The module DebugBar 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 allowed (troubles into "experimental", "developement" or external modules are not accepted).
* 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 and 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).
* 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.
* CSRF attacks are accepted for all when using a POST URL, but are accepted only for creating or updating data resctricted to the admin user when using GET URL.
* Ability for a high level user to edit web site pages in the CMS by including javascript is an expected feature.
* 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.
Scope is the web application (back office) and the APIs.
## Qualifying vulnerabilities for Bug bounty programs
* Remote code execution (RCE)
* Local files access and manipulation (LFI, RFI, XXE, SSRF, XSPA)
* Code injections (HTML, JS, SQL, PHP, ...)
* 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
* Broken authentication & session management
* Insecure direct object references
@ -96,6 +83,7 @@ Scope is the web application (back office) and the APIs.
## Non-qualifying vulnerabilities for Bug bounty programs, but qualified for reporting
* "Self" XSS
* SSL/TLS best practices
* 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

@ -1,48 +1,62 @@
README (English)
Path: /dolibarr/build/README
##################################################
Building packages
##################################################
All sub-directories of "build" directory contains files (setup or binary tools) required to build automatically Dolibarr packages.
There are several tools:
There are several tools:
- To build full Dolibarr packages, launch the script
> Launch command perl makepack-dolibarr.pl
Note: Prerequisites to build tgz, debian, rpm package
--------------------------------------------------------------------------------------------------
Prerequisites to build tgz, debian, rpm package:
> apt-get install tar dpkg dpatch p7zip-full rpm zip
Note: Prerequisites to build autoexe DoliWamp package:
--------------------------------------------------------------------------------------------------
Prerequisites to build autoexe DoliWamp package:
> apt-get install wine q4wine
> Launch "wine cmd" to check a drive Z: pointing to / exists.
> Install InnoSetup
For example by running isetup-5.3.9.exe (http://www.jrsoftware.org)
For example by running isetup-5.5.8.exe (https://www.jrsoftware.org) https://files.jrsoftware.org/is/5/
> Install WampServer into "C:\wamp64" to have Apache, PHP and MariaDB
For example by running wampserver3.2.0_x64.exe (http://www.wampserver.com). See file build/exe/doliwamp.iss to know the doliwamp version currently setup.
For example by running wampserver3.2.0_x64.exe (https://www.wampserver.com).
See file build/exe/doliwamp.iss to know the doliwamp version currently setup.
> Add path to ISCC into PATH windows var:
Launch wine cmd, then regedit and add entry int HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment\PATH
> To build manually the .exe from Windows (running from makepack-dolibarr.pl script is however recommanded),
open file build/exe/doliwamp.iss and click on button "Compile".
The .exe file will be build into directory build.
--------------------------------------------------------------------------------------------------
- To build a theme package, launch the script
> perl makepack-dolibarrtheme.pl
--------------------------------------------------------------------------------------------------
- To build a package for a module, launch the script
> perl makepack-dolibarrmodule.pl
--------------------------------------------------------------------------------------------------
- To build developper documentation, launch the script
> perl dolibarr-doxygen-build.pl
--------------------------------------------------------------------------------------------------
Note:
The build directory and all its contents is absolutely not required to make Dolibarr working.

View File

@ -306,7 +306,7 @@ If script fails with error Bad certificate, you can set "export PERL_LWP_SSL_VER
- htdocs/includes/jquery/plugins/datatables
- htdocs/includes/jszip
- htdocs/includes/mike42
- htdocs/includes/phpexcel or htdocs/includes/phpoffice
- htdocs/includes/phpoffice
- htdocs/includes/restler/framework/Luracast/Restler/explorer
- htdocs/includes/swiftmailer
- htdocs/includes/tcpdf or htdocs/includes/tecnickcom

View File

@ -232,7 +232,7 @@ $dolibarr_main_prod='0';
# Examples:
# $dolibarr_mailing_limit_sendbycli='0';
# dolibarr_distrib
# dolibarr_main_distrib
# A key to identify the distribution used for first installation
$dolibarr_distrib = 'deb';
$dolibarr_main_distrib = 'debian';

View File

@ -1,4 +1,4 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Dolibarr
Upstream-Contact: Laurent Destailleur <eldy@users.sourceforge.net>
Source: https://www.dolibarr.org/files/stable/standard/
@ -37,7 +37,8 @@ Copyright: 2002-2009, Rodolphe Quiedeville <rodolphe@quiedeville.org>
2010, Servitux Servicios Informaticos <info@servitux.es>
2011, Herve Prot <herve.prot@symeos.com>
2011, Remy Younes <ryounes@gmail.com>
2012-2013, Christophe Battarel <christophe.battarel@altairis.fr>
2012-2013, Christophe Battarel <christophe.battarel@altairis.fr>
License: GPL-3+
This program is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public
@ -56,7 +57,9 @@ License: GPL-3+
.
On Debian systems, the full text of the GNU General Public
License version 3 can be found in the file
`/usr/share/common-licenses/GPL-3'.
'/usr/share/common-licenses/GPL-3'.
------------------------------------------------------------
Files: htdocs/includes/adodbtime/*
Copyright: 2003-2005, John Lim
@ -80,6 +83,9 @@ Comment:
Those files are not shipped in the binary package since we use
the library as packaged in "libphp-adodb".
------------------------------------------------------------
Files: htdocs/includes/ckeditor/*
Copyright: 2003-2012 CKSource - Frederico Knabben
License: GPL-2+
@ -109,6 +115,9 @@ Comment:
Those files are not shipped in the binary package since we use the
library as packaged in "ckeditor".
------------------------------------------------------------
Files: htdocs/includes/fonts/*
Copyright: 2003, Bitstream Inc
unknown, Gavin Graham
@ -158,7 +167,10 @@ License: other
Comments:
Those files are not shipped in the binary package as we
configure Dolibarr to use Dejavu fonts from "fonts-dejavu-core".
------------------------------------------------------------
Files: doc/images/*
Copyright: Laurent Destailleur
License: CC-BY-SA-3.0
@ -174,33 +186,15 @@ License: CC-BY-SA-3.0
distribute the resulting work only under the same, similar or a compatible
license.
.
For more information, see http://creativecommons.org/licenses/by-sa/3.0/
For more information, see https://creativecommons.org/licenses/by-sa/3.0/
Files: htdocs/includes/fpdfi/*
Copyright: 2004-2011 Setasign - Jan Slabon
License: GPL-2+
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 2 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/>.
.
On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file
`/usr/share/common-licenses/GPL-2'.
Files: htdocs/includes/geoip/*
------------------------------------------------------------
Files: htdocs/includes/geoip2/*
Copyright: 2007 MaxMind LLC
License: LGPL-2.1+
License: CC-By-SA
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
@ -216,10 +210,14 @@ License: LGPL-2.1+
.
On Debian systems, the full text of the GNU Lesser General Public
License version 2.1 can be found in the file
`/usr/share/common-licenses/LGPL-2.1'.
'/usr/share/common-licenses/LGPL-2.1'.
------------------------------------------------------------
Files: htdocs/includes/jquery/*
Copyright: JQuery team
https://www.jquery.com
License: GPL-2+ or MIT
=== GPL-2+ LICENSE NOTICE ===
.
@ -240,7 +238,7 @@ License: GPL-2+ or MIT
.
On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file
`/usr/share/common-licenses/GPL-2'.
'/usr/share/common-licenses/GPL-2'.
.
=== MIT LICENSE ===
.
@ -267,6 +265,8 @@ Comment:
"libjs-jquery-ui". Most of the plugins are shipped though.
------------------------------------------------------------
Files: htdocs/includes/jquery/plugins/flot/*
Copyright: Flot team
License: Public-Domain
@ -275,6 +275,9 @@ Comment:
Those files are not shipped in the binary package because we configure
Dolibarr to use the files provided by "libjs-flot".
------------------------------------------------------------
Files: htdocs/includes/jsgantt/*
Copyright: JSGantt team
License: GPL-2+
@ -295,7 +298,10 @@ License: GPL-2+
.
On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file
`/usr/share/common-licenses/GPL-2'.
'/usr/share/common-licenses/GPL-2'.
------------------------------------------------------------
Files: htdocs/includes/nusoap/*
Copyright: 2002-2010 NuSphere Corporation
@ -315,11 +321,14 @@ License: LGPL-2.1+
.
On Debian systems, the full text of the GNU Lesser General Public
License version 2.1 can be found in the file
`/usr/share/common-licenses/LGPL-2.1'.
'/usr/share/common-licenses/LGPL-2.1'.
Comment:
Those files are not shipped in the binary package since we
configure Dolibarr to use the library provided in "libnusoap-php".
------------------------------------------------------------
Files: htdocs/includes/odtphp/*
Copyright: 2008, Julien Pauli
2008, Cyril PIERRE de GEYER
@ -342,29 +351,12 @@ License: GPL-2+
.
On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file
`/usr/share/common-licenses/GPL-2'.
'/usr/share/common-licenses/GPL-2'.
Files: htdocs/includes/phpexcel/*
Copyright: 2006-2011 PHPExcel (http://www.codeplex.com/PHPExcel)
License: LGPL-2.1+
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
.
This library 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
Lesser General Public License for more details.
.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
.
On Debian systems, the full text of the GNU Lesser General Public
License version 2.1 can be found in the file
`/usr/share/common-licenses/LGPL-2.1'.
Files: htdocs/includes/tcpdf/*
------------------------------------------------------------
Files: htdocs/includes/tecnickcom/*
Copyright: 2002-2013 Nicola Asuni - Tecnick.com LTD
License: LGPL-3.0+
TCPDF is free software: you can redistribute it and/or modify it

View File

@ -150,7 +150,6 @@ case "$1" in
##grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
#grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
#grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ] || echo "<?php \$dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; ?>" >> $config
##grep -q -c "dolibarr_lib_PHPEXCEL_PATH" $config || echo "<?php \$dolibarr_lib_PHPEXCEL_PATH=''; ?>" >> $config
##grep -q -c "dolibarr_lib_TCPDF_PATH" $config || echo "<?php \$dolibarr_lib_TCPDF_PATH=''; ?>" >> $config
#grep -q -c "dolibarr_js_CKEDITOR" $config || [ ! -d "/usr/share/javascript/ckeditor" ] || echo "<?php \$dolibarr_js_CKEDITOR='/javascript/ckeditor'; ?>" >> $config
#grep -q -c "dolibarr_js_JQUERY" $config || [ ! -d "/usr/share/javascript/jquery" ] || echo "<?php \$dolibarr_js_JQUERY='/javascript/jquery'; ?>" >> $config

View File

@ -24,6 +24,7 @@ $force_install_databaserootpass='__SUPERUSERPASSWORD__';
$force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1';
$force_install_lockinstall='444';
$force_install_distrib='debian';
// Value to overwrite path to use shared libraries/fonts instead of embedded one.
// If during install, we enable/disable declaration to use non embedded libraries, we must also check they are
@ -34,7 +35,6 @@ $force_install_lockinstall='444';
//$force_dolibarr_lib_GEOIP_PATH='';
//$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap';
//$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip';
//$force_dolibarr_lib_PHPEXCEL_PATH=''; // Use '' or 'disabled'
//$force_dolibarr_js_CKEDITOR='/javascript/ckeditor'; // Use '/javascript/ckeditor' or 'disabled'
//$force_dolibarr_js_JQUERY='/javascript/jquery';
//$force_dolibarr_js_JQUERY_UI='/javascript/jquery-ui';

View File

@ -103,8 +103,6 @@ override_dh_install:
# clean from useless files
rm -fr htdocs/includes/jquery/plugins/multiselect
rm -fr htdocs/includes/phpexcel/PHPExcel/Shared/PDF
rm -fr htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip
rm -fr htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-2.33
rm -fr htdocs/includes/tcpdf/fonts/freefont-20100919
rm -fr htdocs/includes/tcpdf/fonts/utils
@ -113,7 +111,6 @@ override_dh_install:
# Licence files are already included into copyright file.
rm -f htdocs/includes/jquery/plugins/flot/LICENSE.txt
rm -f htdocs/includes/phpexcel/license.txt
rm -f htdocs/includes/tcpdf/LICENSE.TXT
# Drop unwanted executable permissions

View File

@ -20,6 +20,9 @@ RUN apt-get update -y \
unzip \
curl \
apt-utils \
msmtp \
msmtp-mta \
mailutils \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
@ -44,7 +47,17 @@ RUN echo 'xdebug.remote_port=9000' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_connect_back=1' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.profiler_enable=0' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_log="/tmp/xdebug.log"' >> ${PHP_INI_DIR}/php.ini
#RUN echo '172.17.0.1 docker.host' >> /etc/hosts
#RUN echo 'localhost docker.host' >> /etc/hosts
# set up sendmail config, to use maildev
RUN echo "account default" > /etc/msmtprc
RUN echo "auth off" >> /etc/msmtprc
RUN echo "port 25" >> /etc/msmtprc
RUN echo "host mail" >> /etc/msmtprc
RUN echo "from local@localdomain.com" >> /etc/msmtprc
RUN echo "domain localhost.localdomain" >> /etc/msmtprc
RUN echo "sendmail_path=/usr/bin/msmtp -t" >> /usr/local/etc/php/conf.d/php-sendmail.ini
RUN echo "localhost localhost.localdomain" >> /etc/hosts
EXPOSE 80

View File

@ -16,7 +16,7 @@ And then, you can run :
docker-compose up
This will run 3 container Docker : Dolibarr, MariaDB and PhpMyAdmin.
This will run 4 containers Docker : Dolibarr, MariaDB, PhpMyAdmin and MailDev.
The URL to go to the Dolibarr is :
@ -25,7 +25,10 @@ The URL to go to the Dolibarr is :
The URL to go to PhpMyAdmin is (login/password is root/root) :
http://0.0.0.0:8080
In Dolibarr configuration Email let PHP mail function, To see all mail send by Dolibarr go to maildev
Setup the database connection during the installation process, please use mariad
b (name of the database container) as database host.
http://0.0.0.0:8081
Setup the database connection during the installation process, please use mariadb (name of the database container) as database host.
Setup documents folder, during the installation process, to /var/documents

View File

@ -52,3 +52,6 @@ services:
ports:
- "8081:80"
- "25:25"
networks:
- internal-pod
- external-pod

View File

@ -118,7 +118,7 @@ Source: "C:\wamp64\bin\mariadb\mariadb10.4.10\*.*"; DestDir: "{app}\bin\mariadb\
;Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mariadb\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db"
; Dolibarr
Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,documents\*,includes\ckeditor\_source\*,includes\savant\*,includes\phpmailer\*,jquery\plugins\template\*,nltechno*\*,sabre\sabre\*\tests,PHPExcel\Shared\PDF\*,PHPExcel\Shared\PCLZip\*,tcpdf\fonts\dejavu-fonts-ttf-2.33\*,tcpdf\fonts\freefont-20100919\*,tcpdf\fonts\utils\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\conf.php.sav,*\install.forced.php"
Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,documents\*,includes\ckeditor\_source\*,includes\savant\*,includes\phpmailer\*,jquery\plugins\template\*,nltechno*\*,sabre\sabre\*\tests,tcpdf\fonts\dejavu-fonts-ttf-2.33\*,tcpdf\fonts\freefont-20100919\*,tcpdf\fonts\utils\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\conf.php.sav,*\install.forced.php"
Source: "dev\*.*"; DestDir: "{app}\www\dolibarr\dev"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,dbmodel\*,fpdf\*,initdata\*,initdemo\*,iso-normes\*,licence\*,phpcheckstyle\*,phpunit\*,samples\*,test\*,uml\*,vagrant\*,xdebug\*"
Source: "doc\*.*"; DestDir: "{app}\www\dolibarr\doc"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,wiki\*,plaquette\*,dev\*,images\dolibarr_screenshot2.png,images\dolibarr_screenshot3.png,images\dolibarr_screenshot4.png,images\dolibarr_screenshot5.png,images\dolibarr_screenshot6.png,images\dolibarr_screenshot7.png,images\dolibarr_screenshot8.png,images\dolibarr_screenshot9.png,images\dolibarr_screenshot10.png,images\dolibarr_screenshot11.png,images\dolibarr_screenshot12.png"
Source: "scripts\*.*"; DestDir: "{app}\www\dolibarr\scripts"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,product\materiel.net.php,product\import-product.php"

View File

@ -22,6 +22,7 @@ $force_install_databaserootpass='WAMPMYSQLNEWPASSWORD';
$force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1';
$force_install_lockinstall='644';
$force_install_distrib='doliwamp';
$force_install_module='';
?>

View File

@ -125,6 +125,11 @@ $checksumconcat=array();
$outputfile=$outputdir.'/filelist-'.$release.'.xml';
$fp = fopen($outputfile, 'w');
if (empty($fp)) {
print 'Failed to open file '.$outputfile."\n";
exit(-1);
}
fputs($fp, '<?xml version="1.0" encoding="UTF-8" ?>'."\n");
fputs($fp, '<checksum_list version="'.$release.'" date="'.dol_print_date(dol_now(), 'dayhourrfc').'" generator="'.$script_file.'">'."\n");

View File

@ -476,6 +476,7 @@ if ($nboftargetok) {
$ret=`rm -f $BUILDROOT/$PROJECT/build.xml`;
$ret=`rm -f $BUILDROOT/$PROJECT/phpstan.neon`;
$ret=`rm -f $BUILDROOT/$PROJECT/pom.xml`;
$ret=`rm -f $BUILDROOT/$PROJECT/README-*.md`;
$ret=`rm -fr $BUILDROOT/$PROJECT/build/html`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/Doli*-*`;
@ -503,7 +504,10 @@ if ($nboftargetok) {
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/mysql/README`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/pgsql/README`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/install/mssql`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/install/mssql`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/install/sqlite3`;
$ret=`rm -fr $BUILDROOT/$PROJECT/node_modules`;
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/ansible`;
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/codesniffer`;
@ -578,52 +582,54 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/workstation*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/allscreen*`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`;
# Removed other test files
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`;
$ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`;
$ret=`rm -f $BUILDROOT/$PROJECT/.gitignore $BUILDROOT/$PROJECT/*/.gitignore $BUILDROOT/$PROJECT/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.gitignore`;
# Removed files installed by the awful composer
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/geoip/sample*.*`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/bin`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/adapters`; # Keep this removal in case we embed libraries
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/samples`; # Keep this removal in case we embed libraries
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/_source`; # _source must be kept into tarball for official debian, not for the rest
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/composer`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/doctrine`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/select2/release.sh`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/doc`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/example`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/test`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/example`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mobiledetect/mobiledetectlib/.gitmodules`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mobiledetect/mobiledetectlib/docs`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/.github`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/docs`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/samples`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/scripts`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/src`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/parsedown/LICENSE.txt`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/.gitattributes`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Classes/license.md`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared/PDF`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared/PCLZip`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Examples`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/unitTests`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/license.md`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/*/tests`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/tests`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/LICENSE`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/ae_fonts_*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/utils`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/LICENSE.TXT`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/examples`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/dejavu-fonts-ttf-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/freefont-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/ae_fonts_*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/vendor`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/webmozart`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/autoload.php`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`;
}
# Build package for each target

View File

@ -274,7 +274,6 @@ then
#grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ] || echo "<?php \$dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; ?>" >> $config
#grep -q -c "dolibarr_lib_PHPEXCEL_PATH" $config || echo "<?php \$dolibarr_lib_PHPEXCEL_PATH=''; ?>" >> $config
#grep -q -c "dolibarr_lib_TCPDF_PATH" $config || echo "<?php \$dolibarr_lib_TCPDF_PATH=''; ?>" >> $config
grep -q -c "dolibarr_js_CKEDITOR" $config || [ ! -d "/usr/share/javascript/ckeditor" ] || echo "<?php \$dolibarr_js_CKEDITOR='/javascript/ckeditor'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY" $config || [ ! -d "/usr/share/javascript/jquery" ] || echo "<?php \$dolibarr_js_JQUERY='/javascript/jquery'; ?>" >> $config

View File

@ -292,6 +292,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/product
%_datadir/dolibarr/htdocs/projet
%_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/recruitment
%_datadir/dolibarr/htdocs/reception
%_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/salaries
@ -424,7 +425,6 @@ then
#grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ] || echo "<?php \$dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; ?>" >> $config
#grep -q -c "dolibarr_lib_PHPEXCEL_PATH" $config || echo "<?php \$dolibarr_lib_PHPEXCEL_PATH=''; ?>" >> $config
#grep -q -c "dolibarr_lib_TCPDF_PATH" $config || echo "<?php \$dolibarr_lib_TCPDF_PATH=''; ?>" >> $config
grep -q -c "dolibarr_js_CKEDITOR" $config || [ ! -d "/usr/share/javascript/ckeditor" ] || echo "<?php \$dolibarr_js_CKEDITOR='/javascript/ckeditor'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY" $config || [ ! -d "/usr/share/javascript/jquery" ] || echo "<?php \$dolibarr_js_JQUERY='/javascript/jquery'; ?>" >> $config

View File

@ -209,6 +209,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/product
%_datadir/dolibarr/htdocs/projet
%_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/recruitment
%_datadir/dolibarr/htdocs/reception
%_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/salaries
@ -271,7 +272,6 @@ then
#grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ] || echo "<?php \$dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; ?>" >> $config
#grep -q -c "dolibarr_lib_PHPEXCEL_PATH" $config || echo "<?php \$dolibarr_lib_PHPEXCEL_PATH=''; ?>" >> $config
#grep -q -c "dolibarr_lib_TCPDF_PATH" $config || echo "<?php \$dolibarr_lib_TCPDF_PATH=''; ?>" >> $config
grep -q -c "dolibarr_js_CKEDITOR" $config || [ ! -d "/usr/share/javascript/ckeditor" ] || echo "<?php \$dolibarr_js_CKEDITOR='/javascript/ckeditor'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY" $config || [ ! -d "/usr/share/javascript/jquery" ] || echo "<?php \$dolibarr_js_JQUERY='/javascript/jquery'; ?>" >> $config

View File

@ -220,6 +220,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/product
%_datadir/dolibarr/htdocs/projet
%_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/recruitment
%_datadir/dolibarr/htdocs/reception
%_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/salaries
@ -282,7 +283,6 @@ then
#grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ] || echo "<?php \$dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; ?>" >> $config
#grep -q -c "dolibarr_lib_PHPEXCEL_PATH" $config || echo "<?php \$dolibarr_lib_PHPEXCEL_PATH=''; ?>" >> $config
#grep -q -c "dolibarr_lib_TCPDF_PATH" $config || echo "<?php \$dolibarr_lib_TCPDF_PATH=''; ?>" >> $config
grep -q -c "dolibarr_js_CKEDITOR" $config || [ ! -d "/usr/share/javascript/ckeditor" ] || echo "<?php \$dolibarr_js_CKEDITOR='/javascript/ckeditor'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY" $config || [ ! -d "/usr/share/javascript/jquery" ] || echo "<?php \$dolibarr_js_JQUERY='/javascript/jquery'; ?>" >> $config

View File

@ -17,6 +17,7 @@ $force_install_databaserootpass='__SUPERUSERPASSWORD__';
$force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1';
$force_install_lockinstall='444';
$force_install_distrib='rpmfedora';
// Value to overwrite path to use shared libraries/fonts instead of embedded one
$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';
@ -24,7 +25,6 @@ $force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';
//$force_dolibarr_lib_GEOIP_PATH='';
$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap';
//$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip';
$force_dolibarr_lib_PHPEXCEL_PATH='';
$force_dolibarr_lib_TCPDF_PATH='';
//$force_dolibarr_js_CKEDITOR='/javascript/ckeditor';
//$force_dolibarr_js_JQUERY='/javascript/jquery';

View File

@ -17,6 +17,7 @@ $force_install_databaserootpass='__SUPERUSERPASSWORD__';
$force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1';
$force_install_lockinstall='444';
$force_install_distrib='rpmgeneric';
// Value to overwrite path to use shared libraries/fonts instead of embedded one
// We don't force any external lib with generic package

View File

@ -17,6 +17,7 @@ $force_install_databaserootpass='__SUPERUSERPASSWORD__';
$force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1';
$force_install_lockinstall='444';
$force_install_distrib='rpmmandriva';
// Value to overwrite path to use shared libraries/fonts instead of embedded one
$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';
@ -24,7 +25,6 @@ $force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';
//$force_dolibarr_lib_GEOIP_PATH='';
$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap';
//$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip';
$force_dolibarr_lib_PHPEXCEL_PATH='';
$force_dolibarr_lib_TCPDF_PATH='';
//$force_dolibarr_js_CKEDITOR='/javascript/ckeditor';
//$force_dolibarr_js_JQUERY='/javascript/jquery';

View File

@ -17,6 +17,7 @@ $force_install_databaserootpass='__SUPERUSERPASSWORD__';
$force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1';
$force_install_lockinstall='444';
$force_install_distrib='rpmopensuse';
// Value to overwrite path to use shared libraries/fonts instead of embedded one
//$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';
@ -24,7 +25,6 @@ $force_install_lockinstall='444';
//$force_dolibarr_lib_GEOIP_PATH='';
//$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap';
//$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip';
$force_dolibarr_lib_PHPEXCEL_PATH='';
$force_dolibarr_lib_TCPDF_PATH='';
//$force_dolibarr_js_CKEDITOR='/javascript/ckeditor';
//$force_dolibarr_js_JQUERY='/javascript/jquery';

View File

@ -35,7 +35,7 @@
"nnnick/chartjs" : "^2.9",
"stripe/stripe-php" : "6.43.1",
"maximebf/debugbar" : "1.15.1",
"symfony/var-dumper": "3"
"symfony/var-dumper" : "3"
},
"require-dev" : {
"php-parallel-lint/php-parallel-lint" : "^0",
@ -59,4 +59,4 @@
"ext-zip" : "ODT, Excel and file compression support",
"ext-xml" : "Excel support"
}
}
}

592
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -48,6 +48,14 @@ By
* In file nusoap.php, to avoid a warning,
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
* 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] : '').")";
@ -125,17 +133,15 @@ with
}
}
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) {
with
if (strpos($filename, '//') === 0)
{
if (strpos($filename, '//') === 0) {
// Share folder on a (windows) server
// e.g.: "//[MyServerName]/[MySharedFolder]/"
//
@ -167,17 +173,17 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php
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:
require_once(dirname(__FILE__).'/include/tcpdf_filters.php');
Add file tcpdi_parser.php and replace:
require_once(dirname(__FILE__).'/include/tcpdf_filters.php');
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))) {
with
} elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1]) >= 2)) {
@ -187,23 +193,23 @@ with
JSGANTT:
--------
* 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
// LDR To open in same window
//var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth);
window.location.href=pRef
// LDR To open in same window
//var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth);
window.location.href=pRef
* Replace
vTmpDiv=this.newNode(vTmpCell, 'div', null, null, vTaskList[i].getResource());
vTmpDiv=this.newNode(vTmpCell, 'div', null, null, vTaskList[i].getResource());
with
var vTmpNode=this.newNode(vTmpCell, 'div', null, '');
vTmpNode=this.newNode(vTmpNode, 'a', null, '', vLangs[vLang]['moreinfo']);
vTmpNode.setAttribute('href',vTaskList[i].getLink());
var vTmpNode=this.newNode(vTmpCell, 'div', null, '');
vTmpNode=this.newNode(vTmpNode, 'a', null, '', vLangs[vLang]['moreinfo']);
vTmpNode.setAttribute('href',vTaskList[i].getLink());
* Replace '% Comp.' to have a smaller text column header
'comp':'% Comp.'
'comp':'% Comp.'
with
'comp':'%'
'comp':'%'
@ -217,14 +223,6 @@ JQUERYFILETREE:
* Remove directory htdocs/includes/jquery/plugins/jqueryFileTree/connectors
PHPEXCEL:
---------
* Replace in htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared/OLE.php
continue;
with:
continue 2;
RESTLER:
--------
Change content of file htdocs/includes/restler/framework/Luracast/Restler/explorer/index.html
@ -236,11 +234,21 @@ Change content of file htdocs/includes/restler/framework/Luracast/Restler/explor
public static function getShortName($className)
{
// @CHANGE LDR
if (! is_string($className)) return;
if (!is_string($className)) return;
//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
---------
@ -306,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
.select2-hidden-accessible {
margin: -1px !important; /* line to restore */
margin: -10000px !important; /* line to restore */
}

View File

@ -1,10 +1,19 @@
# HOW TO BUILD
## DEVELOPPER ACCOUNT
## ENABLE MODULE ZAPIER ON DOLIBARR
This should also enable the module API (required for authentication by Zapier service and to execute action in Dolibarr by Zapier).
Create the Dolibarr login that will be used by Zapier to call APIs. Give the login the permissions on the action you plan to automate.
## CREATE A ZAPIER DEVELOPPER ACCOUNT
At first, you need to have a Zapier developper acoount, create it here [Zapier Platform](https://developer.zapier.com/)
## BUILD INTEGRATION
## INSTALL ZAPIER COMMAND LINE TOOLS WITH LINK TO ZAPIER ONLINE ACCOUNT
### Install Node.js
@ -17,7 +26,7 @@ After installation, confirm that Node.js is ready to use:
Next let's install the Zapier CLI tools. The CLI will allow you to build your app, deploy it to the Zapier platform, do local testing, manage users and testers, view remote logs, collaborate with your team, and more:
`cd dev/exemples/zapier`
`cd dev/examples/zapier`
`npm install -g zapier-platform-cli` to install the CLI globally
@ -27,13 +36,15 @@ Next let's install the Zapier CLI tools. The CLI will allow you to build your ap
Let's configure authentication between your dev environment and the Zapier platform. You'll use the email address and password you use to log in to the Zapier application.
`zapier --version`
`zapier login`
This command will set up a .zapierrc file in your home directory.
### Install the Project
In zapier exemple directory, run:
In zapier example directory, run:
`cd dev/examples/zapier`
`npm install`
@ -41,8 +52,17 @@ In zapier exemple directory, run:
Let's deploy it! When you're ready to try your code out on the Zapier platform use the push command. Only you will be able to see the app until you invite testers.
`zapier register` (the first time, choose name for example "Dolibarr")
`zapier push`
### More info
After a push, the Application, with the name you defined during the register step, is available when creating a Zap.
You will find original tutorial here : [https://zapier.com/developer/start/introduction](https://zapier.com/developer/start/introduction)
### Create a Zap
Create a ZAP that use the application you registered.
For authentication, you must enter the login / pass of account used by Zapier to call APIs.

View File

@ -1,6 +1,6 @@
/*jshint esversion: 6 */
const testAuth = (z , bundle) => {
const url = bundle.authData.url+'/api/index.php/login';
const test = (z , bundle) => {
const url = bundle.authData.url+'/api/index.php/status';
// Normally you want to make a request to an endpoint that is either specifically designed to test auth, or one that
// every user will have access to, such as an account or profile endpoint like /me.
// In this example, we'll hit httpbin, which validates the Authorization Header against the arguments passed in the URL path
@ -11,67 +11,92 @@ const testAuth = (z , bundle) => {
// This method can return any truthy value to indicate the credentials are valid.
// Raise an error to show
return promise.then((response) => {
if (response.status === 401) {
throw new Error('The Session Key you supplied is invalid');
if (response.status === 400) {
throw new Error('400 -The Session Key you supplied is invalid');
}
if (response.status === 403) {
throw new Error('403 -The Session Key you supplied is invalid');
}
return response;
});
};
const getSessionKey = (z, bundle) => {
// To include the session key header on all outbound requests, simply define a function here.
// It runs runs before each request is sent out, allowing you to make tweaks to the request in a centralized spot
const includeSessionKeyHeader = (request, z, bundle) => {
if (bundle.authData.sessionKey) {
request.headers = request.headers || {};
request.headers['DOLAPIKEY'] = bundle.authData.sessionKey;
}
return request;
};
// If we get a response and it is a 401, we can raise a special error telling Zapier to retry this after another exchange.
const sessionRefreshIf401 = (response, z, bundle) => {
if (bundle.authData.sessionKey) {
if (response.status === 401) {
throw new z.errors.RefreshAuthError('Session apikey needs refreshing.');
}
}
return response;
};
const getSessionKey = async (z, bundle) => {
const url = bundle.authData.url + '/api/index.php/login';
const promise = z.request({
method: 'POST',
const response = await z.request({
url: url,
method: 'POST',
body: {
login: bundle.authData.login,
password: bundle.authData.password,
}
},
});
return promise.then((response) => {
if (response.status === 401) {
throw new Error('The login/password you supplied is invalid');
}
const json = JSON.parse(response.content);
return {
sessionKey: json.success.token || 'secret'
};
});
// if (response.status === 401) {
// throw new Error('The login/password you supplied is invalid');
// }
const json = JSON.parse(response.content);
return {
sessionKey: json.success.token || '',
};
};
module.exports = {
type: 'session',
// Define any auth fields your app requires here. The user will be prompted to enter this info when
// they connect their account.
fields: [
{
key: 'url',
label: 'Url of service',
required: true,
type: 'string'
config: {
type: 'session',
sessionConfig: {
perform: getSessionKey
},
{
key: 'login',
label: 'Login',
required: true,
type: 'string'
},
{
key: 'password',
label: 'Password',
required: true,
type: 'password'
}
],
// The test method allows Zapier to verify that the credentials a user provides are valid. We'll execute this
// method whenever a user connects their account for the first time.
test: testAuth,
// The method that will exchange the fields provided by the user for session credentials.
sessionConfig: {
perform: getSessionKey
// Define any auth fields your app requires here. The user will be prompted to enter this info when
// they connect their account.
fields: [
{
key: 'url',
label: 'Url of service without trailing-slash',
required: true,
type: 'string'
},
{
key: 'login',
label: 'Login',
required: true,
type: 'string'
},
{
key: 'password',
label: 'Password',
required: true,
type: 'password'
}
],
// The test method allows Zapier to verify that the credentials a user provides are valid. We'll execute this
// method whenever a user connects their account for the first time.
test,
// The method that will exchange the fields provided by the user for session credentials.
// assuming "login" is a key returned from the test
connectionLabel: '{{login}}'
},
// assuming "login" is a key returned from the test
connectionLabel: '{{login}}'
befores: [includeSessionKeyHeader],
afters: [sessionRefreshIf401],
};

View File

@ -72,7 +72,7 @@ module.exports = {
},
outputFields: [
{key: 'id', label: 'ID'},
{key: 'id', type: "integer", label: 'ID'},
{key: 'name', label: 'Name'},
{key: 'name_alias', label: 'Name alias'},
{key: 'address', label: 'Address'},
@ -81,8 +81,8 @@ module.exports = {
{key: 'phone', label: 'Phone'},
{key: 'fax', label: 'Fax'},
{key: 'email', label: 'Email'},
{key: 'client', label: 'Customer/Prospect 0/1/2/3'},
{key: 'fournisseur', label: 'Supplier 0/1'},
{key: 'client', type: "integer", label: 'Customer/Prospect 0/1/2/3'},
{key: 'fournisseur', type: "integer", label: 'Supplier 0/1'},
{key: 'code_client', label: 'Customer code'},
{key: 'code_fournisseur', label: 'Supplier code'}
]

View File

@ -1,33 +1,39 @@
/*jshint esversion: 6 */
const triggerThirdparty = require('./triggers/thirdparty');
const triggerOrder = require('./triggers/order');
const triggerAction = require('./triggers/action');
const triggerOrder = require('./triggers/order');
const triggerThirdparty = require('./triggers/thirdparty');
const triggerTicket = require('./triggers/ticket');
const triggerUser = require('./triggers/user');
const searchThirdparty = require('./searches/thirdparty');
const createThirdparty = require('./creates/thirdparty');
const authentication = require('./authentication');
const {
config: authentication,
befores = [],
afters = [],
} = require('./authentication');
// To include the session key header on all outbound requests, simply define a function here.
// It runs runs before each request is sent out, allowing you to make tweaks to the request in a centralized spot
const includeSessionKeyHeader = (request, z, bundle) => {
if (bundle.authData.sessionKey) {
request.headers = request.headers || {};
request.headers['DOLAPIKEY'] = bundle.authData.sessionKey;
}
return request;
};
// const includeSessionKeyHeader = (request, z, bundle) => {
// if (bundle.authData.sessionKey) {
// request.headers = request.headers || {};
// request.headers['DOLAPIKEY'] = bundle.authData.sessionKey;
// }
// return request;
// };
// If we get a response and it is a 401, we can raise a special error telling Zapier to retry this after another exchange.
const sessionRefreshIf401 = (response, z, bundle) => {
if (bundle.authData.sessionKey) {
if (response.status === 401) {
throw new z.errors.RefreshAuthError('Session apikey needs refreshing.');
}
}
return response;
};
// const sessionRefreshIf401 = (response, z, bundle) => {
// if (bundle.authData.sessionKey) {
// if (response.status === 401) {
// throw new z.errors.RefreshAuthError('Session apikey needs refreshing.');
// }
// }
// return response;
// };
// We can roll up all our behaviors in an App.
const App = {
@ -40,11 +46,11 @@ const App = {
// beforeRequest & afterResponse are optional hooks into the provided HTTP client
beforeRequest: [
includeSessionKeyHeader
...befores
],
afterResponse: [
sessionRefreshIf401
...afters
],
// If you want to define optional resources to simplify creation of triggers, searches, creates - do that here!
@ -53,9 +59,11 @@ const App = {
// If you want your trigger to show up, you better include it here!
triggers: {
[triggerThirdparty.key]: triggerThirdparty,
[triggerAction.key]: triggerAction,
[triggerOrder.key]: triggerOrder,
[triggerAction.key]: triggerAction
[triggerThirdparty.key]: triggerThirdparty,
[triggerTicket.key]: triggerTicket,
[triggerUser.key]: triggerUser,
},
// If you want your searches to show up, you better include it here!

View File

@ -1,6 +1,6 @@
{
"name": "dolibarr",
"version": "1.0.0",
"version": "1.13.0",
"description": "An app for connecting Dolibarr to the Zapier platform.",
"repository": "Dolibarr/dolibarr",
"homepage": "https://www.dolibarr.org/",
@ -15,7 +15,7 @@
"npm": ">=5.6.0"
},
"dependencies": {
"zapier-platform-core": "8.0.1"
"zapier-platform-core": "10.1.2"
},
"devDependencies": {
"mocha": "^5.2.0",

View File

@ -54,13 +54,20 @@ module.exports = {
// outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [
{key: 'id', label: 'ID'},
{key: 'createdAt', label: 'Created At'},
{
key: 'id',
type: "integer",
label: 'ID'
},
{key: 'createdAt', type: "integer", label: 'Created At'},
{key: 'name', label: 'Name'},
{key: 'firstname', label: 'Firstname'},
{key: 'directions', label: 'Directions'},
{key: 'authorId', label: 'Author ID'},
{key: 'style', label: 'Style'}
{key: 'authorId', type: "integer", label: 'Author ID'},
{
key: 'style',
label: 'Style'
}
]
}
};

View File

@ -10,14 +10,14 @@ const subscribeHook = (z, bundle) => {
action: bundle.inputData.action
};
const url = bundle.authData.url + '/api/index.php/zapierapi/hook';
const url = bundle.authData.url + '/api/index.php/zapierapi/hook';
// You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this.
const options = {
url: url,
method: 'POST',
body: JSON.stringify(data)
body: data,
};
// You may return a promise or a normal data structure from any perform method.
@ -32,7 +32,7 @@ const unsubscribeHook = (z, bundle) => {
// You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this.
const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id,
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id,
method: 'DELETE',
};
@ -74,7 +74,7 @@ const getFallbackRealAction = (z, bundle) => {
// For the test poll, you should get some real data, to aid the setup process.
const module = bundle.inputData.module;
const options = {
url: bundle.authData.url + '/api/index.php/agendaevents/0',
url: bundle.authData.url + '/api/index.php/agendaevents/0',
};
return z.request(options).then((response) => [JSON.parse(response.content)]);
@ -100,7 +100,7 @@ module.exports = {
noun: 'Action',
display: {
label: 'New Agenda',
description: 'Trigger when a new agenda with action is done in Dolibarr.'
description: 'Triggers when a new agenda with action is done in Dolibarr.'
},
// `operation` is where the business logic goes.
@ -111,6 +111,7 @@ module.exports = {
inputFields: [
{
key: 'action',
required: true,
type: 'string',
helpText: 'Which action of agenda this should trigger on.',
choices: {
@ -145,12 +146,33 @@ module.exports = {
// outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [
{key: 'id', label: 'ID'},
{key: 'createdAt', label: 'Created At'},
{key: 'name', label: 'Name'},
{key: 'usertodo__name', label: 'UserToDo Name'},
{key: 'authorId', label: 'Author ID'},
{key: 'action', label: 'Action'}
{
key: 'id',
type: "integer",
label: 'ID'
},
{
key: 'createdAt',
type: "integer",
label: 'Created At'
},
{
key: 'name',
label: 'Name'
},
{
key: 'usertodo__name',
label: 'UserToDo Name'
},
{
key: 'authorId',
type: "integer",
label: 'Author ID'
},
{
key: 'action',
label: 'Action'
}
]
}
};

View File

@ -17,7 +17,7 @@ const subscribeHook = (z, bundle) => {
const options = {
url: url,
method: 'POST',
body: JSON.stringify(data)
body: data,
};
// You may return a promise or a normal data structure from any perform method.
@ -90,7 +90,7 @@ module.exports = {
noun: 'Order',
display: {
label: 'New Order',
description: 'Trigger when a new order with action is done in Dolibarr.'
description: 'Triggers when a new order with action is done in Dolibarr.'
},
// `operation` is where the business logic goes.
@ -101,6 +101,7 @@ module.exports = {
inputFields: [
{
key: 'action',
required: true,
type: 'string',
helpText: 'Which action of order this should trigger on.',
choices: {
@ -136,11 +137,11 @@ module.exports = {
// outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [
{key: 'id', label: 'ID'},
{key: 'createdAt', label: 'Created At'},
{key: 'id', type: "integer", label: 'ID'},
{key: 'createdAt', type: "integer", label: 'Created At'},
{key: 'name', label: 'Name'},
{key: 'directions', label: 'Directions'},
{key: 'authorId', label: 'Author ID'},
{key: 'authorId', type: "integer", label: 'Author ID'},
{key: 'module', label: 'Module'},
{key: 'action', label: 'Action'}
]

View File

@ -17,7 +17,7 @@ const subscribeHook = (z, bundle) => {
const options = {
url: url,
method: 'POST',
body: JSON.stringify(data)
body: data,
};
// You may return a promise or a normal data structure from any perform method.
@ -112,7 +112,7 @@ module.exports = {
noun: 'Thirdparty',
display: {
label: 'New Thirdparty',
description: 'Trigger when a new thirdpaty action is done in Dolibarr.'
description: 'Triggers when a new thirdpaty action is done in Dolibarr.'
},
// `operation` is where the business logic goes.
@ -123,6 +123,7 @@ module.exports = {
inputFields: [
{
key: 'action',
required: true,
type: 'string',
helpText: 'Which action of thirdparty this should trigger on.',
choices: {
@ -159,12 +160,12 @@ module.exports = {
// outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [
{key: 'id', label: 'ID'},
{key: 'id', type: "integer", label: 'ID'},
{key: 'createdAt', label: 'Created At'},
{key: 'name', label: 'Name'},
{key: 'name_alias', label: 'Name alias'},
{key: 'firstname', label: 'Firstame'},
{key: 'authorId', label: 'Author ID'},
{key: 'firstname', label: 'Firstname'},
{key: 'authorId', type: "integer", label: 'Author ID'},
{key: 'action', label: 'Action'},
{key: 'client', label: 'Customer/Prospect 0/1/2/3'},
{key: 'fournisseur', label: 'Supplier 0/1'},

View File

@ -0,0 +1,237 @@
const subscribeHook = (z, bundle) => {
// `z.console.log()` is similar to `console.log()`.
z.console.log('suscribing hook!');
// bundle.targetUrl has the Hook URL this app should call when an action is created.
const data = {
url: bundle.targetUrl,
event: bundle.event,
module: 'ticket',
action: bundle.inputData.action
};
const url = bundle.authData.url + '/api/index.php/zapierapi/hook';
// You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this.
const options = {
url: url,
method: 'POST',
body: data,
};
// You may return a promise or a normal data structure from any perform method.
return z.request(options).then((response) => JSON.parse(response.content));
};
const unsubscribeHook = (z, bundle) => {
// bundle.subscribeData contains the parsed response JSON from the subscribe
// request made initially.
z.console.log('unsuscribing hook!');
// You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this.
const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id,
method: 'DELETE',
};
// You may return a promise or a normal data structure from any perform method.
return z.request(options).then((response) => JSON.parse(response.content));
};
const getTicket = (z, bundle) => {
// bundle.cleanedRequest will include the parsed JSON object (if it's not a
// test poll) and also a .querystring property with the URL's query string.
const ticket = {
id: bundle.cleanedRequest.id,
track_id: bundle.cleanedRequest.track_id,
subject: bundle.cleanedRequest.subject,
message: bundle.cleanedRequest.message,
lastname: bundle.cleanedRequest.lastname,
firstname: bundle.cleanedRequest.firstname,
address: bundle.cleanedRequest.address,
zip: bundle.cleanedRequest.zip,
town: bundle.cleanedRequest.town,
email_from: bundle.cleanedRequest.email_from,
login: bundle.cleanedRequest.login,
authorId: bundle.cleanedRequest.authorId,
createdAt: bundle.cleanedRequest.createdAt,
action: bundle.cleanedRequest.action
};
return [ticket];
};
const getFallbackRealTicket = (z, bundle) => {
// For the test poll, you should get some real data, to aid the setup process.
const module = bundle.inputData.module;
const options = {
url: bundle.authData.url + '/api/index.php/tickets/0',
};
return z.request(options).then((response) => [JSON.parse(response.content)]);
};
// const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices',
// };
// return z.request(options).then((response) => JSON.parse(response.content));
// };
// const getModulesChoices = () => {
// return {
// orders: "Order",
// invoices: "Invoice",
// thirdparties: "Thirdparty",
// users: "User",
// tickets: "Ticket",
// contacts: "Contacts"
// };
// };
// const getActionsChoices = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module;
// const options = {
// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`,
// };
// return z.request(options).then((response) => JSON.parse(response.content));
// };
// We recommend writing your triggers separate like this and rolling them
// into the App definition at the end.
module.exports = {
key: 'ticket',
// You'll want to provide some helpful display labels and descriptions
// for tickets. Zapier will put them into the UX.
noun: 'Ticket',
display: {
label: 'New Ticket',
description: 'Triggers when a new ticket action is done in Dolibarr.'
},
// `operation` is where the business logic goes.
operation: {
// `inputFields` can define the fields a ticket could provide,
// we'll pass them in as `bundle.inputData` later.
inputFields: [
{
key: 'action',
type: 'string',
required: true,
helpText: 'Which action of ticket this should trigger on.',
choices: {
create: "Create",
modify: "Modify",
validate: "Validate",
}
}
],
type: 'hook',
performSubscribe: subscribeHook,
performUnsubscribe: unsubscribeHook,
perform: getTicket,
performList: getFallbackRealTicket,
// In cases where Zapier needs to show an example record to the user, but we are unable to get a live example
// from the API, Zapier will fallback to this hard-coded sample. It should reflect the data structure of
// returned records, and have obviously dummy values that we can show to any user.
sample: {
id: 1,
track_id: 'Xaz123er',
subject: 'Subject',
message: 'Message',
createdAt: 1472069465,
lastname: 'DOE',
firstname: 'John',
email: 'john@doe.com',
address: 'Park Avenue',
zip: '12345',
town: 'NEW-YORK',
email_from: 'doe.john@example;com',
authorId: 1,
action: 'create'
},
// If the resource can have fields that are custom on a per-user basis, define a function to fetch the custom
// field definitions. The result will be used to augment the sample.
// outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [
{
key: 'id',
type: "integer",
label: 'ID'
},
{
key: 'track_id',
type: "string",
label: 'TrackID'
},
{
key: 'subject',
type: "string",
label: 'Subject'
},
{
key: 'message',
type: "string",
label: 'Message'
},
{
key: 'createdAt',
type: "integer",
label: 'Created At'
},
{
key: 'lastname',
label: 'Lastname'
},
{
key: 'firstname',
label: 'Firstname'
},
{
key: 'email',
label: 'Email'
},
{
key: 'address',
label: 'Address'
},
{
key: 'zip',
label: 'Zip'
},
{
key: 'town',
label: 'Town'
},
{
key: 'email_from',
type: 'string',
label: 'Email from'
},
{
key: 'authorId',
type: "integer",
label: 'Author ID'
},
{
key: 'action',
type: 'string',
label: 'Action'
}
]
}
};

View File

@ -0,0 +1,177 @@
const subscribeHook = (z, bundle) => {
// `z.console.log()` is similar to `console.log()`.
z.console.log('suscribing hook!');
// bundle.targetUrl has the Hook URL this app should call when an action is created.
const data = {
url: bundle.targetUrl,
event: bundle.event,
module: 'user',
action: bundle.inputData.action
};
const url = bundle.authData.url + '/api/index.php/zapierapi/hook';
// You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this.
const options = {
url: url,
method: 'POST',
body: data,
};
// You may return a promise or a normal data structure from any perform method.
return z.request(options).then((response) => JSON.parse(response.content));
};
const unsubscribeHook = (z, bundle) => {
// bundle.subscribeData contains the parsed response JSON from the subscribe
// request made initially.
z.console.log('unsuscribing hook!');
// You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this.
const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id,
method: 'DELETE',
};
// You may return a promise or a normal data structure from any perform method.
return z.request(options).then((response) => JSON.parse(response.content));
};
const getUser = (z, bundle) => {
// bundle.cleanedRequest will include the parsed JSON object (if it's not a
// test poll) and also a .querystring property with the URL's query string.
const user = {
id: bundle.cleanedRequest.id,
lastname: bundle.cleanedRequest.lastname,
firstname: bundle.cleanedRequest.firstname,
address: bundle.cleanedRequest.address,
zip: bundle.cleanedRequest.zip,
town: bundle.cleanedRequest.town,
email: bundle.cleanedRequest.email,
login: bundle.cleanedRequest.login,
authorId: bundle.cleanedRequest.authorId,
createdAt: bundle.cleanedRequest.createdAt,
action: bundle.cleanedRequest.action
};
return [user];
};
const getFallbackRealUser = (z, bundle) => {
// For the test poll, you should get some real data, to aid the setup process.
const module = bundle.inputData.module;
const options = {
url: bundle.authData.url + '/api/index.php/users/0',
};
return z.request(options).then((response) => [JSON.parse(response.content)]);
};
// const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices',
// };
// return z.request(options).then((response) => JSON.parse(response.content));
// };
// const getModulesChoices = () => {
// return {
// orders: "Order",
// invoices: "Invoice",
// thirdparties: "Thirdparty",
// users: "User",
// contacts: "Contacts"
// };
// };
// const getActionsChoices = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module;
// const options = {
// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`,
// };
// return z.request(options).then((response) => JSON.parse(response.content));
// };
// We recommend writing your triggers separate like this and rolling them
// into the App definition at the end.
module.exports = {
key: 'user',
// You'll want to provide some helpful display labels and descriptions
// for users. Zapier will put them into the UX.
noun: 'User',
display: {
label: 'New User',
description: 'Triggers when a new user action is done in Dolibarr.'
},
// `operation` is where the business logic goes.
operation: {
// `inputFields` can define the fields a user could provide,
// we'll pass them in as `bundle.inputData` later.
inputFields: [
{
key: 'action',
required: true,
type: 'string',
helpText: 'Which action of user this should trigger on.',
choices: {
create: "Create",
modify: "Modify",
validate: "Validate",
}
}
],
type: 'hook',
performSubscribe: subscribeHook,
performUnsubscribe: unsubscribeHook,
perform: getUser,
performList: getFallbackRealUser,
// In cases where Zapier needs to show an example record to the user, but we are unable to get a live example
// from the API, Zapier will fallback to this hard-coded sample. It should reflect the data structure of
// returned records, and have obviously dummy values that we can show to any user.
sample: {
id: 1,
createdAt: 1472069465,
lastname: 'DOE',
firstname: 'John',
email: 'john@doe.com',
address: 'Park Avenue',
zip: '12345',
town: 'NEW-YORK',
login: 'doe.john',
authorId: 1,
action: 'create'
},
// If the resource can have fields that are custom on a per-user basis, define a function to fetch the custom
// field definitions. The result will be used to augment the sample.
// outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [
{key: 'id', type: "integer", label: 'ID'},
{key: 'createdAt', type: "integer", label: 'Created At'},
{key: 'lastname', label: 'Lastname'},
{key: 'firstname', label: 'Firstname'},
{key: 'email', label: 'Email'},
{key: 'address', label: 'Address'},
{key: 'zip', label: 'Zip'},
{key: 'town', label: 'Town'},
{key: 'login', label: 'Login'},
{key: 'authorId', type: "integer", label: 'Author ID'},
{key: 'action', label: 'Action'}
]
}
};

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

View File

@ -189,8 +189,8 @@ export res=$?
export documentdir=`cat $mydir/../../htdocs/conf/conf.php | grep '^\$dolibarr_main_data_root' | sed -e 's/$dolibarr_main_data_root=//' | sed -e 's/;//' | sed -e "s/'//g" | sed -e 's/"//g' `
if [ "x$documentdir" != "x" ]
then
$DIALOG --title "Reset document directory tpp" --clear \
--inputbox "Delete and recreate document directory $documentdir/:" 16 55 n 2> $fichtemp
$DIALOG --title "Reset document directory" --clear \
--inputbox "DELETE and recreate document directory $documentdir/:" 16 55 n 2> $fichtemp
valret=$?

View File

@ -53,7 +53,7 @@ then
DIALOG="$DIALOG --ascii-lines"
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
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
valret=$?
case $valret in
@ -70,7 +70,7 @@ then
DIALOG=${DIALOG=dialog}
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
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
valret=$?
@ -128,7 +128,7 @@ then
# ---------------------------- confirmation
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
case $? in

File diff suppressed because one or more lines are too long

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

@ -0,0 +1,2 @@
Spain https://incwell.eu/en/company-formation-spain/
France https://www.economie.gouv.fr/entreprises/numeros-identification-entreprise

View File

@ -6,7 +6,7 @@
<exclude-pattern type="relative">build/html</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">documents</exclude-pattern>
<exclude-pattern type="relative">htdocs/core/class/lessc.class.php</exclude-pattern>
@ -17,6 +17,7 @@
<exclude-pattern type="relative">*/nltechno*</exclude-pattern>
<exclude-pattern type="relative">*/htdocs/includes</exclude-pattern>
<exclude-pattern type="relative">*/htdocs/includes</exclude-pattern>
<exclude-pattern type="relative">.git</exclude-pattern>
<!-- List of all tests -->

View File

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

View File

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

View File

@ -2,13 +2,18 @@ README (English)
--------------------------------
This directory contains tools to generate translation files for a new
languages or to update translation files for existing languages.
See Dolibarr Wiki page:
https://wiki.dolibarr.org/index.php/Translator_documentation
For more information on how to use them.
for Linux OS:
To install transifex client:
Translation of Dolibarr Project at Transifex:
https://www.transifex.com/dolibarr-association/dolibarr/dashboard/
Installation of Transifex Client:
---------------------------------
for Linux OS
to install or to update transifex client:
sudo pip install --upgrade transifex-client
To update transifex client:
sudo pip install --upgrade transifex-client

View File

@ -21,8 +21,8 @@
* \ingroup dev
* \brief This script uses google language ajax api as the translator engine
* The main translator function can be found at:
* http://code.google.com/intl/fr/apis/language/translate/overview.html
* http://translate.google.com/translate_tools
* defunct -http://code.google.com/intl/fr/apis/language/translate/overview.html-
* defunct -http://translate.google.com/translate_tools-
* https://code.google.com/apis/console
*/
@ -58,7 +58,7 @@ $dir=DOL_DOCUMENT_ROOT."/langs";
if (! isset($argv[3])) {
print "Usage: ".$script_file." lang_code_src lang_code_dest|all APIKEY [langfile.lang]\n";
print "Example: ".$script_file." en_US pt_PT 123456\n";
print "Rem: lang_code to use can be found on http://www.google.com/language_tools\n";
print "Rem: lang_code to use can be found on https://translate.google.com\n";
exit;
}

View File

@ -1,25 +0,0 @@
comparison of terms
Dolibarr SAP ERP Odoo
-------------------------------------------------------------------------
Thirdparty Contact partner Partner/Contact (company)
Contact/address Contact person Partner/Contact (individual)
Financial Finance (FI) Accounting
Accounting
Income / Expense ?? Profit / Loss
Balance ?? Net profit
Subledger account Subledger account ??
CRM Sales & Distribution Sales
Proposal ?? Quotation
Proposal is ok but proposition looks better (proposal is for a detailed proposition).
We can say also "business proposition or business proposal".
In India they are using "Quotation".

View File

@ -1,33 +1,45 @@
README (deutsch / german / allemand)
--------------------------------
------------------------------------
--------------------------------
------------------------------------
Download / Herunterladen
--------------------------------
------------------------------------
* Dolibarr ERP/CRM kann man über die offizielle Dolibarr Website
https://www.dolibarr.org/downloads
oder direkt von Sourceforge
oder direkt bei Sourceforge
https://sourceforge.net/projects/dolibarr/files/
herunterladen.
* Die meisten externen Module/Themens sind über den DoliStore verfügbar:
https://www.dolistore.com/de/
--------------------------------
Installation
--------------------------------
* Für eine kurze Einleitung, schau auf die README Datei im Hauptverzeichnis.
------------------------------------
Installation / Hilfe
------------------------------------
* Für eine kurze Einleitung schau in die README Datei im Hauptverzeichnis.
* Umfangreiche Dokumentationen sind im Dolibarr Wiki zu finden:
https://wiki.dolibarr.org/index.php/Hauptseite
* eine Deutsche Community bietet der Dolibarr e.V. unter
https://www.dolibarr.de/
------------------------------------
Zusatzmodule
------------------------------------
* Die meisten externen Module/Themen sind über den offiziellen DoliStore verfügbar:
https://www.dolistore.com/de/

View File

@ -6,13 +6,14 @@ README (french)
Téléchargement
--------------------------------
* Dolibarr ERP/CRM can be downloaded at sourceforge:
http://sourceforge.net/projects/dolibarr/files
or from Dolibarr official web site:
* Dolibarr ERP/CRM peut être téléchargé sur sourceforge:
https://sourceforge.net/projects/dolibarr/files
ou sur le site officiel de Dolibarr:
https://www.dolibarr.org
* Most external modules are only available on DoliStore:
https://www.dolistore.org
* La plupart des modules externes ne sont disponibles que sur le DoliStore officiel:
https://www.dolistore.com
--------------------------------
@ -24,4 +25,4 @@ README-FR à la racine.
* Une documentation utilisateur francophone plus consistante est disponible en
ligne sur le wiki de Dolibarr à l'adresse:
https://wiki.dolibarr.org
https://wiki.dolibarr.org/index.php/Accueil

View File

@ -65,12 +65,12 @@ if (!$sortfield) $sortfield = "aa.account_number";
if (!$sortorder) $sortorder = "ASC";
$arrayfields = array(
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'aa.labelshort'=>array('label'=>$langs->trans("LabelToShow"), 'checked'=>1),
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1),
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
'aa.reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1),
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
'aa.reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1),
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
);
@ -93,24 +93,24 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook))
{
if (!empty($cancel)) $action = '';
if (!empty($cancel)) $action = '';
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 test are required to be compatible with all browsers
{
$search_account = "";
$search_label = "";
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
{
$search_account = "";
$search_label = "";
$search_labelshort = "";
$search_accountparent = "";
$search_pcgtype = "";
$search_pcgtype = "";
$search_array_options = array();
}
if ((GETPOST('valid_change_chart', 'alpha') && GETPOST('chartofaccounts', 'int') > 0) // explicit click on button 'Change and load' with js on
|| (GETPOST('chartofaccounts', 'int') > 0 && GETPOST('chartofaccounts', 'int') != $conf->global->CHARTOFACCOUNTS)) // a submit of form is done and chartofaccounts combo has been modified
{
if ($chartofaccounts > 0)
{
}
if ((GETPOST('valid_change_chart', 'alpha') && GETPOST('chartofaccounts', 'int') > 0) // explicit click on button 'Change and load' with js on
|| (GETPOST('chartofaccounts', 'int') > 0 && GETPOST('chartofaccounts', 'int') != $conf->global->CHARTOFACCOUNTS)) // a submit of form is done and chartofaccounts combo has been modified
{
if ($chartofaccounts > 0)
{
// Get language code for this $chartofaccounts
$sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_country as c, '.MAIN_DB_PREFIX.'accounting_system as a';
$sql .= ' WHERE c.rowid = a.fk_country AND a.rowid = '.(int) $chartofaccounts;
@ -147,34 +147,34 @@ if (empty($reshook))
}
}
if (!dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
$error++;
}
} else {
$error++;
}
}
if (!dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
$error++;
}
} else {
$error++;
}
}
if ($action == 'disable') {
if ($accounting->fetch($id)) {
$mode = GETPOST('mode', 'int');
$result = $accounting->accountDeactivate($id, $mode);
}
if ($action == 'disable') {
if ($accounting->fetch($id)) {
$mode = GETPOST('mode', 'int');
$result = $accounting->accountDeactivate($id, $mode);
}
$action = 'update';
if ($result < 0) {
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
} elseif ($action == 'enable') {
if ($accounting->fetch($id)) {
$mode = GETPOST('mode', 'int');
$result = $accounting->account_activate($id, $mode);
}
$action = 'update';
if ($result < 0) {
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
}
$action = 'update';
if ($result < 0) {
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
} elseif ($action == 'enable') {
if ($accounting->fetch($id)) {
$mode = GETPOST('mode', 'int');
$result = $accounting->account_activate($id, $mode);
}
$action = 'update';
if ($result < 0) {
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
}
}
@ -273,9 +273,9 @@ if ($resql)
if ($search_pcgtype) $param .= '&search_pcgtype='.urlencode($search_pcgtype);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
if (!empty($conf->use_javascript_ajax))
{
print '<!-- Add javascript to reload page when we click "Change plan" -->
if (!empty($conf->use_javascript_ajax))
{
print '<!-- Add javascript to reload page when we click "Change plan" -->
<script type="text/javascript">
$(document).ready(function () {
$("#change_chart").on("click", function (e) {
@ -285,7 +285,7 @@ if ($resql)
});
});
</script>';
}
}
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -296,48 +296,48 @@ if ($resql)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$newcardbutton .= dolGetButtonTitle($langs->trans("New"), $langs->trans("Addanaccount"), 'fa fa-plus-circle', './card.php?action=create');
$newcardbutton .= dolGetButtonTitle($langs->trans("New"), $langs->trans("Addanaccount"), 'fa fa-plus-circle', './card.php?action=create');
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
// Box to select active chart of account
print $langs->trans("Selectchartofaccounts")." : ";
print '<select class="flat" name="chartofaccounts" id="chartofaccounts">';
$sql = "SELECT a.rowid, a.pcg_version, a.label, a.active, c.code as country_code";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_system as a";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON a.fk_country = c.rowid AND c.active = 1";
$sql .= " WHERE a.active = 1";
dol_syslog('accountancy/admin/account.php $sql='.$sql);
print $sql;
$resqlchart = $db->query($sql);
if ($resqlchart) {
$numbis = $db->num_rows($resqlchart);
$i = 0;
while ($i < $numbis) {
$obj = $db->fetch_object($resqlchart);
print $langs->trans("Selectchartofaccounts")." : ";
print '<select class="flat" name="chartofaccounts" id="chartofaccounts">';
$sql = "SELECT a.rowid, a.pcg_version, a.label, a.active, c.code as country_code";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_system as a";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON a.fk_country = c.rowid AND c.active = 1";
$sql .= " WHERE a.active = 1";
dol_syslog('accountancy/admin/account.php $sql='.$sql);
print $sql;
$resqlchart = $db->query($sql);
if ($resqlchart) {
$numbis = $db->num_rows($resqlchart);
$i = 0;
while ($i < $numbis) {
$obj = $db->fetch_object($resqlchart);
print '<option value="'.$obj->rowid.'"';
print ($pcgver == $obj->rowid) ? ' selected' : '';
print '>'.$obj->pcg_version.' - '.$obj->label.' - ('.$obj->country_code.')</option>';
print '<option value="'.$obj->rowid.'"';
print ($pcgver == $obj->rowid) ? ' selected' : '';
print '>'.$obj->pcg_version.' - '.$obj->label.' - ('.$obj->country_code.')</option>';
$i++;
}
} else dol_print_error($db);
print "</select>";
print ajax_combobox("chartofaccounts");
print '<input type="'.(empty($conf->use_javascript_ajax) ? 'submit' : 'button').'" class="button" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
$i++;
}
} else dol_print_error($db);
print "</select>";
print ajax_combobox("chartofaccounts");
print '<input type="'.(empty($conf->use_javascript_ajax) ? 'submit' : 'button').'" class="button" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
print '<br>';
print '<br>';
print '<br>';
$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
$moreforfilter = '';
$massactionbutton = '';
$moreforfilter = '';
$massactionbutton = '';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
// Line for search fields
print '<tr class="liste_titre_filter">';
@ -358,7 +358,7 @@ if ($resql)
print '</td>';
print '</tr>';
print '<tr class="liste_titre">';
print '<tr class="liste_titre">';
if (!empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"], "aa.label", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['aa.labelshort']['checked'])) print_liste_field_titre($arrayfields['aa.labelshort']['label'], $_SERVER["PHP_SELF"], "aa.labelshort", "", $param, '', $sortfield, $sortorder);
@ -422,7 +422,7 @@ if ($resql)
print '<!-- obj->account_parent = '.$obj->account_parent.' obj->rowid2 = '.$obj->rowid2.' -->';
$accountparent->id = $obj->rowid2;
$accountparent->label = $obj->label2;
$accountparent->account_number = $obj->account_number2; // Sotre an account number for output
$accountparent->account_number = $obj->account_number2; // Sotre an account number for output
print $accountparent->getNomUrl(1);
print "</td>\n";
if (!$i) $totalarray['nbfield']++;

View File

@ -187,7 +187,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
}*/
}
if (isset($_POST["country"]) && ($_POST["country"] == '0') && ($id != 2))
if (GETPOSTISSET("country") && (GETPOST("country") == '0') && ($id != 2))
{
$ok = 0;
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors');
@ -472,13 +472,13 @@ if ($id)
if ($valuetoshow != '') {
print '<td class="'.$class.'">';
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
} elseif (!empty($tabhelp[$id][$value])) {
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
} else {
print $valuetoshow;
}
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
} elseif (!empty($tabhelp[$id][$value])) {
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
} else {
print $valuetoshow;
}
print '</td>';
}
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;
@ -609,7 +609,7 @@ if ($id)
if (empty($reshook)) fieldListAccountModel($fieldlist, $obj, $tabname[$id], 'edit');
print '<td colspan="3" class="right"><a name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'">&nbsp;</a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '&nbsp;<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
print '&nbsp;<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
} else {
$tmpaction = 'view';
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);

View File

@ -108,16 +108,16 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
setEventMessages($object->error, $object->errors, 'errors');
} elseif ($res < 0)
{
$error++;
setEventMessages($object->error, $object->errors, 'errors');
$action = "create";
$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;
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) {
@ -158,15 +158,15 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
$result = $object->update($user);
if ($result > 0) {
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id);
header("Location: ".$urltogo);
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id);
header("Location: ".$urltogo);
exit();
} else {
$mesg = $object->error;
}
} else {
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id);
header("Location: ".$urltogo);
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id);
header("Location: ".$urltogo);
exit();
}
} elseif ($action == 'delete' && $user->rights->accounting->chartofaccount) {
@ -238,26 +238,26 @@ if ($action == 'create') {
print $formaccounting->select_account($object->account_parent, 'account_parent', 1, null, 0, 0, 'minwidth200');
print '</td></tr>';
// Chart of accounts type
print '<tr><td>'.$langs->trans("Pcgtype").'</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 '</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
print '<tr><td>'.$langs->trans("Pcgtype").'</td>';
print '<td>';
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(isset($_POST['pcg_type']) ?GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
print '</td></tr>';
print '</table>';
dol_fiche_end();
print dol_get_fiche_end();
print '<div class="center">';
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>';
@ -300,26 +300,26 @@ if ($action == 'create') {
print $formaccounting->select_account($object->account_parent, 'account_parent', 1);
print '</td></tr>';
// Chart of accounts type
print '<tr><td>'.$langs->trans("Pcgtype").'</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 '</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
print '<tr><td>'.$langs->trans("Pcgtype").'</td>';
print '<td>';
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(isset($_POST['pcg_type']) ?GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
print '</td></tr>';
print '</table>';
dol_fiche_end();
print dol_get_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '<input type="submit" class="button button-save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
print '<input type="submit" name="cancel" class="button button-cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>';
@ -364,7 +364,7 @@ if ($action == 'create') {
print '</div>';
dol_fiche_end();
print dol_get_fiche_end();
/*
* Actions buttons

View File

@ -146,7 +146,7 @@ if (!empty($cat_id))
print '</table>';
dol_fiche_end();
print dol_get_fiche_end();
print '</form>';

File diff suppressed because it is too large Load Diff

View File

@ -39,8 +39,8 @@ $action = GETPOST('action', 'aZ09');
$list_account_main = array(
'ACCOUNTING_RESULT_PROFIT',
'ACCOUNTING_RESULT_LOSS'
'ACCOUNTING_RESULT_PROFIT',
'ACCOUNTING_RESULT_LOSS'
);
/*
@ -48,17 +48,17 @@ $list_account_main = array(
*/
if ($action == 'update') {
$error = 0;
$error = 0;
$defaultjournal = GETPOST('ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', 'alpha');
$defaultjournal = GETPOST('ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', 'alpha');
if (!empty($defaultjournal)) {
if (!dolibarr_set_const($db, 'ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', $defaultjournal, 'chaine', 0, '', $conf->entity)) {
$error++;
}
} else {
$error++;
}
if (!empty($defaultjournal)) {
if (!dolibarr_set_const($db, 'ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', $defaultjournal, 'chaine', 0, '', $conf->entity)) {
$error++;
}
} else {
$error++;
}
foreach ($list_account_main as $constname) {
$constvalue = GETPOST($constname, 'alpha');
@ -99,20 +99,20 @@ print '<input type="hidden" name="action" value="update">';
print '<table class="noborder centpercent">';
foreach ($list_account_main as $key) {
print '<tr class="oddeven value">';
// Param
$label = $langs->trans($key);
$keydesc = $key.'_Desc';
print '<tr class="oddeven value">';
// Param
$label = $langs->trans($key);
$keydesc = $key.'_Desc';
$htmltext = $langs->trans($keydesc);
print '<td class="fieldrequired" width="50%">';
print $form->textwithpicto($label, $htmltext);
print '</td>';
// Value
print '<td>'; // Do not force class=right, or it align also the content of the select box
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
print '</td>';
print '</tr>';
$htmltext = $langs->trans($keydesc);
print '<td class="fieldrequired" width="50%">';
print $form->textwithpicto($label, $htmltext);
print '</td>';
// Value
print '<td>'; // Do not force class=right, or it align also the content of the select box
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
print '</td>';
print '</tr>';
}
// Journal

View File

@ -45,7 +45,7 @@ $action = GETPOST('action', 'aZ09');
// Parameters ACCOUNTING_EXPORT_*
$main_option = array(
'ACCOUNTING_EXPORT_PREFIX_SPEC',
'ACCOUNTING_EXPORT_PREFIX_SPEC',
);
$configuration = AccountancyExport::getTypeConfig();
@ -58,22 +58,22 @@ $listcr = $configuration['cr'];
$model_option = array(
'1' => array(
'label' => 'ACCOUNTING_EXPORT_FORMAT',
'param' => $listformat,
),
'2' => array(
'label' => 'ACCOUNTING_EXPORT_SEPARATORCSV',
'param' => '',
),
'3' => array(
'label' => 'ACCOUNTING_EXPORT_ENDLINE',
'param' => $listcr,
),
'4' => array(
'label' => 'ACCOUNTING_EXPORT_DATE',
'param' => '',
),
'1' => array(
'label' => 'ACCOUNTING_EXPORT_FORMAT',
'param' => $listformat,
),
'2' => array(
'label' => 'ACCOUNTING_EXPORT_SEPARATORCSV',
'param' => '',
),
'3' => array(
'label' => 'ACCOUNTING_EXPORT_ENDLINE',
'param' => $listcr,
),
'4' => array(
'label' => 'ACCOUNTING_EXPORT_DATE',
'param' => '',
),
);
@ -105,22 +105,22 @@ if ($action == 'update') {
}
}
foreach ($listparam[$modelcsv] as $key => $value) {
$constante = $key;
foreach ($listparam[$modelcsv] as $key => $value) {
$constante = $key;
if (strpos($constante, 'ACCOUNTING') !== false) {
$constvalue = GETPOST($key, 'alpha');
if (!dolibarr_set_const($db, $constante, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
}
}
if (strpos($constante, 'ACCOUNTING') !== false) {
$constvalue = GETPOST($key, 'alpha');
if (!dolibarr_set_const($db, $constante, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
}
}
if (!$error) {
// reload
$configuration = AccountancyExport::getTypeConfig();
$listparam = $configuration['param'];
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
// reload
$configuration = AccountancyExport::getTypeConfig();
$listparam = $configuration['param'];
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
@ -148,36 +148,36 @@ print 'jQuery(document).ready(function () {'."\n";
print ' function initfields()'."\n";
print ' {'."\n";
foreach ($listparam as $key => $param) {
print ' if (jQuery("#ACCOUNTING_EXPORT_MODELCSV").val()=="'.$key.'")'."\n";
print ' {'."\n";
print ' //console.log("'.$param['label'].'");'."\n";
if (empty($param['ACCOUNTING_EXPORT_FORMAT'])) {
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$conf->global->ACCOUNTING_EXPORT_FORMAT.'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").prop("disabled", true);'."\n";
} else {
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$param['ACCOUNTING_EXPORT_FORMAT'].'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").removeAttr("disabled");'."\n";
}
if (empty($param['ACCOUNTING_EXPORT_SEPARATORCSV'])) {
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").prop("disabled", true);'."\n";
} else {
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("'.$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV.'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").removeAttr("disabled");'."\n";
}
if (empty($param['ACCOUNTING_EXPORT_ENDLINE'])) {
print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").prop("disabled", true);'."\n";
} else {
print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").removeAttr("disabled");'."\n";
}
if (empty($param['ACCOUNTING_EXPORT_DATE'])) {
print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_DATE").prop("disabled", true);'."\n";
} else {
print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("'.$conf->global->ACCOUNTING_EXPORT_DATE.'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_DATE").removeAttr("disabled");'."\n";
}
print ' }'."\n";
print ' if (jQuery("#ACCOUNTING_EXPORT_MODELCSV").val()=="'.$key.'")'."\n";
print ' {'."\n";
print ' //console.log("'.$param['label'].'");'."\n";
if (empty($param['ACCOUNTING_EXPORT_FORMAT'])) {
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$conf->global->ACCOUNTING_EXPORT_FORMAT.'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").prop("disabled", true);'."\n";
} else {
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$param['ACCOUNTING_EXPORT_FORMAT'].'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").removeAttr("disabled");'."\n";
}
if (empty($param['ACCOUNTING_EXPORT_SEPARATORCSV'])) {
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").prop("disabled", true);'."\n";
} else {
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("'.$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV.'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").removeAttr("disabled");'."\n";
}
if (empty($param['ACCOUNTING_EXPORT_ENDLINE'])) {
print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").prop("disabled", true);'."\n";
} else {
print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").removeAttr("disabled");'."\n";
}
if (empty($param['ACCOUNTING_EXPORT_DATE'])) {
print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_DATE").prop("disabled", true);'."\n";
} else {
print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("'.$conf->global->ACCOUNTING_EXPORT_DATE.'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_DATE").removeAttr("disabled");'."\n";
}
print ' }'."\n";
}
print ' }'."\n";
print ' initfields();'."\n";
@ -262,17 +262,17 @@ if ($num2) {
foreach ($model_option as $key) {
print '<tr class="oddeven value">';
// Param
$label = $key['label'];
// Param
$label = $key['label'];
print '<td width="50%">'.$langs->trans($label).'</td>';
// Value
print '<td>';
if (is_array($key['param'])) {
print $form->selectarray($label, $key['param'], $conf->global->$label, 0);
} else {
print '<input type="text" size="20" id="'.$label.'" name="'.$key['label'].'" value="'.$conf->global->$label.'">';
}
print '<td>';
if (is_array($key['param'])) {
print $form->selectarray($label, $key['param'], $conf->global->$label, 0);
} else {
print '<input type="text" size="20" id="'.$label.'" name="'.$key['label'].'" value="'.$conf->global->$label.'">';
}
print '</td></tr>';
}

View File

@ -113,7 +113,7 @@ if ($result)
$i = 0;
$addbutton .= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->rights->accounting->fiscalyear->write);
$addbutton .= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->rights->accounting->fiscalyear->write);
$title = $langs->trans('AccountingPeriods');

View File

@ -187,12 +187,12 @@ if ($action == 'create')
print '</table>';
dol_fiche_end();
print dol_get_fiche_end();
print '<div class="center">';
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>';
@ -241,14 +241,14 @@ if ($action == 'create')
print '</table>';
print '<br><div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '<input type="submit" class="button button-save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
print '<input type="submit" name="cancel" class="button button-cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>';
dol_fiche_end();
print dol_get_fiche_end();
} else {
/*
* Confirm delete
@ -296,7 +296,7 @@ if ($action == 'create')
print "</table>";
dol_fiche_end();
print dol_get_fiche_end();
if (!empty($user->rights->accounting->fiscalyear->write))
{

View File

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

View File

@ -420,15 +420,15 @@ if ($id)
$valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
$valuetoshow = $langs->trans($valuetoshow); // try to translate
$class = "left";
if ($fieldlist[$field] == 'code') {
$valuetoshow = $langs->trans("Code");
}
if ($fieldlist[$field] == 'code') {
$valuetoshow = $langs->trans("Code");
}
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
$valuetoshow = $langs->trans("Label");
}
if ($fieldlist[$field] == 'nature') {
$valuetoshow = $langs->trans("NatureOfJournal");
}
if ($fieldlist[$field] == 'nature') {
$valuetoshow = $langs->trans("NatureOfJournal");
}
if ($valuetoshow != '') {
print '<td class="'.$class.'">';
@ -540,14 +540,14 @@ if ($id)
$valuetoshow = ucfirst($fieldlist[$field]); // By defaut
$valuetoshow = $langs->trans($valuetoshow); // try to translate
if ($fieldlist[$field] == 'code') {
$valuetoshow = $langs->trans("Code");
}
$valuetoshow = $langs->trans("Code");
}
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
$valuetoshow = $langs->trans("Label");
}
$valuetoshow = $langs->trans("Label");
}
if ($fieldlist[$field] == 'nature') {
$valuetoshow = $langs->trans("NatureOfJournal");
}
$valuetoshow = $langs->trans("NatureOfJournal");
}
// Affiche nom du champ
if ($showfield) {
@ -582,7 +582,7 @@ if ($id)
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
print '</td>';
} else {
@ -594,7 +594,7 @@ if ($id)
if (empty($reshook))
{
$langs->load("accountancy");
$langs->load("accountancy");
foreach ($fieldlist as $field => $value)
{
$showfield = 1;
@ -607,7 +607,7 @@ if ($id)
$valuetoshow = ($obj->nature && $key != "AccountingJournalType".strtoupper($langs->trans($obj->nature)) ? $key : $obj->{$fieldlist[$field]});
} elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') {
$valuetoshow = $langs->trans($obj->label);
}
}
$class = 'tddict';
// Show value for field
@ -619,15 +619,15 @@ if ($id)
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
if (isset($obj->code) && $id != 10) {
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
$iserasable = 0;
$canbedisabled = 0;
} elseif ($obj->code == 'RECEP') {
$iserasable = 0;
$canbedisabled = 0;
} elseif ($obj->code == 'EF0') {
$iserasable = 0;
$canbedisabled = 0;
}
$iserasable = 0;
$canbedisabled = 0;
} elseif ($obj->code == 'RECEP') {
$iserasable = 0;
$canbedisabled = 0;
} elseif ($obj->code == 'EF0') {
$iserasable = 0;
$canbedisabled = 0;
}
}
$canbemodified = $iserasable;

View File

@ -42,7 +42,7 @@ if (empty($conf->accounting->enabled)) {
accessforbidden();
}
if (!$user->rights->accounting->bind->write)
accessforbidden();
accessforbidden();
// search & action GETPOST
$action = GETPOST('action', 'aZ09');
@ -100,14 +100,14 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
{
$search_ref = '';
$search_label = '';
$search_desc = '';
$search_ref = '';
$search_label = '';
$search_desc = '';
$search_vat = '';
$search_onsell = '';
$search_onpurchase = '';
$search_current_account = '';
$search_current_account_valid = '-1';
$search_onsell = '';
$search_onpurchase = '';
$search_current_account = '';
$search_current_account_valid = '-1';
}
// Sales or Purchase mode ?
@ -117,8 +117,8 @@ if ($action == 'update') {
$accounting_product_modes = array(
'ACCOUNTANCY_SELL',
'ACCOUNTANCY_SELL_INTRA',
'ACCOUNTANCY_SELL_EXPORT',
'ACCOUNTANCY_SELL_INTRA',
'ACCOUNTANCY_SELL_EXPORT',
'ACCOUNTANCY_BUY',
'ACCOUNTANCY_BUY_INTRA',
'ACCOUNTANCY_BUY_EXPORT'
@ -172,22 +172,22 @@ if ($action == 'update') {
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
$sql .= " SET accountancy_code_sell = ".$accounting->account_number;
}
if ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
$sql .= " SET accountancy_code_sell_intra = ".$accounting->account_number;
}
if ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
$sql .= " SET accountancy_code_sell_export = ".$accounting->account_number;
}
if ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
$sql .= " SET accountancy_code_sell_intra = ".$accounting->account_number;
}
if ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
$sql .= " SET accountancy_code_sell_export = ".$accounting->account_number;
}
$sql .= " WHERE rowid = ".((int) $productid);
dol_syslog("/accountancy/admin/productaccount.php sql=".$sql, LOG_DEBUG);
if ($db->query($sql))
{
$ok++;
$db->commit();
$ok++;
$db->commit();
} else {
$ko++;
$db->rollback();
$ko++;
$db->rollback();
}
}
@ -253,7 +253,7 @@ $sql .= " aa.rowid as aaid";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON";
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
$sql .= " p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'";
$sql .= " p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA')
{
$sql .= " p.accountancy_code_buy_intra = aa.account_number AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'";
@ -271,9 +271,9 @@ if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
}
$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_buy", $search_current_account);
}
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_buy", $search_current_account);
}
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_buy_intra", $search_current_account);
@ -283,17 +283,17 @@ if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
$sql .= natural_search("p.accountancy_code_buy_export", $search_current_account);
}
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_sell", $search_current_account);
}
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_sell", $search_current_account);
}
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_sell_intra", $search_current_account);
}
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_sell_intra", $search_current_account);
}
} else {
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_sell_export", $search_current_account);
}
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_sell_export", $search_current_account);
}
}
if ($search_current_account_valid == 'withoutvalidaccount')
{
@ -301,7 +301,7 @@ if ($search_current_account_valid == 'withoutvalidaccount')
}
if ($search_current_account_valid == 'withvalidaccount')
{
$sql .= " AND aa.account_number IS NOT NULL";
$sql .= " AND aa.account_number IS NOT NULL";
}
// Add search filter like
if (strlen(trim($search_ref))) {
@ -324,13 +324,13 @@ $sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
$offset = 0;
}
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
$offset = 0;
}
}
$sql .= $db->plimit($limit + 1, $offset);
@ -342,32 +342,32 @@ if ($result)
$num = $db->num_rows($result);
$i = 0;
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($search_ref > 0) $param .= "&search_desc=".urlencode($search_ref);
if ($search_label > 0) $param .= "&search_desc=".urlencode($search_label);
if ($search_desc > 0) $param .= "&search_desc=".urlencode($search_desc);
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($search_ref > 0) $param .= "&search_desc=".urlencode($search_ref);
if ($search_label > 0) $param .= "&search_desc=".urlencode($search_label);
if ($search_desc > 0) $param .= "&search_desc=".urlencode($search_desc);
if ($search_vat > 0) $param .= '&search_vat='.urlencode($search_vat);
if ($search_current_account > 0) $param .= "&search_current_account=".urlencode($search_current_account);
if ($search_current_account_valid && $search_current_account_valid != '-1') $param .= "&search_current_account_valid=".urlencode($search_current_account_valid);
if ($accounting_product_mode) $param .= '&accounting_product_mode='.urlencode($accounting_product_mode);
if ($search_current_account > 0) $param .= "&search_current_account=".urlencode($search_current_account);
if ($search_current_account_valid && $search_current_account_valid != '-1') $param .= "&search_current_account_valid=".urlencode($search_current_account_valid);
if ($accounting_product_mode) $param .= '&accounting_product_mode='.urlencode($accounting_product_mode);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy');
print load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy');
print '<br>';
print '<span class="opacitymedium">'.$langs->trans("InitAccountancyDesc").'</span><br>';
print '<br>';
// Select mode
// Select mode
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Options').'</td><td>'.$langs->trans('Description').'</td>';
@ -377,13 +377,13 @@ if ($result)
print "</td></tr>\n";
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 '<td>'.$langs->trans('OptionModeProductSellIntraDesc');
print "</td></tr>\n";
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 '<td>'.$langs->trans('OptionModeProductSellIntraDesc');
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 '<td>'.$langs->trans('OptionModeProductSellExportDesc');
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 '<td>'.$langs->trans('OptionModeProductSellExportDesc');
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 '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
if ($mysoc->isInEEC())
@ -405,8 +405,8 @@ if ($result)
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$buttonsave = '<input type="submit" class="button" id="changeaccount" name="changeaccount" value="'.$langs->trans("Save").'">';
//print '<br><div class="center">'.$buttonsave.'</div>';
$buttonsave = '<input type="submit" class="button button-save" id="changeaccount" name="changeaccount" value="'.$langs->trans("Save").'">';
//print '<br><div class="center">'.$buttonsave.'</div>';
$texte = $langs->trans("ListOfProductsServices");
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $buttonsave, $num, $nbtotalofrecords, '', 0, '', '', $limit, 0, 0, 1);
@ -444,22 +444,22 @@ if ($result)
print '<tr class="liste_titre">';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
if (!empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
if (!empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "p.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
// On sell / On purchase
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_sell";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_sell_intra";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_sell_export";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_buy";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_sell";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_sell_intra";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_sell_export";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_buy";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_buy_intra";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
@ -475,8 +475,8 @@ if ($result)
$product_static = new Product($db);
$i = 0;
while ($i < min($num, $limit))
{
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
// Ref produit as link
@ -494,12 +494,12 @@ if ($result)
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell;
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell_intra;
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell_intra;
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell_export;
} else {
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell_export;
} else {
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell;
}
@ -560,11 +560,11 @@ if ($result)
if (!empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC))
{
// TODO ADJUST DESCRIPTION SIZE
// print '<td class="left">' . $obj->description . '</td>';
// TODO: we should set a user defined value to adjust user square / wide screen size
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print '<td>'.nl2br(dol_trunc($obj->description, $trunclength)).'</td>';
// TODO ADJUST DESCRIPTION SIZE
// print '<td class="left">' . $obj->description . '</td>';
// TODO: we should set a user defined value to adjust user square / wide screen size
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print '<td>'.nl2br(dol_trunc($obj->description, $trunclength)).'</td>';
}
// VAT
@ -581,36 +581,36 @@ if ($result)
// Current accounting account
print '<td class="left">';
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
print length_accountg($obj->accountancy_code_buy);
if ($obj->accountancy_code_buy && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
print length_accountg($obj->accountancy_code_buy);
if ($obj->accountancy_code_buy && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
print length_accountg($obj->accountancy_code_buy_intra);
if ($obj->accountancy_code_buy_intra && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
print length_accountg($obj->accountancy_code_buy_export);
if ($obj->accountancy_code_buy_export && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
print length_accountg($obj->accountancy_code_sell);
if ($obj->accountancy_code_sell && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
print length_accountg($obj->accountancy_code_sell_intra);
if ($obj->accountancy_code_sell_intra && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
print length_accountg($obj->accountancy_code_buy_intra);
if ($obj->accountancy_code_buy_intra && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
print length_accountg($obj->accountancy_code_buy_export);
if ($obj->accountancy_code_buy_export && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
print length_accountg($obj->accountancy_code_sell);
if ($obj->accountancy_code_sell && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
print length_accountg($obj->accountancy_code_sell_intra);
if ($obj->accountancy_code_sell_intra && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} else {
print length_accountg($obj->accountancy_code_sell_export);
if ($obj->accountancy_code_sell_export && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
}
print length_accountg($obj->accountancy_code_sell_export);
if ($obj->accountancy_code_sell_export && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
}
print '</td>';
// New account to set
$defaultvalue = '';
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
// Accounting account buy
// Accounting account buy
print '<td class="left">';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
if (empty($defaultvalue)) $defaultvalue = $compta_prodbuy;
$codesell = length_accountg($obj->accountancy_code_buy);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
// Accounting account buy intra (In EEC)
@ -620,7 +620,7 @@ if ($result)
$codesell = length_accountg($obj->accountancy_code_buy_intra);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
// Accounting account buy export (Out of EEC)
@ -630,7 +630,7 @@ if ($result)
$codesell = length_accountg($obj->accountancy_code_buy_export);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
// Accounting account sell
@ -640,32 +640,32 @@ if ($result)
$codesell = length_accountg($obj->accountancy_code_sell);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
// Accounting account sell intra (In EEC)
print '<td class="left">';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
$codesell = length_accountg($obj->accountancy_code_sell_intra);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
print '</td>';
} else {
// Accounting account sell export (Out of EEC)
print '<td class="left">';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
$codesell = length_accountg($obj->accountancy_code_sell_export);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
print '</td>';
}
// Accounting account sell intra (In EEC)
print '<td class="left">';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
$codesell = length_accountg($obj->accountancy_code_sell_intra);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print '</td>';
} else {
// Accounting account sell export (Out of EEC)
print '<td class="left">';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
$codesell = length_accountg($obj->accountancy_code_sell_export);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1, 0, 'maxwidth300 maxwidthonsmartphone productforselect');
print '</td>';
}
// Checkbox select
print '<td class="center">';
print '<input type="checkbox" class="checkforselect" name="chk_prod[]" value="'.$obj->rowid.'"/></td>';
print '<input type="checkbox" class="checkforselect productforselectcodeventil_'.$product_static->id.'" name="chk_prod[]" value="'.$obj->rowid.'"/></td>';
print "</tr>";
$i++;
}
@ -689,7 +689,17 @@ if ($result)
if (atleastoneselected) jQuery("#changeaccount").attr(\'class\',\'button\');
else jQuery("#changeaccount").attr(\'class\',\'button\');
}
jQuery(".checkforselect, #checkallactions").click(function() {
jQuery(".checkforselect").change(function() {
init_savebutton();
});
jQuery(".productforselect").change(function() {
console.log($(this).attr("id")+" "+$(this).val());
if ($(this).val() && $(this).val() != -1) {
$(".productforselect"+$(this).attr("id")).prop(\'checked\', true);
} else {
$(".productforselect"+$(this).attr("id")).prop(\'checked\', false);
}
init_savebutton();
});

View File

@ -105,7 +105,7 @@ $title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger');
llxHeader('', $title);
// Customer
$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '0' as type, sa.entity";
$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '1' as type, sa.entity";
$sql .= " FROM ".MAIN_DB_PREFIX."societe sa";
$sql .= " WHERE sa.entity IN (".getEntity('societe').")";
$sql .= " AND sa.code_compta <> ''";
@ -148,7 +148,7 @@ if (!empty($search_type) && $search_type >= 0) $sql .= " HAVING type LIKE '".$db
// Supplier
$sql .= " UNION ";
$sql .= " SELECT sa.rowid, sa.nom as label, sa.code_compta_fournisseur as subaccount, '1' as type, sa.entity FROM ".MAIN_DB_PREFIX."societe sa";
$sql .= " SELECT sa.rowid, sa.nom as label, sa.code_compta_fournisseur as subaccount, '2' as type, sa.entity FROM ".MAIN_DB_PREFIX."societe sa";
$sql .= " WHERE sa.entity IN (".getEntity('societe').")";
$sql .= " AND sa.code_compta_fournisseur <> ''";
//print $sql;
@ -190,7 +190,7 @@ if (!empty($search_type) && $search_type >= 0) $sql .= " HAVING type LIKE '".$db
// User
$sql .= " UNION ";
$sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '2' as type, u.entity FROM ".MAIN_DB_PREFIX."user u";
$sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '3' as type, u.entity FROM ".MAIN_DB_PREFIX."user u";
$sql .= " WHERE u.entity IN (".getEntity('user').")";
$sql .= " AND u.accountancy_code <> ''";
//print $sql;
@ -287,7 +287,7 @@ if ($resql)
print '<tr class="liste_titre_filter">';
if (!empty($arrayfields['subaccount']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_subaccount" value="'.$search_subaccount.'"></td>';
if (!empty($arrayfields['label']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="'.$search_label.'"></td>';
if (!empty($arrayfields['type']['checked'])) print '<td class="liste_titre center">'.$form->selectarray('search_type', array('0'=>$langs->trans('Customer'), '1'=>$langs->trans('Supplier'), '2'=>$langs->trans('Employee')), $search_type, 1).'</td>';
if (!empty($arrayfields['type']['checked'])) print '<td class="liste_titre center">'.$form->selectarray('search_type', array('1'=>$langs->trans('Customer'), '2'=>$langs->trans('Supplier'), '3'=>$langs->trans('Employee')), $search_type, 1).'</td>';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (!empty($arrayfields['reconcilable']['checked'])) print '<td class="liste_titre">&nbsp;</td>'; }
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
@ -335,17 +335,17 @@ if ($resql)
print '<td class="center">';
$s = '';
// Customer
if ($obj->type == 0)
if ($obj->type == 1)
{
$s .= '<a class="customer-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->rowid.'">'.$langs->trans("Customer").'</a>';
}
// Supplier
elseif ($obj->type == 1)
elseif ($obj->type == 2)
{
$s .= '<a class="vendor-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->rowid.'">'.$langs->trans("Supplier").'</a>';
}
// User
elseif ($obj->type == 2)
elseif ($obj->type == 3)
{
$s .= '<a class="user-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->id.'">'.$langs->trans("Employee").'</a>';
}
@ -378,17 +378,17 @@ if ($resql)
print '<td class="center">';
$e = '';
// Customer
if ($obj->type == 0)
if ($obj->type == 1)
{
$e .= '<a class="editfielda" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
}
// Supplier
elseif ($obj->type == 1)
elseif ($obj->type == 2)
{
$e .= '<a class="editfielda" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
}
// User
elseif ($obj->type == 2)
elseif ($obj->type == 3)
{
$e .= '<a class="editfielda" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?action=edit&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
}

View File

@ -78,7 +78,7 @@ $form = new Form($db);
if (empty($search_date_start) && !GETPOSTISSET('formfilteraction'))
{
$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);
$res = $db->query($sql);
if ($res->num_rows > 0) {
@ -227,8 +227,8 @@ if ($action != 'export_csv')
$moreforfilter .= $form->selectDate($search_date_end ? $search_date_end : -1, 'date_end', 0, 0, 1, '', 1, 0);
$moreforfilter .= ' - ';
$moreforfilter .= $langs->trans('ShowSubtotalByGroup').': ';
$moreforfilter .= '<input type="checkbox" name="show_subgroup" value="show_subgroup"'.($show_subgroup == 'show_subgroup' ? ' checked' : '').'>';
$moreforfilter .= '<label for="show_subgroup">'.$langs->trans('ShowSubtotalByGroup').'</label>: ';
$moreforfilter .= '<input type="checkbox" name="show_subgroup" id="show_subgroup" value="show_subgroup"'.($show_subgroup == 'show_subgroup' ? ' checked' : '').'>';
$moreforfilter .= '</div>';
@ -242,10 +242,12 @@ if ($action != 'export_csv')
print '</div>';
}
$colspan = (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE) ? 5 : 4);
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
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 $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, '');
print ' ';
@ -261,7 +263,7 @@ if ($action != 'export_csv')
print '<tr class="liste_titre">';
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("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder);
@ -272,74 +274,99 @@ if ($action != 'export_csv')
$total_credit = 0;
$sous_total_debit = 0;
$sous_total_credit = 0;
$total_opening_balance = 0;
$sous_total_opening_balance = 0;
$displayed_account = "";
$accountingaccountstatic = new AccountingAccount($db);
$accountingaccountstatic = new AccountingAccount($db);
$sql = "SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance";
$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";
// TODO Debug - This feature is dangerous, it takes all the entries and adds all the accounts
// without time and class limits (Class 6 and 7 accounts ???) and does not take into account the "a-nouveau" journal.
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
$sql = "SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance";
$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);
$nrows = $resql->num_rows;
$opening_balances = array();
for ($i = 0; $i < $nrows; $i++) {
$arr = $resql->fetch_array();
$opening_balances["'".$arr['numero_compte']."'"] = $arr['opening_balance'];
$resql = $db->query($sql);
$nrows = $resql->num_rows;
$opening_balances = array();
for ($i = 0; $i < $nrows; $i++) {
$arr = $resql->fetch_array();
$opening_balances["'" . $arr['numero_compte'] . "'"] = $arr['opening_balance'];
}
}
foreach ($object->lines as $line)
{
$accountingaccountstatic->fetch(null, $line->numero_compte, true);
if (!empty($accountingaccountstatic->account_number)) {
$accounting_account = $accountingaccountstatic->getNomUrl(0, 1);
} else {
$accounting_account = length_accountg($line->numero_compte);
}
// reset before the fetch (in case of the fetch fails)
$accountingaccountstatic->id = 0;
$accountingaccountstatic->account_number = '';
$accountingaccountstatic->fetch(null, $line->numero_compte, true);
if (!empty($accountingaccountstatic->account_number)) {
$accounting_account = $accountingaccountstatic->getNomUrl(0, 1);
} else {
$accounting_account = length_accountg($line->numero_compte);
}
$link = '';
$total_debit += $line->debit;
$total_credit += $line->credit;
$root_account_description = $object->get_compte_racine($line->numero_compte);
if (empty($accountingaccountstatic->account_number)) {
$link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?action=create&accountingaccount='.length_accountg($line->numero_compte).'">'.img_edit_add().'</a>';
$opening_balance = isset($opening_balances["'".$line->numero_compte."'"]) ? $opening_balances["'".$line->numero_compte."'"] : 0;
$total_opening_balance += $opening_balance;
$tmparrayforrootaccount = $object->getRootAccount($line->numero_compte);
$root_account_description = $tmparrayforrootaccount['label'];
$root_account_number = $tmparrayforrootaccount['account_number'];
if (empty($accountingaccountstatic->label) && $accountingaccountstatic->id > 0) {
$link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?action=update&token='.newToken().'&id='.$accountingaccountstatic->id.'">'.img_edit().'</a>';
}
print '<tr class="oddeven">';
if (!empty($show_subgroup))
{
// Show accounting account
if (empty($displayed_account) || $root_account_description != $displayed_account) {
if (empty($displayed_account) || $root_account_number != $displayed_account) {
// Show subtotal per accounting account
if ($displayed_account != "") {
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_credit).'</td>';
print '<td class="nowrap right">'.price(price2num($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 '</tr>';
}
// Show first line of a break
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>';
$displayed_account = $root_account_description;
$displayed_account = $root_account_number;
$sous_total_debit = 0;
$sous_total_credit = 0;
$sous_total_opening_balance = 0;
}
}
// $object->get_compte_racine($line->numero_compte);
print '<tr class="oddeven">';
print '<td>'.$accounting_account.'</td>';
print '<td class="nowraponall right">'.price($opening_balances["'".$line->numero_compte."'"]).'</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->credit).'</td>';
print '<td class="nowraponall right">'.price(price2num($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>';
print "</tr>\n";
@ -347,16 +374,33 @@ if ($action != 'export_csv')
// Records the sub-total
$sous_total_debit += $line->debit;
$sous_total_credit += $line->credit;
$sous_total_opening_balance += $opening_balance;
}
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_debit - $sous_total_credit)).'</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 '</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_debit - $total_credit)).'</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 '</tr>';

View File

@ -3,7 +3,7 @@
* Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
* it under the terms of the GNU General Public License as published by
@ -114,12 +114,12 @@ if ($action == "confirm_update") {
$object->credit = $credit;
if (floatval($debit) != 0.0) {
$object->montant = $debit; // deprecated
$object->montant = $debit; // deprecated
$object->amount = $debit;
$object->sens = 'D';
}
if (floatval($credit) != 0.0) {
$object->montant = $credit; // deprecated
$object->montant = $credit; // deprecated
$object->amount = $credit;
$object->sens = 'C';
}
@ -128,8 +128,7 @@ if ($action == "confirm_update") {
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
if ($mode != '_tmp')
{
if ($mode != '_tmp') {
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
}
@ -165,23 +164,23 @@ if ($action == "confirm_update") {
$object->label_operation = $label_operation;
$object->debit = $debit;
$object->credit = $credit;
$object->doc_date = GETPOST('doc_date', 'alpha');
$object->doc_type = GETPOST('doc_type', 'alpha');
$object->doc_date = (string) GETPOST('doc_date', 'alpha');
$object->doc_type = (string) GETPOST('doc_type', 'alpha');
$object->piece_num = $piece_num;
$object->doc_ref = GETPOST('doc_ref', 'alpha');
$object->doc_ref = (string) GETPOST('doc_ref', 'alpha');
$object->code_journal = $journal_code;
$object->journal_label = $journal_label;
$object->fk_doc = (int) GETPOST('fk_doc', 'int');
$object->fk_docdet = (int) GETPOST('fk_docdet', 'int');
$object->fk_doc = GETPOSTINT('fk_doc');
$object->fk_docdet = GETPOSTINT('fk_docdet');
if (floatval($debit) != 0.0) {
$object->montant = $debit; // deprecated
$object->montant = $debit; // deprecated
$object->amount = $debit;
$object->sens = 'D';
}
if (floatval($credit) != 0.0) {
$object->montant = $credit; // deprecated
$object->montant = $credit; // deprecated
$object->amount = $credit;
$object->sens = 'C';
}
@ -190,8 +189,7 @@ if ($action == "confirm_update") {
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
if ($mode != '_tmp')
{
if ($mode != '_tmp') {
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
}
@ -245,7 +243,7 @@ if ($action == "confirm_update") {
$object->journal_label = $journal_label;
$object->fk_doc = 0;
$object->fk_docdet = 0;
$object->montant = 0; // deprecated
$object->montant = 0; // deprecated
$object->amount = 0;
$result = $object->createStd($user, 0, $mode);
@ -386,12 +384,12 @@ if ($action == 'create')
print '</table>';
dol_fiche_end();
print dol_get_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Create").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="button" value="'.$langs->trans("Cancel").'" class="button" onclick="history.go(-1)" />';
print '<input type="button" value="'.$langs->trans("Cancel").'" class="button button-cancel" onclick="history.go(-1)" />';
print '</div>';
print '</form>';
@ -573,7 +571,7 @@ if ($action == 'create')
print '</div></div><!-ee-->';
dol_fiche_end();
print dol_get_fiche_end();
print '<div style="clear:both"></div>';
@ -707,7 +705,7 @@ if ($action == 'create')
}
print ' &nbsp; ';
print '<a class="button" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">'.$langs->trans("Cancel").'</a>';
print '<a class="button button-cancel" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">'.$langs->trans("Cancel").'</a>';
print "</div>";
}
@ -719,7 +717,7 @@ if ($action == 'create')
}
}
dol_fiche_end();
print dol_get_fiche_end();
// End of page
llxFooter();

View File

@ -85,7 +85,7 @@ $search_mvt_label = GETPOST('search_mvt_label', 'alpha');
$search_direction = GETPOST('search_direction', 'alpha');
$search_debit = GETPOST('search_debit', '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_not_reconciled = GETPOST('search_reconciled_option', 'alpha');
@ -108,7 +108,7 @@ $hookmanager->initHooks(array('bookkeepinglist'));
$formaccounting = new FormAccounting($db);
$form = new Form($db);
if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !isset($_POST['formfilteraction']) && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->rights->accounting->mouvements->export)
if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->rights->accounting->mouvements->export)
{
if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values'))
{
@ -151,7 +151,7 @@ $arrayfields = array(
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
);
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']);
@ -176,145 +176,147 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
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
{
$search_mvt_num = '';
$search_doc_type = '';
$search_doc_ref = '';
$search_doc_date = '';
$search_accountancy_code = '';
$search_accountancy_code_start = '';
$search_accountancy_code_end = '';
$search_accountancy_aux_code = '';
$search_accountancy_aux_code_start = '';
$search_accountancy_aux_code_end = '';
$search_mvt_label = '';
$search_direction = '';
$search_ledger_code = '';
$search_date_start = '';
$search_date_end = '';
$search_date_creation_start = '';
$search_date_creation_end = '';
$search_date_modification_start = '';
$search_date_modification_end = '';
$search_date_export_start = '';
$search_date_export_end = '';
$search_debit = '';
$search_credit = '';
$search_lettering_code = '';
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
$search_mvt_num = '';
$search_doc_type = '';
$search_doc_ref = '';
$search_doc_date = '';
$search_accountancy_code = '';
$search_accountancy_code_start = '';
$search_accountancy_code_end = '';
$search_accountancy_aux_code = '';
$search_accountancy_aux_code_start = '';
$search_accountancy_aux_code_end = '';
$search_mvt_label = '';
$search_direction = '';
$search_ledger_code = array();
$search_date_start = '';
$search_date_end = '';
$search_date_creation_start = '';
$search_date_creation_end = '';
$search_date_modification_start = '';
$search_date_modification_end = '';
$search_date_export_start = '';
$search_date_export_end = '';
$search_debit = '';
$search_credit = '';
$search_lettering_code = '';
$search_not_reconciled = '';
}
}
// Must be after the remove filter action, before the export.
$param = '';
$filter = array();
if (!empty($search_date_start)) {
$filter['t.doc_date>='] = $search_date_start;
$tmp = dol_getdate($search_date_start);
$param .= '&search_date_startmonth='.urlencode($tmp['mon']).'&search_date_startday='.urlencode($tmp['mday']).'&search_date_startyear='.urlencode($tmp['year']);
}
if (!empty($search_date_end)) {
$filter['t.doc_date<='] = $search_date_end;
$tmp = dol_getdate($search_date_end);
$param .= '&search_date_endmonth='.urlencode($tmp['mon']).'&search_date_endday='.urlencode($tmp['mday']).'&search_date_endyear='.urlencode($tmp['year']);
}
if (!empty($search_doc_date)) {
$filter['t.doc_date'] = $search_doc_date;
$tmp = dol_getdate($search_doc_date);
$param .= '&doc_datemonth='.urlencode($tmp['mon']).'&doc_dateday='.urlencode($tmp['mday']).'&doc_dateyear='.urlencode($tmp['year']);
}
if (!empty($search_doc_type)) {
$filter['t.doc_type'] = $search_doc_type;
$param .= '&search_doc_type='.urlencode($search_doc_type);
}
if (!empty($search_doc_ref)) {
$filter['t.doc_ref'] = $search_doc_ref;
$param .= '&search_doc_ref='.urlencode($search_doc_ref);
}
if (!empty($search_accountancy_code)) {
$filter['t.numero_compte'] = $search_accountancy_code;
$param .= '&search_accountancy_code='.urlencode($search_accountancy_code);
}
if (!empty($search_accountancy_code_start)) {
$filter['t.numero_compte>='] = $search_accountancy_code_start;
$param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
}
if (!empty($search_accountancy_code_end)) {
$filter['t.numero_compte<='] = $search_accountancy_code_end;
$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
}
if (!empty($search_accountancy_aux_code)) {
$filter['t.subledger_account'] = $search_accountancy_aux_code;
$param .= '&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code);
}
if (!empty($search_accountancy_aux_code_start)) {
$filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
$param .= '&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start);
}
if (!empty($search_accountancy_aux_code_end)) {
$filter['t.subledger_account<='] = $search_accountancy_aux_code_end;
$param .= '&search_accountancy_aux_code_end='.urlencode($search_accountancy_aux_code_end);
}
if (!empty($search_mvt_label)) {
$filter['t.label_operation'] = $search_mvt_label;
$param .= '&search_mvt_label='.urlencode($search_mvt_label);
}
if (!empty($search_direction)) {
$filter['t.sens'] = $search_direction;
$param .= '&search_direction='.urlencode($search_direction);
}
if (!empty($search_ledger_code)) {
$filter['t.code_journal'] = $search_ledger_code;
$param .= '&search_ledger_code='.urlencode($search_ledger_code);
}
if (!empty($search_mvt_num)) {
$filter['t.piece_num'] = $search_mvt_num;
$param .= '&search_mvt_num='.urlencode($search_mvt_num);
}
if (!empty($search_date_creation_start)) {
$filter['t.date_creation>='] = $search_date_creation_start;
$tmp = dol_getdate($search_date_creation_start);
$param .= '&date_creation_startmonth='.urlencode($tmp['mon']).'&date_creation_startday='.urlencode($tmp['mday']).'&date_creation_startyear='.urlencode($tmp['year']);
}
if (!empty($search_date_creation_end)) {
$filter['t.date_creation<='] = $search_date_creation_end;
$tmp = dol_getdate($search_date_creation_end);
$param .= '&date_creation_endmonth='.urlencode($tmp['mon']).'&date_creation_endday='.urlencode($tmp['mday']).'&date_creation_endyear='.urlencode($tmp['year']);
}
if (!empty($search_date_modification_start)) {
$filter['t.tms>='] = $search_date_modification_start;
$tmp = dol_getdate($search_date_modification_start);
$param .= '&date_modification_startmonth='.urlencode($tmp['mon']).'&date_modification_startday='.urlencode($tmp['mday']).'&date_modification_startyear='.urlencode($tmp['year']);
}
if (!empty($search_date_modification_end)) {
$filter['t.tms<='] = $search_date_modification_end;
$tmp = dol_getdate($search_date_modification_end);
$param .= '&date_modification_endmonth='.urlencode($tmp['mon']).'&date_modification_endday='.urlencode($tmp['mday']).'&date_modification_endyear='.urlencode($tmp['year']);
}
if (!empty($search_date_export_start)) {
$filter['t.date_export>='] = $search_date_export_start;
$tmp = dol_getdate($search_date_export_start);
$param .= '&date_export_startmonth='.urlencode($tmp['mon']).'&date_export_startday='.urlencode($tmp['mday']).'&date_export_startyear='.urlencode($tmp['year']);
}
if (!empty($search_date_export_end)) {
$filter['t.date_export<='] = $search_date_export_end;
$tmp = dol_getdate($search_date_export_end);
$param .= '&date_export_endmonth='.urlencode($tmp['mon']).'&date_export_endday='.urlencode($tmp['mday']).'&date_export_endyear='.urlencode($tmp['year']);
}
if (!empty($search_debit)) {
$filter['t.debit'] = $search_debit;
$param .= '&search_debit='.urlencode($search_debit);
}
if (!empty($search_credit)) {
$filter['t.credit'] = $search_credit;
$param .= '&search_credit='.urlencode($search_credit);
}
if (!empty($search_lettering_code)) {
$filter['t.lettering_code'] = $search_lettering_code;
$param .= '&search_lettering_code='.urlencode($search_lettering_code);
}
// Must be after the remove filter action, before the export.
$param = '';
$filter = array();
if (!empty($search_date_start)) {
$filter['t.doc_date>='] = $search_date_start;
$tmp = dol_getdate($search_date_start);
$param .= '&search_date_startmonth='.urlencode($tmp['mon']).'&search_date_startday='.urlencode($tmp['mday']).'&search_date_startyear='.urlencode($tmp['year']);
}
if (!empty($search_date_end)) {
$filter['t.doc_date<='] = $search_date_end;
$tmp = dol_getdate($search_date_end);
$param .= '&search_date_endmonth='.urlencode($tmp['mon']).'&search_date_endday='.urlencode($tmp['mday']).'&search_date_endyear='.urlencode($tmp['year']);
}
if (!empty($search_doc_date)) {
$filter['t.doc_date'] = $search_doc_date;
$tmp = dol_getdate($search_doc_date);
$param .= '&doc_datemonth='.urlencode($tmp['mon']).'&doc_dateday='.urlencode($tmp['mday']).'&doc_dateyear='.urlencode($tmp['year']);
}
if (!empty($search_doc_type)) {
$filter['t.doc_type'] = $search_doc_type;
$param .= '&search_doc_type='.urlencode($search_doc_type);
}
if (!empty($search_doc_ref)) {
$filter['t.doc_ref'] = $search_doc_ref;
$param .= '&search_doc_ref='.urlencode($search_doc_ref);
}
if (!empty($search_accountancy_code)) {
$filter['t.numero_compte'] = $search_accountancy_code;
$param .= '&search_accountancy_code='.urlencode($search_accountancy_code);
}
if (!empty($search_accountancy_code_start)) {
$filter['t.numero_compte>='] = $search_accountancy_code_start;
$param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
}
if (!empty($search_accountancy_code_end)) {
$filter['t.numero_compte<='] = $search_accountancy_code_end;
$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
}
if (!empty($search_accountancy_aux_code)) {
$filter['t.subledger_account'] = $search_accountancy_aux_code;
$param .= '&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code);
}
if (!empty($search_accountancy_aux_code_start)) {
$filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
$param .= '&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start);
}
if (!empty($search_accountancy_aux_code_end)) {
$filter['t.subledger_account<='] = $search_accountancy_aux_code_end;
$param .= '&search_accountancy_aux_code_end='.urlencode($search_accountancy_aux_code_end);
}
if (!empty($search_mvt_label)) {
$filter['t.label_operation'] = $search_mvt_label;
$param .= '&search_mvt_label='.urlencode($search_mvt_label);
}
if (!empty($search_direction)) {
$filter['t.sens'] = $search_direction;
$param .= '&search_direction='.urlencode($search_direction);
}
if (!empty($search_ledger_code)) {
$filter['t.code_journal'] = $search_ledger_code;
foreach ($search_ledger_code as $code) {
$param .= '&search_ledger_code[]='.urlencode($code);
}
}
if (!empty($search_mvt_num)) {
$filter['t.piece_num'] = $search_mvt_num;
$param .= '&search_mvt_num='.urlencode($search_mvt_num);
}
if (!empty($search_date_creation_start)) {
$filter['t.date_creation>='] = $search_date_creation_start;
$tmp = dol_getdate($search_date_creation_start);
$param .= '&date_creation_startmonth='.urlencode($tmp['mon']).'&date_creation_startday='.urlencode($tmp['mday']).'&date_creation_startyear='.urlencode($tmp['year']);
}
if (!empty($search_date_creation_end)) {
$filter['t.date_creation<='] = $search_date_creation_end;
$tmp = dol_getdate($search_date_creation_end);
$param .= '&date_creation_endmonth='.urlencode($tmp['mon']).'&date_creation_endday='.urlencode($tmp['mday']).'&date_creation_endyear='.urlencode($tmp['year']);
}
if (!empty($search_date_modification_start)) {
$filter['t.tms>='] = $search_date_modification_start;
$tmp = dol_getdate($search_date_modification_start);
$param .= '&date_modification_startmonth='.urlencode($tmp['mon']).'&date_modification_startday='.urlencode($tmp['mday']).'&date_modification_startyear='.urlencode($tmp['year']);
}
if (!empty($search_date_modification_end)) {
$filter['t.tms<='] = $search_date_modification_end;
$tmp = dol_getdate($search_date_modification_end);
$param .= '&date_modification_endmonth='.urlencode($tmp['mon']).'&date_modification_endday='.urlencode($tmp['mday']).'&date_modification_endyear='.urlencode($tmp['year']);
}
if (!empty($search_date_export_start)) {
$filter['t.date_export>='] = $search_date_export_start;
$tmp = dol_getdate($search_date_export_start);
$param .= '&date_export_startmonth='.urlencode($tmp['mon']).'&date_export_startday='.urlencode($tmp['mday']).'&date_export_startyear='.urlencode($tmp['year']);
}
if (!empty($search_date_export_end)) {
$filter['t.date_export<='] = $search_date_export_end;
$tmp = dol_getdate($search_date_export_end);
$param .= '&date_export_endmonth='.urlencode($tmp['mon']).'&date_export_endday='.urlencode($tmp['mday']).'&date_export_endyear='.urlencode($tmp['year']);
}
if (!empty($search_debit)) {
$filter['t.debit'] = $search_debit;
$param .= '&search_debit='.urlencode($search_debit);
}
if (!empty($search_credit)) {
$filter['t.credit'] = $search_credit;
$param .= '&search_credit='.urlencode($search_credit);
}
if (!empty($search_lettering_code)) {
$filter['t.lettering_code'] = $search_lettering_code;
$param .= '&search_lettering_code='.urlencode($search_lettering_code);
}
if (!empty($search_not_reconciled)) {
$filter['t.reconciled_option'] = $search_not_reconciled;
$param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
@ -447,6 +449,8 @@ if (count($filter) > 0) {
$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)) {
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
} else {
$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, ...)
// 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.
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT);
@ -475,48 +479,49 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
{
setEventMessages($object->error, $object->errors, 'errors');
} else {
// Export files
// Export files
$accountancyexport = new AccountancyExport($db);
$accountancyexport->export($object->lines, $formatexportset);
if (!empty($accountancyexport->errors))
{
setEventMessages('', $accountancyexport->errors, 'errors');
} else {
// Specify as export : update field date_export
$error = 0;
$db->begin();
if (!empty($accountancyexport->errors))
{
setEventMessages('', $accountancyexport->errors, 'errors');
} else {
// Specify as export : update field date_export
$error = 0;
$db->begin();
if (is_array($object->lines))
{
foreach ($object->lines as $movement)
{
$now = dol_now();
if (is_array($object->lines))
{
foreach ($object->lines as $movement)
{
$now = dol_now();
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
$sql .= " SET date_export = '".$db->idate($now)."'";
$sql .= " WHERE rowid = ".$movement->id;
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
$sql .= " SET date_export = '".$db->idate($now)."'";
$sql .= " , date_validated = '".$db->idate($now)."'";
$sql .= " WHERE rowid = ".$movement->id;
dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=".$sql, LOG_DEBUG);
$result = $db->query($sql);
if (!$result)
{
$error++;
break;
}
}
}
dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=".$sql, LOG_DEBUG);
$result = $db->query($sql);
if (!$result)
{
$error++;
break;
}
}
}
if (!$error)
{
$db->commit();
// setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs');
} else {
$error++;
$db->rollback();
setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors');
}
}
if (!$error)
{
$db->commit();
// setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs');
} else {
$error++;
$db->rollback();
setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors');
}
}
exit;
}
}
@ -566,7 +571,25 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
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') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?mvt_num='.GETPOST('mvt_num').$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1);
print $formconfirm;
@ -627,22 +650,27 @@ print '<input type="hidden" name="sortorder" value="'.urlencode($sortorder).'">'
if (count($filter)) $buttonLabel = $langs->trans("ExportFilteredList");
else $buttonLabel = $langs->trans("ExportList");
// Button re-export
if (!empty($conf->global->ACCOUNTING_REEXPORT)) {
$newcardbutton = '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Activated"), 'switch_on').'</a> ';
} else {
$newcardbutton = '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> ';
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
// Button re-export
if (!empty($conf->global->ACCOUNTING_REEXPORT)) {
$newcardbutton = '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Activated"), 'switch_on').'</a> ';
} else {
$newcardbutton = '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> ';
}
$newcardbutton .= '<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);
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php', '', 1, array('morecss' => 'marginleftonly'));
$url = './card.php?action=create';
if (!empty($socid)) $url .= '&socid='.$socid;
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', $url, '', $user->rights->accounting->mouvements->creer);
}
$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);
$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'));
$url = './card.php?action=create';
if (!empty($socid)) $url .= '&socid='.$socid;
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', $url, '', $user->rights->accounting->mouvements->creer);
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -756,7 +784,9 @@ if (!empty($arrayfields['t.lettering_code']['checked']))
// 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>';
print '<td class="liste_titre center">';
print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1);
print '</td>';
}
// Fields from hook
@ -791,14 +821,14 @@ if (!empty($arrayfields['t.tms']['checked']))
// 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, '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, 'date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
print '</div>';
print '</td>';
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $form->selectDate($search_date_export_start, '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, 'date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
print '</div>';
print '</td>';
}
// Action column
print '<td class="liste_titre center">';
@ -854,7 +884,7 @@ while ($i < min($num, $limit))
$line->label_operation = $obj->label_operation;
$line->debit = $obj->debit;
$line->credit = $obj->credit;
$line->montant = $obj->amount; // deprecated
$line->montant = $obj->amount; // deprecated
$line->amount = $obj->amount;
$line->sens = $obj->sens;
$line->lettering_code = $obj->lettering_code;
@ -893,65 +923,74 @@ while ($i < min($num, $limit))
// Document ref
if (!empty($arrayfields['t.doc_ref']['checked']))
{
if ($line->doc_type == 'customer_invoice')
{
$langs->loadLangs(array('bills'));
if ($line->doc_type == 'customer_invoice')
{
$langs->loadLangs(array('bills'));
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$objectstatic = new Facture($db);
$objectstatic->fetch($line->fk_doc);
//$modulepart = 'facture';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$objectstatic = new Facture($db);
$objectstatic->fetch($line->fk_doc);
//$modulepart = 'facture';
$filename = dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} elseif ($line->doc_type == 'supplier_invoice')
{
$langs->loadLangs(array('bills'));
$filename = dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} elseif ($line->doc_type == 'supplier_invoice')
{
$langs->loadLangs(array('bills'));
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$objectstatic = new FactureFournisseur($db);
$objectstatic->fetch($line->fk_doc);
//$modulepart = 'invoice_supplier';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$objectstatic = new FactureFournisseur($db);
$objectstatic->fetch($line->fk_doc);
//$modulepart = 'invoice_supplier';
$filename = 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);
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
} elseif ($line->doc_type == 'expense_report')
{
$langs->loadLangs(array('trips'));
$filename = 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);
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
} elseif ($line->doc_type == 'expense_report')
{
$langs->loadLangs(array('trips'));
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$objectstatic = new ExpenseReport($db);
$objectstatic->fetch($line->fk_doc);
//$modulepart = 'expensereport';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$objectstatic = new ExpenseReport($db);
$objectstatic->fetch($line->fk_doc);
//$modulepart = 'expensereport';
$filename = dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} else {
// Other type
}
$filename = dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$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 {
// Other type
}
print '<td class="nowrap">';
print '<td class="nowrap">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
// Picto + Ref
print '<td class="nobordernopadding nowrap">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
// Picto + Ref
print '<td class="nobordernopadding nowrap">';
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 $documentlink;
} else {
print $line->doc_ref;
}
print '</td></tr></table>';
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 $documentlink;
} elseif ($line->doc_type == 'bank') {
print $objectstatic->getNomUrl(1);
$bank_ref = strstr($line->doc_ref, '-');
print " " . $bank_ref;
} else {
print $line->doc_ref;
}
print '</td></tr></table>';
print "</td>\n";
print "</td>\n";
if (!$i) $totalarray['nbfield']++;
}
@ -1065,9 +1104,9 @@ print '</div>';
// TODO Replace this with mass delete action
if ($user->rights->accounting->mouvements->supprimer_tous) {
print '<div class="tabsAction tabsActionNoBottom">'."\n";
print '<a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear'.($param ? '&'.$param : '').'">'.$langs->trans("DeleteMvt").'</a>';
print '</div>';
print '<div class="tabsAction tabsActionNoBottom">'."\n";
print '<a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear'.($param ? '&'.$param : '').'">'.$langs->trans("DeleteMvt").'</a>';
print '</div>';
}
print '</form>';

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2016 Neil Orley <neil.orley@oeris.fr>
* 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) 2018 Frédéric France <frederic.france@netlogic.fr>
*
@ -22,7 +22,7 @@
/**
* \file htdocs/accountancy/bookkeeping/listbyaccount.php
* \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';
@ -36,11 +36,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("accountancy"));
$langs->loadLangs(array("accountancy", "compta"));
$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_end = dol_mktime(0, 0, 0, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
$search_date_startyear = GETPOST('search_date_startyear', '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_accountancy_code = GETPOST("search_accountancy_code");
@ -56,7 +62,7 @@ $search_doc_ref = GETPOST('search_doc_ref', 'alpha');
$search_label_operation = GETPOST('search_label_operation', 'alpha');
$search_mvt_num = GETPOST('search_mvt_num', 'int');
$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_credit = GETPOST('search_credit', 'alpha');
$search_lettering_code = GETPOST('search_lettering_code', 'alpha');
@ -126,9 +132,24 @@ $arrayfields = array(
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
*/
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
@ -138,7 +159,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
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
{
@ -151,7 +172,7 @@ if (empty($reshook))
$search_label_operation = '';
$search_mvt_num = '';
$search_direction = '';
$search_ledger_code = '';
$search_ledger_code = array();
$search_date_start = '';
$search_date_end = '';
$search_date_startyear = '';
@ -172,55 +193,57 @@ if (empty($reshook))
if (!empty($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)) {
$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)) {
$filter['t.doc_date'] = $search_doc_date;
$param .= '&doc_datemonth=' . GETPOST('doc_datemonth', 'int') . '&doc_dateday=' . GETPOST('doc_dateday', 'int') . '&doc_dateyear=' . GETPOST('doc_dateyear', 'int');
$param .= '&doc_datemonth='.GETPOST('doc_datemonth', 'int').'&doc_dateday='.GETPOST('doc_dateday', 'int').'&doc_dateyear='.GETPOST('doc_dateyear', 'int');
}
if (!empty($search_accountancy_code_start)) {
$filter['t.numero_compte>='] = $search_accountancy_code_start;
$param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start);
$param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
}
if (!empty($search_accountancy_code_end)) {
$filter['t.numero_compte<='] = $search_accountancy_code_end;
$param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end);
$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
}
if (!empty($search_label_account)) {
$filter['t.label_compte'] = $search_label_account;
$param .= '&search_label_compte=' . urlencode($search_label_account);
$param .= '&search_label_compte='.urlencode($search_label_account);
}
if (!empty($search_mvt_num)) {
$filter['t.piece_num'] = $search_mvt_num;
$param .= '&search_mvt_num=' . urlencode($search_mvt_num);
$param .= '&search_mvt_num='.urlencode($search_mvt_num);
}
if (!empty($search_doc_ref)) {
$filter['t.doc_ref'] = $search_doc_ref;
$param .= '&search_doc_ref=' . urlencode($search_doc_ref);
$param .= '&search_doc_ref='.urlencode($search_doc_ref);
}
if (!empty($search_label_operation)) {
$filter['t.label_operation'] = $search_label_operation;
$param .= '&search_label_operation=' . urlencode($search_label_operation);
$param .= '&search_label_operation='.urlencode($search_label_operation);
}
if (!empty($search_direction)) {
$filter['t.sens'] = $search_direction;
$param .= '&search_direction=' . urlencode($search_direction);
$param .= '&search_direction='.urlencode($search_direction);
}
if (!empty($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)) {
$filter['t.debit'] = $search_debit;
$param .= '&search_debit=' . urlencode($search_debit);
$param .= '&search_debit='.urlencode($search_debit);
}
if (!empty($search_credit)) {
$filter['t.credit'] = $search_credit;
$param .= '&search_credit=' . urlencode($search_credit);
$param .= '&search_credit='.urlencode($search_credit);
}
if (!empty($search_lettering_code)) {
$filter['t.lettering_code'] = $search_lettering_code;
@ -242,7 +265,7 @@ if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->suppri
}
// 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;
}
}
@ -267,7 +290,7 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme
}
// 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;
} else {
setEventMessages("NoRecordDeleted", null, 'warnings');
@ -284,7 +307,7 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
}
header("Location: listbyaccount.php?noreset=1".($param ? '&'.$param : ''));
header("Location: ".$_SERVER["PHP_SELF"]."?noreset=1".($param ? '&'.$param : ''));
exit;
}
}
@ -303,7 +326,6 @@ $title_page = $langs->trans("Operations").' - '.$langs->trans("VueByAccountAccou
llxHeader('', $title_page);
// List
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
@ -376,18 +398,19 @@ print '<input type="hidden" name="formfilteraction" id="formfilteraction" value=
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
$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 .= ' &nbsp; ';
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create');
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
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('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', '', 1, array('morecss' => 'marginleftonly'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $viewflat.$newcardbutton, '', $limit, 0, 0, 1);
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
@ -427,7 +450,9 @@ print '<tr class="liste_titre_filter">';
// 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="' . 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
if (!empty($arrayfields['t.doc_date']['checked'])) {
@ -447,19 +472,19 @@ if (!empty($arrayfields['t.piece_num']['checked']))
}
// Ref document
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>';
}
// Label operation
if (!empty($arrayfields['t.label_operation']['checked'])) {
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_operation" value="' . dol_escape_htmltag($search_label_operation) . '"/></td>';
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_operation" value="'.dol_escape_htmltag($search_label_operation).'"/></td>';
}
// Debit
if (!empty($arrayfields['t.debit']['checked'])) {
print '<td class="liste_titre right"><input type="text" class="flat" name="search_debit" size="4" value="' . dol_escape_htmltag($search_debit) . '"></td>';
print '<td class="liste_titre right"><input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).'"></td>';
}
// Credit
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
if (!empty($arrayfields['t.lettering_code']['checked']))
@ -521,8 +546,15 @@ while ($i < min($num, $limit))
// Is it a break ?
if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
$colspan = $totalarray['nbfield'] - 3;
$colspanend = $totalarray['nbfield'] - 7;
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
$colnumber = 3;
$colnumberend = 7;
} else {
$colnumber = 4;
$colnumberend = 7;
}
$colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend;
// Show a subtotal by accounting account
if (isset($displayed_account_number)) {
print '<tr class="liste_total">';
@ -535,7 +567,7 @@ while ($i < min($num, $limit))
$balance = $sous_total_debit - $sous_total_credit;
print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
if ($balance > 0 )
if ($balance > 0)
{
print '<td class="nowraponall right">';
print price($sous_total_debit - $sous_total_credit);
@ -639,20 +671,29 @@ while ($i < min($num, $limit))
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$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 {
// Other type
}
print '<td class="nowrap">';
print '<td class="maxwidth400">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
// 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')
{
print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
print $documentlink;
} elseif ($line->doc_type == 'bank') {
print $objectstatic->getNomUrl(1);
$bank_ref = strstr($line->doc_ref, '-');
print " " . $bank_ref;
} else {
print $line->doc_ref;
}
@ -666,7 +707,7 @@ while ($i < min($num, $limit))
if (!empty($arrayfields['t.label_operation']['checked'])) {
// Affiche un lien vers la facture client/fournisseur
$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']++;
}
@ -681,7 +722,7 @@ while ($i < min($num, $limit))
// Amount credit
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) $totalarray['pos'][$totalarray['nbfield']] = 'totalcredit';
$totalarray['val']['totalcredit'] += $line->credit;
@ -721,33 +762,42 @@ while ($i < min($num, $limit))
$i++;
}
// Show sub-total of last shown account
$colspan = $totalarray['nbfield'] - 3;
$colspanend = $totalarray['nbfield'] - 8;
print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>';
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
print '<td colspan="'.$colspanend.'"></td>';
print '</tr>';
// Show balance of last shown account
$balance = $sous_total_debit - $sous_total_credit;
print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
if ($balance > 0 )
{
print '<td class="nowraponall right">';
print price($sous_total_debit - $sous_total_credit);
print '</td>';
print '<td></td>';
} else {
print '<td></td>';
print '<td class="nowraponall right">';
print price($sous_total_credit - $sous_total_debit);
print '</td>';
if ($num > 0) {
// Show sub-total of last shown account
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
$colnumber = 3;
$colnumberend = 7;
} else {
$colnumber = 4;
$colnumberend = 7;
}
$colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend;
print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>';
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
print '<td colspan="'.$colspanend.'"></td>';
print '</tr>';
// Show balance of last shown account
$balance = $sous_total_debit - $sous_total_credit;
print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
if ($balance > 0)
{
print '<td class="nowraponall right">';
print price($sous_total_debit - $sous_total_credit);
print '</td>';
print '<td></td>';
} else {
print '<td></td>';
print '<td class="nowraponall right">';
print price($sous_total_credit - $sous_total_debit);
print '</td>';
}
print '<td colspan="'.$colspanend.'"></td>';
print '</tr>';
}
print '<td colspan="'.$colspanend.'"></td>';
print '</tr>';
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';

View File

@ -0,0 +1,832 @@
<?php
/* Copyright (C) 2016 Neil Orley <neil.orley@oeris.fr>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2020 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* 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/accountancy/bookkeeping/listbysubaccount.php
* \ingroup Accountancy (Double entries)
* \brief List operation of ledger ordered by subaccount number
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("accountancy", "compta"));
$action = GETPOST('action', 'aZ09');
$search_date_startyear = GETPOST('search_date_startyear', '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_accountancy_code = GETPOST("search_accountancy_code");
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
if ($search_accountancy_code_start == - 1) {
$search_accountancy_code_start = '';
}
$search_accountancy_code_end = GETPOST('search_accountancy_code_end', 'alpha');
if ($search_accountancy_code_end == - 1) {
$search_accountancy_code_end = '';
}
$search_doc_ref = GETPOST('search_doc_ref', 'alpha');
$search_label_operation = GETPOST('search_label_operation', 'alpha');
$search_mvt_num = GETPOST('search_mvt_num', 'int');
$search_direction = GETPOST('search_direction', 'alpha');
$search_ledger_code = GETPOST('search_ledger_code', 'array');
$search_debit = GETPOST('search_debit', 'alpha');
$search_credit = GETPOST('search_credit', 'alpha');
$search_lettering_code = GETPOST('search_lettering_code', 'alpha');
$search_not_reconciled = GETPOST('search_reconciled_option', 'alpha');
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
$action = 'delbookkeepingyear';
}
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if ($sortorder == "") $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
$object = new BookKeeping($db);
$formfile = new FormFile($db);
$hookmanager->initHooks(array('bookkeepingbysubaccountlist'));
$formaccounting = new FormAccounting($db);
$form = new Form($db);
if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('search_date_startday') && !GETPOSTISSET('search_date_startmonth') && !GETPOSTISSET('search_date_starthour')) {
$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 .= $db->plimit(1);
$res = $db->query($sql);
if ($res->num_rows > 0) {
$fiscalYear = $db->fetch_object($res);
$search_date_start = strtotime($fiscalYear->date_start);
$search_date_end = strtotime($fiscalYear->date_end);
} else {
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
$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);
}
}
$arrayfields = array(
// '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.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
);
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
*/
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
$parameters = array('socid'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
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
{
$search_doc_date = '';
$search_accountancy_code = '';
$search_accountancy_code_start = '';
$search_accountancy_code_end = '';
$search_label_account = '';
$search_doc_ref = '';
$search_label_operation = '';
$search_mvt_num = '';
$search_direction = '';
$search_ledger_code = array();
$search_date_start = '';
$search_date_end = '';
$search_date_startyear = '';
$search_date_startmonth = '';
$search_date_startday = '';
$search_date_endyear = '';
$search_date_endmonth = '';
$search_date_endday = '';
$search_debit = '';
$search_credit = '';
$search_lettering_code = '';
$search_not_reconciled = '';
}
// Must be after the remove filter action, before the export.
$param = '';
$filter = array();
if (!empty($search_date_start)) {
$filter['t.doc_date>='] = $search_date_start;
$param .= '&search_date_startmonth='.$search_date_startmonth.'&search_date_startday='.$search_date_startday.'&search_date_startyear='.$search_date_startyear;
}
if (!empty($search_date_end)) {
$filter['t.doc_date<='] = $search_date_end;
$param .= '&search_date_endmonth='.$search_date_endmonth.'&search_date_endday='.$search_date_endday.'&search_date_endyear='.$search_date_endyear;
}
if (!empty($search_doc_date)) {
$filter['t.doc_date'] = $search_doc_date;
$param .= '&doc_datemonth='.GETPOST('doc_datemonth', 'int').'&doc_dateday='.GETPOST('doc_dateday', 'int').'&doc_dateyear='.GETPOST('doc_dateyear', 'int');
}
if (!empty($search_accountancy_code_start)) {
$filter['t.subledger_account>='] = $search_accountancy_code_start;
$param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
}
if (!empty($search_accountancy_code_end)) {
$filter['t.subledger_account<='] = $search_accountancy_code_end;
$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
}
if (!empty($search_label_account)) {
$filter['t.label_compte'] = $search_label_account;
$param .= '&search_label_compte='.urlencode($search_label_account);
}
if (!empty($search_mvt_num)) {
$filter['t.piece_num'] = $search_mvt_num;
$param .= '&search_mvt_num='.urlencode($search_mvt_num);
}
if (!empty($search_doc_ref)) {
$filter['t.doc_ref'] = $search_doc_ref;
$param .= '&search_doc_ref='.urlencode($search_doc_ref);
}
if (!empty($search_label_operation)) {
$filter['t.label_operation'] = $search_label_operation;
$param .= '&search_label_operation='.urlencode($search_label_operation);
}
if (!empty($search_direction)) {
$filter['t.sens'] = $search_direction;
$param .= '&search_direction='.urlencode($search_direction);
}
if (!empty($search_ledger_code)) {
$filter['t.code_journal'] = $search_ledger_code;
foreach ($search_ledger_code as $code) {
$param .= '&search_ledger_code[]='.urlencode($code);
}
}
if (!empty($search_debit)) {
$filter['t.debit'] = $search_debit;
$param .= '&search_debit='.urlencode($search_debit);
}
if (!empty($search_credit)) {
$filter['t.credit'] = $search_credit;
$param .= '&search_credit='.urlencode($search_credit);
}
if (!empty($search_lettering_code)) {
$filter['t.lettering_code'] = $search_lettering_code;
$param .= '&search_lettering_code='.urlencode($search_lettering_code);
}
if (!empty($search_not_reconciled)) {
$filter['t.reconciled_option'] = $search_not_reconciled;
$param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
}
}
if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) {
$import_key = GETPOST('importkey', 'alpha');
if (!empty($import_key)) {
$result = $object->deleteByImportkey($import_key);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
// Make a redirect to avoid to launch the delete later after a back button
header("Location: ".$_SERVER["PHP_SELF"].($param ? '?'.$param : ''));
exit;
}
}
if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouvements->supprimer_tous) {
$delmonth = GETPOST('delmonth', 'int');
$delyear = GETPOST('delyear', 'int');
if ($delyear == -1) {
$delyear = 0;
}
$deljournal = GETPOST('deljournal', 'alpha');
if ($deljournal == -1) {
$deljournal = 0;
}
if (!empty($delmonth) || !empty($delyear) || !empty($deljournal))
{
$result = $object->deleteByYearAndJournal($delyear, $deljournal, '', ($delmonth > 0 ? $delmonth : 0));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessages("RecordDeleted", null, 'mesgs');
}
// Make a redirect to avoid to launch the delete later after a back button
header("Location: listbysubaccount.php".($param ? '?'.$param : ''));
exit;
} else {
setEventMessages("NoRecordDeleted", null, 'warnings');
}
}
if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->supprimer) {
$mvt_num = GETPOST('mvt_num', 'int');
if (!empty($mvt_num)) {
$result = $object->deleteMvtNum($mvt_num);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
}
header("Location: listbysubaccount.php?noreset=1".($param ? '&'.$param : ''));
exit;
}
}
/*
* View
*/
$formaccounting = new FormAccounting($db);
$formfile = new FormFile($db);
$formother = new FormOther($db);
$form = new Form($db);
$title_page = $langs->trans("Operations").' - '.$langs->trans("VueByAccountAccounting").' ('.$langs->trans("BookkeepingSubAccount").')';
llxHeader('', $title_page);
// List
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 1);
if ($nbtotalofrecords < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
$result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 1);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
$num = count($object->lines);
if ($action == 'delmouv') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?mvt_num='.GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1);
print $formconfirm;
}
if ($action == 'delbookkeepingyear') {
$form_question = array();
$delyear = GETPOST('delyear', 'int');
$deljournal = GETPOST('deljournal', 'alpha');
if (empty($delyear)) {
$delyear = dol_print_date(dol_now(), '%Y');
}
$month_array = array();
for ($i = 1; $i <= 12; $i++) {
$month_array[$i] = $langs->trans("Month".sprintf("%02d", $i));
}
$year_array = $formaccounting->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
$journal_array = $formaccounting->select_journal($deljournal, 'deljournal', '', 1, 1, 1, '', 0, 1);
$form_question['delmonth'] = array(
'name' => 'delmonth',
'type' => 'select',
'label' => $langs->trans('DelMonth'),
'values' => $month_array,
'default' => ''
);
$form_question['delyear'] = array(
'name' => 'delyear',
'type' => 'select',
'label' => $langs->trans('DelYear'),
'values' => $year_array,
'default' => $delyear
);
$form_question['deljournal'] = array(
'name' => 'deljournal',
'type' => 'other', // We don't use select here, the journal_array is already a select html component
'label' => $langs->trans('DelJournal'),
'value' => $journal_array,
'default' => $deljournal
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'delbookkeepingyearconfirm', $form_question, '', 1, 300);
print $formconfirm;
}
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="list">';
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="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
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('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php', '', 1, array('morecss' => 'marginleftonly'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php', '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
print info_admin($langs->trans("WarningRecordWithoutSubledgerAreExcluded"));
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
// Reverse sort order
if (preg_match('/^asc/i', $sortorder)) $sortorder = "asc";
else $sortorder = "desc";
$moreforfilter = '';
// Accountancy account
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('AccountAccounting').': ';
$moreforfilter .= '<div class="nowrap inline-block">';
$moreforfilter .= $langs->trans('From').' ';
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', 1, 'maxwidth200');
$moreforfilter .= ' '.$langs->trans('to').' ';
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', 1, 'maxwidth200');
$moreforfilter .= '</div>';
$moreforfilter .= '</div>';
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint;
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
print '</div>';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste centpercent">';
// Filters lines
print '<tr class="liste_titre_filter">';
// Code journal
if (!empty($arrayfields['t.code_journal']['checked'])) {
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
if (!empty($arrayfields['t.doc_date']['checked'])) {
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $form->selectDate($search_date_start, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search_date_end, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
print '</div>';
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
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>';
}
// Label operation
if (!empty($arrayfields['t.label_operation']['checked'])) {
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_operation" value="'.dol_escape_htmltag($search_label_operation).'"/></td>';
}
// Debit
if (!empty($arrayfields['t.debit']['checked'])) {
print '<td class="liste_titre right"><input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).'"></td>';
}
// Credit
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>';
}
// Lettering code
if (!empty($arrayfields['t.lettering_code']['checked']))
{
print '<td class="liste_titre center">';
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 '</td>';
}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="liste_titre center">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
print "</tr>\n";
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.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.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 ');
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "</tr>\n";
$total_debit = 0;
$total_credit = 0;
$sous_total_debit = 0;
$sous_total_credit = 0;
$displayed_account_number = null; // Start with undefined to be able to distinguish with empty
// Loop on record
// --------------------------------------------------------------------
$i = 0;
$totalarray = array();
while ($i < min($num, $limit))
{
$line = $object->lines[$i];
$total_debit += $line->debit;
$total_credit += $line->credit;
$accountg = length_accounta($line->subledger_account);
//if (empty($accountg)) $accountg = '-';
// Is it a break ?
if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
$colnumber = 3;
$colnumberend = 7;
} else {
$colnumber = 4;
$colnumberend = 7;
}
$colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend;
// Show a subtotal by accounting account
if (isset($displayed_account_number)) {
print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.length_accounta($displayed_account_number).':</td>';
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
print '<td colspan="'.$colspanend.'"></td>';
print '</tr>';
// Show balance of last shown account
$balance = $sous_total_debit - $sous_total_credit;
print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
if ($balance > 0)
{
print '<td class="nowraponall right">';
print price($sous_total_debit - $sous_total_credit);
print '</td>';
print '<td></td>';
} else {
print '<td></td>';
print '<td class="nowraponall right">';
print price($sous_total_credit - $sous_total_debit);
print '</td>';
}
print '<td colspan="'.$colspanend.'"></td>';
print '</tr>';
}
// Show the break account
print "<tr>";
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 9).'" style="font-weight:bold; border-bottom: 1pt solid black;">';
if ($line->subledger_account != "" && $line->subledger_account != '-1') {
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';
print $form->textwithpicto('', $htmltext);
print '</span>';
}
print '</td>';
print '</tr>';
$displayed_account_number = $accountg;
//if (empty($displayed_account_number)) $displayed_account_number='-';
$sous_total_debit = 0;
$sous_total_credit = 0;
$colspan = 0;
}
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
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
if (!empty($arrayfields['t.doc_ref']['checked']))
{
if ($line->doc_type == 'customer_invoice')
{
$langs->loadLangs(array('bills'));
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$objectstatic = new Facture($db);
$objectstatic->fetch($line->fk_doc);
//$modulepart = 'facture';
$filename = dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} elseif ($line->doc_type == 'supplier_invoice')
{
$langs->loadLangs(array('bills'));
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$objectstatic = new FactureFournisseur($db);
$objectstatic->fetch($line->fk_doc);
//$modulepart = 'invoice_supplier';
$filename = 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);
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
} elseif ($line->doc_type == 'expense_report')
{
$langs->loadLangs(array('trips'));
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$objectstatic = new ExpenseReport($db);
$objectstatic->fetch($line->fk_doc);
//$modulepart = 'expensereport';
$filename = dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$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 {
// Other type
}
print '<td class="maxwidth400">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
// Picto + Ref
print '<td class="nobordernopadding">';
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 $documentlink;
} elseif ($line->doc_type == 'bank') {
print $objectstatic->getNomUrl(1);
$bank_ref = strstr($line->doc_ref, '-');
print " " . $bank_ref;
} else {
print $line->doc_ref;
}
print '</td></tr></table>';
print "</td>\n";
if (!$i) $totalarray['nbfield']++;
}
// Label operation
if (!empty($arrayfields['t.label_operation']['checked'])) {
// Affiche un lien vers la facture client/fournisseur
$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>';
if (!$i) $totalarray['nbfield']++;
}
// Amount debit
if (!empty($arrayfields['t.debit']['checked']))
{
print '<td class="nowrap right">'.($line->debit ? price($line->debit) : '').'</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totaldebit';
$totalarray['val']['totaldebit'] += $line->debit;
}
// Amount credit
if (!empty($arrayfields['t.credit']['checked'])) {
print '<td class="nowrap right">'.($line->credit ? price($line->credit) : '').'</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalcredit';
$totalarray['val']['totalcredit'] += $line->credit;
}
// Lettering code
if (!empty($arrayfields['t.lettering_code']['checked']))
{
print '<td class="center">'.$line->lettering_code.'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="nowraponall center">';
if (empty($line->date_export)) {
if ($user->rights->accounting->mouvements->creer) {
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$line->piece_num.$param.'&page='.$page.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">'.img_edit().'</a>';
}
if ($user->rights->accounting->mouvements->supprimer) {
print ' &nbsp; <a class="paddingleft" href="'.$_SERVER['PHP_SELF'].'?action=delmouv&mvt_num='.$line->piece_num.$param.'&page='.$page.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">'.img_delete().'</a>';
}
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
// Comptabilise le sous-total
$sous_total_debit += $line->debit;
$sous_total_credit += $line->credit;
print "</tr>\n";
$i++;
}
if ($num > 0) {
// Show sub-total of last shown account
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
$colnumber = 3;
$colnumberend = 7;
} else {
$colnumber = 4;
$colnumberend = 7;
}
$colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend;
print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>';
print '<td class="nowrap right">'.price($sous_total_debit).'</td>';
print '<td class="nowrap right">'.price($sous_total_credit).'</td>';
print '<td colspan="'.$colspanend.'"></td>';
print '</tr>';
// Show balance of last shown account
$balance = $sous_total_debit - $sous_total_credit;
print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
if ($balance > 0)
{
print '<td class="nowraponall right">';
print price($sous_total_debit - $sous_total_credit);
print '</td>';
print '<td></td>';
} else {
print '<td></td>';
print '<td class="nowraponall right">';
print price($sous_total_credit - $sous_total_debit);
print '</td>';
}
print '<td colspan="'.$colspanend.'"></td>';
print '</tr>';
}
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
print "</table>";
print '</div>';
// TODO Replace this with mass delete action
if ($user->rights->accounting->mouvements->supprimer_tous) {
print '<div class="tabsAction tabsActionNoBottom">'."\n";
print '<a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear'.($param ? '&'.$param : '').'">'.$langs->trans("DeleteMvt").'</a>';
print '</div>';
}
print '</form>';
// End of page
llxFooter();
$db->close();

View File

@ -141,7 +141,7 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_value
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
dol_fiche_end();
print dol_get_fiche_end();
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
@ -195,17 +195,17 @@ dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_customer.php", LOG_DEB
if ($resql) {
$i = 0;
$param = "&socid=".$socid;
$param = "&socid=".$socid;
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="socid" value="'.$object->id.'">';
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
print '<div class="div-table-responsive-no-min">';
print '<table class="liste centpercent">'."\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="liste centpercent">'."\n";
/*
print '<tr class="liste_titre">';
@ -244,13 +244,13 @@ if ($resql) {
print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center ');
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center ');
print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center ');
print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center ');
print "</tr>\n";
$solde = 0;
$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($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
@ -265,20 +265,20 @@ if ($resql) {
print '<td class="nowrap right">'.price(round($solde, 2)).'</td>';
// Journal
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $obj->code_journal);
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
print '<td class="center">'.$journaltoshow.'</td>';
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $obj->code_journal);
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
print '<td class="center">'.$journaltoshow.'</td>';
if (empty($obj->lettering_code)) {
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="'.$obj->rowid.'" /></td>';
print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.'">';
print img_edit();
print '</a></td>'."\n";
} else {
print '<td class="center">'.$obj->lettering_code.'</td>';
print '<td></td>';
}
if (empty($obj->lettering_code)) {
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="'.$obj->rowid.'" /></td>';
print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.'">';
print img_edit();
print '</a></td>'."\n";
} else {
print '<td class="center">'.$obj->lettering_code.'</td>';
print '<td></td>';
}
print "</tr>\n";
}
@ -299,9 +299,9 @@ if ($resql) {
print "</table>";
print '<div class="tabsAction tabsActionNoBottom">'."\n";
print $letteringbutton;
print '</div>';
print '<div class="tabsAction tabsActionNoBottom">'."\n";
print $letteringbutton;
print '</div>';
print "</form>";
$db->free($resql);

View File

@ -4,7 +4,7 @@
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* 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
* it under the terms of the GNU General Public License as published by
@ -41,7 +41,7 @@ $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array');
$socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int');
$socid = GETPOST('socid', 'int') ? ((int) GETPOST('socid', 'int')) : ((int) GETPOST('id', 'int'));
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
@ -140,7 +140,7 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_value
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
dol_fiche_end();
print dol_get_fiche_end();
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
@ -193,17 +193,17 @@ if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$param = "&socid=".$socid;
$param = "&socid=".$socid;
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="socid" value="'.$object->id.'">';
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
print '<div class="div-table-responsive-no-min">';
print '<table class="liste centpercent">'."\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="liste centpercent">'."\n";
/*
print '<tr class="liste_titre">';
@ -242,7 +242,7 @@ if ($resql) {
print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center ');
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center ');
print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center ');
print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center ');
print "</tr>\n";
$solde = 0;
@ -261,21 +261,21 @@ if ($resql) {
print '<td class="nowrap right">'.price($obj->credit).'</td>';
print '<td class="nowrap right">'.price(round($solde, 2)).'</td>';
// Journal
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $obj->code_journal);
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
print '<td class="center">'.$journaltoshow.'</td>';
// Journal
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $obj->code_journal);
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
print '<td class="center">'.$journaltoshow.'</td>';
if (empty($obj->lettering_code) && empty($obj->date_validated)) {
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="'.$obj->rowid.'" /></td>';
print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.'">';
print img_edit();
print '</a></td>'."\n";
print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.'">';
print img_edit();
print '</a></td>'."\n";
} else {
print '<td class="center">'.$obj->lettering_code.'</td>';
print '<td></td>';
}
print '<td class="center">'.$obj->lettering_code.'</td>';
print '<td></td>';
}
print "</tr>\n";
}
@ -296,9 +296,9 @@ if ($resql) {
print "</table>";
print '<div class="tabsAction tabsActionNoBottom">'."\n";
print '<div class="tabsAction tabsActionNoBottom">'."\n";
print $letteringbutton;
print '</div>';
print '</div>';
print "</form>";
$db->free($resql);

View File

@ -31,10 +31,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
*/
class AccountancyCategory // extends CommonObject
{
/**
* @var DoliDB Database handler.
*/
public $db;
/**
* @var DoliDB Database handler.
*/
public $db;
/**
* @var string Error string
@ -63,9 +63,9 @@ class AccountancyCategory // extends CommonObject
public $rowid;
/**
* @var int ID
*/
public $id;
* @var int ID
*/
public $id;
/**
* @var string Accountancy code
@ -73,11 +73,11 @@ class AccountancyCategory // extends CommonObject
public $code;
/**
* @var string Accountancy Category label
*/
public $label;
* @var string Accountancy Category label
*/
public $label;
/**
/**
* @var string Accountancy range account
*/
public $range_account;
@ -381,8 +381,8 @@ class AccountancyCategory // extends CommonObject
* @param int $id Id
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function display($id)
{
public function display($id)
{
global $conf;
$sql = "SELECT t.rowid, t.account_number, t.label";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t";
@ -408,7 +408,7 @@ class AccountancyCategory // extends CommonObject
return -1;
}
}
}
/**
* Function to select accounting category of an accounting account present in chart of accounts
@ -417,8 +417,8 @@ class AccountancyCategory // extends CommonObject
*
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function getCptBK($id)
{
public function getCptBK($id)
{
global $conf;
$sql = "SELECT t.numero_compte, t.label_operation, t.doc_ref";
@ -457,7 +457,7 @@ class AccountancyCategory // extends CommonObject
return -1;
}
}
}
/**
* Function to select accounting category of an accounting account present in chart of accounts
@ -466,41 +466,41 @@ class AccountancyCategory // extends CommonObject
*
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function getAccountsWithNoCategory($id)
{
global $conf;
public function getAccountsWithNoCategory($id)
{
global $conf;
$sql = "SELECT aa.account_number as numero_compte, aa.label as label_compte";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " WHERE (aa.fk_accounting_category != ".$id." OR aa.fk_accounting_category IS NULL)";
$sql .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = ".$conf->entity;
$sql .= " GROUP BY aa.account_number, aa.label";
$sql .= " ORDER BY aa.account_number, aa.label";
$sql = "SELECT aa.account_number as numero_compte, aa.label as label_compte";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " WHERE (aa.fk_accounting_category != ".$id." OR aa.fk_accounting_category IS NULL)";
$sql .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = ".$conf->entity;
$sql .= " GROUP BY aa.account_number, aa.label";
$sql .= " ORDER BY aa.account_number, aa.label";
$this->lines_CptBk = array();
$this->lines_CptBk = array();
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
if ($num) {
while ($obj = $this->db->fetch_object($resql)) {
$this->lines_cptbk[] = $obj;
}
}
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
if ($num) {
while ($obj = $this->db->fetch_object($resql)) {
$this->lines_cptbk[] = $obj;
}
}
return $num;
} else {
$this->error = "Error ".$this->db->lasterror();
$this->errors[] = $this->error;
dol_syslog(__METHOD__." ".implode(','.$this->errors), LOG_ERR);
return $num;
} else {
$this->error = "Error ".$this->db->lasterror();
$this->errors[] = $this->error;
dol_syslog(__METHOD__." ".implode(','.$this->errors), LOG_ERR);
return -1;
}
}
return -1;
}
}
/**
* Function to add an accounting account in an accounting category
@ -510,8 +510,8 @@ class AccountancyCategory // extends CommonObject
*
* @return int <0 if KO, >0 if OK
*/
public function updateAccAcc($id_cat, $cpts = array())
{
public function updateAccAcc($id_cat, $cpts = array())
{
global $conf;
$error = 0;
@ -523,7 +523,7 @@ class AccountancyCategory // extends CommonObject
$sql .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = ".$conf->entity;
$sql .= " ORDER BY LENGTH(aa.account_number) DESC;"; // LENGTH is ok with mysql and postgresql
$sql .= " ORDER BY LENGTH(aa.account_number) DESC;"; // LENGTH is ok with mysql and postgresql
$this->db->begin();
@ -539,13 +539,13 @@ class AccountancyCategory // extends CommonObject
$accountincptsadded = array();
while ($obj = $this->db->fetch_object($resql))
{
$account_number_formated = length_accountg($obj->account_number);
if (!empty($accountincptsadded[$account_number_formated])) continue;
$account_number_formated = length_accountg($obj->account_number);
if (!empty($accountincptsadded[$account_number_formated])) continue;
if (array_key_exists($account_number_formated, $cpts))
if (array_key_exists($account_number_formated, $cpts))
{
$accountincptsadded[$account_number_formated] = 1;
// We found an account number that is in list $cpts of account to add
$accountincptsadded[$account_number_formated] = 1;
// We found an account number that is in list $cpts of account to add
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account";
$sql .= " SET fk_accounting_category=".$id_cat;
$sql .= " WHERE rowid=".$obj->rowid;
@ -572,7 +572,7 @@ class AccountancyCategory // extends CommonObject
return 1;
}
}
}
/**
* Function to delete an accounting account from an accounting category
@ -581,8 +581,8 @@ class AccountancyCategory // extends CommonObject
*
* @return int <0 if KO, >0 if OK
*/
public function deleteCptCat($cpt_id)
{
public function deleteCptCat($cpt_id)
{
$error = 0;
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account as aa";
@ -598,7 +598,7 @@ class AccountancyCategory // extends CommonObject
}
// Commit or rollback
if ($error) {
if ($error) {
foreach ($this->errors as $errmsg) {
dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
@ -606,12 +606,12 @@ class AccountancyCategory // extends CommonObject
$this->db->rollback();
return -1 * $error;
} else {
} else {
$this->db->commit();
return 1;
}
}
return 1;
}
}
/**
* Function to know all category from accounting account
@ -781,7 +781,7 @@ class AccountancyCategory // extends CommonObject
'formula' => $obj->formula,
'position' => $obj->position,
'category_type' => $obj->category_type,
'bc' => $obj->sens
'bc' => $obj->sens
);
$i++;
}

File diff suppressed because it is too large Load Diff

View File

@ -28,10 +28,10 @@
*/
class AccountancySystem
{
/**
* @var DoliDB Database handler.
*/
public $db;
/**
* @var DoliDB Database handler.
*/
public $db;
/**
* @var string Error code (or message)
@ -44,13 +44,13 @@ class AccountancySystem
public $rowid;
/**
* @var int ID
*/
* @var int ID
*/
public $fk_pcg_version;
/**
* @var string pcg type
*/
/**
* @var string pcg type
*/
public $pcg_type;
/**
@ -59,18 +59,18 @@ class AccountancySystem
public $numero;
/**
* @var string Accountancy System label
*/
public $label;
* @var string Accountancy System label
*/
public $label;
/**
* @var string account number
*/
/**
* @var string account number
*/
public $account_number;
/**
* @var string account parent
*/
/**
* @var string account parent
*/
public $account_parent;
/**
@ -78,10 +78,10 @@ class AccountancySystem
*
* @param DoliDB $db handler
*/
public function __construct($db)
{
public function __construct($db)
{
$this->db = $db;
}
}
/**
@ -93,42 +93,42 @@ class AccountancySystem
*/
public function fetch($rowid = 0, $ref = '')
{
global $conf;
global $conf;
if ($rowid > 0 || $ref)
{
$sql = "SELECT a.rowid, a.pcg_version, a.label, a.active";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_system as a";
$sql .= " WHERE";
if ($rowid) {
$sql .= " a.rowid = ".((int) $rowid);
} elseif ($ref) {
$sql .= " a.pcg_version = '".$this->db->escape($ref)."'";
}
if ($rowid > 0 || $ref)
{
$sql = "SELECT a.rowid, a.pcg_version, a.label, a.active";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_system as a";
$sql .= " WHERE";
if ($rowid) {
$sql .= " a.rowid = ".((int) $rowid);
} elseif ($ref) {
$sql .= " a.pcg_version = '".$this->db->escape($ref)."'";
}
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
if ($obj) {
$this->id = $obj->rowid;
$this->rowid = $obj->rowid;
$this->pcg_version = $obj->pcg_version;
$this->ref = $obj->pcg_version;
$this->label = $obj->label;
$this->active = $obj->active;
if ($obj) {
$this->id = $obj->rowid;
$this->rowid = $obj->rowid;
$this->pcg_version = $obj->pcg_version;
$this->ref = $obj->pcg_version;
$this->label = $obj->label;
$this->active = $obj->active;
return $this->id;
} else {
return 0;
}
} else {
$this->error = "Error ".$this->db->lasterror();
$this->errors[] = "Error ".$this->db->lasterror();
}
}
return -1;
return $this->id;
} else {
return 0;
}
} else {
$this->error = "Error ".$this->db->lasterror();
$this->errors[] = "Error ".$this->db->lasterror();
}
}
return -1;
}
@ -138,8 +138,8 @@ class AccountancySystem
* @param User $user making insert
* @return int if KO, Id of line if OK
*/
public function create($user)
{
public function create($user)
{
$now = dol_now();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."accounting_system";
@ -165,6 +165,6 @@ class AccountancySystem
dol_syslog($this->error, LOG_ERR);
}
return $result;
}
return $result;
}
}

View File

@ -74,35 +74,35 @@ class AccountingAccount extends CommonObject
public $rowid;
/**
* Date creation record (datec)
*
* @var integer
*/
public $datec;
* Date creation record (datec)
*
* @var integer
*/
public $datec;
/**
* @var string pcg version
*/
* @var string pcg version
*/
public $fk_pcg_version;
/**
* @var string pcg type
*/
/**
* @var string pcg type
*/
public $pcg_type;
/**
* @var string account number
*/
/**
* @var string account number
*/
public $account_number;
/**
* @var int ID parent account
*/
/**
* @var int ID parent account
*/
public $account_parent;
/**
* @var int ID category account
*/
/**
* @var int ID category account
*/
public $account_category;
/**
@ -110,10 +110,10 @@ class AccountingAccount extends CommonObject
*/
public $status;
/**
* @var string Label of account
*/
public $label;
/**
* @var string Label of account
*/
public $label;
/**
* @var string Label short of account
@ -121,19 +121,19 @@ class AccountingAccount extends CommonObject
public $labelshort;
/**
* @var int ID
*/
public $fk_user_author;
* @var int ID
*/
public $fk_user_author;
/**
* @var int ID
*/
public $fk_user_modif;
/**
* @var int ID
*/
public $fk_user_modif;
/**
* @var int active (duplicate with status)
*/
public $active;
public $active;
/**
* @var int reconcilable
@ -145,13 +145,13 @@ class AccountingAccount extends CommonObject
*
* @param DoliDB $db Database handle
*/
public function __construct($db)
{
public function __construct($db)
{
global $conf;
$this->db = $db;
$this->next_prev_filter = 'fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$conf->global->CHARTOFACCOUNTS.')'; // Used to add a filter in Form::showrefnav method
}
}
/**
* Load record in memory
@ -162,7 +162,7 @@ class AccountingAccount extends CommonObject
* @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC' (better and faster than previous parameter if you have chart of account code).
* @return int <0 if KO, 0 if not found, Id of record if OK and found
*/
public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0, $limittoachartaccount = '')
public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0, $limittoachartaccount = '')
{
global $conf;
@ -182,7 +182,7 @@ class AccountingAccount extends CommonObject
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$this->db->escape($conf->global->CHARTOFACCOUNTS).')';
}
if (!empty($limittoachartaccount)) {
$sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'";
$sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'";
}
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
@ -229,8 +229,8 @@ class AccountingAccount extends CommonObject
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
public function create($user, $notrigger = 0)
{
public function create($user, $notrigger = 0)
{
global $conf;
$error = 0;
$now = dol_now();
@ -318,7 +318,7 @@ class AccountingAccount extends CommonObject
$this->db->commit();
return $this->id;
}
}
}
/**
* Update record
@ -366,8 +366,8 @@ class AccountingAccount extends CommonObject
*
* @return int <0 if KO, >0 if OK
*/
public function checkUsage()
{
public function checkUsage()
{
global $langs;
$sql = "(SELECT fk_code_ventilation FROM ".MAIN_DB_PREFIX."facturedet";
@ -400,8 +400,8 @@ class AccountingAccount extends CommonObject
* @param int $notrigger 0=triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
public function delete($user, $notrigger = 0)
{
public function delete($user, $notrigger = 0)
{
$error = 0;
$result = $this->checkUsage();
@ -436,9 +436,9 @@ class AccountingAccount extends CommonObject
} else {
return -1;
}
}
}
/**
/**
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
@ -446,28 +446,29 @@ class AccountingAccount extends CommonObject
* @param int $nourl 1=Disable url
* @param string $moretitle Add more text to title tooltip
* @param int $notooltip 1=Disable tooltip
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @param int $withcompletelabel 0=Short label (field short label), 1=Complete label (field label)
* @param string $option 'ledger', 'journals', 'accountcard'
* @return string String with URL
*/
public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1, $withcompletelabel = 0, $option = '')
public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1, $withcompletelabel = 0, $option = '')
{
global $langs, $conf, $user;
global $langs, $conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
$result = '';
$url = ''; $labelurl = '';
if (empty($option) || $option == 'ledger') {
$url = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start=' . $this->account_number . '&search_accountancy_code_end=' . $this->account_number;
$url = DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start='.urlencode($this->account_number).'&search_accountancy_code_end='.urlencode($this->account_number);
$labelurl = $langs->trans("ShowAccountingAccountInLedger");
} elseif ($option == 'journals') {
$url = DOL_URL_ROOT . '/accountancy/bookkeeping/list.php?search_accountancy_code_start=' . $this->account_number . '&search_accountancy_code_end=' . $this->account_number;
$url = DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?search_accountancy_code_start='.urlencode($this->account_number).'&search_accountancy_code_end='.urlencode($this->account_number);
$labelurl = $langs->trans("ShowAccountingAccountInJournals");
} elseif ($option == 'accountcard') {
$url = DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . $this->id;
$url = DOL_URL_ROOT.'/accountancy/admin/card.php?id='.urlencode($this->id);
$labelurl = $langs->trans("ShowAccountingAccount");
}
@ -523,7 +524,7 @@ class AccountingAccount extends CommonObject
if ($withpicto && $withpicto != 2) $result .= ' ';
if ($withpicto != 2) $result .= $linkstart.$label_link.$linkend;
return $result;
}
}
/**
* Information on record
@ -531,8 +532,8 @@ class AccountingAccount extends CommonObject
* @param int $id of record
* @return void
*/
public function info($id)
{
public function info($id)
{
$sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms';
$sql .= ' FROM '.MAIN_DB_PREFIX.'accounting_account as a';
$sql .= ' WHERE a.rowid = '.$id;
@ -567,18 +568,18 @@ class AccountingAccount extends CommonObject
* Deactivate an account (for status active or status reconcilable)
*
* @param int $id Id
* @param int $mode 0=field active, 1=field reconcilable
* @param int $mode 0=field active, 1=field reconcilable
* @return int <0 if KO, >0 if OK
*/
public function accountDeactivate($id, $mode = 0)
{
public function accountDeactivate($id, $mode = 0)
{
$result = $this->checkUsage();
$fieldtouse = 'active';
if ($mode == 1)
{
if ($mode == 1)
{
$fieldtouse = 'reconcilable';
}
}
if ($result > 0) {
$this->db->begin();
@ -603,42 +604,39 @@ class AccountingAccount extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Account activated
*
* @param int $id Id
* @param int $mode 0=field active, 1=field reconcilable
* @param int $mode 0=field active, 1=field reconcilable
* @return int <0 if KO, >0 if OK
*/
public function account_activate($id, $mode = 0)
{
// phpcs:enable
public function account_activate($id, $mode = 0)
{
// phpcs:enable
$this->db->begin();
if ($mode == 0)
{
$fieldtouse = 'active';
} elseif ($mode == 1)
{
$fieldtouse = 'reconcilable';
}
$fieldtouse = 'active';
if ($mode == 1) {
$fieldtouse = 'reconcilable';
}
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account ";
$sql .= "SET ".$fieldtouse." = '1'";
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account";
$sql .= " SET ".$fieldtouse." = '1'";
$sql .= " WHERE rowid = ".$this->db->escape($id);
dol_syslog(get_class($this)."::account_activate ".$fieldtouse." sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
if ($result) {
$this->db->commit();
return 1;
} else {
} else {
$this->error = $this->db->lasterror();
$this->db->rollback();
return -1;
}
}
}
}
/**
@ -652,7 +650,7 @@ class AccountingAccount extends CommonObject
return $this->LibStatut($this->status, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
*
@ -662,7 +660,7 @@ class AccountingAccount extends CommonObject
*/
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
// phpcs:enable
global $langs;
$langs->loadLangs(array("users"));

View File

@ -37,7 +37,7 @@ class AccountingJournal extends CommonObject
public $table_element = 'accounting_journal';
/**
* @var int Field with ID of parent key if this field has a parent
* @var string Fieldname with ID of parent key if this field has a parent
*/
public $fk_element = '';
@ -56,29 +56,29 @@ class AccountingJournal extends CommonObject
*/
public $rowid;
/**
* @var string Accounting journal code
*/
/**
* @var string Accounting journal code
*/
public $code;
/**
* @var string Accounting Journal label
*/
public $label;
* @var string Accounting Journal label
*/
public $label;
/**
* @var int 1:various operations, 2:sale, 3:purchase, 4:bank, 5:expense-report, 8:inventory, 9: has-new
*/
public $nature;
/**
* @var int 1:various operations, 2:sale, 3:purchase, 4:bank, 5:expense-report, 8:inventory, 9: has-new
*/
public $nature;
/**
* @var int is active or not
*/
/**
* @var int is active or not
*/
public $active;
/**
* @var array array of lines
*/
/**
* @var array array of lines
*/
public $lines;
/**
@ -86,10 +86,10 @@ class AccountingJournal extends CommonObject
*
* @param DoliDB $db Database handle
*/
public function __construct($db)
{
$this->db = $db;
}
public function __construct($db)
{
$this->db = $db;
}
/**
* Load an object from database
@ -155,8 +155,8 @@ class AccountingJournal extends CommonObject
*
* @return int <0 if KO, >0 if OK
*/
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
{
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
{
$sql = "SELECT rowid, code, label, nature, active";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
// Manage filter
@ -284,7 +284,7 @@ class AccountingJournal extends CommonObject
return $this->LibType($this->nature, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return type of an accounting journal
*
@ -294,7 +294,7 @@ class AccountingJournal extends CommonObject
*/
public function LibType($nature, $mode = 0)
{
// phpcs:enable
// phpcs:enable
global $langs;
$langs->loadLangs(array("accountancy"));

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2014-2017 Olivier Geffroy <jeff@jeffinfo.com>
* 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>
*
* This program is free software; you can redistribute it and/or modify
@ -768,10 +768,11 @@ class BookKeeping extends CommonObject
* @param int $offset offset limit
* @param array $filter filter array
* @param string $filtermode filter mode (AND or OR)
* @param int $option option (0: general account or 1: subaccount)
*
* @return int <0 if KO, >=0 if OK
*/
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $option = 0)
{
global $conf;
@ -824,6 +825,10 @@ class BookKeeping extends CommonObject
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.credit' || $key == 't.debit') {
$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)) {
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
} else {
$sqlwhere[] = natural_search($key, $value, 0, 1);
}
@ -836,7 +841,13 @@ class BookKeeping extends CommonObject
$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
}
// Affichage par compte comptable
$sql .= ' ORDER BY t.numero_compte ASC';
if (!empty($option)) {
$sql .= ' AND t.subledger_account IS NOT NULL';
$sql .= ' ORDER BY t.subledger_account ASC';
} else {
$sql .= ' ORDER BY t.numero_compte ASC';
}
if (!empty($sortfield)) {
$sql .= ', '.$sortfield.' '.$sortorder;
}
@ -1530,14 +1541,14 @@ class BookKeeping extends CommonObject
$this->label_compte = 'Customer';
$this->label_operation = 'Sales of pea';
$this->debit = 99.9;
$this->credit = '';
$this->montant = '';
$this->credit = 0.0;
$this->amount = 0.0;
$this->sens = 'D';
$this->fk_user_author = $user->id;
$this->import_key = '';
$this->import_key = '20201027';
$this->code_journal = 'VT';
$this->journal_label = 'Journal de vente';
$this->piece_num = '';
$this->piece_num = 1234;
$this->date_creation = $now;
}
@ -1891,23 +1902,22 @@ class BookKeeping extends CommonObject
return $out;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Description of a root accounting account
* Return id and description of a root accounting account.
* This function takes the parent of parent to get the root account !
*
* @param string $account Accounting account
* @return string Root account
*/
public function get_compte_racine($account = null)
public function getRootAccount($account = null)
{
// phpcs:enable
global $conf;
$pcgver = $conf->global->CHARTOFACCOUNTS;
$sql = "SELECT root.account_number, root.label as label";
$sql = "SELECT root.rowid, root.account_number, root.label as label";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = ".$pcgver;
$sql .= " AND asy.rowid = ".((int) $pcgver);
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as parent ON aa.account_parent = parent.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as root ON parent.account_parent = root.rowid";
$sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'";
@ -1923,7 +1933,7 @@ class BookKeeping extends CommonObject
$obj = $this->db->fetch_object($resql);
}
return $obj->label;
return array('id'=>$obj->rowid, 'account_number'=>$obj->account_number, 'label'=>$obj->label);
} else {
$this->error = "Error ".$this->db->lasterror();
dol_syslog(__METHOD__." ".$this->error, LOG_ERR);

View File

@ -25,11 +25,16 @@
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.'/core/class/html.formaccounting.class.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"));
$socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'aZ09');
// Security check
if (empty($conf->accounting->enabled)) {
accessforbidden();
@ -39,6 +44,7 @@ if ($user->socid > 0)
if (!$user->rights->accounting->fiscalyear->write)
accessforbidden();
$object = new BookKeeping($db);
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
@ -60,14 +66,91 @@ $year_current = $year_start;
/*
* 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
*/
$form = new Form($db);
$formaccounting = new FormAccounting($db);
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>';
$textnextyear = '&nbsp;<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>';
@ -80,9 +163,9 @@ print '<br>';
$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 '<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 .= " 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 date_validated IS NULL";
dol_syslog('htdocs/accountancy/closure/index.php sql='.$sql, LOG_DEBUG);
$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

@ -50,7 +50,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write)
{
if (!$cancel)
{
if ($codeventil < 0) $codeventil = 0;
if ($codeventil < 0) $codeventil = 0;
$sql = " UPDATE ".MAIN_DB_PREFIX."facturedet";
$sql .= " SET fk_code_ventilation = ".$codeventil;
@ -60,12 +60,12 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write)
if (!$resql) {
setEventMessages($db->lasterror(), null, 'errors');
} else {
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
if ($backtopage)
{
header("Location: ".$backtopage);
exit();
}
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
if ($backtopage)
{
header("Location: ".$backtopage);
exit();
}
}
} else {
header("Location: ./lines.php");
@ -137,12 +137,12 @@ if (!empty($id)) {
print '</td></tr>';
print '</table>';
dol_fiche_end();
print dol_get_fiche_end();
print '<div class="center">';
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>';

View File

@ -133,7 +133,7 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
}
if (!$error) {
$db->commit();
setEventMessages($langs->trans('Save'), null, 'mesgs');
setEventMessages($langs->trans("Save"), null, 'mesgs');
} else {
$db->rollback();
setEventMessages($db->lasterror(), null, 'errors');

View File

@ -357,12 +357,6 @@ if ($result) {
print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer").'</span></br><br>';
/*$topicmail="Information";
$modelmail="project";
$objecttmp=new Project($db);
$trackid='prj'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';*/
if ($msg) print $msg.'<br>';
$moreforfilter = '';

View File

@ -146,12 +146,12 @@ if (!empty($id)) {
print '</td></tr>';
print '</table>';
dol_fiche_end();
print dol_get_fiche_end();
print '<div class="center">';
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>';

View File

@ -123,7 +123,7 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
}
if (!$error) {
$db->commit();
setEventMessages($langs->trans('Save'), null, 'mesgs');
setEventMessages($langs->trans("Save"), null, 'mesgs');
} else {
$db->rollback();
setEventMessages($db->lasterror(), null, 'errors');

View File

@ -285,12 +285,6 @@ if ($result) {
print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoExpenseReport").'</span></br><br>';
/*$topicmail="Information";
$modelmail="project";
$objecttmp=new Project($db);
$trackid='prj'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';*/
if ($msg) print $msg.'<br>';
$moreforfilter = '';

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2016-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2016-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
*
@ -45,14 +45,14 @@ $hookmanager->initHooks(array('accountancyindex'));
if (GETPOST('addbox')) // Add box (when submit is done from a form when ajax disabled)
{
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
$zone = GETPOST('areacode', 'aZ09');
$userid = GETPOST('userid', 'int');
$boxorder = GETPOST('boxorder', 'aZ09');
$boxorder .= GETPOST('boxcombo', 'aZ09');
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
$zone = GETPOST('areacode', 'aZ09');
$userid = GETPOST('userid', 'int');
$boxorder = GETPOST('boxorder', 'aZ09');
$boxorder .= GETPOST('boxcombo', 'aZ09');
$result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
if ($result > 0) setEventMessages($langs->trans("BoxAdded"), null);
$result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
if ($result > 0) setEventMessages($langs->trans("BoxAdded"), null);
}
@ -64,11 +64,11 @@ llxHeader('', $langs->trans("AccountancyArea"));
if ($conf->accounting->enabled)
{
$step = 0;
$step = 0;
$resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
$resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
$helpisexpanded = empty($resultboxes['boxactivated']) || (empty($resultboxes['boxlista']) && empty($resultboxes['boxlistb'])); // If there is no widget, the tooltip help is expanded by default.
$helpisexpanded = empty($resultboxes['boxactivated']) || (empty($resultboxes['boxlista']) && empty($resultboxes['boxlistb'])); // If there is no widget, the tooltip help is expanded by default.
$showtutorial = '';
if (!$helpisexpanded)
@ -92,9 +92,9 @@ if ($conf->accounting->enabled)
print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'title_accountancy', 0, '', '', $showtutorial);
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
print "<br>\n";
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
print "<br>\n";
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
print "<br>\n"; print "<br>\n";
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
@ -103,13 +103,19 @@ if ($conf->accounting->enabled)
// STEPS
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong></a>');
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong></a>', $s);
print $s;
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong></a>');
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong></a>', $s);
print $s;
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong></a>');
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong></a>', $s);
print $s;
print "<br>\n";
print "<br>\n";
@ -118,66 +124,51 @@ if ($conf->accounting->enabled)
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong></a>');
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong></a>', $s);
print $s;
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong></a>')."\n";
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '{s}')."\n";
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong></a>', $s);
print $s;
print "<br>\n";
$step++;
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong></a>';
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, '{s}');
$s = str_replace('{s}', $textlink, $s);
print $s;
print "<br>\n";
if (!empty($conf->tax->enabled))
{
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
print "<br>\n";
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
$s = str_replace('{s}', $textlink, $s);
print $s;
print "<br>\n";
}
/*if (! empty($conf->salaries->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
// htdocs/admin/salaries.php
print "<br>\n";
print "<br>\n";
}*/
if (!empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>');
print "<br>\n";
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>', $s);
print $s;
print "<br>\n";
}
/*
if (! empty($conf->loan->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n";
}
if (! empty($conf->don->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n";
}
if (! empty($conf->adherents->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, '<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n";
}*/
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong></a>');
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong></a>', $s);
print $s;
print "<br>\n";
print '<br>';
// Step A - E
// Step A - E
print "<br>\n";
print load_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionFreq"), '', '');
@ -188,62 +179,70 @@ if ($conf->accounting->enabled)
$langs->loadLangs(array('bills', 'trips'));
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), '<a href="'.DOL_URL_ROOT.'/accountancy/customer/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").'</strong></a>')."\n";
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), '{s}')."\n";
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/customer/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").'</strong></a>', $s);
print $s;
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<a href="'.DOL_URL_ROOT.'/accountancy/supplier/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong></a>')."\n";
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), '{s}')."\n";
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/supplier/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong></a>', $s);
print $s;
print "<br>\n";
if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong></a>')."\n";
print "<br>\n";
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '{s}')."\n";
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong></a>', $s);
print $s;
print "<br>\n";
}
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64 + $step), $langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("RegistrationInAccounting"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n";
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64 + $step), $langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("RegistrationInAccounting"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n";
print $s;
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step))."<br>\n";
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step))."<br>\n";
print $s;
print "<br>\n";
print '<br>';
print '</div>';
print '<div class="clearboth"></div>';
print '<div class="clearboth"></div>';
print '<div class="fichecenter fichecenterbis">';
print '<div class="fichecenter fichecenterbis">';
/*
/*
* Show boxes
*/
$boxlist .= '<div class="twocolumns">';
$boxlist .= '<div class="twocolumns">';
$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
$boxlist .= $resultboxes['boxlista'];
$boxlist .= $resultboxes['boxlista'];
$boxlist .= '</div>';
$boxlist .= '</div>';
$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
$boxlist .= $resultboxes['boxlistb'];
$boxlist .= $resultboxes['boxlistb'];
$boxlist .= '</div>';
$boxlist .= "\n";
$boxlist .= '</div>';
$boxlist .= "\n";
$boxlist .= '</div>';
$boxlist .= '</div>';
print $boxlist;
print $boxlist;
print '</div>';
print '</div>';
} else {
print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
print '<span class="opacitymedium">'.$langs->trans("Module10Desc")."</span><br>\n";
}

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