mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-21 17:01:19 +01:00
Merge branch 'develop' of github.com:Dolibarr/dolibarr into new-webportal-module
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -62,3 +62,9 @@ doc/install.lock
|
||||
.idea
|
||||
/composer.json
|
||||
/composer.lock
|
||||
|
||||
/build/phpstan/phpstan
|
||||
/build/phpstan/bootstrap_custom.php
|
||||
phpstan_custom.neon
|
||||
/.php-cs-fixer.cache
|
||||
/.php_cs.cache
|
||||
|
||||
63
.php-cs-fixer.dist.php
Normal file
63
.php-cs-fixer.dist.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/* PHP 7.0 */
|
||||
$finder = (new PhpCsFixer\Finder())
|
||||
->in(__DIR__)
|
||||
->exclude([
|
||||
'core/includes',
|
||||
'custom',
|
||||
'documents',
|
||||
'doctemplates',
|
||||
'vendor',
|
||||
'install/doctemplates',
|
||||
'htdocs/custom',
|
||||
'htdocs/includes',
|
||||
'htdocs/install/doctemplates',
|
||||
])
|
||||
->notPath('vendor');
|
||||
|
||||
|
||||
/* PHP 7.4+ */
|
||||
/*
|
||||
$finder = (new PhpCsFixer\Finder())
|
||||
->in(__DIR__)
|
||||
->exclude([
|
||||
'custom',
|
||||
'documents',
|
||||
'htdocs/custom',
|
||||
'htdocs/includes',
|
||||
])
|
||||
->notPath([
|
||||
'vendor',
|
||||
]);
|
||||
*/
|
||||
|
||||
return (new PhpCsFixer\Config())
|
||||
->setRules([
|
||||
// Apply PSR-12 as per https://wiki.dolibarr.org/index.php?title=Langages_et_normes#PHP:~:text=utiliser%20est%20le-,PSR%2D12,-(https%3A//www
|
||||
'@PSR12' => true, // Disabled for now to limit number of changes
|
||||
|
||||
// Minimum version Dolibarr v18.0.0
|
||||
// Compatibility with min 7.1 is announced with Dolibarr18.0 but
|
||||
// app is still working with 7.0 so no reason to abandon compatiblity with this target for the moment.
|
||||
// So we use target PHP70 for the moment.
|
||||
'@PHP70Migration' => true,
|
||||
//'@PHP71Migration' => true,
|
||||
// Avoid adding public to const (incompatible with PHP 7.0):
|
||||
'visibility_required' => ['elements'=>['property', 'method']],
|
||||
|
||||
//'strict_param' => true,
|
||||
//'array_syntax' => ['syntax' => 'short'],
|
||||
//'list_syntax' => false,
|
||||
//'visibility_required' => false,
|
||||
'array_syntax' => false,
|
||||
'ternary_to_null_coalescing' => false
|
||||
])
|
||||
->setFinder($finder)
|
||||
// TAB Indent violates PSR-12 "must" rule, but used in code
|
||||
// (See https://www.php-fig.org/psr/psr-12/#24-indenting )
|
||||
->setIndent("\t")
|
||||
// All files MUST use the Unix LF line ending only
|
||||
// https://www.php-fig.org/psr/psr-12/#22-files
|
||||
->setLineEnding("\n")
|
||||
;
|
||||
13
.phpcs.xml.dist
Normal file
13
.phpcs.xml.dist
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="phpcs.xsd">
|
||||
<!--
|
||||
Documentation:
|
||||
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset
|
||||
-->
|
||||
|
||||
<rule ref="dev/setup/codesniffer/ruleset.xml"/>
|
||||
|
||||
<arg value="p"/>
|
||||
<arg name="colors"/>
|
||||
<arg name="extensions" value="php,inc" />
|
||||
</ruleset>
|
||||
63
.travis.yml
63
.travis.yml
@@ -31,25 +31,27 @@ env:
|
||||
|
||||
jobs:
|
||||
fast_finish: true
|
||||
#allow_failures:
|
||||
#- php: nightly
|
||||
allow_failures:
|
||||
- php: '8.3'
|
||||
include:
|
||||
- stage: PHP 7.0-8.1
|
||||
- stage: PHP min and max
|
||||
if: type = push
|
||||
php: '7.1'
|
||||
env:
|
||||
- DB=postgresql
|
||||
- TRAVIS_PHP_VERSION=7.1
|
||||
- stage: PHP 7.0-8.1
|
||||
- stage: PHP min and max
|
||||
if: type = pull_request OR type = push
|
||||
php: '8.1'
|
||||
php: '8.2'
|
||||
env:
|
||||
- DB=mysql
|
||||
- TRAVIS_PHP_VERSION=8.1
|
||||
#- stage: PHP Dev
|
||||
# if: type = push AND branch = developdisabled
|
||||
# php: '8.2'
|
||||
# env: DB=mysql
|
||||
- TRAVIS_PHP_VERSION=8.2
|
||||
- stage: PHP 8.3
|
||||
if: type = push AND branch = develop
|
||||
php: '8.3'
|
||||
env:
|
||||
- DB=mysql
|
||||
- TRAVIS_PHP_VERSION=8.3
|
||||
|
||||
notifications:
|
||||
email:
|
||||
@@ -81,6 +83,12 @@ before_install:
|
||||
if [ "$TRAVIS_PHP_VERSION" = '8.1' ]; then
|
||||
sudo apt install unzip apache2 php8.1 php8.1-cli php8.1-curl php8.1-mysql php8.1-pgsql php8.1-gd php8.1-imap php8.1-intl php8.1-ldap php8.1-xml php8.1-mbstring php8.1-xml php8.1-zip libapache2-mod-php8.1
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = '8.2' ]; then
|
||||
sudo apt install unzip apache2 php8.2 php8.2-cli php8.2-curl php8.2-mysql php8.2-pgsql php8.2-gd php8.2-imap php8.2-intl php8.2-ldap php8.2-xml php8.2-mbstring php8.2-xml php8.2-zip libapache2-mod-php8.2
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = '8.3' ]; then
|
||||
sudo apt install unzip apache2 php8.3 php8.3-cli php8.3-curl php8.3-mysql php8.3-pgsql php8.3-gd php8.3-imap php8.3-intl php8.3-ldap php8.3-xml php8.3-mbstring php8.3-xml php8.3-zip libapache2-mod-php8.3
|
||||
fi
|
||||
|
||||
- |
|
||||
echo Install pgsql if run is for pgsql
|
||||
@@ -112,6 +120,9 @@ install:
|
||||
if [ "$TRAVIS_PHP_VERSION" = '8.1' ]; then
|
||||
sudo update-alternatives --set php /usr/bin/php8.1
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = '8.2' ]; then
|
||||
sudo update-alternatives --set php /usr/bin/php8.2
|
||||
fi
|
||||
php -i | head -
|
||||
|
||||
- |
|
||||
@@ -148,7 +159,7 @@ install:
|
||||
squizlabs/php_codesniffer ^3
|
||||
fi
|
||||
# phpunit 9 is required for php 8
|
||||
if [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = '8.2' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
||||
if [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = '8.2' ] || [ "$TRAVIS_PHP_VERSION" = '8.3' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
||||
sudo composer self-update 2.4.4
|
||||
composer -n require --ignore-platform-reqs phpunit/phpunit ^8 \
|
||||
php-parallel-lint/php-parallel-lint ^1.2 \
|
||||
@@ -257,8 +268,9 @@ before_script:
|
||||
|
||||
- |
|
||||
export CONF_FILE=htdocs/conf/conf.php
|
||||
echo "Setting up Dolibarr $CONF_FILE"
|
||||
echo "Setting up Dolibarr '$CONF_FILE'"
|
||||
echo '<?php' > $CONF_FILE
|
||||
echo 'error_reporting(E_ALL);' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_url_root=\'http://127.0.0.1\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_document_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $CONF_FILE
|
||||
echo '$'dolibarr_main_data_root=\'$TRAVIS_BUILD_DIR/documents\'';' >> $CONF_FILE
|
||||
@@ -323,6 +335,20 @@ script:
|
||||
--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 --exclude htdocs/includes/webklex --blame .
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = "8.2" ]; then
|
||||
parallel-lint -e php --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 --exclude htdocs/includes/webklex --blame .
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = "8.3" ]; then
|
||||
parallel-lint -e php --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 --exclude htdocs/includes/webklex --blame .
|
||||
fi
|
||||
set +e
|
||||
echo
|
||||
|
||||
@@ -335,6 +361,12 @@ script:
|
||||
if [ "$TRAVIS_PHP_VERSION" = "8.1" ]; 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_PHP_VERSION" = "8.2" ]; 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_PHP_VERSION" = "8.3" ]; 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
|
||||
|
||||
@@ -347,6 +379,12 @@ script:
|
||||
if [ "$TRAVIS_PHP_VERSION" = "8.1" ]; then
|
||||
var-dump-check --extensions php --tracy --exclude htdocs/includes --exclude test/ --exclude htdocs/public/test/ --exclude htdocs/core/lib/functions.lib.php .
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = "8.2" ]; then
|
||||
var-dump-check --extensions php --tracy --exclude htdocs/includes --exclude test/ --exclude htdocs/public/test/ --exclude htdocs/core/lib/functions.lib.php .
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = "8.3" ]; then
|
||||
var-dump-check --extensions php --tracy --exclude htdocs/includes --exclude test/ --exclude htdocs/public/test/ --exclude htdocs/core/lib/functions.lib.php .
|
||||
fi
|
||||
set +e
|
||||
echo
|
||||
|
||||
@@ -356,6 +394,7 @@ script:
|
||||
# Ensure we catch errors
|
||||
set +e
|
||||
echo '<?php ' > $INSTALL_FORCED_FILE
|
||||
echo 'error_reporting(E_ALL);' >> $INSTALL_FORCED_FILE
|
||||
echo '$'force_install_noedit=2';' >> $INSTALL_FORCED_FILE
|
||||
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then
|
||||
echo '$'force_install_type=\'mysqli\'';' >> $INSTALL_FORCED_FILE
|
||||
|
||||
@@ -26,9 +26,9 @@ PHP libraries:
|
||||
EvalMath 1.0 BSD Yes Safe math expressions evaluation. Used by dynamic price only. TODO Replace with dol_eval ?
|
||||
Escpos-php 3.0 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
||||
GeoIP2 0.2.0 Apache License 2.0 Yes Lib to make geoip convert
|
||||
MathPHP 2.8.1 MIT License Yes Modern math library for PHP
|
||||
MathPHP 2.8.1 MIT License Yes Modern math library for PHP (only few files)
|
||||
Mobiledetect 2.8.41 MIT License Yes Detect mobile devices browsers
|
||||
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
|
||||
NuSoap 0.9.16 LGPL 2.1+ Yes Library to develop SOAP Web services. From https://github.com/f00b4r/nusoap/tree/v0.9.16
|
||||
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
|
||||
ParseDown 1.7.4 MIT License Yes Markdown parser
|
||||
PCLZip 2.8.4 LGPL-3+ Yes Library to zip/unzip files
|
||||
@@ -38,6 +38,7 @@ PHP-Iban 4.1.1 LGPL-3+ Yes
|
||||
PHP-Imap 2.7.2 MIT License Yes Library to use IMAP with OAuth
|
||||
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
|
||||
PrestaShop-WS-Lib 94feb5f OSL-3.0 No Library providing API client for Prestashop.
|
||||
PSR/Logs 1.0 MIT License Yes Library for logs (used by DebugBar)
|
||||
PSR/simple-cache ? MIT License Yes Library for cache (used by PHPSpreadSheet)
|
||||
Restler 3.1.1 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer)
|
||||
|
||||
47
ChangeLog
47
ChangeLog
@@ -9,6 +9,7 @@ For users:
|
||||
----------
|
||||
NEW: Compatibility with PHP 8.2
|
||||
NEW: Module for Advanced stock transfert is now stable (#26594)
|
||||
NEW: Module Workstation (used to enhance the module BOM and Manufacturing Order) is now stable
|
||||
NEW: Add a confirmation popup when deleting extrafields
|
||||
NEW: Add type 'icon' type for extrafields
|
||||
NEW: Close #20930 Use ajax for state loading after country change
|
||||
@@ -170,10 +171,12 @@ NEW: use account address in sepa mandate (#23642)
|
||||
NEW: VAT rate - Add entity
|
||||
NEW: webportal site account
|
||||
NEW: When an user unset the batch management of products, transformation of each batch stock mouvement in global stock mouvement
|
||||
FIX: #25828 wrong odt style naming
|
||||
|
||||
SEC: #25512 applicative anti bruteforce - security on too many login attempts (#25520)
|
||||
SEC: Add action confirm_... as sensitive to need a CSRF token
|
||||
SEC: Disable not used PHP streams
|
||||
SEC: Add option MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY
|
||||
|
||||
|
||||
For developers or integrators:
|
||||
@@ -197,6 +200,7 @@ QUAL: Standardize code and look and feel for dictionaries
|
||||
QUAL: Standardize code. Renamed ID of user properties into ->user_xxx_id
|
||||
QUAL: Use dol_clone with parameter 2 for ->oldcopy
|
||||
QUAL: use switch case instead of if elseif statements for actions
|
||||
QUAL: Better respect of REST API RFC.
|
||||
|
||||
NEW: [Add hook in user bank page]
|
||||
NEW: #19501 Add two hooks in dolreceiptprinter.php (#26439)
|
||||
@@ -231,12 +235,14 @@ WARNING:
|
||||
--------
|
||||
|
||||
The following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* The hook changeHelpURL is replaced by llxHeader
|
||||
* The property ->brouillon has been removed from all classes. It was not reliable and was a duplicate of ->status == self::STATUS_DRAFT.
|
||||
* The duplicated and deprecated property ->date_livraison that was renamed into ->delivery_date has been completely removed.
|
||||
* The property ->user_close to store ID of closing user has been renamed into ->user_closing_id.
|
||||
* The property ->user_validation to store ID of user validating has been renamed into ->user_validation_id.
|
||||
* The property ->user_creation to store ID of user of creation has been renamed into ->user_creation_id.
|
||||
* The property ->user_modification to store ID of user of modification has been renamed into ->user_modification_id.
|
||||
* The private array ->status_short, ->statuts and ->status_long are now array ->labelStatusShort and ->labelStatus everywhere.
|
||||
* The duplicate property ->user_creat, ->date_creat, ->date_valid has been removed (use instead user_creation, date_creation, date_validation).
|
||||
* The method get_substitutionarray_shipment_lines() has been removed. Use the generic get_substitutionarray_lines() instead.
|
||||
* The method ProductcustomerPrice->fetch_all_log() has been renamed into camel case ->fetchAllLog()
|
||||
@@ -245,8 +251,49 @@ The following changes may create regressions for some external modules, but were
|
||||
* It was possible to use a variable $soc or $right inside a PHP code condition of some extrafields properties, this is no more true (this 2 variables are no more global variables).
|
||||
* New hook files of modules actions_mymodule.class.php should now "extends CommonHookActions"
|
||||
* Endpoint for API /partnershipapi and /recruitment has been renamed into /partnerships and /recruitments to follow name conventions.
|
||||
* Hidden option ACCOUNTANCY_AUTOFIX_MISSING_LINK_TO_USEr_ON_SALARY_BANK_PAYMENT has been renamed into ACCOUNTANCY_AUTOFIX_MISSING_LINK_TO_USER_ON_SALARY_BANK_PAYMENT
|
||||
* The delete() method of AdherentType, Contact, Delivery, MultiCurrency, CurrencyRate now need $user as first parameter.
|
||||
* A very high number of class properties (with old name in french) are now deprecated in favor of the property name in english.
|
||||
|
||||
|
||||
***** ChangeLog for 18.0.4 compared to 18.0.3 *****
|
||||
FIX: $this->newref already exists and could have been modified by trigger but we still use a local variable for the filesystem-based renaming
|
||||
FIX: 16.0 only, backport fix for SQL error on global search product
|
||||
FIX: #25399 (#26694)
|
||||
FIX: #25458 intervention localizations (backport v17) (#26757)
|
||||
FIX: #26518
|
||||
FIX: #26536 Accountancy - Balance - Not divided lines by label & account, only by account (#26547)
|
||||
FIX: #26553 Supplier invoice - Do not display the delete button for reconciled payment (#26554)
|
||||
FIX: #26735
|
||||
FIX: #26994
|
||||
FIX: Accountancy - Possibility to write in bookkeeping expense report operation with some line not bound (#26545)
|
||||
FIX: add display of an error when attempting to delete a committed transaction (#26573)
|
||||
FIX: avoid warning : Cannot use a scalar value as an array (#26437)
|
||||
FIX: backport SQL error on global search product
|
||||
FIX: # Bug Estimated Stock at date value in V14 (#26479)
|
||||
FIX: commande context (#26497)
|
||||
FIX: delivery note disappear after generation
|
||||
FIX: double hook and paging search param in product list (#26767)
|
||||
FIX: Email reminder template must not be visible when option is off
|
||||
FIX: escape HTML tags in return value of getFullName() (#26735)
|
||||
FIX: Fix set private note (#26610)
|
||||
FIX: Fix when options FAC_FORCE_DATE_VALIDATION and INVOICE_CHECK_POSTERIOR_DATE enabled. The date is forced after the test and not before
|
||||
FIX: menu auguria
|
||||
FIX: pagination parameters on save and cancel buttons (#26605)
|
||||
FIX: pdf cornas page head multicell width (backport v17)
|
||||
FIX: php8 fatal on edit supplier order when multicurrency is activated (#26758)
|
||||
FIX: possible inconsistency between llx_ecm_files and file system when BILL_SUPPLIER_VALIDATES changes ref
|
||||
FIX: regression on planned bank entries (#26556)
|
||||
FIX: Social contribution - Payment list - Wrong information in type column (#26561)
|
||||
FIX: special_code update line keep old value. (#26819)
|
||||
FIX: substitute project variables in invoice documents (#26445)
|
||||
FIX: Test on permission for holiday tooltips
|
||||
FIX: v17: Param $notrigger in $societe->create() causes method to return true regardless of actual result of database functions (#26499)
|
||||
FIX: v18 SQL error in llx_c_forme_juridique.sql when installing
|
||||
FIX: Warehouse Global Amounts not displayed (#26478)
|
||||
FIX: warning param $lineID getSpecialCode is negatif (#26826)
|
||||
FIX: warning php8.2 undefined_array_key (#26830)
|
||||
|
||||
***** ChangeLog for 18.0.3 compared to 18.0.2 *****
|
||||
FIX: #25793 Cannot add time spent (#26405)
|
||||
FIX: #26100 Ticket - On edit, list of closed project must be excluded (#26223)
|
||||
|
||||
11
README.md
11
README.md
@@ -104,7 +104,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
||||
- Batches / Lots / Serials
|
||||
- Product Variants
|
||||
- Bill of Materials (BOM)
|
||||
- Manufacturing Orders
|
||||
- Manufacturing Orders (MO)
|
||||
|
||||
Customer/Sales Management
|
||||
|
||||
@@ -114,7 +114,8 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
||||
- Customer Orders management
|
||||
- Contracts/Subscription management
|
||||
- Interventions management
|
||||
- Ticket System
|
||||
- Ticket System (+ Knowledge management)
|
||||
- Partnership management
|
||||
- Shipping management
|
||||
- Customer Invoices/Credit notes and payment management
|
||||
- Point of Sale (POS)
|
||||
@@ -143,14 +144,16 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
||||
|
||||
- Shared calendar/agenda (with ical and vcal import/export for third-party tools integration)
|
||||
- Projects & Tasks management
|
||||
- Event organization
|
||||
- Ticket System
|
||||
- Surveys
|
||||
|
||||
HR
|
||||
HR - Human Resources Management
|
||||
|
||||
- Employee's leaves management
|
||||
- Expense reports
|
||||
- Recruitment management
|
||||
- Employee/staff management
|
||||
- Timesheets
|
||||
|
||||
### Other application/modules
|
||||
@@ -168,7 +171,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
||||
- Payment platforms integration (PayPal, Stripe, Paybox...)
|
||||
- Email-Collector
|
||||
|
||||
(around 100 modules available by default, 1000+ on the addon marketplace)
|
||||
(around 100 modules available by default, 1000+ addons at the official marketplace Dolistore.com)
|
||||
|
||||
### Other general features
|
||||
|
||||
|
||||
17
SECURITY.md
17
SECURITY.md
@@ -82,18 +82,17 @@ Scope is the web application (backoffice) and the APIs.
|
||||
## Examples of vulnerabilities that are Non-qualified for reporting.
|
||||
|
||||
* "Self" XSS
|
||||
* SSL/TLS best practices
|
||||
* Denial of Service attacks
|
||||
* Clickjacking/UI redressing
|
||||
* Physical or social engineering attempts or issues that require physical access to a victim’s computer/device
|
||||
* Presence of autocomplete attribute on web forms
|
||||
* Vulnerabilities affecting outdated browsers or platforms, or vulnerabilities inside browsers themself.
|
||||
* Logout and other instances of low-severity Cross-Site Request Forgery
|
||||
* Missing security-related HTTP headers which do not lead directly to a vulnerability
|
||||
* Reports from automated web vulnerability scanners (Acunetix, Vega, etc.) that have not been validated
|
||||
* Invalid or missing SPF (Sender Policy Framework) records (Incomplete or missing SPF/DKIM/DMARC)
|
||||
* Reports on features flagged as "experimental" or "development"
|
||||
* Software version or private IP disclosure when logged-in user is admin
|
||||
* Reports on features on modules flagged as "deprecated", "experimental" or "development" if the module needs to be enabled for that (this is not the case on production).
|
||||
* Software or libraries versions or private IP disclosure when logged-in user is admin
|
||||
* Stack traces or path disclosure when logged-in user is admin
|
||||
* Any vulnerabilities due to a configuration different than the one defined in chapter "Scope for qualified vulnerabilities".
|
||||
* Brute force attacks on login page, password forgotten page or any public pages (/public/*) are not qualified if the fail2ban recommended fail2ban rules were not installed.
|
||||
* Vulnerabilities affecting outdated browsers or platforms, or vulnerabilities inside browsers themself.
|
||||
* Brute force attacks on login page, password forgotten page or any public pages (/public/*) are not qualified if the recommended fail2ban rules were not installed.
|
||||
* SSL/TLS best practices
|
||||
* Denial of Service attacks
|
||||
* Invalid or missing SPF (Sender Policy Framework) records (Incomplete or missing SPF/DKIM/DMARC)
|
||||
* Physical or social engineering attempts or issues that require physical access to a victim’s computer/device
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
<?php
|
||||
$force_install_message='KeepDefaultValuesMamp';
|
||||
$force_install_main_data_root='/Applications/MAMP/dolibarr_documents';
|
||||
$force_install_type='mysqli';
|
||||
$force_install_dbserver='localhost';
|
||||
$force_install_port='8889';
|
||||
$force_install_database='dolibarr';
|
||||
$force_install_createdatabase='1';
|
||||
$force_install_databaselogin='dolibarrmysql';
|
||||
$force_install_databasepass='root';
|
||||
$force_install_createuser='1';
|
||||
$force_install_databaserootlogin='root';
|
||||
$force_install_databaserootpass='root';
|
||||
$force_install_dolibarrlogin='admin';
|
||||
$force_install_nophpinfo='1';
|
||||
$force_install_lockinstall='444';
|
||||
|
||||
$force_install_message = 'KeepDefaultValuesMamp';
|
||||
$force_install_main_data_root = '/Applications/MAMP/dolibarr_documents';
|
||||
$force_install_type = 'mysqli';
|
||||
$force_install_dbserver = 'localhost';
|
||||
$force_install_port = '8889';
|
||||
$force_install_database = 'dolibarr';
|
||||
$force_install_createdatabase = '1';
|
||||
$force_install_databaselogin = 'dolibarrmysql';
|
||||
$force_install_databasepass = 'root';
|
||||
$force_install_createuser = '1';
|
||||
$force_install_databaserootlogin = 'root';
|
||||
$force_install_databaserootpass = 'root';
|
||||
$force_install_dolibarrlogin = 'admin';
|
||||
$force_install_nophpinfo = '1';
|
||||
$force_install_lockinstall = '444';
|
||||
|
||||
@@ -253,6 +253,7 @@ int main(int argc, char **argv)
|
||||
//----------------
|
||||
int noarg,curseurarg,help=0,invalide=0;
|
||||
char option;
|
||||
char *endptr;
|
||||
|
||||
for (noarg=1;noarg<argc;noarg++) {
|
||||
if (((argv[noarg][0])=='/') || ((argv[noarg][0])=='-')) {
|
||||
@@ -261,7 +262,7 @@ for (noarg=1;noarg<argc;noarg++) {
|
||||
if (strlen(argv[noarg]) < 3) { ++noarg; curseurarg=0; }
|
||||
switch (option) {
|
||||
case 's': strncpy(Host,argv[noarg]+curseurarg,sizeof(Host)); break;
|
||||
case 'p': Port=atoi(argv[noarg]+curseurarg); break;
|
||||
case 'p': Port=strtol(argv[noarg] + curseurarg, &endptr, 10); break; // Get port from "-p80" (curseurarg = 2) or "-p 80" (curseurarg = 0)
|
||||
case '?': help=-1;break; // Help
|
||||
case 'h': help=-1;break; // Help
|
||||
case 'v': help=-1;break; // Help
|
||||
@@ -270,6 +271,20 @@ for (noarg=1;noarg<argc;noarg++) {
|
||||
}
|
||||
}
|
||||
|
||||
// Check for conversion errors
|
||||
if (*endptr != '\0') {
|
||||
// Handle error: Invalid input format
|
||||
printf("Invalid port number format\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// Check for overflow
|
||||
if (Port < 0 || Port > INT_MAX) {
|
||||
// Handle error: Port number out of range
|
||||
printf("Port number out of range\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
help=!(Port > 0);
|
||||
|
||||
// Show usage
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
* \brief This script create a xml checksum file
|
||||
*/
|
||||
|
||||
if (! defined('NOREQUIREDB')) {
|
||||
if (!defined('NOREQUIREDB')) {
|
||||
define('NOREQUIREDB', '1'); // Do not create database handler $db
|
||||
}
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
$path = dirname(__FILE__).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
@@ -44,9 +44,9 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
|
||||
* Main
|
||||
*/
|
||||
|
||||
$includecustom=0;
|
||||
$includeconstants=array();
|
||||
$buildzip=0;
|
||||
$includecustom = 0;
|
||||
$includeconstants = array();
|
||||
$buildzip = 0;
|
||||
|
||||
if (empty($argv[1])) {
|
||||
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value] [buildzip=1]\n";
|
||||
@@ -55,7 +55,7 @@ if (empty($argv[1])) {
|
||||
}
|
||||
|
||||
|
||||
$i=0;
|
||||
$i = 0;
|
||||
$result = array();
|
||||
while ($i < $argc) {
|
||||
if (!empty($argv[$i])) {
|
||||
@@ -71,10 +71,10 @@ while ($i < $argc) {
|
||||
$includeconstants[$i] = $result["includeconstant"];
|
||||
}
|
||||
if (!empty($result["buildzip"])) {
|
||||
$buildzip=1;
|
||||
$buildzip = 1;
|
||||
}
|
||||
if (preg_match('/includeconstant=/', strval($argv[$i]))) {
|
||||
$tmp=explode(':', $result['includeconstant'], 3); // $includeconstant has been set with previous parse_str()
|
||||
$tmp = explode(':', $result['includeconstant'], 3); // $includeconstant has been set with previous parse_str()
|
||||
if (count($tmp) != 3) {
|
||||
print "Error: Bad parameter includeconstant=".$result['includeconstant'] ."\n";
|
||||
exit -1;
|
||||
@@ -93,16 +93,16 @@ if (empty($release)) {
|
||||
$savrelease = $release;
|
||||
|
||||
// If release is auto, we take current version
|
||||
$tmpver=explode('-', $release, 2);
|
||||
$tmpver = explode('-', $release, 2);
|
||||
if ($tmpver[0] == 'auto' || $tmpver[0] == 'autostable') {
|
||||
$release=DOL_VERSION;
|
||||
$release = DOL_VERSION;
|
||||
if ($tmpver[1] && $tmpver[0] == 'auto') {
|
||||
$release.='-'.$tmpver[1];
|
||||
$release .= '-'.$tmpver[1];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($includecustom)) {
|
||||
$tmpverbis=explode('-', $release, 2);
|
||||
$tmpverbis = explode('-', $release, 2);
|
||||
if (empty($tmpverbis[1]) || $tmpver[0] == 'autostable') {
|
||||
if (DOL_VERSION != $tmpverbis[0] && $savrelease != 'auto') {
|
||||
print 'Error: When parameter "includecustom" is not set and there is no suffix in release parameter, version declared into filefunc.in.php ('.DOL_VERSION.') must be exact same value than "release" parameter ('.$tmpverbis[0].')'."\n";
|
||||
@@ -110,7 +110,7 @@ if (empty($includecustom)) {
|
||||
exit -1;
|
||||
}
|
||||
} else {
|
||||
$tmpverter=explode('-', DOL_VERSION, 2);
|
||||
$tmpverter = explode('-', DOL_VERSION, 2);
|
||||
if ($tmpverter[0] != $tmpverbis[0]) {
|
||||
print 'Error: When parameter "includecustom" is not set, version declared into filefunc.in.php ('.DOL_VERSION.') must have value without prefix ('.$tmpverter[0].') that is exact same value than "release" parameter ('.$tmpverbis[0].')'."\n";
|
||||
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
|
||||
@@ -118,7 +118,7 @@ if (empty($includecustom)) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (! preg_match('/'.preg_quote(DOL_VERSION, '/').'-/', $release)) {
|
||||
if (!preg_match('/'.preg_quote(DOL_VERSION, '/').'-/', $release)) {
|
||||
print 'Error: When parameter "includecustom" is set, version declared into filefunc.inc.php ('.DOL_VERSION.') must be used with a suffix into "release" parameter (ex: '.DOL_VERSION.'-mydistrib).'."\n";
|
||||
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
|
||||
exit -1;
|
||||
@@ -137,13 +137,13 @@ foreach ($includeconstants as $countrycode => $tmp) {
|
||||
print "\n";
|
||||
|
||||
//$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml';
|
||||
$outputdir=dirname(dirname(__FILE__)).'/htdocs/install';
|
||||
$outputdir = dirname(dirname(__FILE__)).'/htdocs/install';
|
||||
print 'Delete current files '.$outputdir.'/filelist*.xml*'."\n";
|
||||
dol_delete_file($outputdir.'/filelist*.xml*', 0, 1, 1);
|
||||
|
||||
$checksumconcat=array();
|
||||
$checksumconcat = array();
|
||||
|
||||
$outputfile=$outputdir.'/filelist-'.$release.'.xml';
|
||||
$outputfile = $outputdir.'/filelist-'.$release.'.xml';
|
||||
$fp = fopen($outputfile, 'w');
|
||||
if (empty($fp)) {
|
||||
print 'Failed to open file '.$outputfile."\n";
|
||||
@@ -156,8 +156,8 @@ fputs($fp, '<checksum_list version="'.$release.'" date="'.dol_print_date(dol_now
|
||||
foreach ($includeconstants as $countrycode => $tmp) {
|
||||
fputs($fp, '<dolibarr_constants country="'.$countrycode.'">'."\n");
|
||||
foreach ($tmp as $constname => $constvalue) {
|
||||
$valueforchecksum=(empty($constvalue)?'0':$constvalue);
|
||||
$checksumconcat[]=$valueforchecksum;
|
||||
$valueforchecksum = (empty($constvalue) ? '0' : $constvalue);
|
||||
$checksumconcat[] = $valueforchecksum;
|
||||
fputs($fp, ' <constant name="'.$constname.'">'.$valueforchecksum.'</constant>'."\n");
|
||||
}
|
||||
fputs($fp, '</dolibarr_constants>'."\n");
|
||||
@@ -172,26 +172,26 @@ $files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom
|
||||
*/
|
||||
// Define qualified files (must be same than into generate_filelist_xml.php and in api_setup.class.php)
|
||||
$regextoinclude = '\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|bak|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$';
|
||||
$regextoexclude = '('.($includecustom?'':'custom|').'documents|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
|
||||
$regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
|
||||
$files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
|
||||
|
||||
$dir='';
|
||||
$needtoclose=0;
|
||||
$dir = '';
|
||||
$needtoclose = 0;
|
||||
foreach ($files as $filetmp) {
|
||||
$file = $filetmp['fullname'];
|
||||
//$newdir = str_replace(dirname(__FILE__).'/../htdocs', '', dirname($file));
|
||||
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
|
||||
if ($newdir!=$dir) {
|
||||
if ($newdir != $dir) {
|
||||
if ($needtoclose) {
|
||||
fputs($fp, ' </dir>'."\n");
|
||||
}
|
||||
fputs($fp, ' <dir name="'.$newdir.'">'."\n");
|
||||
$dir = $newdir;
|
||||
$needtoclose=1;
|
||||
$needtoclose = 1;
|
||||
}
|
||||
if (filetype($file)=="file") {
|
||||
$md5=md5_file($file);
|
||||
$checksumconcat[]=$md5;
|
||||
if (filetype($file) == "file") {
|
||||
$md5 = md5_file($file);
|
||||
$checksumconcat[] = $md5;
|
||||
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
|
||||
}
|
||||
}
|
||||
@@ -205,7 +205,7 @@ fputs($fp, md5(join(',', $checksumconcat))."\n");
|
||||
fputs($fp, '</dolibarr_htdocs_dir_checksum>'."\n");
|
||||
|
||||
|
||||
$checksumconcat=array();
|
||||
$checksumconcat = array();
|
||||
|
||||
fputs($fp, '<dolibarr_script_dir version="'.$release.'">'."\n");
|
||||
|
||||
@@ -215,27 +215,27 @@ $iterator2 = new RecursiveIteratorIterator($dir_iterator2);
|
||||
// Need to ignore document custom etc. Note: this also ignore natively symbolic links.
|
||||
$files = new RegexIterator($iterator2, '#^(?:[A-Z]:)?(?:/(?!(?:custom|documents|conf|install))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i');
|
||||
*/
|
||||
$regextoinclude='\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$';
|
||||
$regextoexclude='(custom|documents|conf|install)$'; // Exclude dirs
|
||||
$regextoinclude = '\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$';
|
||||
$regextoexclude = '(custom|documents|conf|install)$'; // Exclude dirs
|
||||
$files = dol_dir_list(dirname(__FILE__).'/../scripts/', 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
|
||||
$dir='';
|
||||
$needtoclose=0;
|
||||
$dir = '';
|
||||
$needtoclose = 0;
|
||||
foreach ($files as $filetmp) {
|
||||
$file = $filetmp['fullname'];
|
||||
//$newdir = str_replace(dirname(__FILE__).'/../scripts', '', dirname($file));
|
||||
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
|
||||
$newdir = str_replace(dirname(__FILE__).'/../scripts', '', dirname($file));
|
||||
if ($newdir!=$dir) {
|
||||
if ($newdir != $dir) {
|
||||
if ($needtoclose) {
|
||||
fputs($fp, ' </dir>'."\n");
|
||||
}
|
||||
fputs($fp, ' <dir name="'.$newdir.'" >'."\n");
|
||||
$dir = $newdir;
|
||||
$needtoclose=1;
|
||||
$needtoclose = 1;
|
||||
}
|
||||
if (filetype($file)=="file") {
|
||||
$md5=md5_file($file);
|
||||
$checksumconcat[]=$md5;
|
||||
if (filetype($file) == "file") {
|
||||
$md5 = md5_file($file);
|
||||
$checksumconcat[] = $md5;
|
||||
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ Prerequisites to build autoexe DoliWamp package from Windows:
|
||||
|
||||
|
||||
***** Actions to do a BETA *****
|
||||
|
||||
This files describe steps made by Dolibarr packaging team to make a
|
||||
beta version of Dolibarr, step by step.
|
||||
|
||||
@@ -67,6 +68,7 @@ Recopy the content of the output file into the file ChangeLog.
|
||||
|
||||
|
||||
***** Actions to do a RELEASE *****
|
||||
|
||||
This files describe steps made by Dolibarr packaging team to make a
|
||||
complete release of Dolibarr, step by step.
|
||||
|
||||
|
||||
@@ -3,9 +3,7 @@ README (English)
|
||||
Building a Patch file
|
||||
##################################################
|
||||
|
||||
This directory contains tools to build a patch
|
||||
after a developer has made changes on files in its
|
||||
Dolibarr tree.
|
||||
The output patch file can then be submited on Dolibarr
|
||||
dev mailing-list, with explanation on its goal, for
|
||||
inclusion in main branch.
|
||||
This directory contains tools to build a patch after a developer has made changes on files in its Dolibarr tree.
|
||||
The output patch file can then be submited on Dolibarr dev mailing-list, with explanation on its goal, for inclusion in main branch.
|
||||
|
||||
Using this tool is now deprecated. You must use git pull requests to submit contributions.
|
||||
|
||||
@@ -5,15 +5,16 @@ PHPStan requires PHP >= 7.1
|
||||
|
||||
Config File is: ./phpstan.neon
|
||||
|
||||
Install phpstan:
|
||||
cd git; mkdir phpstan
|
||||
In dolibarr/build/phpstan
|
||||
mkdir phpstan
|
||||
cd phpstan
|
||||
composer require --dev phpstan/phpstan
|
||||
|
||||
Build report from CLI:
|
||||
cd git/dolibarr; mv htdocs/custom /tmp/
|
||||
php ../phpstan/htdocs/includes/bin/phpstan -v analyze -a build/phpstan/bootstrap.php --memory-limit 4G --error-format=table htdocs/commande/class
|
||||
php ../phpstan/htdocs/includes/bin/phpstan -v analyze -a build/phpstan/bootstrap.php --memory-limit 4G --error-format=table
|
||||
In dolibarr/
|
||||
mv htdocs/custom /tmp/
|
||||
php build/phpstan/phpstan/vendor/bin/phpstan -v analyze -c ./phpstan.neon -a build/phpstan/bootstrap.php --memory-limit 4G --error-format=table htdocs/commande/class
|
||||
php build/phpstan/phpstan/vendor/bin/phpstan -v analyze -c ./phpstan.neon -a build/phpstan/bootstrap.php --memory-limit 4G --error-format=table htdocs/
|
||||
mv /tmp/custom htdocs
|
||||
|
||||
Build HTML report from Cron:
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
<?php
|
||||
|
||||
// Defined some constants and load Dolibarr env to reduce PHPStan bootstrap that fails to load a lot of things.
|
||||
//define('DOL_DOCUMENT_ROOT', __DIR__ . '/../../htdocs');
|
||||
//define('DOL_DATA_ROOT', __DIR__ . '/../../documents');
|
||||
//define('DOL_URL_ROOT', '/');
|
||||
|
||||
// Load the main.inc.php file to have functions env defined
|
||||
if (! defined("NOLOGIN")) define("NOLOGIN", '1');
|
||||
if (! defined("NOHTTPSREDIRECT")) define("NOHTTPSREDIRECT", '1');
|
||||
if (!defined("NOLOGIN")) {
|
||||
define("NOLOGIN", '1');
|
||||
}
|
||||
if (!defined("NOSESSION")) {
|
||||
define("NOSESSION", '1');
|
||||
}
|
||||
if (!defined("NOHTTPSREDIRECT")) {
|
||||
define("NOHTTPSREDIRECT", '1');
|
||||
}
|
||||
global $conf, $langs, $user, $db;
|
||||
include_once __DIR__ . '/../../htdocs/main.inc.php';
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
How to use Rector to fix code
|
||||
-----------------------------
|
||||
|
||||
First, move rector.php file into htdocs
|
||||
|
||||
Then install rector.
|
||||
|
||||
Then ...
|
||||
@@ -1,99 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Set\ValueObject\LevelSetList;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
|
||||
return static function (RectorConfig $rectorConfig): void {
|
||||
$rectorConfig->paths([
|
||||
__DIR__ . '/accountancy',
|
||||
/* __DIR__ . '/adherents',
|
||||
__DIR__ . '/admin',
|
||||
__DIR__ . '/api',
|
||||
__DIR__ . '/asset',
|
||||
__DIR__ . '/asterisk',
|
||||
__DIR__ . '/barcode',
|
||||
__DIR__ . '/blockedlog',
|
||||
__DIR__ . '/bom',
|
||||
__DIR__ . '/bookcal',
|
||||
__DIR__ . '/bookmarks',
|
||||
__DIR__ . '/categories',
|
||||
__DIR__ . '/collab',
|
||||
__DIR__ . '/comm',
|
||||
__DIR__ . '/commande',
|
||||
__DIR__ . '/compta',
|
||||
__DIR__ . '/conf',
|
||||
__DIR__ . '/contact',
|
||||
__DIR__ . '/contrat',
|
||||
__DIR__ . '/core',
|
||||
__DIR__ . '/cron',
|
||||
__DIR__ . '/custom',
|
||||
__DIR__ . '/datapolicy',
|
||||
__DIR__ . '/dav',
|
||||
__DIR__ . '/debugbar',
|
||||
__DIR__ . '/delivery',
|
||||
__DIR__ . '/don',
|
||||
__DIR__ . '/ecm',
|
||||
__DIR__ . '/emailcollector',
|
||||
__DIR__ . '/eventorganization',
|
||||
__DIR__ . '/expedition',
|
||||
__DIR__ . '/expensereport',
|
||||
__DIR__ . '/exports',
|
||||
__DIR__ . '/externalsite',
|
||||
__DIR__ . '/fichinter',
|
||||
__DIR__ . '/fourn',
|
||||
__DIR__ . '/ftp',
|
||||
__DIR__ . '/holiday',
|
||||
__DIR__ . '/hrm',
|
||||
__DIR__ . '/imports',
|
||||
__DIR__ . '/install',
|
||||
__DIR__ . '/intracommreport',
|
||||
__DIR__ . '/knowledgemanagement',
|
||||
__DIR__ . '/loan',
|
||||
__DIR__ . '/mailmanspip',
|
||||
__DIR__ . '/margin',
|
||||
__DIR__ . '/mrp',
|
||||
__DIR__ . '/multicurrency',
|
||||
__DIR__ . '/opensurvey',
|
||||
__DIR__ . '/partnership',
|
||||
__DIR__ . '/paybox',
|
||||
__DIR__ . '/paypal',
|
||||
__DIR__ . '/printing',
|
||||
__DIR__ . '/product',
|
||||
__DIR__ . '/projet',
|
||||
__DIR__ . '/public',
|
||||
__DIR__ . '/reception',
|
||||
__DIR__ . '/recruitment',
|
||||
__DIR__ . '/resource',
|
||||
__DIR__ . '/salaries',
|
||||
__DIR__ . '/societe',
|
||||
__DIR__ . '/stripe',
|
||||
__DIR__ . '/supplier_proposal',
|
||||
__DIR__ . '/support',
|
||||
__DIR__ . '/takepos',
|
||||
__DIR__ . '/theme',
|
||||
__DIR__ . '/ticket',
|
||||
__DIR__ . '/user',
|
||||
__DIR__ . '/webhook',
|
||||
__DIR__ . '/webservices',
|
||||
__DIR__ . '/website',
|
||||
__DIR__ . '/workstation',
|
||||
__DIR__ . '/zapier',*/
|
||||
]);
|
||||
|
||||
// register a single rule
|
||||
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
|
||||
|
||||
// define sets of rules
|
||||
$rectorConfig->sets([
|
||||
//LevelSetList::UP_TO_PHP_81,
|
||||
SetList::CODE_QUALITY,
|
||||
SetList::CODING_STYLE,
|
||||
SetList::DEAD_CODE,
|
||||
SetList::EARLY_RETURN,
|
||||
SetList::NAMING
|
||||
]);
|
||||
};
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
//
|
||||
// Take a look at conf.php.example file for an example of conf.php file
|
||||
// and explanations for all possibles parameters.
|
||||
|
||||
@@ -44,37 +44,34 @@ With
|
||||
|
||||
NUSOAP:
|
||||
-------
|
||||
* In file nusoap.php, to avoid a warning,
|
||||
Replace
|
||||
if (isset($this->methodreturn) && ((get_class($this->methodreturn) == 'soap_fault') || (get_class($this->methodreturn) == 'nusoap_fault'))) {
|
||||
By
|
||||
if (! is_array($this->methodreturn) && isset($this->methodreturn) && ((get_class($this->methodreturn) == 'soap_fault') || (get_class($this->methodreturn) == 'nusoap_fault'))) {
|
||||
* Line 1257 of file nusoap.php. Add:
|
||||
|
||||
* In file nusoap.php, to avoid a warning,
|
||||
Replace call to serialize_val with no bugged value
|
||||
libxml_disable_entity_loader(true); // Avoid load of external entities (security problem). Required only for libxml < 2.
|
||||
|
||||
* In all files, replace constructor names into __construct. Replace also parent::constructor_name with parent::__construct
|
||||
|
||||
* Line 4222 of file nusoap.php
|
||||
* Line 4346 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] : '').")";
|
||||
$rev = array();
|
||||
preg_match('/\$Revision: ([^ ]+)/', $this->revision, $rev);
|
||||
$this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".(isset($rev[1]) ? $rev[1] : '').")";
|
||||
|
||||
* Line 6566 of file nusoap.php, replace
|
||||
|
||||
if (count($attrs) > 0) {
|
||||
with
|
||||
if (is_array($attrs) && count($attrs) > 0) {
|
||||
|
||||
|
||||
|
||||
TCPDF:
|
||||
------
|
||||
* Replace in tcpdf.php:
|
||||
|
||||
if (isset($this->imagekeys)) {
|
||||
foreach($this->imagekeys as $file) {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
with
|
||||
|
||||
if (isset($this->imagekeys)) {
|
||||
foreach($this->imagekeys as $file) {
|
||||
// DOL CHANGE If we keep this, source image files are physically destroyed
|
||||
@@ -82,8 +79,7 @@ with
|
||||
}
|
||||
}
|
||||
|
||||
* Replace in tcpdf.php
|
||||
|
||||
* Replace in tcpdf.php:
|
||||
$preserve = array(
|
||||
'file_id',
|
||||
'internal_encoding',
|
||||
@@ -91,9 +87,7 @@ with
|
||||
'bufferlen',
|
||||
'buffer',
|
||||
'cached_files',
|
||||
|
||||
with
|
||||
|
||||
$preserve = array(
|
||||
'file_id',
|
||||
'internal_encoding',
|
||||
@@ -104,14 +98,11 @@ with
|
||||
// @CHANGE DOL
|
||||
'imagekeys',
|
||||
|
||||
* Replace in tcpdf.php
|
||||
|
||||
* Replace in tcpdf.php:
|
||||
if (!@TCPDF_STATIC::file_exists($file)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
with
|
||||
|
||||
if (!@TCPDF_STATIC::file_exists($file)) {
|
||||
// DOL CHANGE If we keep this, the image is not visible on pages after the first one.
|
||||
//var_dump($file.' '.(!@TCPDF_STATIC::file_exists($file)));
|
||||
@@ -122,12 +113,9 @@ with
|
||||
}
|
||||
}
|
||||
|
||||
* Replace in tcpdf.php
|
||||
|
||||
* Replace in tcpdf.php:
|
||||
if (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) {
|
||||
|
||||
with
|
||||
|
||||
// @CHANGE LDR Add support for src="file://..." links
|
||||
if (strpos($imgsrc, 'file://') === 0) {
|
||||
$imgsrc = str_replace('file://', '/', $imgsrc);
|
||||
@@ -144,12 +132,9 @@ with
|
||||
elseif (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) {
|
||||
|
||||
|
||||
* In tecnickcom/tcpdf/include/tcpdf_static.php, in function fopenLocal, replace
|
||||
|
||||
* In tecnickcom/tcpdf/include/tcpdf_static.php, in function fopenLocal, replace:
|
||||
if (strpos($filename, '://') === false) {
|
||||
|
||||
with
|
||||
|
||||
if (strpos($filename, '//') === 0) {
|
||||
// Share folder on a (windows) server
|
||||
// e.g.: "//[MyServerName]/[MySharedFolder]/"
|
||||
@@ -158,10 +143,15 @@ with
|
||||
}
|
||||
elseif (strpos($filename, '://') === false)
|
||||
|
||||
* To avoid to have QRcode changed because generated with a random mask, replace
|
||||
define('QR_FIND_FROM_RANDOM', 2);
|
||||
* To avoid to have QRcode changed because generated with a random mask, replace:
|
||||
define('QR_FIND_FROM_RANDOM', 2);
|
||||
with
|
||||
define('QR_FIND_FROM_RANDOM', false);
|
||||
define('QR_FIND_FROM_RANDOM', false);
|
||||
|
||||
* Change line:
|
||||
imagesetpixel($imgalpha, $xpx, $ypx, $alpha);
|
||||
into
|
||||
imagesetpixel($imgalpha, $xpx, $ypx, (int) $alpha);
|
||||
|
||||
* Removed useless directories ("examples", "tools")
|
||||
|
||||
@@ -180,15 +170,15 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php
|
||||
* In tecnickcom/tcpdf/include/tcpdf_static, in function intToRoman, right at the beginning
|
||||
of the function, replace:
|
||||
|
||||
$roman = '';
|
||||
$roman = '';
|
||||
|
||||
with:
|
||||
with:
|
||||
|
||||
$roman = '';
|
||||
if ($number >= 4000) {
|
||||
// do not represent numbers above 4000 in Roman numerals
|
||||
return strval($number);
|
||||
}
|
||||
$roman = '';
|
||||
if ($number >= 4000) {
|
||||
// do not represent numbers above 4000 in Roman numerals
|
||||
return strval($number);
|
||||
}
|
||||
|
||||
* Add this at begin of tcpdf_autoconfig.php
|
||||
|
||||
@@ -223,7 +213,7 @@ with:
|
||||
|
||||
* Fix syntax error by replacing
|
||||
} elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1] >= 2))) {
|
||||
with
|
||||
with
|
||||
} elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1]) >= 2)) {
|
||||
|
||||
* Fix php fatal error on php 8.0 on tcpdi.php
|
||||
@@ -314,6 +304,24 @@ RESTLER:
|
||||
empty($value[0]) ? null :
|
||||
empty($value[1]) ? null :
|
||||
|
||||
* Add a test into AutoLoader.php to complete function loadThisLoader and test if property exists before calling it. For this replace code
|
||||
|
||||
if (false !== $file = $b::$loader[1]($className) && $this->exists($className, $b::$loader[1])) {
|
||||
return $file;
|
||||
}
|
||||
|
||||
with:
|
||||
|
||||
//avoid PHP Fatal error: Uncaught Error: Access to undeclared static property: Composer\\Autoload\\ClassLoader::$loader
|
||||
//in case of multiple autoloader systems
|
||||
if(property_exists($b, $loader[1])) {
|
||||
if (false !== $file = $b::$loader[1]($className)
|
||||
&& $this->exists($className, $b::$loader[1])) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+With swagger 2 provided into /explorer:
|
||||
----------------------------------------
|
||||
|
||||
@@ -332,11 +340,10 @@ PARSEDOWN
|
||||
...
|
||||
|
||||
// @CHANGE LDR
|
||||
if (preg_match('/{([^}]+)}/', $remainder, $matches2))
|
||||
{
|
||||
$Element['attributes']['class'] = $matches2[1];
|
||||
$remainder = preg_replace('/{'.preg_quote($matches2[1],'/').'}/', '', $remainder);
|
||||
}
|
||||
if (preg_match('/{([^}]+)}/', $remainder, $matches2)) {
|
||||
$Element['attributes']['class'] = $matches2[1];
|
||||
$remainder = preg_replace('/{'.preg_quote($matches2[1],'/').'}/', '', $remainder);
|
||||
}
|
||||
|
||||
|
||||
// @CHANGE LDR
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
$path = dirname(__FILE__).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
@@ -34,8 +34,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
}
|
||||
|
||||
// Global variables
|
||||
$version='1.7';
|
||||
$error=0;
|
||||
$version = '1.7';
|
||||
$error = 0;
|
||||
|
||||
|
||||
// -------------------- START OF YOUR CODE HERE --------------------
|
||||
@@ -48,8 +48,8 @@ $langs->load("main"); // To load language file for default language
|
||||
@set_time_limit(0);
|
||||
|
||||
// Load user and its permissions
|
||||
$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (! $result > 0) {
|
||||
$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (!$result > 0) {
|
||||
dol_print_error('', $user->error);
|
||||
exit;
|
||||
}
|
||||
@@ -74,20 +74,20 @@ $obj->note_public = 'A public comment';
|
||||
$obj->note_private = 'A private comment';
|
||||
$obj->cond_reglement_id = 1;
|
||||
|
||||
$line1=new FactureLigne($db);
|
||||
$line1->tva_tx=10.0;
|
||||
$line1->remise_percent=0;
|
||||
$line1->qty=1;
|
||||
$line1->total_ht=100;
|
||||
$line1->total_tva=10;
|
||||
$line1->total_ttc=110;
|
||||
$obj->lines[]=$line1;
|
||||
$line1 = new FactureLigne($db);
|
||||
$line1->tva_tx = 10.0;
|
||||
$line1->remise_percent = 0;
|
||||
$line1->qty = 1;
|
||||
$line1->total_ht = 100;
|
||||
$line1->total_tva = 10;
|
||||
$line1->total_ttc = 110;
|
||||
$obj->lines[] = $line1;
|
||||
|
||||
// Create invoice
|
||||
$idobject=$obj->create($user);
|
||||
$idobject = $obj->create($user);
|
||||
if ($idobject > 0) {
|
||||
// Change status to validated
|
||||
$result=$obj->validate($user);
|
||||
$result = $obj->validate($user);
|
||||
if ($result > 0) {
|
||||
print "OK Object created with id ".$idobject."\n";
|
||||
} else {
|
||||
@@ -102,7 +102,7 @@ if ($idobject > 0) {
|
||||
|
||||
// -------------------- END OF YOUR CODE --------------------
|
||||
|
||||
if (! $error) {
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
print '--- end ok'."\n";
|
||||
} else {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
$path = dirname(__FILE__).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
@@ -34,8 +34,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
}
|
||||
|
||||
// Global variables
|
||||
$version='1.11';
|
||||
$error=0;
|
||||
$version = '1.11';
|
||||
$error = 0;
|
||||
|
||||
|
||||
// -------------------- START OF YOUR CODE HERE --------------------
|
||||
@@ -48,8 +48,8 @@ $langs->load("main"); // To load language file for default language
|
||||
@set_time_limit(0);
|
||||
|
||||
// Load user and its permissions
|
||||
$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (! $result > 0) {
|
||||
$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (!$result > 0) {
|
||||
dol_print_error('', $user->error);
|
||||
exit;
|
||||
}
|
||||
@@ -75,17 +75,17 @@ $com->note_private = 'A private comment';
|
||||
$com->source = 1;
|
||||
$com->remise_percent = 0;
|
||||
|
||||
$orderline1=new OrderLine($db);
|
||||
$orderline1->tva_tx=10.0;
|
||||
$orderline1->remise_percent=0;
|
||||
$orderline1->qty=1;
|
||||
$com->lines[]=$orderline1;
|
||||
$orderline1 = new OrderLine($db);
|
||||
$orderline1->tva_tx = 10.0;
|
||||
$orderline1->remise_percent = 0;
|
||||
$orderline1->qty = 1;
|
||||
$com->lines[] = $orderline1;
|
||||
|
||||
// Create order
|
||||
$idobject=$com->create($user);
|
||||
$idobject = $com->create($user);
|
||||
if ($idobject > 0) {
|
||||
// Change status to validated
|
||||
$result=$com->valid($user);
|
||||
$result = $com->valid($user);
|
||||
if ($result > 0) {
|
||||
print "OK Object created with id ".$idobject."\n";
|
||||
} else {
|
||||
@@ -100,7 +100,7 @@ if ($idobject > 0) {
|
||||
|
||||
// -------------------- END OF YOUR CODE --------------------
|
||||
|
||||
if (! $error) {
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
print '--- end ok'."\n";
|
||||
} else {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
$path = dirname(__FILE__).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
@@ -34,8 +34,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
}
|
||||
|
||||
// Global variables
|
||||
$version='1.10';
|
||||
$error=0;
|
||||
$version = '1.10';
|
||||
$error = 0;
|
||||
|
||||
|
||||
// -------------------- START OF YOUR CODE HERE --------------------
|
||||
@@ -48,8 +48,8 @@ $langs->load("main"); // To load language file for default language
|
||||
@set_time_limit(0);
|
||||
|
||||
// Load user and its permissions
|
||||
$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (! $result > 0) {
|
||||
$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (!$result > 0) {
|
||||
dol_print_error('', $user->error);
|
||||
exit;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ $db->begin();
|
||||
require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php";
|
||||
|
||||
// Create instance of object
|
||||
$myproduct=new Product($db);
|
||||
$myproduct = new Product($db);
|
||||
|
||||
// Definition of product instance properties
|
||||
$myproduct->ref = '1234';
|
||||
@@ -91,7 +91,7 @@ if ($idobject > 0) {
|
||||
|
||||
// -------------------- END OF YOUR CODE --------------------
|
||||
|
||||
if (! $error) {
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
print '--- end ok'."\n";
|
||||
} else {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
$path = dirname(__FILE__).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
@@ -34,8 +34,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
}
|
||||
|
||||
// Global variables
|
||||
$version='1.7';
|
||||
$error=0;
|
||||
$version = '1.7';
|
||||
$error = 0;
|
||||
|
||||
|
||||
// -------------------- START OF YOUR CODE HERE --------------------
|
||||
@@ -48,8 +48,8 @@ $langs->load("main"); // To load language file for default language
|
||||
@set_time_limit(0);
|
||||
|
||||
// Load user and its permissions
|
||||
$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (! $result > 0) {
|
||||
$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (!$result > 0) {
|
||||
dol_print_error('', $user->error);
|
||||
exit;
|
||||
}
|
||||
@@ -71,10 +71,10 @@ $obj->login = 'ABCDEF';
|
||||
$obj->nom = 'ABCDEF';
|
||||
|
||||
// Create user
|
||||
$idobject=$obj->create($user);
|
||||
$idobject = $obj->create($user);
|
||||
if ($idobject > 0) {
|
||||
// Change status to validated
|
||||
$result=$obj->setStatut(1);
|
||||
$result = $obj->setStatut(1);
|
||||
if ($result > 0) {
|
||||
print "OK Object created with id ".$idobject."\n";
|
||||
} else {
|
||||
@@ -82,7 +82,7 @@ if ($idobject > 0) {
|
||||
dol_print_error($db, $obj->error);
|
||||
}
|
||||
} elseif ($obj->error == 'ErrorLoginAlreadyExists') {
|
||||
print "User with login ".$obj->login." already exists\n";
|
||||
print "User with login ".$obj->login." already exists\n";
|
||||
} else {
|
||||
$error++;
|
||||
dol_print_error($db, $obj->error);
|
||||
@@ -91,7 +91,7 @@ if ($idobject > 0) {
|
||||
|
||||
// -------------------- END OF YOUR CODE --------------------
|
||||
|
||||
if (! $error) {
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
print '--- end ok'."\n";
|
||||
} else {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
$path = dirname(__FILE__).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
@@ -34,8 +34,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
}
|
||||
|
||||
// Global variables
|
||||
$version='1.7';
|
||||
$error=0;
|
||||
$version = '1.7';
|
||||
$error = 0;
|
||||
|
||||
|
||||
// -------------------- START OF YOUR CODE HERE --------------------
|
||||
@@ -48,8 +48,8 @@ $langs->load("main"); // To load language file for default language
|
||||
@set_time_limit(0);
|
||||
|
||||
// Load user and its permissions
|
||||
$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (! $result > 0) {
|
||||
$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||
if (!$result > 0) {
|
||||
dol_print_error('', $user->error);
|
||||
exit;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ $user->getrights();
|
||||
|
||||
|
||||
print "***** ".$script_file." (".$version.") *****\n";
|
||||
if (! isset($argv[1])) { // Check parameters
|
||||
if (!isset($argv[1])) { // Check parameters
|
||||
print "Usage: ".$script_file." id_thirdparty ...\n";
|
||||
exit;
|
||||
}
|
||||
@@ -72,9 +72,9 @@ require_once DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php";
|
||||
|
||||
// Create contract object
|
||||
$obj = new Contrat($db);
|
||||
$obj->socid=$argv[1];
|
||||
$obj->socid = $argv[1];
|
||||
|
||||
$listofcontractsforcompany=$obj->getListOfContracts('all');
|
||||
$listofcontractsforcompany = $obj->getListOfContracts('all');
|
||||
|
||||
print $listofcontractsforcompany;
|
||||
|
||||
|
||||
124
dev/examples/stripe/webhook_ipn_paymentintent_failed_sepa.txt
Normal file
124
dev/examples/stripe/webhook_ipn_paymentintent_failed_sepa.txt
Normal file
@@ -0,0 +1,124 @@
|
||||
{
|
||||
"id": "evt_123456789",
|
||||
"object": "event",
|
||||
"api_version": "2023-10-16",
|
||||
"created": 1702053463,
|
||||
"data": {
|
||||
"object": {
|
||||
"id": "pi_123456789",
|
||||
"object": "payment_intent",
|
||||
"amount": 60,
|
||||
"amount_capturable": 0,
|
||||
"amount_details": {
|
||||
"tip": {
|
||||
}
|
||||
},
|
||||
"amount_received": 0,
|
||||
"application": null,
|
||||
"application_fee_amount": null,
|
||||
"automatic_payment_methods": null,
|
||||
"canceled_at": null,
|
||||
"cancellation_reason": null,
|
||||
"capture_method": "automatic",
|
||||
"client_secret": "pi_123456789_secret_123456789",
|
||||
"confirmation_method": "automatic",
|
||||
"created": 1702053448,
|
||||
"currency": "eur",
|
||||
"customer": "cus_123456789",
|
||||
"description": "Stripe payment from makeStripeSepaRequest: DID=31262-INV=123-CUS=123 did=123 ref=FA2312-123",
|
||||
"invoice": null,
|
||||
"last_payment_error": {
|
||||
"code": "",
|
||||
"decline_code": "generic_decline",
|
||||
"message": "The transaction can't be processed because your customer's account information is missing or incorrect. Collect a new mandate and ask your customer to provide their name and address exactly as it appears on their bank account. After this, you can attempt the transaction again.",
|
||||
"payment_method": {
|
||||
"id": "pm_123456789",
|
||||
"object": "payment_method",
|
||||
"billing_details": {
|
||||
"address": {
|
||||
"city": null,
|
||||
"country": "FR",
|
||||
"line1": null,
|
||||
"line2": null,
|
||||
"postal_code": null,
|
||||
"state": null
|
||||
},
|
||||
"email": "email@example.com",
|
||||
"name": "Test example",
|
||||
"phone": null
|
||||
},
|
||||
"created": 1692688898,
|
||||
"customer": "cus_123456789",
|
||||
"livemode": false,
|
||||
"metadata": {
|
||||
"dol_version": "19.0.0-dev",
|
||||
"dol_thirdparty_id": "123",
|
||||
"ipaddress": "1.2.3.4",
|
||||
"dol_id": "123",
|
||||
"dol_type": "companypaymentmode",
|
||||
"dol_entity": "1"
|
||||
},
|
||||
"sepa_debit": {
|
||||
"bank_code": "123",
|
||||
"branch_code": "",
|
||||
"country": "AT",
|
||||
"fingerprint": "123456789",
|
||||
"generated_from": {
|
||||
"charge": null,
|
||||
"setup_attempt": null
|
||||
},
|
||||
"last4": "3202"
|
||||
},
|
||||
"type": "sepa_debit"
|
||||
},
|
||||
"type": "card_error"
|
||||
},
|
||||
"latest_charge": "py_123456789",
|
||||
"livemode": false,
|
||||
"metadata": {
|
||||
"dol_version": "19.0.0-beta",
|
||||
"dol_thirdparty_id": "123",
|
||||
"ipaddress": "1.2.3.4",
|
||||
"dol_id": "123",
|
||||
"dol_type": "facture",
|
||||
"dol_entity": "1"
|
||||
},
|
||||
"next_action": null,
|
||||
"on_behalf_of": null,
|
||||
"payment_method": null,
|
||||
"payment_method_configuration_details": null,
|
||||
"payment_method_options": {
|
||||
"card": {
|
||||
"installments": null,
|
||||
"mandate_options": null,
|
||||
"network": null,
|
||||
"request_three_d_secure": "automatic"
|
||||
},
|
||||
"sepa_debit": {
|
||||
}
|
||||
},
|
||||
"payment_method_types": [
|
||||
"card",
|
||||
"sepa_debit"
|
||||
],
|
||||
"processing": null,
|
||||
"receipt_email": null,
|
||||
"review": null,
|
||||
"setup_future_usage": null,
|
||||
"shipping": null,
|
||||
"source": null,
|
||||
"statement_descriptor": "DID=123-",
|
||||
"statement_descriptor_suffix": "DID=123-",
|
||||
"status": "requires_payment_method",
|
||||
"transfer_data": null,
|
||||
"transfer_group": null
|
||||
}
|
||||
},
|
||||
"livemode": false,
|
||||
"pending_webhooks": 1,
|
||||
"request": {
|
||||
"id": null,
|
||||
"idempotency_key": null
|
||||
},
|
||||
"type": "payment_intent.payment_failed"
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
README
|
||||
------
|
||||
|
||||
Scripts in this directory can be used to load or purge data of a database instance.
|
||||
Scripts in this directory can be used to load massive data or purge data of a database instance.
|
||||
WARNING: Some of this script may delete definitely data.
|
||||
|
||||
To init data for a demo, use instead the tool into dev/initdemo
|
||||
|
||||
@@ -47,7 +47,7 @@ require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
|
||||
|
||||
define('GEN_NUMBER_FACTURE', $argv[1] ?? 1);
|
||||
$year = 2016;
|
||||
$dates = array (mktime(12, 0, 0, 1, 3, $year),
|
||||
$dates = array(mktime(12, 0, 0, 1, 3, $year),
|
||||
mktime(12, 0, 0, 1, 9, $year),
|
||||
mktime(12, 0, 0, 2, 13, $year),
|
||||
mktime(12, 0, 0, 2, 23, $year),
|
||||
@@ -168,7 +168,8 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0) {
|
||||
|
||||
$result=$object->validate($fuser);
|
||||
if ($result) {
|
||||
print " OK with ref ".$object->ref."\n";;
|
||||
print " OK with ref ".$object->ref."\n";
|
||||
;
|
||||
} else {
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ require_once DOL_DOCUMENT_ROOT."/commande/class/commande.class.php";
|
||||
|
||||
define('GEN_NUMBER_COMMANDE', $argv[1] ?? 10);
|
||||
$year = 2016;
|
||||
$dates = array (mktime(12, 0, 0, 1, 3, $year),
|
||||
$dates = array(mktime(12, 0, 0, 1, 3, $year),
|
||||
mktime(12, 0, 0, 1, 9, $year),
|
||||
mktime(12, 0, 0, 2, 13, $year),
|
||||
mktime(12, 0, 0, 2, 23, $year),
|
||||
|
||||
@@ -64,18 +64,24 @@ $user->getrights();
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product"; $productsid = array();
|
||||
$resql=$db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql); $i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql); $productsid[$i] = $row[0]; $i++;
|
||||
$row = $db->fetch_row($resql);
|
||||
$productsid[$i] = $row[0];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array();
|
||||
$resql=$db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql); $i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql); $societesid[$i] = $row[0]; $i++;
|
||||
$row = $db->fetch_row($resql);
|
||||
$societesid[$i] = $row[0];
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
print "err";
|
||||
@@ -84,9 +90,12 @@ if ($resql) {
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande"; $commandesid = array();
|
||||
$resql=$db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql); $i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql); $commandesid[$i] = $row[0]; $i++;
|
||||
$row = $db->fetch_row($resql);
|
||||
$commandesid[$i] = $row[0];
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
print "err";
|
||||
@@ -99,7 +108,7 @@ for ($s = 0; $s < GEN_NUMBER_PRODUIT; $s++) {
|
||||
$produit = new Product($db);
|
||||
$produit->type = mt_rand(0, 1);
|
||||
$produit->status = 1;
|
||||
$produit->ref = ($produit->type?'S':'P').time().$s;
|
||||
$produit->ref = ($produit->type ? 'S' : 'P').time().$s;
|
||||
$produit->label = 'Label '.time().$s;
|
||||
$produit->description = 'Description '.time().$s;
|
||||
$produit->price = mt_rand(1, 999.99);
|
||||
|
||||
@@ -49,7 +49,7 @@ require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
|
||||
|
||||
define('GEN_NUMBER_PROPAL', $argv[1] ?? 10);
|
||||
$year = 2016;
|
||||
$dates = array (mktime(12, 0, 0, 1, 3, $year),
|
||||
$dates = array(mktime(12, 0, 0, 1, 3, $year),
|
||||
mktime(12, 0, 0, 1, 9, $year),
|
||||
mktime(12, 0, 0, 2, 13, $year),
|
||||
mktime(12, 0, 0, 2, 23, $year),
|
||||
@@ -152,7 +152,7 @@ $user->rights->propal->creer=1;
|
||||
$user->rights->propal->propal_advance->validate=1;
|
||||
|
||||
|
||||
if (!empty($conf->global->PROPALE_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/" . getDolGlobalString('PROPALE_ADDON').".php")) {
|
||||
if (getDolGlobalString('PROPALE_ADDON') && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/" . getDolGlobalString('PROPALE_ADDON').".php")) {
|
||||
require_once DOL_DOCUMENT_ROOT ."/core/modules/propale/" . getDolGlobalString('PROPALE_ADDON').".php";
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,8 @@ $user->getrights();
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product"; $productsid = array();
|
||||
$resql=$db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql); $i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql);
|
||||
$productsid[$i] = $row[0];
|
||||
@@ -78,7 +79,8 @@ if ($resql) {
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array();
|
||||
$resql=$db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql); $i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql);
|
||||
$societesid[$i] = $row[0];
|
||||
@@ -91,7 +93,8 @@ if ($resql) {
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande"; $commandesid = array();
|
||||
$resql=$db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql); $i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$row = $db->fetch_row($resql);
|
||||
$commandesid[$i] = $row[0];
|
||||
@@ -117,7 +120,8 @@ for ($s = 0; $s < GEN_NUMBER_SOCIETE; $s++) {
|
||||
$soc->country_id=1;
|
||||
$soc->country_code='FR';
|
||||
// Un client sur 3 a une remise de 5%
|
||||
$user_remise=mt_rand(1, 3); if ($user_remise==3) {
|
||||
$user_remise=mt_rand(1, 3);
|
||||
if ($user_remise==3) {
|
||||
$soc->remise_percent=5;
|
||||
}
|
||||
print "> client=".$soc->client.", fournisseur=".$soc->fournisseur.", remise=".$soc->remise_percent."\n";
|
||||
|
||||
@@ -62,9 +62,9 @@ dol_syslog($script_file." launched with arg ".implode(',', $argv));
|
||||
$mode = $argv[1];
|
||||
$filepath = $argv[2];
|
||||
$filepatherr = $filepath.'.err';
|
||||
$defaultlang = empty($argv[3])?'en_US':$argv[3];
|
||||
$startlinenb = empty($argv[4])?1:$argv[4];
|
||||
$endlinenb = empty($argv[5])?0:$argv[5];
|
||||
$defaultlang = empty($argv[3]) ? 'en_US' : $argv[3];
|
||||
$startlinenb = empty($argv[4]) ? 1 : $argv[4];
|
||||
$endlinenb = empty($argv[5]) ? 0 : $argv[5];
|
||||
|
||||
if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) || empty($filepath)) {
|
||||
print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [defaultlang] [startlinenb] [endlinenb]\n";
|
||||
|
||||
@@ -63,8 +63,8 @@ $mode = $argv[1];
|
||||
$filepath = $argv[2];
|
||||
$filepatherr = $filepath.'.err';
|
||||
//$defaultlang = empty($argv[3])?'en_US':$argv[3];
|
||||
$startlinenb = empty($argv[3])?1:$argv[3];
|
||||
$endlinenb = empty($argv[4])?0:$argv[4];
|
||||
$startlinenb = empty($argv[3]) ? 1 : $argv[3];
|
||||
$endlinenb = empty($argv[4]) ? 0 : $argv[4];
|
||||
|
||||
if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) || empty($filepath)) {
|
||||
print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [startlinenb] [endlinenb]\n";
|
||||
@@ -128,8 +128,8 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
|
||||
$object->client = $fields[7];
|
||||
$object->fournisseur = $fields[8];
|
||||
|
||||
$object->name = $fields[13]?trim($fields[13]):$fields[0];
|
||||
$object->name_alias = $fields[0]!=$fields[13]?trim($fields[0]):'';
|
||||
$object->name = $fields[13] ? trim($fields[13]) : $fields[0];
|
||||
$object->name_alias = $fields[0] != $fields[13] ? trim($fields[0]) : '';
|
||||
|
||||
$object->address = trim($fields[14]);
|
||||
$object->zip = trim($fields[15]);
|
||||
|
||||
@@ -63,8 +63,8 @@ $mode = $argv[1];
|
||||
$filepath = $argv[2];
|
||||
$filepatherr = $filepath.'.err';
|
||||
//$defaultlang = empty($argv[3])?'en_US':$argv[3];
|
||||
$startlinenb = empty($argv[3])?1:$argv[3];
|
||||
$endlinenb = empty($argv[4])?0:$argv[4];
|
||||
$startlinenb = empty($argv[3]) ? 1 : $argv[3];
|
||||
$endlinenb = empty($argv[4]) ? 0 : $argv[4];
|
||||
|
||||
if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) || empty($filepath)) {
|
||||
print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [startlinenb] [endlinenb]\n";
|
||||
|
||||
@@ -148,8 +148,8 @@ $sqls=array(
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__'",
|
||||
),
|
||||
'project'=>array(
|
||||
// TODO set fk_project to null on object that refer to project
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."projet_task_time WHERE fk_task IN (select rowid FROM ".MAIN_DB_PREFIX."projet_task WHERE fk_projet IN (select rowid FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__'))",
|
||||
// TODO set fk_project to null on all objects/tables that refer to project
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."element_time WHERE elementtype = 'task' AND fk_element IN (select rowid FROM ".MAIN_DB_PREFIX."projet_task WHERE fk_projet IN (select rowid FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__'))",
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."projet_task WHERE fk_projet IN (select rowid FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__')",
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__'",
|
||||
),
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -245,6 +245,16 @@ export list="
|
||||
--ignore-table=$base.llx_c_ticketsup_category
|
||||
--ignore-table=$base.llx_c_ticketsup_severity
|
||||
--ignore-table=$base.llx_c_ticketsup_type
|
||||
--ignore-table=$base.llx_cabinetmed_c_banques
|
||||
--ignore-table=$base.llx_cabinetmed_c_examconclusion
|
||||
--ignore-table=$base.llx_cabinetmed_cons_extrafields
|
||||
--ignore-table=$base.llx_cabinetmed_diaglec
|
||||
--ignore-table=$base.llx_cabinetmed_examaut
|
||||
--ignore-table=$base.llx_cabinetmed_exambio
|
||||
--ignore-table=$base.llx_cabinetmed_examenprescrit
|
||||
--ignore-table=$base.llx_cabinetmed_motifcons
|
||||
--ignore-table=$base.llx_cabinetmed_patient
|
||||
--ignore-table=$base.llx_cabinetmed_societe
|
||||
--ignore-table=$base.llx_congespayes
|
||||
--ignore-table=$base.llx_congespayes_config
|
||||
--ignore-table=$base.llx_congespayes_events
|
||||
@@ -328,6 +338,8 @@ export list="
|
||||
--ignore-table=$base.tmp_llx_accouting_account
|
||||
--ignore-table=$base.tmp_llx_product_batch
|
||||
--ignore-table=$base.tmp_llx_product_batch2
|
||||
--ignore-table=$base.tmp_tmp
|
||||
--ignore-table=$base.tmp_user
|
||||
"
|
||||
echo "mysqldump -P$port -u$admin -p***** $list $base > $mydir/$dumpfile"
|
||||
mysqldump -P$port -u$admin $passwd $list $base > $mydir/$dumpfile
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
$path = dirname(__FILE__).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
@@ -30,39 +30,39 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
}
|
||||
|
||||
// Global variables
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
$sourceserver=isset($argv[1])?$argv[1]:''; // user@server:/src/file
|
||||
$password=isset($argv[2])?$argv[2]:'';
|
||||
$dataserver=isset($argv[3])?$argv[3]:'';
|
||||
$database=isset($argv[4])?$argv[4]:'';
|
||||
$loginbase=isset($argv[5])?$argv[5]:'';
|
||||
$passwordbase=isset($argv[6])?$argv[6]:'';
|
||||
$sourceserver = isset($argv[1]) ? $argv[1] : ''; // user@server:/src/file
|
||||
$password = isset($argv[2]) ? $argv[2] : '';
|
||||
$dataserver = isset($argv[3]) ? $argv[3] : '';
|
||||
$database = isset($argv[4]) ? $argv[4] : '';
|
||||
$loginbase = isset($argv[5]) ? $argv[5] : '';
|
||||
$passwordbase = isset($argv[6]) ? $argv[6] : '';
|
||||
|
||||
// Include Dolibarr environment
|
||||
$res=0;
|
||||
if (! $res && file_exists($path."../../master.inc.php")) {
|
||||
$res=@include $path."../../master.inc.php";
|
||||
$res = 0;
|
||||
if (!$res && file_exists($path."../../master.inc.php")) {
|
||||
$res = @include $path."../../master.inc.php";
|
||||
}
|
||||
if (! $res && file_exists($path."../../htdocs/master.inc.php")) {
|
||||
$res=@include $path."../../htdocs/master.inc.php";
|
||||
if (!$res && file_exists($path."../../htdocs/master.inc.php")) {
|
||||
$res = @include $path."../../htdocs/master.inc.php";
|
||||
}
|
||||
if (! $res && file_exists("../master.inc.php")) {
|
||||
$res=@include "../master.inc.php";
|
||||
if (!$res && file_exists("../master.inc.php")) {
|
||||
$res = @include "../master.inc.php";
|
||||
}
|
||||
if (! $res && file_exists("../../master.inc.php")) {
|
||||
$res=@include "../../master.inc.php";
|
||||
if (!$res && file_exists("../../master.inc.php")) {
|
||||
$res = @include "../../master.inc.php";
|
||||
}
|
||||
if (! $res && file_exists("../../../master.inc.php")) {
|
||||
$res=@include "../../../master.inc.php";
|
||||
if (!$res && file_exists("../../../master.inc.php")) {
|
||||
$res = @include "../../../master.inc.php";
|
||||
}
|
||||
if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) {
|
||||
$res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
|
||||
if (!$res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) {
|
||||
$res = @include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
|
||||
}
|
||||
if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) {
|
||||
$res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
|
||||
if (!$res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) {
|
||||
$res = @include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
|
||||
}
|
||||
if (! $res) {
|
||||
if (!$res) {
|
||||
die("Failed to include master.inc.php file\n");
|
||||
}
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
@@ -72,13 +72,13 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
* Main
|
||||
*/
|
||||
|
||||
$login='';
|
||||
$server='';
|
||||
$login = '';
|
||||
$server = '';
|
||||
if (preg_match('/^(.*)@(.*):(.*)$/', $sourceserver, $reg)) {
|
||||
$login=$reg[1];
|
||||
$server=$reg[2];
|
||||
$sourcefile=$reg[3];
|
||||
$targetfile=basename($sourcefile);
|
||||
$login = $reg[1];
|
||||
$server = $reg[2];
|
||||
$sourcefile = $reg[3];
|
||||
$targetfile = basename($sourcefile);
|
||||
}
|
||||
if (empty($sourceserver) || empty($server) || empty($login) || empty($sourcefile) || empty($password) || empty($database) || empty($loginbase) || empty($passwordbase)) {
|
||||
print "Usage: $script_file login@server:/src/file.(sql|gz|bz2) passssh databaseserver databasename loginbase passbase\n";
|
||||
@@ -88,22 +88,23 @@ if (empty($sourceserver) || empty($server) || empty($login) || empty($sourcefile
|
||||
}
|
||||
|
||||
|
||||
$targetdir='/tmp';
|
||||
$targetdir = '/tmp';
|
||||
print "Get dump file from server ".$server.", path ".$sourcefile.", connect with login ".$login." loaded into localhost\n";
|
||||
|
||||
$sftpconnectstring=$sourceserver;
|
||||
$sftpconnectstring = $sourceserver;
|
||||
print 'SFTP connect string : '.$sftpconnectstring."\n";
|
||||
//print 'SFTP password '.$password."\n";
|
||||
|
||||
|
||||
// SFTP connect
|
||||
if (! function_exists("ssh2_connect")) {
|
||||
dol_print_error('', 'ssh2_connect function does not exists'); exit(1);
|
||||
if (!function_exists("ssh2_connect")) {
|
||||
dol_print_error('', 'ssh2_connect function does not exists');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$connection = ssh2_connect($server, 22);
|
||||
if ($connection) {
|
||||
if (! @ssh2_auth_password($connection, $login, $password)) {
|
||||
if (!@ssh2_auth_password($connection, $login, $password)) {
|
||||
dol_syslog("Could not authenticate with username ".$login." . and password ".preg_replace('/./', '*', $password), LOG_ERR);
|
||||
exit(-5);
|
||||
} else {
|
||||
@@ -121,16 +122,16 @@ if ($connection) {
|
||||
print 'Get file '.$sourcefile.' into '.$targetdir.$targetfile."\n";
|
||||
ssh2_scp_recv($connection, $sourcefile, $targetdir.$targetfile);
|
||||
|
||||
$fullcommand="cat ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
|
||||
$fullcommand = "cat ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
|
||||
if (preg_match('/\.bz2$/', $targetfile)) {
|
||||
$fullcommand="bzip2 -c -d ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
|
||||
$fullcommand = "bzip2 -c -d ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
|
||||
}
|
||||
if (preg_match('/\.gz$/', $targetfile)) {
|
||||
$fullcommand="gzip -d ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
|
||||
$fullcommand = "gzip -d ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
|
||||
}
|
||||
print "Load dump with ".$fullcommand."\n";
|
||||
$output=array();
|
||||
$return_var=0;
|
||||
$output = array();
|
||||
$return_var = 0;
|
||||
print strftime("%Y%m%d-%H%M%S").' '.$fullcommand."\n";
|
||||
exec($fullcommand, $output, $return_var);
|
||||
foreach ($output as $line) {
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
$path = dirname(__FILE__).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
@@ -30,34 +30,34 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
}
|
||||
|
||||
// Global variables
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
$confirm=isset($argv[1])?$argv[1]:'';
|
||||
$confirm = isset($argv[1]) ? $argv[1] : '';
|
||||
|
||||
// Include Dolibarr environment
|
||||
$res=0;
|
||||
if (! $res && file_exists($path."../../master.inc.php")) {
|
||||
$res=@include $path."../../master.inc.php";
|
||||
$res = 0;
|
||||
if (!$res && file_exists($path."../../master.inc.php")) {
|
||||
$res = @include $path."../../master.inc.php";
|
||||
}
|
||||
if (! $res && file_exists($path."../../htdocs/master.inc.php")) {
|
||||
$res=@include $path."../../htdocs/master.inc.php";
|
||||
if (!$res && file_exists($path."../../htdocs/master.inc.php")) {
|
||||
$res = @include $path."../../htdocs/master.inc.php";
|
||||
}
|
||||
if (! $res && file_exists("../master.inc.php")) {
|
||||
$res=@include "../master.inc.php";
|
||||
if (!$res && file_exists("../master.inc.php")) {
|
||||
$res = @include "../master.inc.php";
|
||||
}
|
||||
if (! $res && file_exists("../../master.inc.php")) {
|
||||
$res=@include "../../master.inc.php";
|
||||
if (!$res && file_exists("../../master.inc.php")) {
|
||||
$res = @include "../../master.inc.php";
|
||||
}
|
||||
if (! $res && file_exists("../../../master.inc.php")) {
|
||||
$res=@include "../../../master.inc.php";
|
||||
if (!$res && file_exists("../../../master.inc.php")) {
|
||||
$res = @include "../../../master.inc.php";
|
||||
}
|
||||
if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) {
|
||||
$res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
|
||||
if (!$res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) {
|
||||
$res = @include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
|
||||
}
|
||||
if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) {
|
||||
$res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
|
||||
if (!$res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) {
|
||||
$res = @include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
|
||||
}
|
||||
if (! $res) {
|
||||
if (!$res) {
|
||||
die("Failed to include master.inc.php file\n");
|
||||
}
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
@@ -76,56 +76,56 @@ if (empty($confirm)) {
|
||||
}
|
||||
|
||||
|
||||
$tmp=dol_getdate(dol_now());
|
||||
$tmp = dol_getdate(dol_now());
|
||||
|
||||
|
||||
$tables=array(
|
||||
'propal'=>array(0=>'datep', 1=>'fin_validite', 2=>'date_valid', 3=>'date_cloture'),
|
||||
'commande'=>array(0=>'date_commande', 1=>'date_valid', 2=>'date_cloture'),
|
||||
'facture'=>array(0=>'datec', 1=>'datef', 2=>'date_valid', 3=>'date_lim_reglement'),
|
||||
'paiement'=>array(0=>'datep'),
|
||||
'bank'=>array(0=>'datev', 1=>'dateo'),
|
||||
'commande_fournisseur'=>array(0=>'date_commande', 1=>'date_valid', 3=>'date_creation', 4=>'date_approve', 5=>'date_approve2', 6=>'date_livraison'),
|
||||
'supplier_proposal'=>array(0=>'datec', 1=>'date_valid', 2=>'date_cloture'),
|
||||
'expensereport'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 4=>'date_approve', 5=>'date_refuse', 6=>'date_cancel'),
|
||||
'holiday'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 5=>'date_refuse', 6=>'date_cancel'),
|
||||
'ticket'=>array(0=>'datec', 1=>'date_read', 2=>'date_close')
|
||||
$tables = array(
|
||||
'propal' => array(0 => 'datep', 1 => 'fin_validite', 2 => 'date_valid', 3 => 'date_cloture'),
|
||||
'commande' => array(0 => 'date_commande', 1 => 'date_valid', 2 => 'date_cloture'),
|
||||
'facture' => array(0 => 'datec', 1 => 'datef', 2 => 'date_valid', 3 => 'date_lim_reglement'),
|
||||
'paiement' => array(0 => 'datep'),
|
||||
'bank' => array(0 => 'datev', 1 => 'dateo'),
|
||||
'commande_fournisseur' => array(0 => 'date_commande', 1 => 'date_valid', 3 => 'date_creation', 4 => 'date_approve', 5 => 'date_approve2', 6 => 'date_livraison'),
|
||||
'supplier_proposal' => array(0 => 'datec', 1 => 'date_valid', 2 => 'date_cloture'),
|
||||
'expensereport' => array(0 => 'date_debut', 1 => 'date_fin', 2 => 'date_create', 3 => 'date_valid', 4 => 'date_approve', 5 => 'date_refuse', 6 => 'date_cancel'),
|
||||
'holiday' => array(0 => 'date_debut', 1 => 'date_fin', 2 => 'date_create', 3 => 'date_valid', 5 => 'date_refuse', 6 => 'date_cancel'),
|
||||
'ticket' => array(0 => 'datec', 1 => 'date_read', 2 => 'date_close')
|
||||
);
|
||||
|
||||
$year=2010;
|
||||
$currentyear=$tmp['year'];
|
||||
$year = 2010;
|
||||
$currentyear = $tmp['year'];
|
||||
while ($year <= $currentyear) {
|
||||
//$year=2021;
|
||||
$delta1=($currentyear - $year);
|
||||
$delta2=($currentyear - $year - 1);
|
||||
$delta1 = ($currentyear - $year);
|
||||
$delta2 = ($currentyear - $year - 1);
|
||||
//$delta=-1;
|
||||
|
||||
if ($delta1) {
|
||||
foreach ($tables as $tablekey => $tableval) {
|
||||
print "Correct ".$tablekey." for year ".$year." and move them to current year ".$currentyear." ";
|
||||
$sql="select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." < DATE_ADD(NOW(), INTERVAL -1 YEAR)";
|
||||
$sql = "select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." < DATE_ADD(NOW(), INTERVAL -1 YEAR)";
|
||||
//$sql="select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." > NOW()";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i=0;
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj=$db->fetch_object($resql);
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
print ".";
|
||||
$sql2="UPDATE ".MAIN_DB_PREFIX.$tablekey." set ";
|
||||
$j=0;
|
||||
$sql2 = "UPDATE ".MAIN_DB_PREFIX.$tablekey." set ";
|
||||
$j = 0;
|
||||
foreach ($tableval as $field) {
|
||||
if ($j) {
|
||||
$sql2.=", ";
|
||||
$sql2 .= ", ";
|
||||
}
|
||||
$sql2.= $field." = ".$db->ifsql("DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR) > NOW()", "DATE_ADD(".$field.", INTERVAL ".$delta2." YEAR)", "DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR)");
|
||||
$sql2 .= $field." = ".$db->ifsql("DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR) > NOW()", "DATE_ADD(".$field.", INTERVAL ".$delta2." YEAR)", "DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR)");
|
||||
$j++;
|
||||
}
|
||||
$sql2.=" WHERE rowid = ".$obj->rowid;
|
||||
$sql2 .= " WHERE rowid = ".$obj->rowid;
|
||||
//print $sql2."\n";
|
||||
$resql2 = $db->query($sql2);
|
||||
if (! $resql2) {
|
||||
if (!$resql2) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
Files and tools were moved into htdocs/modulebuilder/template
|
||||
Files and tools of a skeleton to build a module were moved into htdocs/modulebuilder/template
|
||||
1
dev/tools/.gitignore
vendored
Normal file
1
dev/tools/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/vendor/
|
||||
@@ -34,10 +34,12 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
exit();
|
||||
}
|
||||
|
||||
error_reporting(E_ALL & ~ E_DEPRECATED);
|
||||
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
define('PRODUCT', "apstats");
|
||||
define('VERSION', "1.0");
|
||||
|
||||
$phpstanlevel = 2;
|
||||
|
||||
|
||||
print '***** '.constant('PRODUCT').' - '.constant('VERSION').' *****'."\n";
|
||||
if (empty($argv[1])) {
|
||||
@@ -51,7 +53,7 @@ $outputpath = $argv[1];
|
||||
$outputdir = dirname($outputpath);
|
||||
$outputfile = basename($outputpath);
|
||||
|
||||
if (! is_dir($outputdir)) {
|
||||
if (!is_dir($outputdir)) {
|
||||
print 'Error: dir '.$outputdir.' does not exists or is not writable'."\n";
|
||||
exit(1);
|
||||
}
|
||||
@@ -71,6 +73,7 @@ while ($i < $argc) {
|
||||
$i++;
|
||||
}
|
||||
|
||||
$timestart = time();
|
||||
|
||||
// Count lines of code of Dolibarr itself
|
||||
/*
|
||||
@@ -86,7 +89,7 @@ $resexec = (int) (empty($resexec) ? 0 : trim($resexec));
|
||||
*/
|
||||
|
||||
// Count lines of code of application
|
||||
$commandcheck = ($dirscc ? $dirscc.'/' : '').'scc . --exclude-dir=includes,custom';
|
||||
$commandcheck = ($dirscc ? $dirscc.'/' : '').'scc . --exclude-dir=htdocs/includes,htdocs/custom,htdocs/theme/common/fontawesome-5,htdocs/theme/common/octicons';
|
||||
print 'Execute SCC to count lines of code in project: '.$commandcheck."\n";
|
||||
$output_arrproj = array();
|
||||
$resexecproj = 0;
|
||||
@@ -94,7 +97,7 @@ exec($commandcheck, $output_arrproj, $resexecproj);
|
||||
|
||||
|
||||
// Count lines of code of dependencies
|
||||
$commandcheck = ($dirscc ? $dirscc.'/' : '').'scc htdocs/includes';
|
||||
$commandcheck = ($dirscc ? $dirscc.'/' : '').'scc htdocs/includes htdocs/theme/common/fontawesome-5 htdocs/theme/common/octicons';
|
||||
print 'Execute SCC to count lines of code in dependencies: '.$commandcheck."\n";
|
||||
$output_arrdep = array();
|
||||
$resexecdep = 0;
|
||||
@@ -102,7 +105,7 @@ exec($commandcheck, $output_arrdep, $resexecdep);
|
||||
|
||||
|
||||
// Get technical debt
|
||||
$commandcheck = ($dirphpstan ? $dirphpstan.'/' : '').'phpstan -v analyze -a build/phpstan/bootstrap.php --memory-limit 5G --error-format=github';
|
||||
$commandcheck = ($dirphpstan ? $dirphpstan.'/' : '').'phpstan --level='.$phpstanlevel.' -v analyze -a build/phpstan/bootstrap.php --memory-limit 5G --error-format=github';
|
||||
print 'Execute PHPStan to get the technical debt: '.$commandcheck."\n";
|
||||
$output_arrtd = array();
|
||||
$resexectd = 0;
|
||||
@@ -111,8 +114,8 @@ exec($commandcheck, $output_arrtd, $resexectd);
|
||||
$arrayoflineofcode = array();
|
||||
$arraycocomo = array();
|
||||
$arrayofmetrics = array(
|
||||
'proj'=>array('Bytes'=>0, 'Files'=>0, 'Lines'=>0, 'Blanks'=>0, 'Comments'=>0, 'Code'=>0, 'Complexity'=>0),
|
||||
'dep'=>array('Bytes'=>0, 'Files'=>0, 'Lines'=>0, 'Blanks'=>0, 'Comments'=>0, 'Code'=>0, 'Complexity'=>0)
|
||||
'proj' => array('Bytes' => 0, 'Files' => 0, 'Lines' => 0, 'Blanks' => 0, 'Comments' => 0, 'Code' => 0, 'Complexity' => 0),
|
||||
'dep' => array('Bytes' => 0, 'Files' => 0, 'Lines' => 0, 'Blanks' => 0, 'Comments' => 0, 'Code' => 0, 'Complexity' => 0)
|
||||
);
|
||||
|
||||
// Analyse $output_arrproj
|
||||
@@ -169,6 +172,8 @@ foreach (array('proj', 'dep') as $source) {
|
||||
}
|
||||
}
|
||||
|
||||
$timeend = time();
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@@ -176,6 +181,7 @@ foreach (array('proj', 'dep') as $source) {
|
||||
|
||||
$html = '<html>'."\n";
|
||||
$html .= '<meta charset="utf-8">'."\n";
|
||||
$html .= '<meta http-equiv="refresh" content="300">'."\n";
|
||||
$html .= '<meta name="viewport" content="width=device-width, initial-scale=1.0">'."\n";
|
||||
$html .= '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css" integrity="sha512-q3eWabyZPc1XTCmF+8/LuE1ozpg5xxn7iO89yfSOd5/oKvyqLngoNGsx8jq92Y8eXJ/IRxQbEC+FGSYxtk2oiw==" crossorigin="anonymous" referrerpolicy="no-referrer" />'."\n";
|
||||
$html .= '<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js" integrity="sha512-3gJwYpMe3QewGELv8k/BX9vcqhryRdzRMxVfq6ngyWXwo03GFEzjsUm8Q7RZcHPHksttq7/GFoxjCVUjkjvPdw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>'."\n";
|
||||
@@ -223,7 +229,7 @@ th,td {
|
||||
.nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.opacity {
|
||||
.opacitymedium {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.centpercent {
|
||||
@@ -237,6 +243,7 @@ th,td {
|
||||
}
|
||||
.seedetail {
|
||||
color: #000088;
|
||||
cursor: pointer;
|
||||
}
|
||||
.box {
|
||||
padding: 20px;
|
||||
@@ -292,16 +299,17 @@ $html .= '<body>'."\n";
|
||||
$html .= '<header>'."\n";
|
||||
$html .= '<h1>Advanced Project Statistics</h1>'."\n";
|
||||
$currentDate = date("Y-m-d H:i:s"); // Format: Year-Month-Day Hour:Minute:Second
|
||||
$html .= '<span class="opacity">Generated on '.$currentDate.'</span>'."\n";
|
||||
$html .= '<span class="opacitymedium">Generated on '.$currentDate.' in '.($timeend - $timestart).' seconds</span>'."\n";
|
||||
$html .= '</header>'."\n";
|
||||
|
||||
$html .= '<section class="chapter">'."\n";
|
||||
$html .= '<section class="chapter" id="linesofcode">'."\n";
|
||||
$html .= '<h2>Lines of code</h2>'."\n";
|
||||
|
||||
$html .= '<div class="div-table-responsive">'."\n";
|
||||
$html .= '<div class="boxallwidth">'."\n";
|
||||
$html .= '<table class="centpercent">';
|
||||
$html .= '<tr class="loc">';
|
||||
$html .= '<th class="left">Language</td>';
|
||||
$html .= '<th class="left">Language</th>';
|
||||
$html .= '<th class="right">Bytes</th>';
|
||||
$html .= '<th class="right">Files</th>';
|
||||
$html .= '<th class="right">Lines</th>';
|
||||
@@ -309,13 +317,13 @@ $html .= '<th class="right">Blanks</th>';
|
||||
$html .= '<th class="right">Comments</th>';
|
||||
$html .= '<th class="right">Code</th>';
|
||||
//$html .= '<td class="right">'.$val['Complexity'].'</td>';
|
||||
$html .= '</th>';
|
||||
$html .= '</tr>';
|
||||
foreach (array('proj', 'dep') as $source) {
|
||||
$html .= '<tr class="trgroup" id="source'.$source.'">';
|
||||
if ($source == 'proj') {
|
||||
$html .= '<td>All files from project only';
|
||||
$html .= '<td>All files without dependencies';
|
||||
} elseif ($source == 'dep') {
|
||||
$html .= '<td>All files from dependencies';
|
||||
$html .= '<td>All files of dependencies only';
|
||||
}
|
||||
$html .= ' <span class="seedetail" data-source="'.$source.'">(See detail per file type...)</span>';
|
||||
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Bytes']).'</td>';
|
||||
@@ -356,36 +364,51 @@ $html .= '<td></td>';
|
||||
$html .= '</tr>';
|
||||
$html .= '</table>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '</section>'."\n";
|
||||
|
||||
$html .= '<section class="chapter">'."\n";
|
||||
$html .= '<section class="chapter" id="projectvalue">'."\n";
|
||||
$html .= '<h2>Project value</h2><br>'."\n";
|
||||
|
||||
$html .= '<div class="boxallwidth">'."\n";
|
||||
$html .= '<div class="box inline-box back1">';
|
||||
$html .= 'COCOMO (Basic organic model) value:<br>';
|
||||
$html .= 'COCOMO value<br><span class="small">(Basic organic model)</span><br>';
|
||||
$html .= '<b>$'.formatNumber((empty($arraycocomo['proj']['currency']) ? 0 : $arraycocomo['proj']['currency']) + (empty($arraycocomo['dep']['currency']) ? 0 : $arraycocomo['dep']['currency']), 2).'</b>';
|
||||
$html .= '</div>';
|
||||
$html .= '<div class="box inline-box back2">';
|
||||
$html .= 'COCOMO (Basic organic model) effort<br>';
|
||||
$html .= 'COCOMO effort<br><span class="small">(Basic organic model)</span><br>';
|
||||
$html .= '<b>'.formatNumber($arraycocomo['proj']['people'] * $arraycocomo['proj']['effort'] + $arraycocomo['dep']['people'] * $arraycocomo['dep']['effort']);
|
||||
$html .= ' monthes people</b><br>';
|
||||
$html .= ' monthes people</b>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '</section>'."\n";
|
||||
|
||||
$html .= '<section class="chapter">'."\n";
|
||||
$html .= '<h2>Technical debt ('.count($output_arrtd).')</h2><br>'."\n";
|
||||
$html .= '<div class="div-table-responsive">'."\n";
|
||||
$html .= '<table class="list_technical_debt">'."\n";
|
||||
$html .= '<tr><td>File</td><td>Line</td><td>Type</td></tr>'."\n";
|
||||
$tmp = '';
|
||||
$nblines = 0;
|
||||
foreach ($output_arrtd as $line) {
|
||||
$reg = array();
|
||||
//print $line."\n";
|
||||
preg_match('/^::error file=(.*),line=(\d+),col=(\d+)::(.*)$/', $line, $reg);
|
||||
if (!empty($reg[1])) {
|
||||
$html .= '<tr><td>'.$reg[1].'</td><td>'.$reg[2].'</td><td>'.$reg[4].'</td></tr>'."\n";
|
||||
$tmp .= '<tr><td>'.$reg[1].'</td><td>'.$reg[2].'</td><td>'.$reg[4].'</td></tr>'."\n";
|
||||
$nblines++;
|
||||
}
|
||||
}
|
||||
|
||||
$html .= '<section class="chapter" id="technicaldebt">'."\n";
|
||||
$html .= '<h2>Technical debt <span class="opacitymedium">(PHPStan level '.$phpstanlevel.' -> '.$nblines.' warnings)</span></h2><br>'."\n";
|
||||
|
||||
$html .= '<div class="div-table-responsive">'."\n";
|
||||
$html .= '<div class="boxallwidth">'."\n";
|
||||
$html .= '<table class="list_technical_debt">'."\n";
|
||||
$html .= '<tr><td>File</td><td>Line</td><td>Type</td></tr>'."\n";
|
||||
$html .= $tmp;
|
||||
$html .= '</table>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '</section>'."\n";
|
||||
|
||||
$html .= '
|
||||
@@ -399,7 +422,7 @@ $( ".seedetail" ).on( "click", function() {
|
||||
});
|
||||
</script>
|
||||
';
|
||||
$html .= '</boby>';
|
||||
$html .= '</body>';
|
||||
$html .= '</html>';
|
||||
|
||||
$fh = fopen($outputpath, 'w');
|
||||
|
||||
@@ -37,14 +37,14 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
exit();
|
||||
}
|
||||
|
||||
error_reporting(E_ALL & ~ E_DEPRECATED);
|
||||
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
define('PRODUCT', "pg2mysql");
|
||||
define('VERSION', "2.0");
|
||||
|
||||
// this is the default, it can be overridden here, or specified as the third parameter on the command line
|
||||
$config['engine'] = "InnoDB";
|
||||
|
||||
if (! ($argv[1] && $argv[2])) {
|
||||
if (!($argv[1] && $argv[2])) {
|
||||
echo "Usage: php pg2mysql_cli.php <inputfilename> <outputfilename> [engine]\n";
|
||||
exit();
|
||||
} else {
|
||||
@@ -141,7 +141,7 @@ function pg2mysql_large($infilename, $outfilename)
|
||||
echo "Filesize: " . formatsize($fs) . "\n";
|
||||
|
||||
while ($instr = fgets($infp)) {
|
||||
$linenum ++;
|
||||
$linenum++;
|
||||
$memusage = round(memory_get_usage(true) / 1024 / 1024);
|
||||
$len = strlen($instr);
|
||||
$pgsqlchunk[] = $instr;
|
||||
@@ -163,7 +163,7 @@ function pg2mysql_large($infilename, $outfilename)
|
||||
}
|
||||
|
||||
if (strlen($instr) > 3 && ($instr[$len - 3] == ")" && $instr[$len - 2] == ";" && $instr[$len - 1] == "\n") && $inquotes == false) {
|
||||
$chunkcount ++;
|
||||
$chunkcount++;
|
||||
|
||||
if ($linenum % 10000 == 0) {
|
||||
$currentpos = ftell($infp);
|
||||
@@ -246,7 +246,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
if (is_array($input)) {
|
||||
$lines = $input;
|
||||
} else {
|
||||
$lines = split("\n", $input);
|
||||
$lines = explode("\n", $input);
|
||||
}
|
||||
|
||||
if ($header) {
|
||||
@@ -302,7 +302,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
$output .= 'DROP TABLE IF EXISTS `' . $reg2[1] . '`;' . "\n";
|
||||
}
|
||||
$output .= $line;
|
||||
$linenumber ++;
|
||||
$linenumber++;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
$output .= $tbl_extra;
|
||||
$output .= $line;
|
||||
|
||||
$linenumber ++;
|
||||
$linenumber++;
|
||||
$tbl_extra = "";
|
||||
continue;
|
||||
}
|
||||
@@ -395,10 +395,10 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
if (strstr($line, " CONSTRAINT ")) {
|
||||
$line = "";
|
||||
// and if the previous output ended with a , remove the ,
|
||||
$lastchr = substr($output, - 2, 1);
|
||||
$lastchr = substr($output, -2, 1);
|
||||
// echo "lastchr=$lastchr";
|
||||
if ($lastchr == ",") {
|
||||
$output = substr($output, 0, - 2) . "\n";
|
||||
$output = substr($output, 0, -2) . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,9 +408,9 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
if (substr($line, 0, 11) == "INSERT INTO") {
|
||||
$line = str_replace('public.', '', $line);
|
||||
|
||||
if (substr($line, - 3, - 1) == ");") {
|
||||
if (substr($line, -3, -1) == ");") {
|
||||
// we have a complete insert on one line
|
||||
list ($before, $after) = explode(" VALUES ", $line, 2);
|
||||
list($before, $after) = explode(" VALUES ", $line, 2);
|
||||
// we only replace the " with ` in what comes BEFORE the VALUES
|
||||
// (ie, field names, like INSERT INTO table ("bla","bla2") VALUES ('s:4:"test"','bladata2');
|
||||
// should convert to INSERT INTO table (`bla`,`bla2`) VALUES ('s:4:"test"','bladata2');
|
||||
@@ -424,13 +424,13 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
$after = str_replace(", E'", ", '", $after);
|
||||
|
||||
$output .= $before . " VALUES " . $after;
|
||||
$linenumber ++;
|
||||
$linenumber++;
|
||||
continue;
|
||||
} else {
|
||||
// this insert spans multiple lines, so keep dumping the lines until we reach a line
|
||||
// that ends with ");"
|
||||
|
||||
list ($before, $after) = explode(" VALUES ", $line, 2);
|
||||
list($before, $after) = explode(" VALUES ", $line, 2);
|
||||
// we only replace the " with ` in what comes BEFORE the VALUES
|
||||
// (ie, field names, like INSERT INTO table ("bla","bla2") VALUES ('s:4:"test"','bladata2');
|
||||
// should convert to INSERT INTO table (`bla`,`bla2`) VALUES ('s:4:"test"','bladata2');
|
||||
@@ -453,7 +453,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
|
||||
$output .= $before . " VALUES " . $after;
|
||||
do {
|
||||
$linenumber ++;
|
||||
$linenumber++;
|
||||
|
||||
// in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string')
|
||||
// ugh i guess its possible these strings could exist IN the data as well, but the only way to solve that is to process these lines one character
|
||||
@@ -477,7 +477,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
}
|
||||
// echo "inquotes=$inquotes\n";
|
||||
}
|
||||
} while (substr($lines[$linenumber], - 3, - 1) != ");" || $inquotes);
|
||||
} while (substr($lines[$linenumber], -3, -1) != ");" || $inquotes);
|
||||
}
|
||||
}
|
||||
if (substr($line, 0, 16) == "ALTER TABLE ONLY") {
|
||||
@@ -486,14 +486,14 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
$line = str_replace("public.", "", $line);
|
||||
$pkey = $line;
|
||||
|
||||
$linenumber ++;
|
||||
$linenumber++;
|
||||
if (!empty($lines[$linenumber])) {
|
||||
$line = $lines[$linenumber];
|
||||
} else {
|
||||
$line = '';
|
||||
}
|
||||
|
||||
if (strstr($line, " PRIMARY KEY ") && substr($line, - 3, - 1) == ");") {
|
||||
if (strstr($line, " PRIMARY KEY ") && substr($line, -3, -1) == ");") {
|
||||
$reg2 = array();
|
||||
if (preg_match('/ALTER TABLE ([^\s]+)/', $pkey, $reg2)) {
|
||||
if (empty($arrayofprimaryalreadyintabledef[$reg2[1]])) {
|
||||
@@ -580,7 +580,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
}
|
||||
}
|
||||
|
||||
$linenumber ++;
|
||||
$linenumber++;
|
||||
}
|
||||
|
||||
return array('output' => $output,'outputatend' => $outputatend);
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Count number of different contributors and number of commits for a given year.
|
||||
# Can be used for statistics (for example to generate the inforgraphy of the year)
|
||||
#
|
||||
|
||||
if [ "x$1" = "x" ]; then
|
||||
echo "Usage: $0 YEAR"
|
||||
echo "Usage: $0 YEARSTART [YEAREND]"
|
||||
exit
|
||||
fi
|
||||
|
||||
@@ -12,10 +13,15 @@ fi
|
||||
FROM=$1-01-01
|
||||
TO=$1-12-31
|
||||
|
||||
echo "Number of contributors for the year"
|
||||
echo "git log --since $FROM --before $TO | grep ^Author | sort -u -f -i -b | wc -l"
|
||||
git log --since $FROM --before $TO | grep ^Author | sort -u -f -i -b | wc -l
|
||||
if [ "x$2" != "x" ]; then
|
||||
TO=$2-12-31
|
||||
fi
|
||||
|
||||
echo "--- Number of contributors for the year"
|
||||
echo "git log --since $FROM --before $TO | grep ^Author | awk -F'<' '{ print $1 }' | iconv -f UTF-8 -t ASCII//TRANSLIT | sort -u -f -i -b | wc -l"
|
||||
git log --since $FROM --before $TO | grep '^Author' | awk -F"<" '{ print $1 }' | iconv -f UTF-8 -t ASCII//TRANSLIT | sort -u -f -i -b | wc -l
|
||||
|
||||
|
||||
echo "Number of commit for the year"
|
||||
git log --pretty='format:%cd' --date=format:'%Y' | uniq -c | awk '{print "Year: "$2", commits: "$1}' | grep "Year: $1"
|
||||
echo "--- Number of commit for the year"
|
||||
echo "git log --pretty='format:%cd' --date=format:'%Y' | sort | uniq -c | awk '{ if (\$2 >= '"$1"') { print \"Year: \"\$2\", commits: \"\$1 } }'"
|
||||
git log --pretty='format:%cd' --date=format:'%Y' | sort | uniq -c | awk '{ if ($2 >= '$1') { print "Year: "$2", commits: "$1 } }'
|
||||
|
||||
3
dev/tools/php-cs-fixer/.gitignore
vendored
Normal file
3
dev/tools/php-cs-fixer/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/vendor/
|
||||
/composer.json
|
||||
/composer.lock
|
||||
80
dev/tools/php-cs-fixer/run-php-cs-fixer.sh
Executable file
80
dev/tools/php-cs-fixer/run-php-cs-fixer.sh
Executable file
@@ -0,0 +1,80 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Usage:
|
||||
# Optionally set COMPOSER_CMD to the command to use to run composer.
|
||||
# Optionally set COMPOSER_VENDOR_DIR to your vendor path for composer.
|
||||
#
|
||||
# Run php-cs-fixer by calling this script:
|
||||
# ./run-php-cs-fixer.sh check # Only checks (not available with PHP 7.0)
|
||||
# ./run-php-cs-fixer.sh fix # Fixes
|
||||
#
|
||||
# You can fix only a few files using
|
||||
# ./run-php-cs-fixer.sh fix htdocs/path/to/myfile.php
|
||||
#
|
||||
# You can run this from the root directory of dolibarr
|
||||
# dev/tools/run-php-cs-fixer.sh fix htdocs/path/to/myfile.php
|
||||
#
|
||||
# You can provide the environment variables on the CLI like this:
|
||||
# COMPOSER_CMD="php ~/composer.phar" COMPOSER_VENDOR_DIR="~/vendor" ./run-php-cs-fixer.sh
|
||||
#
|
||||
# or export them:
|
||||
# export COMPOSER_CMD="~/composer.phar"
|
||||
# export COMPOSER_VENDOR_DIR="~/vendor"
|
||||
# ./run-php-cs-fixer.sh
|
||||
#
|
||||
# Or some other method
|
||||
#
|
||||
|
||||
|
||||
MYDIR=$(dirname "$(realpath "$0")")
|
||||
export COMPOSER_VENDOR_DIR=${COMPOSER_VENDOR_DIR:=$MYDIR/vendor}
|
||||
COMPOSER_CMD=${COMPOSER_CMD:composer}
|
||||
MINPHPVERSION="7.0"
|
||||
|
||||
|
||||
echo "***** run-php-cs-fixer.sh *****"
|
||||
|
||||
if [ "x$1" = "x" ]; then
|
||||
echo "Syntax: run-php-cs-fixer.sh check|fix [path_from_root_project]"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Check composer is available
|
||||
#
|
||||
if [ ! -r "${COMPOSER_CMD}" ] ; then
|
||||
echo composer is not available or not in path. You can give the path of composer by setting COMPOSER_CMD=/pathto/composer
|
||||
echo Example: export COMPOSER_CMD="~/composer.phar"
|
||||
echo Example: export COMPOSER_CMD="/usr/local/bin/composer"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Install/update php-cs-fixer
|
||||
#
|
||||
echo Install php-cs-fixer
|
||||
PHP_CS_FIXER="${COMPOSER_VENDOR_DIR}/bin/php-cs-fixer"
|
||||
if [ ! -r "${PHP_CS_FIXER}" ] ; then
|
||||
[[ ! -e "${COMPOSER_VENDOR_DIR}" ]] && ${COMPOSER_CMD} install
|
||||
[[ -e "${COMPOSER_VENDOR_DIR}" ]] && ${COMPOSER_CMD} update
|
||||
php${MINPHPVERSION} ${COMPOSER_CMD} require --dev friendsofphp/php-cs-fixer
|
||||
echo
|
||||
fi
|
||||
|
||||
|
||||
# With PHP 7.0, php-cs-fixer is V2 (command check not supported)
|
||||
# With PHP 8.2, php-cs-fixer is V3
|
||||
|
||||
(
|
||||
echo cd "${MYDIR}/../../.."
|
||||
cd "${MYDIR}/../../.." || exit
|
||||
CMD=
|
||||
# If no argument, run check by default
|
||||
[[ "$1" == "" ]] && CMD=check
|
||||
# shellcheck disable=SC2086
|
||||
echo php${MINPHPVERSION} "${PHP_CS_FIXER}" $CMD "$@"
|
||||
php${MINPHPVERSION} "${PHP_CS_FIXER}" $CMD "$@"
|
||||
)
|
||||
1
dev/tools/rector/.gitignore
vendored
1
dev/tools/rector/.gitignore
vendored
@@ -1 +1,2 @@
|
||||
/test.php
|
||||
/vendor
|
||||
@@ -3,12 +3,18 @@
|
||||
|
||||
#### Installation
|
||||
|
||||
run in this folder
|
||||
Run in this folder
|
||||
```shell
|
||||
cd dev/tools/rector
|
||||
```
|
||||
|
||||
Install rector with composer
|
||||
```shell
|
||||
composer install
|
||||
```
|
||||
#### Usage
|
||||
|
||||
|
||||
#### Usage
|
||||
|
||||
##### To make changes (Add --dry-run for test mode only)
|
||||
```shell
|
||||
|
||||
@@ -5,10 +5,20 @@ declare(strict_types=1);
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\Set\ValueObject\LevelSetList;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
|
||||
return static function (RectorConfig $rectorConfig): void {
|
||||
$rectorConfig->phpVersion(PhpVersion::PHP_71);
|
||||
//$rectorConfig->indent(' ', 4);
|
||||
|
||||
// Traits seems not supported correctly by rector without declaring them as bootstrapFiles
|
||||
$arrayoftraitfiles = array(
|
||||
__DIR__ . '/../../../htdocs/core/class/commonincoterm.class.php',
|
||||
__DIR__ . '/../../../htdocs/core/class/commonpeople.class.php',
|
||||
__DIR__ . '/../../../htdocs/core/class/commonsocialnetworks.class.php'
|
||||
);
|
||||
$rectorConfig->bootstrapFiles($arrayoftraitfiles);
|
||||
|
||||
$rectorConfig->paths([
|
||||
__DIR__ . '/../../../htdocs/',
|
||||
__DIR__ . '/../../../scripts/',
|
||||
@@ -17,6 +27,8 @@ return static function (RectorConfig $rectorConfig): void {
|
||||
$rectorConfig->skip([
|
||||
'**/includes/**',
|
||||
'**/custom/**',
|
||||
'**/vendor/**',
|
||||
'**/rector/**', // Disable this line to test the "test.php" file.
|
||||
__DIR__ . '/../../../htdocs/custom/',
|
||||
__DIR__ . '/../../../htdocs/install/doctemplates/*'
|
||||
]);
|
||||
@@ -30,15 +42,33 @@ return static function (RectorConfig $rectorConfig): void {
|
||||
//$rectorConfig->rule(Rector\Php72\Rector\FuncCall\GetClassOnNullRector::class);
|
||||
//$rectorConfig->rule(Rector\Php72\Rector\Assign\ListEachRector::class);
|
||||
//$rectorConfig->rule(Rector\Php72\Rector\FuncCall\ParseStrWithResultArgumentRector::class);
|
||||
//$rectorConfig->rule(ReplaceEachAssignmentWithKeyCurrentRector::class);
|
||||
//$rectorConfig->rule(Rector\Php72\Rector\FuncCall\StringifyDefineRector::class);
|
||||
|
||||
//$rectorConfig->rule(Dolibarr\Rector\Renaming\GlobalToFunction::class);
|
||||
//$rectorConfig->rule(Dolibarr\Rector\Renaming\UserRightsToFunction::class);
|
||||
//$rectorConfig->rule(ReplaceEachAssignmentWithKeyCurrentRector::class);
|
||||
|
||||
$rectorConfig->rule(Rector\CodeQuality\Rector\FuncCall\FloatvalToTypeCastRector::class);
|
||||
$rectorConfig->rule(Rector\CodeQuality\Rector\FuncCall\BoolvalToTypeCastRector::class);
|
||||
$rectorConfig->rule(Rector\CodeQuality\Rector\NotEqual\CommonNotEqualRector::class);
|
||||
//$rectorconfig->rule(Rector\CodeQuality\Rector\If_\CompleteMissingIfElseBracketRector::class);
|
||||
$rectorConfig->rule(Rector\CodeQuality\Rector\For_\ForRepeatedCountToOwnVariableRector::class);
|
||||
|
||||
$rectorConfig->rule(Dolibarr\Rector\Renaming\GlobalToFunction::class);
|
||||
$rectorConfig->rule(Dolibarr\Rector\Renaming\UserRightsToFunction::class);
|
||||
$rectorConfig->rule(Dolibarr\Rector\Renaming\EmptyGlobalToFunction::class);
|
||||
|
||||
// Add all predefined rules to migrate to up to php 71
|
||||
// $rectorConfig->sets([
|
||||
// LevelSetList::UP_TO_PHP_71
|
||||
// ]);
|
||||
// Add all predefined rules to migrate to up to php 71.
|
||||
// Warning this break tab spacing of arrays on several lines
|
||||
/*$rectorConfig->sets([
|
||||
LevelSetList::UP_TO_PHP_70
|
||||
]);*/
|
||||
// Add predefined rules for a given version only
|
||||
//$rectorConfig->import(SetList::PHP_70);
|
||||
//$rectorConfig->import(SetList::PHP_71);
|
||||
//$rectorConfig->import(SetList::PHP_72);
|
||||
//$rectorConfig->import(SetList::PHP_73);
|
||||
//$rectorConfig->import(SetList::PHP_74);
|
||||
//$rectorConfig->import(SetList::PHP_80);
|
||||
//$rectorConfig->import(SetList::PHP_81);
|
||||
//$rectorConfig->import(SetList::PHP_82);
|
||||
//$rectorConfig->import(SetList::PHP_83);
|
||||
};
|
||||
|
||||
@@ -53,9 +53,11 @@ class EmptyGlobalToFunction extends AbstractRector
|
||||
{
|
||||
return new RuleDefinition(
|
||||
'Change $conf->global to getDolGlobal',
|
||||
[new CodeSample('$conf->global->CONSTANT',
|
||||
[new CodeSample(
|
||||
'$conf->global->CONSTANT',
|
||||
'getDolGlobalInt(\'CONSTANT\')'
|
||||
)]);
|
||||
)]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,7 +108,7 @@ class EmptyGlobalToFunction extends AbstractRector
|
||||
return new FuncCall(
|
||||
new Name('getDolGlobalString'),
|
||||
[new Arg($constName)]
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +138,7 @@ class EmptyGlobalToFunction extends AbstractRector
|
||||
return new BooleanNot(new FuncCall(
|
||||
new Name('getDolGlobalString'),
|
||||
[new Arg($constName)]
|
||||
));
|
||||
));
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -169,7 +171,7 @@ class EmptyGlobalToFunction extends AbstractRector
|
||||
}
|
||||
return \true;
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,9 @@ namespace Dolibarr\Rector\Renaming;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\ArrayItem;
|
||||
use PhpParser\Node\Expr\ArrayDimFetch;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\BinaryOp\BooleanAnd;
|
||||
use PhpParser\Node\Expr\BinaryOp\Concat;
|
||||
use PhpParser\Node\Expr\BinaryOp\Equal;
|
||||
@@ -12,6 +14,7 @@ use PhpParser\Node\Expr\BooleanNot;
|
||||
use PhpParser\Node\Expr\Empty_;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Expr\Isset_;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Expr\PropertyFetch;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
@@ -21,10 +24,12 @@ use Rector\Php71\ValueObject\TwoNodeMatch;
|
||||
use Symplify\RuleDocGenerator\Exception\PoorDocumentationException;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
use PhpParser\Node\Expr\BinaryOp\NotEqual;
|
||||
use PhpParser\Node\Expr\BinaryOp\Greater;
|
||||
use PhpParser\Node\Expr\BinaryOp\GreaterOrEqual;
|
||||
use PhpParser\Node\Expr\BinaryOp\Smaller;
|
||||
use PhpParser\Node\Expr\BinaryOp\SmallerOrEqual;
|
||||
use PhpParser\Node\Expr\BinaryOp\NotIdentical;
|
||||
|
||||
/**
|
||||
* Class with Rector custom rule to fix code
|
||||
@@ -55,10 +60,12 @@ class GlobalToFunction extends AbstractRector
|
||||
public function getRuleDefinition(): RuleDefinition
|
||||
{
|
||||
return new RuleDefinition(
|
||||
'Change $conf->global to getDolGlobal',
|
||||
[new CodeSample('$conf->global->CONSTANT',
|
||||
'Change $conf->global to getDolGlobal in context (1) conf->global Operator Value or (2) function(conf->global...)',
|
||||
[new CodeSample(
|
||||
'$conf->global->CONSTANT',
|
||||
'getDolGlobalInt(\'CONSTANT\')'
|
||||
)]);
|
||||
)]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,17 +75,51 @@ class GlobalToFunction extends AbstractRector
|
||||
*/
|
||||
public function getNodeTypes(): array
|
||||
{
|
||||
return [Equal::class, Greater::class, GreaterOrEqual::class, Smaller::class, SmallerOrEqual::class, BooleanAnd::class, Concat::class, ArrayDimFetch::class];
|
||||
return [Assign::class, FuncCall::class, MethodCall::class, Equal::class, NotEqual::class, Greater::class, GreaterOrEqual::class, Smaller::class, SmallerOrEqual::class, NotIdentical::class, BooleanAnd::class, Concat::class, ArrayItem::class, ArrayDimFetch::class];
|
||||
}
|
||||
|
||||
/**
|
||||
* refactor
|
||||
*
|
||||
* @param Node $node A node
|
||||
* @return Equal|Concat|ArrayDimFetch|void
|
||||
* @return FuncCall|Equal|Concat|ArrayDimFetch|void
|
||||
* return $node unchanged or void to do nothing
|
||||
*/
|
||||
public function refactor(Node $node)
|
||||
{
|
||||
if ($node instanceof Node\Expr\Assign) {
|
||||
if (!isset($node->var)) {
|
||||
return;
|
||||
}
|
||||
if ($this->isGlobalVar($node->expr)) {
|
||||
$constName = $this->getConstName($node->expr);
|
||||
if (empty($constName)) {
|
||||
return;
|
||||
}
|
||||
$node->expr = new FuncCall(
|
||||
new Name('getDolGlobalString'),
|
||||
[new Arg($constName)]
|
||||
);
|
||||
}
|
||||
return $node;
|
||||
}
|
||||
if ($node instanceof Node\Expr\ArrayItem) {
|
||||
if (!isset($node->key)) {
|
||||
return;
|
||||
}
|
||||
if ($this->isGlobalVar($node->value)) {
|
||||
$constName = $this->getConstName($node->value);
|
||||
if (empty($constName)) {
|
||||
return;
|
||||
}
|
||||
$node->value = new FuncCall(
|
||||
new Name('getDolGlobalString'),
|
||||
[new Arg($constName)]
|
||||
);
|
||||
}
|
||||
return $node;
|
||||
}
|
||||
|
||||
if ($node instanceof Node\Expr\ArrayDimFetch) {
|
||||
if (!isset($node->dim)) {
|
||||
return;
|
||||
@@ -95,6 +136,68 @@ class GlobalToFunction extends AbstractRector
|
||||
}
|
||||
return $node;
|
||||
}
|
||||
|
||||
if ($node instanceof FuncCall) {
|
||||
$tmpfunctionname = $this->getName($node);
|
||||
// If function is ok. We must avoid a lot of cases like isset(), empty()
|
||||
if (in_array($tmpfunctionname, array('dol_escape_htmltag', 'dol_hash', 'explode', 'is_numeric', 'length_accountg', 'length_accounta', 'make_substitutions', 'min', 'max', 'trunc', 'urlencode', 'yn'))) {
|
||||
//print "tmpfunctionname=".$tmpfunctionname."\n";
|
||||
$args = $node->getArgs();
|
||||
$nbofparam = count($args);
|
||||
|
||||
if ($nbofparam >= 1) {
|
||||
$tmpargs = $args;
|
||||
foreach ($args as $key => $arg) { // only 1 element in this array
|
||||
//var_dump($key);
|
||||
//var_dump($arg->value);exit;
|
||||
if ($this->isGlobalVar($arg->value)) {
|
||||
$constName = $this->getConstName($arg->value);
|
||||
if (empty($constName)) {
|
||||
return;
|
||||
}
|
||||
$a = new FuncCall(new Name('getDolGlobalString'), [new Arg($constName)]);
|
||||
$tmpargs[$key] = new Arg($a);
|
||||
|
||||
$r = new FuncCall(new Name($tmpfunctionname), $tmpargs);
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $node;
|
||||
}
|
||||
|
||||
if ($node instanceof MethodCall) {
|
||||
$tmpmethodname = $this->getName($node->name);
|
||||
// If function is ok. We must avoid a lot of cases
|
||||
if (in_array($tmpmethodname, array('fetch', 'idate', 'sanitize', 'select_language', 'trans'))) {
|
||||
//print "tmpmethodname=".$tmpmethodname."\n";
|
||||
$expr = $node->var;
|
||||
$args = $node->getArgs();
|
||||
$nbofparam = count($args);
|
||||
|
||||
if ($nbofparam >= 1) {
|
||||
$tmpargs = $args;
|
||||
foreach ($args as $key => $arg) { // only 1 element in this array
|
||||
//var_dump($key);
|
||||
//var_dump($arg->value);exit;
|
||||
if ($this->isGlobalVar($arg->value)) {
|
||||
$constName = $this->getConstName($arg->value);
|
||||
if (empty($constName)) {
|
||||
return;
|
||||
}
|
||||
$a = new FuncCall(new Name('getDolGlobalString'), [new Arg($constName)]);
|
||||
$tmpargs[$key] = new Arg($a);
|
||||
|
||||
$r = new MethodCall($expr, $tmpmethodname, $tmpargs);
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $node;
|
||||
}
|
||||
|
||||
if ($node instanceof Concat) {
|
||||
if ($this->isGlobalVar($node->left)) {
|
||||
$constName = $this->getConstName($node->left);
|
||||
@@ -123,6 +226,7 @@ class GlobalToFunction extends AbstractRector
|
||||
}
|
||||
return new Concat($leftConcat, $rightConcat);
|
||||
}
|
||||
|
||||
if ($node instanceof BooleanAnd) {
|
||||
$nodes = $this->resolveTwoNodeMatch($node);
|
||||
if (!isset($nodes)) {
|
||||
@@ -133,10 +237,16 @@ class GlobalToFunction extends AbstractRector
|
||||
$node = $nodes->getFirstExpr();
|
||||
}
|
||||
|
||||
// Now process all comparison like:
|
||||
// $conf->global->... Operator Value
|
||||
|
||||
$typeofcomparison = '';
|
||||
if ($node instanceof Equal) {
|
||||
$typeofcomparison = 'Equal';
|
||||
}
|
||||
if ($node instanceof NotEqual) {
|
||||
$typeofcomparison = 'NotEqual';
|
||||
}
|
||||
if ($node instanceof Greater) {
|
||||
$typeofcomparison = 'Greater';
|
||||
}
|
||||
@@ -149,6 +259,10 @@ class GlobalToFunction extends AbstractRector
|
||||
if ($node instanceof SmallerOrEqual) {
|
||||
$typeofcomparison = 'SmallerOrEqual';
|
||||
}
|
||||
if ($node instanceof NotIdentical) {
|
||||
$typeofcomparison = 'NotIdentical';
|
||||
//var_dump($node->left);
|
||||
}
|
||||
if (empty($typeofcomparison)) {
|
||||
return;
|
||||
}
|
||||
@@ -158,7 +272,8 @@ class GlobalToFunction extends AbstractRector
|
||||
}
|
||||
|
||||
// Test the type after the comparison conf->global->xxx to know the name of function
|
||||
switch ($node->right->getType()) {
|
||||
$typeright = $node->right->getType();
|
||||
switch ($typeright) {
|
||||
case 'Scalar_LNumber':
|
||||
$funcName = 'getDolGlobalInt';
|
||||
break;
|
||||
@@ -183,8 +298,8 @@ class GlobalToFunction extends AbstractRector
|
||||
$node->right
|
||||
);
|
||||
}
|
||||
if ($typeofcomparison == 'Greater') {
|
||||
return new Greater(
|
||||
if ($typeofcomparison == 'NotEqual') {
|
||||
return new NotEqual(
|
||||
new FuncCall(
|
||||
new Name($funcName),
|
||||
[new Arg($constName)]
|
||||
@@ -192,26 +307,44 @@ class GlobalToFunction extends AbstractRector
|
||||
$node->right
|
||||
);
|
||||
}
|
||||
if ($typeofcomparison == 'Greater') {
|
||||
return new Greater(
|
||||
new FuncCall(
|
||||
new Name($funcName),
|
||||
[new Arg($constName)]
|
||||
),
|
||||
$node->right
|
||||
);
|
||||
}
|
||||
if ($typeofcomparison == 'GreaterOrEqual') {
|
||||
return new GreaterOrEqual(
|
||||
new FuncCall(
|
||||
new Name($funcName),
|
||||
[new Arg($constName)]
|
||||
),
|
||||
),
|
||||
$node->right
|
||||
);
|
||||
);
|
||||
}
|
||||
if ($typeofcomparison == 'Smaller') {
|
||||
return new Smaller(
|
||||
new FuncCall(
|
||||
new Name($funcName),
|
||||
[new Arg($constName)]
|
||||
),
|
||||
),
|
||||
$node->right
|
||||
);
|
||||
);
|
||||
}
|
||||
if ($typeofcomparison == 'SmallerOrEqual') {
|
||||
return new SmallerOrEqual(
|
||||
new FuncCall(
|
||||
new Name($funcName),
|
||||
[new Arg($constName)]
|
||||
),
|
||||
$node->right
|
||||
);
|
||||
}
|
||||
if ($typeofcomparison == 'NotIdentical') {
|
||||
return new NotIdentical(
|
||||
new FuncCall(
|
||||
new Name($funcName),
|
||||
[new Arg($constName)]
|
||||
@@ -231,7 +364,7 @@ class GlobalToFunction extends AbstractRector
|
||||
{
|
||||
return $this->binaryOpManipulator->matchFirstAndSecondConditionNode(
|
||||
$booleanAnd,
|
||||
// $conf->global == $value
|
||||
// Function to check if we are in the case $conf->global->... == $value
|
||||
function (Node $node): bool {
|
||||
if (!$node instanceof Equal) {
|
||||
return \false;
|
||||
@@ -255,7 +388,7 @@ class GlobalToFunction extends AbstractRector
|
||||
* Check if node is a global access with format conf->global->XXX
|
||||
*
|
||||
* @param Node $node A node
|
||||
* @return bool Return true if noe is conf->global->XXX
|
||||
* @return bool Return true if node is conf->global->XXX
|
||||
*/
|
||||
private function isGlobalVar($node)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Dolibarr\Rector\Renaming;
|
||||
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
@@ -36,7 +35,8 @@ class UserRightsToFunction extends AbstractRector
|
||||
[new CodeSample(
|
||||
'$user->rights->module->permission',
|
||||
'$user->hasRight(\'module\', \'permission\')'
|
||||
)]);
|
||||
)]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,7 +62,6 @@ class UserRightsToFunction extends AbstractRector
|
||||
*/
|
||||
public function refactor(Node $node)
|
||||
{
|
||||
|
||||
if ($node instanceof Node\Stmt\ClassMethod) {
|
||||
$excludeMethods = ['getrights', 'hasRight'];
|
||||
/** @var \PHPStan\Analyser\MutatingScope $scope */
|
||||
@@ -122,7 +121,7 @@ class UserRightsToFunction extends AbstractRector
|
||||
return null;
|
||||
}
|
||||
// Add a test to avoid rector error on html.formsetup.class.php
|
||||
if (! $node->name instanceof Node\Expr\Variable && is_null($this->getName($node))) {
|
||||
if (!$node->name instanceof Node\Expr\Variable && is_null($this->getName($node))) {
|
||||
//var_dump($node);
|
||||
return null;
|
||||
//exit;
|
||||
|
||||
@@ -1,146 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/*
|
||||
* 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 dev/tools/spider.php
|
||||
* \brief Script to spider Dolibarr app.
|
||||
*
|
||||
* To use it:
|
||||
* - Disable module "bookmark"
|
||||
* - Exclude param optioncss, token, sortfield, sortorder
|
||||
*/
|
||||
|
||||
$crawledLinks=array();
|
||||
const MAX_DEPTH=2;
|
||||
|
||||
|
||||
/**
|
||||
* @param string $url URL
|
||||
* @param string $depth Depth
|
||||
* @return string String
|
||||
*/
|
||||
function followLink($url, $depth = 0)
|
||||
{
|
||||
global $crawledLinks;
|
||||
$crawling=array();
|
||||
if ($depth>MAX_DEPTH) {
|
||||
echo "<div style='color:red;'>The Crawler is giving up!</div>";
|
||||
return;
|
||||
}
|
||||
$options=array(
|
||||
'http'=>array(
|
||||
'method'=>"GET",
|
||||
'user-agent'=>"gfgBot/0.1\n"
|
||||
)
|
||||
);
|
||||
$context=stream_context_create($options);
|
||||
$doc=new DomDocument();
|
||||
@$doc->loadHTML(file_get_contents($url, false, $context));
|
||||
$links=$doc->getElementsByTagName('a');
|
||||
$pageTitle=getDocTitle($doc, $url);
|
||||
$metaData=getDocMetaData($doc);
|
||||
foreach ($links as $i) {
|
||||
$link=$i->getAttribute('href');
|
||||
if (ignoreLink($link)) continue;
|
||||
$link=convertLink($url, $link);
|
||||
if (!in_array($link, $crawledLinks)) {
|
||||
$crawledLinks[]=$link;
|
||||
$crawling[]=$link;
|
||||
insertIntoDatabase($link, $pageTitle, $metaData, $depth);
|
||||
}
|
||||
}
|
||||
foreach ($crawling as $crawlURL)
|
||||
followLink($crawlURL, $depth+1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $site Site
|
||||
* @param string $path Path
|
||||
* @return string String
|
||||
*/
|
||||
function convertLink($site, $path)
|
||||
{
|
||||
if (substr_compare($path, "//", 0, 2)==0)
|
||||
return parse_url($site)['scheme'].$path;
|
||||
elseif (substr_compare($path, "http://", 0, 7)==0
|
||||
or substr_compare($path, "https://", 0, 8)==0
|
||||
or substr_compare($path, "www.", 0, 4)==0
|
||||
)
|
||||
return $path;
|
||||
else return $site.'/'.$path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $url URL
|
||||
* @return boolean
|
||||
*/
|
||||
function ignoreLink($url)
|
||||
{
|
||||
return $url[0]=="#" or substr($url, 0, 11) == "javascript:";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $link URL
|
||||
* @param string $title Title
|
||||
* @param string $metaData Array
|
||||
* @param int $depth Depth
|
||||
* @return void
|
||||
*/
|
||||
function insertIntoDatabase($link, $title, &$metaData, $depth)
|
||||
{
|
||||
//global $crawledLinks;
|
||||
|
||||
echo "Inserting new record {URL= ".$link.", Title = '$title', Description = '".$metaData['description']."', Keywords = ' ".$metaData['keywords']."'}<br/><br/><br/>";
|
||||
|
||||
//²$crawledLinks[]=$link;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $doc Doc
|
||||
* @param string $url URL
|
||||
* @return string URL/Title
|
||||
*/
|
||||
function getDocTitle(&$doc, $url)
|
||||
{
|
||||
$titleNodes=$doc->getElementsByTagName('title');
|
||||
if (count($titleNodes)==0 or !isset($titleNodes[0]->nodeValue))
|
||||
return $url;
|
||||
$title=str_replace('', '\n', $titleNodes[0]->nodeValue);
|
||||
return (strlen($title)<1)?$url:$title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $doc Doc
|
||||
* @return array Array
|
||||
*/
|
||||
function getDocMetaData(&$doc)
|
||||
{
|
||||
$metaData=array();
|
||||
$metaNodes=$doc->getElementsByTagName('meta');
|
||||
foreach ($metaNodes as $node)
|
||||
$metaData[$node->getAttribute("name")] = $node->getAttribute("content");
|
||||
if (!isset($metaData['description']))
|
||||
$metaData['description']='No Description Available';
|
||||
if (!isset($metaData['keywords'])) $metaData['keywords']='';
|
||||
return array(
|
||||
'keywords'=>str_replace('', '\n', $metaData['keywords']),
|
||||
'description'=>str_replace('', '\n', $metaData['description'])
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
followLink("http://localhost/dolibarr_dev/htdocs");
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
//============================================================+
|
||||
// File name : example_016.php
|
||||
// Begin : 2008-03-04
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
// This source file must be UTF-8 encoded
|
||||
/*
|
||||
$filename='filewithé';
|
||||
|
||||
@@ -74,7 +74,6 @@ class autoTranslator
|
||||
*/
|
||||
private function parseRefLangTranslationFiles()
|
||||
{
|
||||
|
||||
$files = $this->getTranslationFilesArray($this->_refLang);
|
||||
$counter = 1;
|
||||
foreach ($files as $file) {
|
||||
@@ -241,7 +240,7 @@ class autoTranslator
|
||||
if ($this->_outputpagecode == 'UTF-8') {
|
||||
$val=$this->translateTexts(array($value), substr($this->_refLang, 0, 2), substr($my_destlang, 0, 2));
|
||||
} else {
|
||||
$val=utf8_decode($this->translateTexts(array($value), substr($this->_refLang, 0, 2), substr($my_destlang, 0, 2)));
|
||||
$val=mb_convert_encoding($this->translateTexts(array($value), substr($this->_refLang, 0, 2), substr($my_destlang, 0, 2)), 'ISO-8859-1');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,7 +275,7 @@ class autoTranslator
|
||||
private function getLineValue($line)
|
||||
{
|
||||
$arraykey = explode('=', $line, 2);
|
||||
return trim(isset($arraykey[1])?$arraykey[1]:'');
|
||||
return trim(isset($arraykey[1]) ? $arraykey[1] : '');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -334,8 +333,8 @@ class autoTranslator
|
||||
//print "Url to translate: ".$url."\n";
|
||||
|
||||
if (! function_exists("curl_init")) {
|
||||
print "Error, your PHP does not support curl functions.\n";
|
||||
die();
|
||||
print "Error, your PHP does not support curl functions.\n";
|
||||
die();
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
@@ -210,7 +210,8 @@ foreach ($dups as $string => $pages) {
|
||||
$inadmin=0;
|
||||
foreach ($pages as $file => $lines) {
|
||||
if ($file == 'main.lang') {
|
||||
$inmain=1; $inadmin=0;
|
||||
$inmain=1;
|
||||
$inadmin=0;
|
||||
}
|
||||
if ($file == 'admin.lang' && ! $inmain) {
|
||||
$inadmin=1;
|
||||
@@ -568,16 +569,16 @@ if ((!empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($ar
|
||||
if (empty($unused)) {
|
||||
print "No string not used found.\n";
|
||||
} else {
|
||||
$filetosave='/tmp/'.($argv[2]?$argv[2]:"").'notused.lang';
|
||||
$filetosave='/tmp/'.($argv[2] ? $argv[2] : "").'notused.lang';
|
||||
print "Strings in en_US that are never used are saved into file ".$filetosave.":\n";
|
||||
file_put_contents($filetosave, implode("", $unused));
|
||||
print "To remove from original file, run command :\n";
|
||||
if (($argv[2]?$argv[2]:"")) {
|
||||
print 'cd htdocs/langs/en_US; mv '.($argv[2]?$argv[2]:"")." ".($argv[2]?$argv[2]:"").".tmp; ";
|
||||
if (($argv[2] ? $argv[2] : "")) {
|
||||
print 'cd htdocs/langs/en_US; mv '.($argv[2] ? $argv[2] : "")." ".($argv[2] ? $argv[2] : "").".tmp; ";
|
||||
}
|
||||
print "diff ".($argv[2]?$argv[2]:"").".tmp ".$filetosave." | grep \< | cut -b 3- > ".($argv[2]?$argv[2]:"");
|
||||
if (($argv[2]?$argv[2]:"")) {
|
||||
print "; rm ".($argv[2]?$argv[2]:"").".tmp;\n";
|
||||
print "diff ".($argv[2] ? $argv[2] : "").".tmp ".$filetosave." | grep \< | cut -b 3- > ".($argv[2] ? $argv[2] : "");
|
||||
if (($argv[2] ? $argv[2] : "")) {
|
||||
print "; rm ".($argv[2] ? $argv[2] : "").".tmp;\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,10 +58,10 @@ $rc = 0;
|
||||
|
||||
// Get and check arguments
|
||||
|
||||
$lPrimary = isset($argv[1])?$argv[1]:'';
|
||||
$lSecondary = isset($argv[2])?$argv[2]:'';
|
||||
$lPrimary = isset($argv[1]) ? $argv[1] : '';
|
||||
$lSecondary = isset($argv[2]) ? $argv[2] : '';
|
||||
$lEnglish = 'en_US';
|
||||
$filesToProcess = isset($argv[3])?$argv[3]:'';
|
||||
$filesToProcess = isset($argv[3]) ? $argv[3] : '';
|
||||
|
||||
if (empty($lPrimary) || empty($lSecondary) || empty($filesToProcess)) {
|
||||
$rc = 1;
|
||||
@@ -308,7 +308,7 @@ foreach ($filesToProcess as $fileToProcess) {
|
||||
|| in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/', $key) || preg_match('/^FormatHour/', $key)
|
||||
) {
|
||||
//print "Key $key differs (aSecondary=".$aSecondary[$key].", aPrimary=".$aPrimary[$key].", aEnglish=".$aEnglish[$key].") so we add it into new secondary language (line: $cnt).\n";
|
||||
fwrite($oh, $key."=".(empty($aSecondary[$key])?$aPrimary[$key]:$aSecondary[$key])."\n");
|
||||
fwrite($oh, $key."=".(empty($aSecondary[$key]) ? $aPrimary[$key] : $aSecondary[$key])."\n");
|
||||
}
|
||||
}
|
||||
if (! feof($handle)) {
|
||||
|
||||
@@ -39,7 +39,7 @@ $id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$massaction = GETPOST('massaction', 'aZ09');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'accountingaccountlist'; // To manage different context of search
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountingaccountlist'; // To manage different context of search
|
||||
$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
|
||||
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
@@ -49,7 +49,7 @@ $search_accountparent = GETPOST('search_accountparent', 'alpha');
|
||||
$search_pcgtype = GETPOST('search_pcgtype', 'alpha');
|
||||
$search_import_key = GETPOST('search_import_key', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
$chartofaccounts = GETPOST('chartofaccounts', 'int');
|
||||
@@ -66,7 +66,7 @@ if (!$user->hasRight('accounting', 'chartofaccount')) {
|
||||
}
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
@@ -111,7 +111,8 @@ $hookmanager->initHooks(array('accountancyadminaccount'));
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha')) {
|
||||
$massaction = '';
|
||||
|
||||
@@ -47,7 +47,7 @@ if (isModEnabled('accounting')) {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('accountancy', 'admin', 'companies', 'compta', 'errors', 'holiday', 'hrm', 'resource'));
|
||||
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
|
||||
$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view';
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$id = 31;
|
||||
$rowid = GETPOST('rowid', 'alpha');
|
||||
@@ -59,7 +59,7 @@ $actl[0] = img_picto($langs->trans("Disabled"), 'switch_off', 'class="size15x"')
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"');
|
||||
|
||||
$listoffset = GETPOST('listoffset', 'alpha');
|
||||
$listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000;
|
||||
$listlimit = GETPOST('listlimit', 'int') > 0 ? GETPOST('listlimit', 'int') : 1000;
|
||||
$active = 1;
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'aZ09comma');
|
||||
@@ -125,18 +125,10 @@ $tabfieldinsert[31] = "pcg_version,label,fk_country";
|
||||
$tabrowid = array();
|
||||
$tabrowid[31] = "";
|
||||
|
||||
// Condition to show dictionary in setup page
|
||||
$tabcond = array();
|
||||
$tabcond[31] = isModEnabled('accounting');
|
||||
|
||||
// List of help for fields
|
||||
$tabhelp = array();
|
||||
$tabhelp[31] = array('pcg_version'=>$langs->trans("EnterAnyCode"));
|
||||
|
||||
// List of check for fields (NOT USED YET)
|
||||
$tabfieldcheck = array();
|
||||
$tabfieldcheck[31] = array();
|
||||
|
||||
|
||||
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
|
||||
$elementList = array();
|
||||
@@ -173,9 +165,12 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
|
||||
if ($fieldnamekey == 'pcg_version') {
|
||||
$fieldnamekey = 'Pcg_version';
|
||||
}
|
||||
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) {
|
||||
if ($fieldnamekey == 'label') {
|
||||
$fieldnamekey = 'Label';
|
||||
}
|
||||
if ($fieldnamekey == 'country') {
|
||||
$fieldnamekey = "Country";
|
||||
}
|
||||
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
}
|
||||
@@ -453,6 +448,7 @@ if ($id) {
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
// Form to add a new line
|
||||
|
||||
if ($tabname[$id]) {
|
||||
$fieldlist = explode(',', $tabfield[$id]);
|
||||
|
||||
@@ -467,12 +463,14 @@ if ($id) {
|
||||
if ($fieldlist[$field] == 'code') {
|
||||
$valuetoshow = $langs->trans("Code");
|
||||
}
|
||||
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
|
||||
if ($fieldlist[$field] == 'label') {
|
||||
$valuetoshow = $langs->trans("Label");
|
||||
$class = 'minwidth300';
|
||||
}
|
||||
if ($fieldlist[$field] == 'country') {
|
||||
if (in_array('region_id', $fieldlist)) {
|
||||
print '<td> </td>'; continue;
|
||||
print '<td> </td>';
|
||||
continue;
|
||||
} // For region page, we do not show the country input
|
||||
$valuetoshow = $langs->trans("Country");
|
||||
}
|
||||
@@ -482,6 +480,7 @@ if ($id) {
|
||||
if ($fieldlist[$field] == 'pcg_version' || $fieldlist[$field] == 'fk_pcg_version') {
|
||||
$valuetoshow = $langs->trans("Pcg_version");
|
||||
}
|
||||
//var_dump($value);
|
||||
|
||||
if ($valuetoshow != '') {
|
||||
print '<td class="'.$class.'">';
|
||||
@@ -519,7 +518,8 @@ if ($id) {
|
||||
$tmpaction = 'create';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook)) {
|
||||
fieldListAccountModel($fieldlist, $obj, $tabname[$id], 'add');
|
||||
@@ -616,20 +616,24 @@ if ($id) {
|
||||
$tmpaction = 'edit';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook)) {
|
||||
fieldListAccountModel($fieldlist, $obj, $tabname[$id], 'edit');
|
||||
}
|
||||
|
||||
print '<td colspan="3" class="right"><a name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"> </a><input type="submit" class="button button-edit" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print ' <input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
|
||||
print '<td colspan="3" class="right">';
|
||||
print '<a name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"> </a><input type="submit" class="button button-edit" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print ' <input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td>';
|
||||
} else {
|
||||
$tmpaction = 'view';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook)) {
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
@@ -669,9 +673,11 @@ if ($id) {
|
||||
}
|
||||
|
||||
// Can an entry be erased or disabled ?
|
||||
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
|
||||
$iserasable = 1;
|
||||
$canbedisabled = 1;
|
||||
$canbemodified = 1; // true by default
|
||||
|
||||
$url = $_SERVER["PHP_SELF"].'?token='.newToken().($page ? '&page='.$page : '').'&sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
|
||||
$url = $_SERVER["PHP_SELF"].'?token='.newToken().($page ? '&page='.$page : '').'&sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ? urlencode($obj->code) : '');
|
||||
if ($param) {
|
||||
$url .= '&'.$param;
|
||||
}
|
||||
@@ -705,6 +711,8 @@ if ($id) {
|
||||
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
print '<tr><td colspan="6"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
@@ -732,11 +740,10 @@ $db->close();
|
||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||
* @return void
|
||||
*/
|
||||
function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
function fieldListAccountModel($fieldlist, $obj = null, $tabname = '', $context = '')
|
||||
{
|
||||
global $conf, $langs, $db;
|
||||
global $langs, $db;
|
||||
global $form;
|
||||
global $region_id;
|
||||
global $elementList, $sourceList;
|
||||
|
||||
$formadmin = new FormAdmin($db);
|
||||
@@ -769,29 +776,23 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context =
|
||||
print '<td>';
|
||||
}
|
||||
if ($fieldlist[$field] == 'type_cdr') {
|
||||
print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''));
|
||||
print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''));
|
||||
} else {
|
||||
print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1);
|
||||
print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''), 1);
|
||||
}
|
||||
print '</td>';
|
||||
} elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||
print '<td><input type="text" class="flat" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" size="10" name="'.$fieldlist[$field].'"></td>';
|
||||
print '<td><input type="text" class="flat" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" size="10" name="'.$fieldlist[$field].'"></td>';
|
||||
} else {
|
||||
print '<td>';
|
||||
$size = ''; $class = '';
|
||||
if ($fieldlist[$field] == 'code') {
|
||||
$size = 'size="8" ';
|
||||
$class = '';
|
||||
if ($fieldlist[$field] == 'pcg_version') {
|
||||
$class = 'width150';
|
||||
}
|
||||
if ($fieldlist[$field] == 'position') {
|
||||
$size = 'size="4" ';
|
||||
if ($fieldlist[$field] == 'label') {
|
||||
$class = 'width300';
|
||||
}
|
||||
if ($fieldlist[$field] == 'libelle') {
|
||||
$size = 'centpercent';
|
||||
}
|
||||
if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type') {
|
||||
$size = 'size="2" ';
|
||||
}
|
||||
print '<input type="text" '.$size.' class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '<input type="text" class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,6 +135,7 @@ $s = $formaccounting->select_accounting_category($cat_id, 'account_category', 1,
|
||||
if ($formaccounting->nbaccounts_category <= 0) {
|
||||
print '<span class="opacitymedium">'.$s.'</span>';
|
||||
} else {
|
||||
print $s;
|
||||
print '<input type="submit" class="button small" value="'.$langs->trans("Select").'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
@@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("errors", "admin", "companies", "resource", "holiday", "accountancy", "hrm"));
|
||||
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
|
||||
$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view';
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$id = 32;
|
||||
$rowid = GETPOST('rowid', 'alpha');
|
||||
@@ -53,7 +53,7 @@ $actl[0] = img_picto($langs->trans("Disabled"), 'switch_off', 'class="size15x"')
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"');
|
||||
|
||||
$listoffset = GETPOST('listoffset', 'alpha');
|
||||
$listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000;
|
||||
$listlimit = GETPOST('listlimit', 'int') > 0 ? GETPOST('listlimit', 'int') : 1000;
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'aZ09comma');
|
||||
$sortorder = GETPOST("sortorder", 'aZ09comma');
|
||||
@@ -507,6 +507,7 @@ if ($tabname[$id]) {
|
||||
}
|
||||
if ($fieldlist[$field] == 'code') {
|
||||
$valuetoshow = $langs->trans("Code");
|
||||
$class = 'width75';
|
||||
}
|
||||
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
|
||||
$valuetoshow = $langs->trans("Label");
|
||||
@@ -581,7 +582,8 @@ if ($tabname[$id]) {
|
||||
$tmpaction = 'create';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook)) {
|
||||
fieldListAccountingCategories($fieldlist, $obj, $tabname[$id], 'add');
|
||||
@@ -784,7 +786,8 @@ if ($resql) {
|
||||
$tmpaction = 'edit';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
// Actions
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
@@ -810,13 +813,16 @@ if ($resql) {
|
||||
}
|
||||
} else {
|
||||
// Can an entry be erased or disabled ?
|
||||
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
|
||||
$iserasable = 1;
|
||||
$canbedisabled = 1;
|
||||
$canbemodified = 1; // true by default
|
||||
if (isset($obj->code)) {
|
||||
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
|
||||
$iserasable = 0; $canbedisabled = 0;
|
||||
$iserasable = 0;
|
||||
$canbedisabled = 0;
|
||||
}
|
||||
}
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ? urlencode($obj->code) : '');
|
||||
if ($param) {
|
||||
$url .= '&'.$param;
|
||||
}
|
||||
@@ -828,7 +834,8 @@ if ($resql) {
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
// Actions
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
@@ -863,16 +870,19 @@ if ($resql) {
|
||||
$key = $langs->trans("Country".strtoupper($obj->country_code));
|
||||
$valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country);
|
||||
}
|
||||
} elseif (in_array($fieldlist[$field], array('label', 'range_account', 'formula'))) {
|
||||
} elseif (in_array($fieldlist[$field], array('label', 'formula'))) {
|
||||
$class = "tdoverflowmax250";
|
||||
$title = $valuetoshow;
|
||||
} elseif (in_array($fieldlist[$field], array('range_account'))) {
|
||||
$class = "tdoverflowmax250 small";
|
||||
$title = $valuetoshow;
|
||||
} elseif ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') {
|
||||
$showfield = 0;
|
||||
}
|
||||
|
||||
// Show value for field
|
||||
if ($showfield) {
|
||||
print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'"'.($title ? ' title="'.dol_escape_htmltag($title).'"': '').'>'.dol_escape_htmltag($valuetoshow).'</td>';
|
||||
print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'"'.($title ? ' title="'.dol_escape_htmltag($title).'"' : '').'>'.dol_escape_htmltag($valuetoshow).'</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -948,7 +958,7 @@ $db->close();
|
||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||
* @return void
|
||||
*/
|
||||
function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
function fieldListAccountingCategories($fieldlist, $obj = null, $tabname = '', $context = '')
|
||||
{
|
||||
global $conf, $langs, $db;
|
||||
global $form, $mysoc;
|
||||
@@ -981,20 +991,23 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co
|
||||
}
|
||||
} elseif ($fieldlist[$field] == 'category_type') {
|
||||
print '<td>';
|
||||
print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1);
|
||||
print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''), 1);
|
||||
print '</td>';
|
||||
} elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||
print '<td><input type="text" class="flat minwidth100" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
|
||||
print '<td><input type="text" class="flat minwidth100" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" name="'.$fieldlist[$field].'"></td>';
|
||||
} else {
|
||||
print '<td>';
|
||||
$class = '';
|
||||
if (in_array($fieldlist[$field], array('code', 'range_account', 'label', 'formula'))) {
|
||||
$class = 'maxwidth100';
|
||||
if (in_array($fieldlist[$field], array('code', 'formula'))) {
|
||||
$class = 'maxwidth75';
|
||||
}
|
||||
if (in_array($fieldlist[$field], array('label', 'range_account'))) {
|
||||
$class = 'maxwidth150';
|
||||
}
|
||||
if ($fieldlist[$field] == 'position') {
|
||||
$class = 'maxwidth50';
|
||||
}
|
||||
print '<input type="text" class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '<input type="text" class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,24 @@ if ($action == 'update') {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$accountinggroupsusedforbalancesheetaccount = GETPOST('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT', 'alphanohtml');
|
||||
if (!empty($accountinggroupsusedforbalancesheetaccount)) {
|
||||
if (!dolibarr_set_const($db, 'ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT', $accountinggroupsusedforbalancesheetaccount, 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
}
|
||||
|
||||
$accountinggroupsusedforincomestatement = GETPOST('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT', 'alpha');
|
||||
if (!empty($accountinggroupsusedforincomestatement)) {
|
||||
if (!dolibarr_set_const($db, 'ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT', $accountinggroupsusedforincomestatement, 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
}
|
||||
|
||||
foreach ($list_account_main as $constname) {
|
||||
$constvalue = GETPOST($constname, 'alpha');
|
||||
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
@@ -117,12 +135,26 @@ foreach ($list_account_main as $key) {
|
||||
|
||||
// Journal
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="50%">'.$langs->trans("ACCOUNTING_CLOSURE_DEFAULT_JOURNAL").'</td>';
|
||||
print '<td class="fieldrequired">'.$langs->trans("ACCOUNTING_CLOSURE_DEFAULT_JOURNAL").'</td>';
|
||||
print '<td>';
|
||||
$defaultjournal = getDolGlobalString('ACCOUNTING_CLOSURE_DEFAULT_JOURNAL');
|
||||
print $formaccounting->select_journal($defaultjournal, "ACCOUNTING_CLOSURE_DEFAULT_JOURNAL", 9, 1, 0, 0);
|
||||
print '</td></tr>';
|
||||
|
||||
// Accounting groups used for the balance sheet account
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="fieldrequired">'.$langs->trans("ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT").'</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" size="100" id="ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT" name="ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT" value="' . dol_escape_htmltag(getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT')). '">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Accounting groups used for the income statement
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="fieldrequired">'.$langs->trans("ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT").'</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" size="100" id="ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT" name="ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT" value="' . dol_escape_htmltag(getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT')). '">';
|
||||
print '</td></tr>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print '<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans('Modify').'"></div>';
|
||||
|
||||
@@ -265,8 +265,6 @@ foreach ($list_account as $key) {
|
||||
print img_picto('', 'payment_vat', 'class="pictofixedwidth"');
|
||||
} elseif (preg_match('/^ACCOUNTING_VAT/', $key)) {
|
||||
print img_picto('', 'vat', 'class="pictofixedwidth"');
|
||||
/*} elseif (preg_match('/^ACCOUNTING_REVENUESTAMP/', $key)) {
|
||||
print img_picto('', 'vat', 'class="pictofixedwidth"');*/
|
||||
} elseif (preg_match('/^ACCOUNTING_ACCOUNT_CUSTOMER/', $key)) {
|
||||
print img_picto('', 'bill', 'class="pictofixedwidth"');
|
||||
} elseif (preg_match('/^LOAN_ACCOUNTING_ACCOUNT/', $key)) {
|
||||
@@ -280,6 +278,7 @@ foreach ($list_account as $key) {
|
||||
} elseif (preg_match('/^ACCOUNTING_ACCOUNT_SUSPENSE/', $key)) {
|
||||
print img_picto('', 'question', 'class="pictofixedwidth"');
|
||||
}
|
||||
// Note: account for revenue stamp are store into dictionary of revenue stamp. There is no default value.
|
||||
print $label;
|
||||
print '</td>';
|
||||
// Value
|
||||
|
||||
@@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php';
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
|
||||
@@ -267,6 +267,7 @@ if ($action == 'setenablevatreversecharge') {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@@ -274,12 +275,16 @@ if ($action == 'setenablevatreversecharge') {
|
||||
$form = new Form($db);
|
||||
|
||||
$title = $langs->trans('ConfigAccountingExpert');
|
||||
|
||||
llxHeader('', $title);
|
||||
|
||||
|
||||
$linkback = '';
|
||||
//$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
print load_fiche_titre($title, $linkback, 'accountancy');
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Show message if accountancy hidden options are activated to help to resolve some problems
|
||||
if (!$user->admin) {
|
||||
if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) {
|
||||
@@ -304,6 +309,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
// Params
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans('Options').'</td>';
|
||||
@@ -387,9 +393,12 @@ foreach ($list as $key) {
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Binding params
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans('BindingOptions').'</td>';
|
||||
@@ -403,12 +412,12 @@ foreach ($list_binding as $key) {
|
||||
$label = $langs->trans($key);
|
||||
print '<td>'.$label.'</td>';
|
||||
// Value
|
||||
print '<td class="right">';
|
||||
print '<td class="right minwidth75imp parentonrightofpage">';
|
||||
if ($key == 'ACCOUNTING_DATE_START_BINDING') {
|
||||
print $form->selectDate((getDolGlobalInt($key) ? (int) getDolGlobalInt($key) : -1), $key, 0, 0, 1);
|
||||
} elseif ($key == 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER') {
|
||||
$array = array(0=>$langs->trans("PreviousMonth"), 1=>$langs->trans("CurrentMonth"), 2=>$langs->trans("Fiscalyear"));
|
||||
print $form->selectarray($key, $array, getDolGlobalInt('ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER', 0), 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage');
|
||||
print $form->selectarray($key, $array, getDolGlobalInt('ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER', 0), 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage width200');
|
||||
} else {
|
||||
print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
|
||||
}
|
||||
@@ -457,7 +466,8 @@ if (getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS')) {
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
||||
// Show advanced options
|
||||
@@ -465,6 +475,7 @@ print '<br>';
|
||||
|
||||
|
||||
// Advanced params
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">' . $langs->trans('OptionsAdvanced') . '</td>';
|
||||
@@ -533,6 +544,7 @@ if (getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) {
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans('Modify').'"></div>';
|
||||
|
||||
@@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin", "compta", "accountancy"));
|
||||
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
|
||||
$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view';
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$id = 35;
|
||||
$rowid = GETPOST('rowid', 'alpha');
|
||||
@@ -56,7 +56,7 @@ $actl[0] = img_picto($langs->trans("Disabled"), 'switch_off', 'class="size15x"')
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"');
|
||||
|
||||
$listoffset = GETPOST('listoffset', 'alpha');
|
||||
$listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000;
|
||||
$listlimit = GETPOST('listlimit', 'int') > 0 ? GETPOST('listlimit', 'int') : 1000;
|
||||
$active = 1;
|
||||
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
@@ -452,7 +452,8 @@ if ($id) {
|
||||
$tmpaction = 'create';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook)) {
|
||||
fieldListJournal($fieldlist, $obj, $tabname[$id], 'add');
|
||||
@@ -561,7 +562,8 @@ if ($id) {
|
||||
$tmpaction = 'edit';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
// Show fields
|
||||
if (empty($reshook)) {
|
||||
@@ -580,7 +582,8 @@ if ($id) {
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook)) {
|
||||
$langs->load("accountancy");
|
||||
@@ -607,7 +610,9 @@ if ($id) {
|
||||
}
|
||||
|
||||
// Can an entry be erased or disabled ?
|
||||
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
|
||||
$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;
|
||||
@@ -617,7 +622,7 @@ if ($id) {
|
||||
|
||||
$canbemodified = $iserasable;
|
||||
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ? urlencode($obj->code) : '');
|
||||
if ($param) {
|
||||
$url .= '&'.$param;
|
||||
}
|
||||
@@ -686,7 +691,7 @@ $db->close();
|
||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||
* @return void
|
||||
*/
|
||||
function fieldListJournal($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
function fieldListJournal($fieldlist, $obj = null, $tabname = '', $context = '')
|
||||
{
|
||||
global $conf, $langs, $db;
|
||||
global $form, $mysoc;
|
||||
@@ -700,13 +705,14 @@ function fieldListJournal($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
if ($fieldlist[$field] == 'nature') {
|
||||
print '<td>';
|
||||
print $form->selectarray('nature', $sourceList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''));
|
||||
print $form->selectarray('nature', $sourceList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''));
|
||||
print '</td>';
|
||||
} elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||
print '<td><input type="text" class="flat minwidth100" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
|
||||
print '<td><input type="text" class="flat minwidth100" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" name="'.$fieldlist[$field].'"></td>';
|
||||
} else {
|
||||
print '<td>';
|
||||
$size = ''; $class = '';
|
||||
$size = '';
|
||||
$class = '';
|
||||
if ($fieldlist[$field] == 'code') {
|
||||
$class = 'maxwidth100';
|
||||
}
|
||||
@@ -716,7 +722,7 @@ function fieldListJournal($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type') {
|
||||
$size = 'size="2" ';
|
||||
}
|
||||
print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ if (empty($accounting_product_mode)) {
|
||||
$accounting_product_mode = 'ACCOUNTANCY_SELL';
|
||||
}
|
||||
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : getDolGlobalInt('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit);
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalInt('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
@@ -136,7 +136,8 @@ if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||
$massaction = '';
|
||||
@@ -184,7 +185,9 @@ if ($action == 'update') {
|
||||
//$msg .= '<div><span class="accountingprocessing">' . count($chk_prod) . ' ' . $langs->trans("SelectedLines") . '</span></div>';
|
||||
$arrayofdifferentselectedvalues = array();
|
||||
|
||||
$cpt = 0; $ok = 0; $ko = 0;
|
||||
$cpt = 0;
|
||||
$ok = 0;
|
||||
$ko = 0;
|
||||
foreach ($chk_prod as $productid) {
|
||||
$accounting_account_id = GETPOST('codeventil_'.$productid);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ $rowid = GETPOST('rowid', 'int');
|
||||
$massaction = GETPOST('massaction', 'aZ09');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'accountingsubaccountlist'; // To manage different context of search
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountingsubaccountlist'; // To manage different context of search
|
||||
|
||||
$search_subaccount = GETPOST('search_subaccount', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
@@ -55,7 +55,7 @@ if (!$user->hasRight('accounting', 'chartofaccount')) {
|
||||
}
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
@@ -89,7 +89,8 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha')) {
|
||||
$massaction = '';
|
||||
|
||||
@@ -64,7 +64,7 @@ if ($search_accountancy_code_end == - 1) {
|
||||
$search_not_reconciled = GETPOST('search_not_reconciled', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
@@ -100,7 +100,7 @@ if (empty($search_date_start) && !GETPOSTISSET('formfilteraction')) {
|
||||
$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);
|
||||
$month_start = getDolGlobalInt('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
|
||||
@@ -206,7 +206,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
if ($action == 'export_csv') {
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$sep = getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV');
|
||||
|
||||
$filename = 'balance';
|
||||
$type_export = 'balance';
|
||||
|
||||
@@ -103,7 +103,7 @@ if ($cancel) {
|
||||
if ($action == "confirm_update") {
|
||||
$error = 0;
|
||||
|
||||
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
|
||||
if (((float) $debit != 0.0) && ((float) $credit != 0.0)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
||||
$action = 'update';
|
||||
@@ -130,12 +130,12 @@ if ($action == "confirm_update") {
|
||||
$object->debit = $debit;
|
||||
$object->credit = $credit;
|
||||
|
||||
if (floatval($debit) != 0.0) {
|
||||
if ((float) $debit != 0.0) {
|
||||
$object->montant = $debit; // deprecated
|
||||
$object->amount = $debit;
|
||||
$object->sens = 'D';
|
||||
}
|
||||
if (floatval($credit) != 0.0) {
|
||||
if ((float) $credit != 0.0) {
|
||||
$object->montant = $credit; // deprecated
|
||||
$object->amount = $credit;
|
||||
$object->sens = 'C';
|
||||
@@ -159,7 +159,7 @@ if ($action == "confirm_update") {
|
||||
} elseif ($action == "add") {
|
||||
$error = 0;
|
||||
|
||||
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
|
||||
if (((float) $debit != 0.0) && ((float) $credit != 0.0)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
||||
$action = '';
|
||||
@@ -189,13 +189,13 @@ if ($action == "confirm_update") {
|
||||
$object->fk_doc = GETPOSTINT('fk_doc');
|
||||
$object->fk_docdet = GETPOSTINT('fk_docdet');
|
||||
|
||||
if (floatval($debit) != 0.0) {
|
||||
if ((float) $debit != 0.0) {
|
||||
$object->montant = $debit; // deprecated
|
||||
$object->amount = $debit;
|
||||
$object->sens = 'D';
|
||||
}
|
||||
|
||||
if (floatval($credit) != 0.0) {
|
||||
if ((float) $credit != 0.0) {
|
||||
$object->montant = $credit; // deprecated
|
||||
$object->amount = $credit;
|
||||
$object->sens = 'C';
|
||||
|
||||
@@ -134,7 +134,7 @@ $search_lettering_code = GETPOST('search_lettering_code', 'alpha');
|
||||
$search_not_reconciled = GETPOST('search_not_reconciled', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
@@ -170,7 +170,7 @@ if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GE
|
||||
$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);
|
||||
$month_start = getDolGlobalInt('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
|
||||
@@ -237,7 +237,8 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
$param = '';
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha')) {
|
||||
$massaction = '';
|
||||
@@ -896,10 +897,10 @@ if (!empty($arrayfields['t.code_journal']['checked'])) {
|
||||
// Date document
|
||||
if (!empty($arrayfields['t.doc_date']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@@ -971,10 +972,10 @@ print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (!empty($arrayfields['t.date_creation']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_creation_start, 'search_date_creation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_creation_end, 'search_date_creation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@@ -982,10 +983,10 @@ if (!empty($arrayfields['t.date_creation']['checked'])) {
|
||||
// Date modification
|
||||
if (!empty($arrayfields['t.tms']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_modification_start, 'search_date_modification_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_modification_end, 'search_date_modification_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@@ -993,10 +994,10 @@ 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 '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_export_start, 'search_date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_export_end, 'search_date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@@ -1004,10 +1005,10 @@ if (!empty($arrayfields['t.date_export']['checked'])) {
|
||||
// Date validation
|
||||
if (!empty($arrayfields['t.date_validated']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_validation_start, 'search_date_validation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_validation_end, 'search_date_validation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@@ -1028,7 +1029,8 @@ print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');
|
||||
}
|
||||
if (!empty($arrayfields['t.piece_num']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
|
||||
}
|
||||
@@ -1093,7 +1095,7 @@ $totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$total_debit = 0;
|
||||
$total_credit = 0;
|
||||
$totalarray['val'] = array ();
|
||||
$totalarray['val'] = array();
|
||||
$totalarray['val']['totaldebit'] = 0;
|
||||
$totalarray['val']['totalcredit'] = 0;
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ $search_lettering_code = GETPOST('search_lettering_code', 'alpha');
|
||||
$search_not_reconciled = GETPOST('search_not_reconciled', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
@@ -165,7 +165,7 @@ if (!in_array($action, array('delmouv', 'delmouvconfirm')) && !GETPOSTISSET('beg
|
||||
$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);
|
||||
$month_start = getDolGlobalInt('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
|
||||
@@ -225,7 +225,8 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
$param = '';
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunletteringauto' && $massaction != 'preunletteringmanual' && $massaction != 'predeletebookkeepingwriting') {
|
||||
$massaction = '';
|
||||
@@ -483,6 +484,10 @@ if (empty($reshook)) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
} elseif (isset($object->date_validation) || $object->date_validation != '') {
|
||||
setEventMessages($langs->trans("ValidatedRecordWhereFound"), null, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -843,10 +848,10 @@ if (!empty($arrayfields['t.code_journal']['checked'])) {
|
||||
// Date document
|
||||
if (!empty($arrayfields['t.doc_date']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@@ -918,10 +923,10 @@ print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (!empty($arrayfields['t.date_creation']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_creation_start, 'search_date_creation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_creation_end, 'search_date_creation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@@ -929,10 +934,10 @@ if (!empty($arrayfields['t.date_creation']['checked'])) {
|
||||
// Date modification
|
||||
if (!empty($arrayfields['t.tms']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_modification_start, 'search_date_modification_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_modification_end, 'search_date_modification_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@@ -940,10 +945,10 @@ 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 '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_export_start, 'search_date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_export_end, 'search_date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@@ -951,10 +956,10 @@ if (!empty($arrayfields['t.date_export']['checked'])) {
|
||||
// Date validation
|
||||
if (!empty($arrayfields['t.date_validated']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_validation_start, 'search_date_validation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_validation_end, 'search_date_validation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@@ -975,7 +980,8 @@ print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');
|
||||
}
|
||||
if (!empty($arrayfields['t.piece_num']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
|
||||
}
|
||||
@@ -1040,7 +1046,7 @@ $totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$total_debit = 0;
|
||||
$total_credit = 0;
|
||||
$totalarray['val'] = array ();
|
||||
$totalarray['val'] = array();
|
||||
$totalarray['val']['totaldebit'] = 0;
|
||||
$totalarray['val']['totalcredit'] = 0;
|
||||
|
||||
@@ -1192,7 +1198,7 @@ while ($i < min($num, $limit)) {
|
||||
$labeltoshowalt .= $line->doc_ref;
|
||||
}
|
||||
|
||||
print '<td class="nowraponall tdoverflowmax200" title="'.dol_escape_htmltag($labeltoshowalt).'">';
|
||||
print '<td class="nowraponall tdoverflowmax250" title="'.dol_escape_htmltag($labeltoshowalt).'">';
|
||||
print $labeltoshow;
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
|
||||
@@ -104,7 +104,7 @@ if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_
|
||||
}
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
@@ -141,7 +141,7 @@ if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('searc
|
||||
$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);
|
||||
$month_start = getDolGlobalInt('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
|
||||
@@ -447,6 +447,10 @@ if (empty($reshook)) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
} elseif (isset($object->date_validation) || $object->date_validation != '') {
|
||||
setEventMessages($langs->trans("ValidatedRecordWhereFound"), null, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -680,6 +684,7 @@ if (empty($reshook)) {
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
|
||||
}
|
||||
$newcardbutton .= dolGetButtonTitleSeparator();
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
|
||||
}
|
||||
|
||||
@@ -828,10 +833,10 @@ if (!empty($arrayfields['t.code_journal']['checked'])) {
|
||||
// Date document
|
||||
if (!empty($arrayfields['t.doc_date']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
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 '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_end, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@@ -866,10 +871,10 @@ if (!empty($arrayfields['t.balance']['checked'])) {
|
||||
// Date export
|
||||
if (!empty($arrayfields['t.date_export']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_export_start, 'search_date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_export_end, 'search_date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@@ -877,10 +882,10 @@ if (!empty($arrayfields['t.date_export']['checked'])) {
|
||||
// Date validation
|
||||
if (!empty($arrayfields['t.date_validated']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_validation_start, 'search_date_validation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_validation_end, 'search_date_validation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@@ -961,7 +966,7 @@ $displayed_account_number = null; // Start with undefined to be able to distingu
|
||||
$i = 0;
|
||||
|
||||
$totalarray = array();
|
||||
$totalarray['val'] = array ();
|
||||
$totalarray['val'] = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$total_debit = 0;
|
||||
$total_credit = 0;
|
||||
@@ -988,20 +993,44 @@ while ($i < min($num, $limit)) {
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
$colspan++;
|
||||
}
|
||||
if (!empty($arrayfields['t.piece_num']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.code_journal']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.doc_date']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.doc_ref']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.label_operation']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.piece_num']['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
if (!empty($arrayfields['t.code_journal']['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
if (!empty($arrayfields['t.doc_date']['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
if (!empty($arrayfields['t.doc_ref']['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
if (!empty($arrayfields['t.label_operation']['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
if (!empty($arrayfields['t.lettering_code']['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['t.balance']['checked'])) { $colspanend++; }
|
||||
if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; }
|
||||
if (!empty($arrayfields['t.date_validating']['checked'])) { $colspanend++; }
|
||||
if (!empty($arrayfields['t.import_key']['checked'])) { $colspanend++; }
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
if (!empty($arrayfields['t.balance']['checked'])) {
|
||||
$colspanend++;
|
||||
}
|
||||
if (!empty($arrayfields['t.date_export']['checked'])) {
|
||||
$colspanend++;
|
||||
}
|
||||
if (!empty($arrayfields['t.date_validated']['checked'])) {
|
||||
$colspanend++;
|
||||
}
|
||||
if (!empty($arrayfields['t.lettering_code']['checked'])) {
|
||||
$colspanend++;
|
||||
}
|
||||
if (!empty($arrayfields['t.import_key']['checked'])) {
|
||||
$colspanend++;
|
||||
}
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
$colspan++;
|
||||
$colspanend--;
|
||||
}
|
||||
|
||||
// Is it a break ?
|
||||
if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
|
||||
@@ -1015,7 +1044,9 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
print '<td class="nowrap right">'.price(price2num($sous_total_debit, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($sous_total_credit, 'MT')).'</td>';
|
||||
if ($colspanend > 0) print '<td colspan="'.$colspanend.'"></td>';
|
||||
if ($colspanend > 0) {
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
// Show balance of last shown account
|
||||
$balance = $sous_total_debit - $sous_total_credit;
|
||||
@@ -1032,7 +1063,9 @@ while ($i < min($num, $limit)) {
|
||||
print price(price2num($sous_total_credit - $sous_total_debit, 'MT'));
|
||||
print '</td>';
|
||||
}
|
||||
if ($colspanend > 0) print '<td colspan="'.$colspanend.'"></td>';
|
||||
if ($colspanend > 0) {
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@@ -1167,12 +1200,9 @@ while ($i < min($num, $limit)) {
|
||||
// Other type
|
||||
}
|
||||
|
||||
print '<td class="maxwidth400">';
|
||||
print '<td class="tdoverflowmax250">';
|
||||
|
||||
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;
|
||||
@@ -1183,7 +1213,6 @@ while ($i < min($num, $limit)) {
|
||||
} else {
|
||||
print $line->doc_ref;
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
@@ -1195,7 +1224,11 @@ 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>';
|
||||
if (strlen(length_accounta($line->subledger_account)) == 0) {
|
||||
print '<td class="small tdoverflowmax350 classfortooltip" title="'.dol_escape_htmltag($line->label_operation).'">'.dol_escape_htmltag($line->label_operation).'</td>';
|
||||
} else {
|
||||
print '<td class="small tdoverflowmax350 classfortooltip" title="'.dol_escape_htmltag($line->label_operation.($line->label_operation?'<br>':'').'<span style="font-size:0.8em">('.length_accounta($line->subledger_account).')').'">'.dol_escape_htmltag($line->label_operation).($line->label_operation?'<br>':'').'<span style="font-size:0.8em">('.dol_escape_htmltag(length_accounta($line->subledger_account)).')</span></td>';
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@@ -1203,7 +1236,7 @@ while ($i < min($num, $limit)) {
|
||||
|
||||
// Lettering code
|
||||
if (!empty($arrayfields['t.lettering_code']['checked'])) {
|
||||
print '<td class="center">'.$line->lettering_code.'</td>';
|
||||
print '<td class="center">'.dol_escape_htmltag($line->lettering_code).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@@ -1262,7 +1295,7 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['t.import_key']['checked'])) {
|
||||
print '<td class="tdoverflowmax100">'.$line->import_key."</td>\n";
|
||||
print '<td class="tdoverflowmax100">'.dol_escape_htmltag($line->import_key)."</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@@ -1303,7 +1336,9 @@ if ($num > 0 && $colspan > 0) {
|
||||
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($sous_total_debit, 'MT')).'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($sous_total_credit, 'MT')).'</td>';
|
||||
if ($colspanend > 0) print '<td colspan="'.$colspanend.'"></td>';
|
||||
if ($colspanend > 0) {
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
// Show balance of last shown account
|
||||
$balance = $sous_total_debit - $sous_total_credit;
|
||||
@@ -1320,7 +1355,9 @@ if ($num > 0 && $colspan > 0) {
|
||||
print price(price2num($sous_total_credit - $sous_total_debit, 'MT'));
|
||||
print '</td>';
|
||||
}
|
||||
if ($colspanend > 0) print '<td colspan="'.$colspanend.'"></td>';
|
||||
if ($colspanend > 0) {
|
||||
print '<td colspan="'.$colspanend.'"></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ class AccountancyCategory // extends CommonObject
|
||||
*
|
||||
* @param User $user User that create
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
* @return int Return integer <0 if KO, Id of created object if OK
|
||||
*/
|
||||
public function create($user, $notrigger = 0)
|
||||
{
|
||||
@@ -228,7 +228,8 @@ class AccountancyCategory // extends CommonObject
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
@@ -252,7 +253,7 @@ class AccountancyCategory // extends CommonObject
|
||||
* @param int $id Id object
|
||||
* @param string $code Code
|
||||
* @param string $label Label
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $code = '', $label = '')
|
||||
{
|
||||
@@ -311,7 +312,7 @@ class AccountancyCategory // extends CommonObject
|
||||
*
|
||||
* @param User $user User that modify
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function update($user = null, $notrigger = 0)
|
||||
{
|
||||
@@ -369,7 +370,8 @@ class AccountancyCategory // extends CommonObject
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
@@ -392,7 +394,7 @@ class AccountancyCategory // extends CommonObject
|
||||
*
|
||||
* @param User $user User that delete
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete($user, $notrigger = 0)
|
||||
{
|
||||
@@ -407,7 +409,8 @@ class AccountancyCategory // extends CommonObject
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
@@ -429,7 +432,7 @@ class AccountancyCategory // extends CommonObject
|
||||
* Function to select into ->lines_display all accounting accounts for a given custom accounting group
|
||||
*
|
||||
* @param int $id Id
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
* @return int Return integer <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function display($id)
|
||||
{
|
||||
@@ -464,7 +467,7 @@ class AccountancyCategory // extends CommonObject
|
||||
* Function to fill ->lines_cptbk with accounting account (defined in chart of account) and not yet into a custom group
|
||||
*
|
||||
* @param int $id Id of category to know which account to exclude
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
* @return int Return integer <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function getAccountsWithNoCategory($id)
|
||||
{
|
||||
@@ -508,7 +511,7 @@ class AccountancyCategory // extends CommonObject
|
||||
* @param int $id_cat Id category
|
||||
* @param array $cpts list of accounts array
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function updateAccAcc($id_cat, $cpts = array())
|
||||
{
|
||||
@@ -579,7 +582,7 @@ class AccountancyCategory // extends CommonObject
|
||||
*
|
||||
* @param int $cpt_id Id of accounting account
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function deleteCptCat($cpt_id)
|
||||
{
|
||||
@@ -623,7 +626,7 @@ class AccountancyCategory // extends CommonObject
|
||||
* @param string $thirdparty_code Thirdparty code
|
||||
* @param int $month Specifig month - Can be empty
|
||||
* @param int $year Specifig year - Can be empty
|
||||
* @return integer <0 if KO, >= 0 if OK
|
||||
* @return integer Return integer <0 if KO, >= 0 if OK
|
||||
*/
|
||||
public function getSumDebitCredit($cpt, $date_start, $date_end, $sens, $thirdparty_code = 'nofilter', $month = 0, $year = 0)
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
*/
|
||||
class AccountancyExport
|
||||
{
|
||||
// Type of export. Used into $conf->global->ACCOUNTING_EXPORT_MODELCSV
|
||||
// Types of export.
|
||||
public static $EXPORT_TYPE_CONFIGURABLE = 1; // CSV
|
||||
public static $EXPORT_TYPE_AGIRIS = 10;
|
||||
public static $EXPORT_TYPE_EBP = 15;
|
||||
@@ -102,8 +102,8 @@ class AccountancyExport
|
||||
global $conf, $hookmanager;
|
||||
|
||||
$this->db = $db;
|
||||
$this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$this->end_line = !getDolGlobalString('ACCOUNTING_EXPORT_ENDLINE') ? "\n" : (getDolGlobalInt('ACCOUNTING_EXPORT_ENDLINE') == 1 ? "\n" : "\r\n");
|
||||
$this->separator = getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV');
|
||||
$this->end_line = getDolGlobalString('ACCOUNTING_EXPORT_ENDLINE') ? (getDolGlobalInt('ACCOUNTING_EXPORT_ENDLINE') == 1 ? "\n" : "\r\n") : "\n";
|
||||
|
||||
$hookmanager->initHooks(array('accountancyexport'));
|
||||
}
|
||||
@@ -201,9 +201,9 @@ class AccountancyExport
|
||||
'param' => array(
|
||||
self::$EXPORT_TYPE_CONFIGURABLE => array(
|
||||
'label' => $langs->trans('Modelcsv_configurable'),
|
||||
'ACCOUNTING_EXPORT_FORMAT' => !getDolGlobalString('ACCOUNTING_EXPORT_FORMAT') ? 'txt' : $conf->global->ACCOUNTING_EXPORT_FORMAT,
|
||||
'ACCOUNTING_EXPORT_SEPARATORCSV' => !getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV') ? ',' : $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV,
|
||||
'ACCOUNTING_EXPORT_ENDLINE' => !getDolGlobalString('ACCOUNTING_EXPORT_ENDLINE') ? 1 : $conf->global->ACCOUNTING_EXPORT_ENDLINE,
|
||||
'ACCOUNTING_EXPORT_FORMAT' => getDolGlobalString('ACCOUNTING_EXPORT_FORMAT', 'txt'),
|
||||
'ACCOUNTING_EXPORT_SEPARATORCSV' => getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV', ','),
|
||||
'ACCOUNTING_EXPORT_ENDLINE' => getDolGlobalString('ACCOUNTING_EXPORT_ENDLINE', 1),
|
||||
'ACCOUNTING_EXPORT_DATE' => getDolGlobalString('ACCOUNTING_EXPORT_DATE', '%Y-%m-%d'),
|
||||
),
|
||||
self::$EXPORT_TYPE_CEGID => array(
|
||||
@@ -325,7 +325,7 @@ class AccountancyExport
|
||||
* @param int $outputMode [=0] Print on screen
|
||||
* or 1 to write in file and uses a temp directory - Forced by default when use withAttachment = 1
|
||||
* or 2 to write in file a default export directory (accounting/export/)
|
||||
* @return int <0 if KO, >0 OK
|
||||
* @return int Return integer <0 if KO, >0 OK
|
||||
*/
|
||||
public function export(&$TData, $formatexportset, $withAttachment = 0, $downloadMode = 0, $outputMode = 0)
|
||||
{
|
||||
@@ -341,6 +341,10 @@ class AccountancyExport
|
||||
$exportFile = null;
|
||||
$exportFileName = '';
|
||||
$exportFilePath = '';
|
||||
$exportFileFullName ='';
|
||||
$downloadFileMimeType = '';
|
||||
$downloadFileFullName = '';
|
||||
$downloadFilePath = '';
|
||||
$archiveFullName = '';
|
||||
$archivePath = '';
|
||||
$archiveFileList = array();
|
||||
@@ -485,7 +489,7 @@ class AccountancyExport
|
||||
case self::$EXPORT_TYPE_FEC2:
|
||||
$archiveFileList = $this->exportFEC2($TData, $exportFile, $archiveFileList, $withAttachment);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_ISUITEEXPERT :
|
||||
case self::$EXPORT_TYPE_ISUITEEXPERT:
|
||||
$this->exportiSuiteExpert($TData, $exportFile);
|
||||
break;
|
||||
default:
|
||||
@@ -825,7 +829,7 @@ class AccountancyExport
|
||||
* @param array $objectLines data
|
||||
* @param resource $exportFile [=null] File resource to export or print if null
|
||||
* @param array $archiveFileList [=array()] Archive file list : array of ['path', 'name']
|
||||
* @param bool $withAttachment [=0] Not add files or 1 to have attached in an archive
|
||||
* @param int $withAttachment [=0] Not add files or 1 to have attached in an archive
|
||||
* @return array Archive file list : array of ['path', 'name']
|
||||
*/
|
||||
public function exportQuadratus($objectLines, $exportFile = null, $archiveFileList = array(), $withAttachment = 0)
|
||||
@@ -835,8 +839,6 @@ class AccountancyExport
|
||||
$end_line = "\r\n";
|
||||
|
||||
// We should use dol_now function not time however this is wrong date to transfert in accounting
|
||||
// $date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||
// $date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||
foreach ($objectLines as $line) {
|
||||
// Clean some data
|
||||
$line->doc_ref = dol_string_unaccent($line->doc_ref);
|
||||
@@ -867,11 +869,11 @@ class AccountancyExport
|
||||
if ($line->doc_type == 'customer_invoice') {
|
||||
$tab['lib_alpha'] = strtoupper(str_pad('C'.self::trunc(dol_string_unaccent($line->subledger_label), 6), 7));
|
||||
$tab['filler'] = str_repeat(' ', 52);
|
||||
$tab['coll_compte'] = str_pad(self::trunc($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, 8), 8);
|
||||
$tab['coll_compte'] = str_pad(self::trunc(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'), 8), 8);
|
||||
} elseif ($line->doc_type == 'supplier_invoice') {
|
||||
$tab['lib_alpha'] = strtoupper(str_pad('F'.self::trunc(dol_string_unaccent($line->subledger_label), 6), 7));
|
||||
$tab['filler'] = str_repeat(' ', 52);
|
||||
$tab['coll_compte'] = str_pad(self::trunc($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, 8), 8);
|
||||
$tab['coll_compte'] = str_pad(self::trunc(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'), 8), 8);
|
||||
} else {
|
||||
$tab['filler'] = str_repeat(' ', 59);
|
||||
$tab['coll_compte'] = str_pad(' ', 8);
|
||||
@@ -934,7 +936,6 @@ class AccountancyExport
|
||||
|
||||
// Force date format : %d%m%y
|
||||
if (!empty($line->date_lim_reglement)) {
|
||||
//$tab['date_echeance'] = dol_print_date($line->date_lim_reglement, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||
$tab['date_echeance'] = dol_print_date($line->date_lim_reglement, '%d%m%y'); // Format must be ddmmyy
|
||||
} else {
|
||||
$tab['date_echeance'] = '000000';
|
||||
@@ -999,7 +1000,9 @@ class AccountancyExport
|
||||
// skip native invoice pdfs (canelle)
|
||||
// We want to retrieve an attachment representative of the supplier invoice, not a fake document generated by Dolibarr.
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
if ($fileFound['name'] === $objectFileName.'.pdf') continue;
|
||||
if ($fileFound['name'] === $objectFileName.'.pdf') {
|
||||
continue;
|
||||
}
|
||||
} elseif ($fileFound['name'] !== $objectFileName.'.pdf') {
|
||||
continue;
|
||||
}
|
||||
@@ -1055,10 +1058,6 @@ class AccountancyExport
|
||||
$end_line = "\r\n";
|
||||
$index = 1;
|
||||
|
||||
//We should use dol_now function not time however this is wrong date to transfert in accounting
|
||||
//$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||
//$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||
|
||||
// Warning ! When truncation is necessary, no dot because 3 dots = three characters. The columns are shifted
|
||||
|
||||
foreach ($objectLines as $line) {
|
||||
@@ -1103,7 +1102,6 @@ class AccountancyExport
|
||||
$tab['code_stat'] = str_repeat(' ', 4);
|
||||
|
||||
if (!empty($line->date_lim_reglement)) {
|
||||
//$tab['date_echeance'] = dol_print_date($line->date_lim_reglement, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||
$tab['date_echeance'] = dol_print_date($line->date_lim_reglement, '%d%m%Y');
|
||||
} else {
|
||||
$tab['date_echeance'] = dol_print_date($line->doc_date, '%d%m%Y');
|
||||
@@ -1137,7 +1135,6 @@ class AccountancyExport
|
||||
*/
|
||||
public function exportEbp($objectLines, $exportFile = null)
|
||||
{
|
||||
|
||||
$separator = ',';
|
||||
$end_line = "\n";
|
||||
|
||||
@@ -1271,7 +1268,7 @@ class AccountancyExport
|
||||
$separator = $this->separator;
|
||||
|
||||
foreach ($objectLines as $line) {
|
||||
$date_document = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
|
||||
$date_document = dol_print_date($line->doc_date, getDolGlobalString('ACCOUNTING_EXPORT_DATE'));
|
||||
|
||||
$tab = array();
|
||||
// export configurable
|
||||
@@ -1304,7 +1301,7 @@ class AccountancyExport
|
||||
* @param array $objectLines data
|
||||
* @param resource $exportFile [=null] File resource to export or print if null
|
||||
* @param array $archiveFileList [=array()] Archive file list : array of ['path', 'name']
|
||||
* @param bool $withAttachment [=0] Not add files or 1 to have attached in an archive
|
||||
* @param int $withAttachment [=0] Not add files or 1 to have attached in an archive
|
||||
* @return array Archive file list : array of ['path', 'name']
|
||||
*/
|
||||
public function exportFEC($objectLines, $exportFile = null, $archiveFileList = array(), $withAttachment = 0)
|
||||
@@ -1468,7 +1465,9 @@ class AccountancyExport
|
||||
// skip native invoice pdfs (canelle)
|
||||
// We want to retrieve an attachment representative of the supplier invoice, not a fake document generated by Dolibarr.
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
if ($fileFound['name'] === $objectFileName.'.pdf') continue;
|
||||
if ($fileFound['name'] === $objectFileName.'.pdf') {
|
||||
continue;
|
||||
}
|
||||
} elseif ($fileFound['name'] !== $objectFileName.'.pdf') {
|
||||
continue;
|
||||
}
|
||||
@@ -1513,7 +1512,7 @@ class AccountancyExport
|
||||
* @param array $objectLines data
|
||||
* @param resource $exportFile [=null] File resource to export or print if null
|
||||
* @param array $archiveFileList [=array()] Archive file list : array of ['path', 'name']
|
||||
* @param bool $withAttachment [=0] Not add files or 1 to have attached in an archive
|
||||
* @param int $withAttachment [=0] Not add files or 1 to have attached in an archive
|
||||
* @return array Archive file list : array of ['path', 'name']
|
||||
*/
|
||||
public function exportFEC2($objectLines, $exportFile = null, $archiveFileList = array(), $withAttachment = 0)
|
||||
@@ -1677,7 +1676,9 @@ class AccountancyExport
|
||||
// skip native invoice pdfs (canelle)
|
||||
// We want to retrieve an attachment representative of the supplier invoice, not a fake document generated by Dolibarr.
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
if ($fileFound['name'] === $objectFileName.'.pdf') continue;
|
||||
if ($fileFound['name'] === $objectFileName.'.pdf') {
|
||||
continue;
|
||||
}
|
||||
} elseif ($fileFound['name'] !== $objectFileName.'.pdf') {
|
||||
continue;
|
||||
}
|
||||
@@ -1879,7 +1880,6 @@ class AccountancyExport
|
||||
*/
|
||||
public function exportLDCompta($objectLines, $exportFile = null)
|
||||
{
|
||||
|
||||
$separator = ';';
|
||||
$end_line = "\r\n";
|
||||
|
||||
@@ -2486,7 +2486,6 @@ class AccountancyExport
|
||||
*/
|
||||
public function exportGestimumV5($objectLines, $exportFile = null)
|
||||
{
|
||||
|
||||
$separator = ',';
|
||||
$end_line = "\r\n";
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class AccountancyImport
|
||||
public function cleanAmount(&$arrayrecord, $listfields, $record_key)
|
||||
{
|
||||
$value_trim = trim($arrayrecord[$record_key]['val']);
|
||||
return floatval($value_trim);
|
||||
return (float) $value_trim;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,8 +98,8 @@ class AccountancyImport
|
||||
$debit_index = $field_index_list['debit'];
|
||||
$credit_index = $field_index_list['credit'];
|
||||
|
||||
$debit = floatval($arrayrecord[$debit_index]['val']);
|
||||
$credit = floatval($arrayrecord[$credit_index]['val']);
|
||||
$debit = (float) $arrayrecord[$debit_index]['val'];
|
||||
$credit = (float) $arrayrecord[$credit_index]['val'];
|
||||
if (!empty($debit)) {
|
||||
$amount = $debit;
|
||||
} else {
|
||||
@@ -127,7 +127,7 @@ class AccountancyImport
|
||||
if (isset($field_index_list['debit'])) {
|
||||
$debit_index = $field_index_list['debit'];
|
||||
|
||||
$debit = floatval($arrayrecord[$debit_index]['val']);
|
||||
$debit = (float) $arrayrecord[$debit_index]['val'];
|
||||
if (!empty($debit)) {
|
||||
$sens = 'D';
|
||||
} else {
|
||||
|
||||
@@ -117,7 +117,7 @@ class AccountancySystem
|
||||
*
|
||||
* @param int $rowid Id
|
||||
* @param string $ref ref
|
||||
* @return int <0 if KO, Id of record if OK and found
|
||||
* @return int Return integer <0 if KO, Id of record if OK and found
|
||||
*/
|
||||
public function fetch($rowid = 0, $ref = '')
|
||||
{
|
||||
|
||||
@@ -179,7 +179,7 @@ class AccountingAccount extends CommonObject
|
||||
* @param string $account_number Account number
|
||||
* @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active chart of account
|
||||
* @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
|
||||
* @return int Return integer <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 = '')
|
||||
{
|
||||
@@ -249,7 +249,7 @@ class AccountingAccount extends CommonObject
|
||||
*
|
||||
* @param User $user User making action
|
||||
* @param int $notrigger Disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function create($user, $notrigger = 0)
|
||||
{
|
||||
@@ -350,7 +350,7 @@ class AccountingAccount extends CommonObject
|
||||
* Update record
|
||||
*
|
||||
* @param User $user User making update
|
||||
* @return int <0 if KO (-2 = duplicate), >0 if OK
|
||||
* @return int Return integer <0 if KO (-2 = duplicate), >0 if OK
|
||||
*/
|
||||
public function update($user)
|
||||
{
|
||||
@@ -395,7 +395,7 @@ class AccountingAccount extends CommonObject
|
||||
/**
|
||||
* Check usage of accounting code
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function checkUsage()
|
||||
{
|
||||
@@ -430,7 +430,7 @@ class AccountingAccount extends CommonObject
|
||||
*
|
||||
* @param User $user User that deletes
|
||||
* @param int $notrigger 0=triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete($user, $notrigger = 0)
|
||||
{
|
||||
@@ -619,7 +619,7 @@ class AccountingAccount extends CommonObject
|
||||
*
|
||||
* @param int $id Id
|
||||
* @param int $mode 0=field active, 1=field reconcilable
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function accountDeactivate($id, $mode = 0)
|
||||
{
|
||||
@@ -659,7 +659,7 @@ class AccountingAccount extends CommonObject
|
||||
*
|
||||
* @param int $id Id
|
||||
* @param int $mode 0=field active, 1=field reconcilable
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function accountActivate($id, $mode = 0)
|
||||
{
|
||||
@@ -878,9 +878,9 @@ class AccountingAccount extends CommonObject
|
||||
if ($factureDet->desc == "(DEPOSIT)" || $facture->type == $facture::TYPE_DEPOSIT) {
|
||||
$accountdeposittoventilated = new self($this->db);
|
||||
if ($type == 'customer') {
|
||||
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
|
||||
$result = $accountdeposittoventilated->fetch('', getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT'), 1);
|
||||
} elseif ($type == 'supplier') {
|
||||
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT, 1);
|
||||
$result = $accountdeposittoventilated->fetch('', getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT'), 1);
|
||||
}
|
||||
if (isset($result) && $result < 0) {
|
||||
return -1;
|
||||
@@ -901,9 +901,9 @@ class AccountingAccount extends CommonObject
|
||||
if ($facture->type == $facture::TYPE_CREDIT_NOTE && $invoiceSource->type == $facture::TYPE_DEPOSIT) {
|
||||
$accountdeposittoventilated = new self($this->db);
|
||||
if ($type == 'customer') {
|
||||
$accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
|
||||
$accountdeposittoventilated->fetch('', getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT'), 1);
|
||||
} elseif ($type == 'supplier') {
|
||||
$accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT, 1);
|
||||
$accountdeposittoventilated->fetch('', getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT'), 1);
|
||||
}
|
||||
$code_l = $accountdeposittoventilated->ref;
|
||||
$code_p = '';
|
||||
|
||||
@@ -84,12 +84,12 @@ class AccountingJournal extends CommonObject
|
||||
/**
|
||||
* @var array Accounting account cached
|
||||
*/
|
||||
static public $accounting_account_cached = array();
|
||||
public static $accounting_account_cached = array();
|
||||
|
||||
/**
|
||||
* @var array Nature mapping
|
||||
*/
|
||||
static public $nature_maps = array(
|
||||
public static $nature_maps = array(
|
||||
1 => 'variousoperations',
|
||||
2 => 'sells',
|
||||
3 => 'purchases',
|
||||
@@ -114,7 +114,7 @@ class AccountingJournal extends CommonObject
|
||||
*
|
||||
* @param int $rowid Id of record to load
|
||||
* @param string $journal_code Journal code
|
||||
* @return int <0 if KO, Id of record if OK and found
|
||||
* @return int Return integer <0 if KO, Id of record if OK and found
|
||||
*/
|
||||
public function fetch($rowid = null, $journal_code = null)
|
||||
{
|
||||
@@ -168,7 +168,7 @@ class AccountingJournal extends CommonObject
|
||||
* @param array $filter filter array
|
||||
* @param string $filtermode filter mode (AND or OR)
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
|
||||
{
|
||||
@@ -379,15 +379,19 @@ class AccountingJournal extends CommonObject
|
||||
* @param int $date_start Filter 'start date'
|
||||
* @param int $date_end Filter 'end date'
|
||||
* @param string $in_bookkeeping Filter 'in bookkeeping' ('already', 'notyet')
|
||||
* @return array|int <0 if KO, >0 if OK
|
||||
* @return array|int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function getData(User $user, $type = 'view', $date_start = null, $date_end = null, $in_bookkeeping = 'notyet')
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
// Clean parameters
|
||||
if (empty($type)) $type = 'view';
|
||||
if (empty($in_bookkeeping)) $in_bookkeeping = 'notyet';
|
||||
if (empty($type)) {
|
||||
$type = 'view';
|
||||
}
|
||||
if (empty($in_bookkeeping)) {
|
||||
$in_bookkeeping = 'notyet';
|
||||
}
|
||||
|
||||
$data = array();
|
||||
|
||||
@@ -423,7 +427,7 @@ class AccountingJournal extends CommonObject
|
||||
* @param int $date_start Filter 'start date'
|
||||
* @param int $date_end Filter 'end date'
|
||||
* @param string $in_bookkeeping Filter 'in bookkeeping' ('already', 'notyet')
|
||||
* @return array|int <0 if KO, >0 if OK
|
||||
* @return array|int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function getAssetData(User $user, $type = 'view', $date_start = null, $date_end = null, $in_bookkeeping = 'notyet')
|
||||
{
|
||||
@@ -466,7 +470,7 @@ class AccountingJournal extends CommonObject
|
||||
}
|
||||
// Define begin binding date
|
||||
if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$sql .= " AND ad.depreciation_date >= '" . $this->db->idate($conf->global->ACCOUNTING_DATE_START_BINDING) . "'";
|
||||
$sql .= " AND ad.depreciation_date >= '" . $this->db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) . "'";
|
||||
}
|
||||
$sql .= " ORDER BY ad.depreciation_date";
|
||||
|
||||
@@ -529,8 +533,6 @@ class AccountingJournal extends CommonObject
|
||||
$element_link = $element_static->getNomUrl(1, 'with_label');
|
||||
|
||||
$element_name_formatted_0 = dol_trunc($element_static->label, 16);
|
||||
$element_name_formatted_1 = utf8_decode(dol_trunc($element_static->label, 32));
|
||||
$element_name_formatted_2 = utf8_decode(dol_trunc($element_static->label, 16));
|
||||
$label_operation = $element_static->getNomUrl(0, 'label', 16);
|
||||
|
||||
$element = array(
|
||||
@@ -614,12 +616,12 @@ class AccountingJournal extends CommonObject
|
||||
$disposal_date = $pre_data_info['disposal']['date'];
|
||||
|
||||
if ((!($date_start && $date_end) || ($date_start <= $disposal_date && $disposal_date <= $date_end)) &&
|
||||
(!getDolGlobalString('ACCOUNTING_DATE_START_BINDING') || $conf->global->ACCOUNTING_DATE_START_BINDING <= $disposal_date)
|
||||
(!getDolGlobalString('ACCOUNTING_DATE_START_BINDING') || getDolGlobalInt('ACCOUNTING_DATE_START_BINDING') <= $disposal_date)
|
||||
) {
|
||||
$disposal_amount = $pre_data_info['disposal']['amount'];
|
||||
$disposal_subject_to_vat = $pre_data_info['disposal']['subject_to_vat'];
|
||||
$disposal_date_formatted = dol_print_date($disposal_date, 'day');
|
||||
$disposal_vat = $conf->global->ASSET_DISPOSAL_VAT > 0 ? $conf->global->ASSET_DISPOSAL_VAT : 20;
|
||||
$disposal_vat = getDolGlobalInt('ASSET_DISPOSAL_VAT') > 0 ? getDolGlobalInt('ASSET_DISPOSAL_VAT') : 20;
|
||||
|
||||
// Get accountancy codes
|
||||
//---------------------------
|
||||
@@ -659,9 +661,11 @@ class AccountingJournal extends CommonObject
|
||||
$lines[0][$accountancy_code_depreciation_asset] = -$last_cumulative_amount_ht;
|
||||
$lines[0][$accountancy_code_asset] = $element_static->acquisition_value_ht;
|
||||
|
||||
$disposal_amount_vat = $disposal_subject_to_vat ? (double) price2num($disposal_amount * $disposal_vat / 100, 'MT') : 0;
|
||||
$disposal_amount_vat = $disposal_subject_to_vat ? (float) price2num($disposal_amount * $disposal_vat / 100, 'MT') : 0;
|
||||
$lines[1][$accountancy_code_receivable_on_assignment] = -($disposal_amount + $disposal_amount_vat);
|
||||
if ($disposal_subject_to_vat) $lines[1][$accountancy_code_vat_collected] = $disposal_amount_vat;
|
||||
if ($disposal_subject_to_vat) {
|
||||
$lines[1][$accountancy_code_vat_collected] = $disposal_amount_vat;
|
||||
}
|
||||
$lines[1][$accountancy_code_proceeds_from_sales] = $disposal_amount;
|
||||
|
||||
foreach ($lines as $lines_block) {
|
||||
@@ -778,7 +782,7 @@ class AccountingJournal extends CommonObject
|
||||
* ),
|
||||
* );
|
||||
* @param int $max_nb_errors Nb error authorized before stop the process
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function writeIntoBookkeeping(User $user, &$journal_data = array(), $max_nb_errors = 10)
|
||||
{
|
||||
@@ -919,13 +923,15 @@ class AccountingJournal extends CommonObject
|
||||
* );
|
||||
* @param int $search_date_end Search date end
|
||||
* @param string $sep CSV separator
|
||||
* @return int|string <0 if KO, >0 if OK
|
||||
* @return int|string Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function exportCsv(&$journal_data = array(), $search_date_end = 0, $sep = '')
|
||||
{
|
||||
global $conf, $langs, $hookmanager;
|
||||
|
||||
if (empty($sep)) $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
if (empty($sep)) {
|
||||
$sep = getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV');
|
||||
}
|
||||
$out = '';
|
||||
|
||||
// Hook
|
||||
@@ -976,7 +982,9 @@ class AccountingJournal extends CommonObject
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($header)) $out .= '"' . implode('"' . $sep . '"', $header) . '"' . "\n";
|
||||
if (!empty($header)) {
|
||||
$out .= '"' . implode('"' . $sep . '"', $header) . '"' . "\n";
|
||||
}
|
||||
foreach ($journal_data as $element_id => $element) {
|
||||
foreach ($element['blocks'] as $lines) {
|
||||
foreach ($lines as $line) {
|
||||
@@ -1007,7 +1015,7 @@ class AccountingJournal extends CommonObject
|
||||
'found' => true,
|
||||
'label' => $accountingaccount->label,
|
||||
'code_formatted_1' => length_accounta(html_entity_decode($account)),
|
||||
'label_formatted_1' => utf8_decode(dol_trunc($accountingaccount->label, 32)),
|
||||
'label_formatted_1' => mb_convert_encoding(dol_trunc($accountingaccount->label, 32), 'ISO-8859-1'),
|
||||
'label_formatted_2' => dol_trunc($accountingaccount->label, 32),
|
||||
);
|
||||
} else {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -400,7 +400,7 @@ class Lettering extends BookKeeping
|
||||
*
|
||||
* @param array $bookkeeping_ids Lettering specific list of bookkeeping id
|
||||
* @param bool $unlettering Do unlettering
|
||||
* @return int <0 if error (nb lettered = result -1), 0 if noting to lettering, >0 if OK (nb lettered)
|
||||
* @return int Return integer <0 if error (nb lettered = result -1), 0 if noting to lettering, >0 if OK (nb lettered)
|
||||
*/
|
||||
public function bookkeepingLetteringAll($bookkeeping_ids, $unlettering = false)
|
||||
{
|
||||
@@ -432,7 +432,7 @@ class Lettering extends BookKeeping
|
||||
*
|
||||
* @param array $bookkeeping_ids Lettering specific list of bookkeeping id
|
||||
* @param bool $unlettering Do unlettering
|
||||
* @return int <0 if error (nb lettered = result -1), 0 if noting to lettering, >0 if OK (nb lettered)
|
||||
* @return int Return integer <0 if error (nb lettered = result -1), 0 if noting to lettering, >0 if OK (nb lettered)
|
||||
*/
|
||||
public function bookkeepingLettering($bookkeeping_ids, $unlettering = false)
|
||||
{
|
||||
@@ -469,9 +469,15 @@ class Lettering extends BookKeeping
|
||||
$group_error++;
|
||||
break;
|
||||
}
|
||||
if (!isset($lettering_code)) $lettering_code = (string) $line_infos['lettering_code'];
|
||||
if (!empty($line_infos['lettering_code'])) $do_it = true;
|
||||
} elseif (!empty($line_infos['lettering_code'])) $do_it = false;
|
||||
if (!isset($lettering_code)) {
|
||||
$lettering_code = (string) $line_infos['lettering_code'];
|
||||
}
|
||||
if (!empty($line_infos['lettering_code'])) {
|
||||
$do_it = true;
|
||||
}
|
||||
} elseif (!empty($line_infos['lettering_code'])) {
|
||||
$do_it = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Check balance amount
|
||||
@@ -482,8 +488,11 @@ class Lettering extends BookKeeping
|
||||
|
||||
// Lettering/Unlettering the group of bookkeeping lines
|
||||
if (!$group_error && $do_it) {
|
||||
if ($unlettering) $result = $this->deleteLettering($bookkeeping_lines);
|
||||
else $result = $this->updateLettering($bookkeeping_lines);
|
||||
if ($unlettering) {
|
||||
$result = $this->deleteLettering($bookkeeping_lines);
|
||||
} else {
|
||||
$result = $this->updateLettering($bookkeeping_lines);
|
||||
}
|
||||
if ($result < 0) {
|
||||
$group_error++;
|
||||
} elseif ($result > 0) {
|
||||
@@ -509,7 +518,7 @@ class Lettering extends BookKeeping
|
||||
*
|
||||
* @param array $bookkeeping_ids Lettering specific list of bookkeeping id
|
||||
* @param bool $only_has_subledger_account Get only lines who have subledger account
|
||||
* @return array|int <0 if error otherwise all linked lines by block
|
||||
* @return array|int Return integer <0 if error otherwise all linked lines by block
|
||||
*/
|
||||
public function getLinkedLines($bookkeeping_ids, $only_has_subledger_account = true)
|
||||
{
|
||||
@@ -534,7 +543,9 @@ class Lettering extends BookKeeping
|
||||
$sql .= " AND pn.piece_num = ab.piece_num";
|
||||
$sql .= " )";
|
||||
}
|
||||
if ($only_has_subledger_account) $sql .= " AND ab.subledger_account != ''";
|
||||
if ($only_has_subledger_account) {
|
||||
$sql .= " AND ab.subledger_account != ''";
|
||||
}
|
||||
|
||||
dol_syslog(__METHOD__ . " - Get all bookkeeping lines", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@@ -608,7 +619,9 @@ class Lettering extends BookKeeping
|
||||
$sql .= " AND dpn.piece_num = ab.piece_num";
|
||||
$sql .= " )";
|
||||
$sql .= ")";
|
||||
if ($only_has_subledger_account) $sql .= " AND ab.subledger_account != ''";
|
||||
if ($only_has_subledger_account) {
|
||||
$sql .= " AND ab.subledger_account != ''";
|
||||
}
|
||||
|
||||
dol_syslog(__METHOD__ . " - Get all bookkeeping lines linked", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@@ -629,7 +642,9 @@ class Lettering extends BookKeeping
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
if (!empty($group)) $grouped_lines[] = $group;
|
||||
if (!empty($group)) {
|
||||
$grouped_lines[] = $group;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -640,7 +655,7 @@ class Lettering extends BookKeeping
|
||||
* Get all fk_doc by doc_type from list of bank ids
|
||||
*
|
||||
* @param array $bank_ids List of bank ids
|
||||
* @return array|int <0 if error otherwise all fk_doc by doc_type
|
||||
* @return array|int Return integer <0 if error otherwise all fk_doc by doc_type
|
||||
*/
|
||||
public function getDocTypeAndFkDocFromBankLines($bank_ids)
|
||||
{
|
||||
@@ -683,7 +698,7 @@ class Lettering extends BookKeeping
|
||||
*
|
||||
* @param array $document_ids List of document id
|
||||
* @param string $doc_type Type of document ('customer_invoice' or 'supplier_invoice', ...)
|
||||
* @return array|int <0 if error otherwise all all bank ids from list of document ids of a type
|
||||
* @return array|int Return integer <0 if error otherwise all all bank ids from list of document ids of a type
|
||||
*/
|
||||
public function getBankLinesFromFkDocAndDocType($document_ids, $doc_type)
|
||||
{
|
||||
@@ -737,7 +752,7 @@ class Lettering extends BookKeeping
|
||||
*
|
||||
* @param array $document_ids List of document id
|
||||
* @param string $doc_type Type of document ('customer_invoice' or 'supplier_invoice', ...)
|
||||
* @return array|int <0 if error otherwise all linked document ids by group and type [ [ 'doc_type' => [ doc_id, ... ], ... ], ... ]
|
||||
* @return array|int Return integer <0 if error otherwise all linked document ids by group and type [ [ 'doc_type' => [ doc_id, ... ], ... ], ... ]
|
||||
*/
|
||||
public function getLinkedDocumentByGroup($document_ids, $doc_type)
|
||||
{
|
||||
@@ -831,7 +846,9 @@ class Lettering extends BookKeeping
|
||||
|
||||
foreach ($element_ids as $element_id) {
|
||||
// Continue if element id in not found
|
||||
if (!isset($link_by_element[$element_id])) continue;
|
||||
if (!isset($link_by_element[$element_id])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Set the element in the current group
|
||||
$current_group[$element_id] = $element_id;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2019 Open-DSI <support@open-dsi.fr>
|
||||
/* Copyright (C) 2019-2023 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
|
||||
@@ -32,32 +32,12 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta", "bills", "other", "accountancy"));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'aZ09');
|
||||
$fiscal_period_id = GETPOST('fiscal_period_id', 'int');
|
||||
$validatemonth = GETPOST('validatemonth', 'int');
|
||||
$validateyear = GETPOST('validateyear', 'int');
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$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');
|
||||
} 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;
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
@@ -69,48 +49,105 @@ if (!$user->hasRight('accounting', 'fiscalyear', 'write')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('accountancyclosure'));
|
||||
|
||||
$object = new BookKeeping($db);
|
||||
|
||||
$now = dol_now();
|
||||
$fiscal_periods = $object->getFiscalPeriods();
|
||||
if (!is_array($fiscal_periods)) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
$active_fiscal_periods = array();
|
||||
$last_fiscal_period = null;
|
||||
$current_fiscal_period = null;
|
||||
$next_fiscal_period = null;
|
||||
$next_active_fiscal_period = null;
|
||||
if (is_array($fiscal_periods)) {
|
||||
foreach ($fiscal_periods as $fiscal_period) {
|
||||
if (empty($fiscal_period['status'])) {
|
||||
$active_fiscal_periods[] = $fiscal_period;
|
||||
}
|
||||
if (isset($current_fiscal_period)) {
|
||||
if (!isset($next_fiscal_period)) {
|
||||
$next_fiscal_period = $fiscal_period;
|
||||
}
|
||||
if (!isset($next_active_fiscal_period) && empty($fiscal_period['status'])) {
|
||||
$next_active_fiscal_period = $fiscal_period;
|
||||
}
|
||||
} else {
|
||||
if ($fiscal_period_id == $fiscal_period['id'] || (empty($fiscal_period_id) && $fiscal_period['date_start'] <= $now && $now <= $fiscal_period['date_end'])) {
|
||||
$current_fiscal_period = $fiscal_period;
|
||||
} else {
|
||||
$last_fiscal_period = $fiscal_period;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$accounting_groups_used_for_balance_sheet_account = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT'))), 'strlen');
|
||||
$accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$now = dol_now();
|
||||
$parameters = array('fiscal_periods' => $fiscal_periods, 'last_fiscal_period' => $last_fiscal_period, 'current_fiscal_period' => $current_fiscal_period, 'next_fiscal_period' => $next_fiscal_period);
|
||||
$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 ($action == 'validate_movements_confirm' && $user->hasRight('accounting', 'fiscalyear', 'write')) {
|
||||
$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 (empty($reshook)) {
|
||||
if (isset($current_fiscal_period) && $user->hasRight('accounting', 'fiscalyear', 'write')) {
|
||||
if ($action == 'confirm_step_1' && $confirm == "yes") {
|
||||
$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'));
|
||||
|
||||
$error = 0;
|
||||
$result = $object->validateMovementForFiscalPeriod($date_start, $date_end);
|
||||
if ($result > 0) {
|
||||
setEventMessages($langs->trans("AllMovementsWereRecordedAsValidated"), null, 'mesgs');
|
||||
|
||||
$db->begin();
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . (isset($current_fiscal_period) ? '?fiscal_period_id=' . $current_fiscal_period['id'] : ''));
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($langs->trans("NotAllMovementsCouldBeRecordedAsValidated"), null, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
} elseif ($action == 'confirm_step_2' && $confirm == "yes") {
|
||||
$new_fiscal_period_id = GETPOST('new_fiscal_period_id', 'int');
|
||||
$separate_auxiliary_account = GETPOST('separate_auxiliary_account', 'aZ09');
|
||||
$generate_bookkeeping_records = GETPOST('generate_bookkeeping_records', 'aZ09');
|
||||
|
||||
// Specify as export : update field date_validated on selected month/year
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||
$sql .= " SET date_validated = '".$db->idate($now)."'";
|
||||
$sql .= " WHERE entity = " . ((int) $conf->entity);
|
||||
$sql .= " AND doc_date >= '" . $db->idate($date_start) . "'";
|
||||
$sql .= " AND doc_date <= '" . $db->idate($date_end) . "'";
|
||||
$sql .= " AND date_validated IS NULL";
|
||||
$result = $object->closeFiscalPeriod($current_fiscal_period['id'], $new_fiscal_period_id, $separate_auxiliary_account, $generate_bookkeeping_records);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans("AccountancyClosureCloseSuccessfully"), null, 'mesgs');
|
||||
|
||||
dol_syslog("/accountancy/closure/index.php action=validate_movement_confirm -> Set movements as validated", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
$error++;
|
||||
}
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . (isset($current_fiscal_period) ? '?fiscal_period_id=' . $current_fiscal_period['id'] : ''));
|
||||
exit;
|
||||
}
|
||||
} elseif ($action == 'confirm_step_3' && $confirm == "yes") {
|
||||
$inventory_journal_id = GETPOST('inventory_journal_id', 'int');
|
||||
$new_fiscal_period_id = GETPOST('new_fiscal_period_id', 'int');
|
||||
$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 (!$error) {
|
||||
$db->commit();
|
||||
$result = $object->insertAccountingReversal($current_fiscal_period['id'], $inventory_journal_id, $new_fiscal_period_id, $date_start, $date_end);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
setEventMessages($langs->trans("AccountancyClosureInsertAccountingReversalSuccessfully"), null, 'mesgs');
|
||||
|
||||
setEventMessages($langs->trans("AllMovementsWereRecordedAsValidated"), null, 'mesgs');
|
||||
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?year=".$year_start);
|
||||
exit;
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
setEventMessages($langs->trans("NotAllMovementsCouldBeRecordedAsValidated"), null, 'errors');
|
||||
$action = '';
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . (isset($current_fiscal_period) ? '?fiscal_period_id=' . $current_fiscal_period['id'] : ''));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,120 +165,229 @@ $help_url ='EN:Module_Double_Entry_Accounting';
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
if ($action == 'validate_movements') {
|
||||
$form_question = array();
|
||||
$formconfirm = '';
|
||||
|
||||
$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'));
|
||||
if (isset($current_fiscal_period)) {
|
||||
if ($action == 'step_1') {
|
||||
$form_question = array();
|
||||
|
||||
$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')
|
||||
);
|
||||
$form_question['date_start'] = array(
|
||||
'name' => 'date_start',
|
||||
'type' => 'date',
|
||||
'label' => $langs->trans('DateStart'),
|
||||
'value' => $current_fiscal_period['date_start']
|
||||
);
|
||||
$form_question['date_end'] = array(
|
||||
'name' => 'date_end',
|
||||
'type' => 'date',
|
||||
'label' => $langs->trans('DateEnd'),
|
||||
'value' => $current_fiscal_period['date_end']
|
||||
);
|
||||
|
||||
$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;
|
||||
}
|
||||
$formconfirm = $form->formconfirm(
|
||||
$_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $current_fiscal_period['id'],
|
||||
$langs->trans('ValidateMovements'),
|
||||
$langs->trans('DescValidateMovements', $langs->transnoentitiesnoconv("RegistrationInAccounting")),
|
||||
'confirm_step_1',
|
||||
$form_question,
|
||||
'',
|
||||
1,
|
||||
300
|
||||
);
|
||||
} elseif ($action == 'step_2') {
|
||||
$form_question = array();
|
||||
|
||||
$textprevyear = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current - 1).'">'.img_previous().'</a>';
|
||||
$textnextyear = ' <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>';
|
||||
$fiscal_period_arr = array();
|
||||
foreach ($active_fiscal_periods as $info) {
|
||||
$fiscal_period_arr[$info['id']] = $info['label'];
|
||||
}
|
||||
$form_question['new_fiscal_period_id'] = array(
|
||||
'name' => 'new_fiscal_period_id',
|
||||
'type' => 'select',
|
||||
'label' => $langs->trans('AccountancyClosureStep3NewFiscalPeriod'),
|
||||
'values' => $fiscal_period_arr,
|
||||
'default' => isset($next_active_fiscal_period) ? $next_active_fiscal_period['id'] : '',
|
||||
);
|
||||
$form_question['generate_bookkeeping_records'] = array(
|
||||
'name' => 'generate_bookkeeping_records',
|
||||
'type' => 'checkbox',
|
||||
'label' => $langs->trans('AccountancyClosureGenerateClosureBookkeepingRecords'),
|
||||
'value' => 1
|
||||
);
|
||||
$form_question['separate_auxiliary_account'] = array(
|
||||
'name' => 'separate_auxiliary_account',
|
||||
'type' => 'checkbox',
|
||||
'label' => $langs->trans('AccountancyClosureSeparateAuxiliaryAccounts'),
|
||||
'value' => 0
|
||||
);
|
||||
|
||||
$formconfirm = $form->formconfirm(
|
||||
$_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $current_fiscal_period['id'],
|
||||
$langs->trans('AccountancyClosureClose'),
|
||||
$langs->trans('AccountancyClosureConfirmClose'),
|
||||
'confirm_step_2',
|
||||
$form_question,
|
||||
'',
|
||||
1,
|
||||
300
|
||||
);
|
||||
} elseif ($action == 'step_3') {
|
||||
$form_question = array();
|
||||
|
||||
print load_fiche_titre($langs->trans("Closure")." ".$textprevyear." ".$langs->trans("Year")." ".$year_start." ".$textnextyear, '', 'title_accountancy');
|
||||
$form_question['inventory_journal_id'] = array(
|
||||
'name' => 'inventory_journal_id',
|
||||
'type' => 'other',
|
||||
'label' => $langs->trans('InventoryJournal'),
|
||||
'value' => $formaccounting->select_journal(0, "inventory_journal_id", 8, 1, 0, 0)
|
||||
);
|
||||
$fiscal_period_arr = array();
|
||||
foreach ($active_fiscal_periods as $info) {
|
||||
$fiscal_period_arr[$info['id']] = $info['label'];
|
||||
}
|
||||
$form_question['new_fiscal_period_id'] = array(
|
||||
'name' => 'new_fiscal_period_id',
|
||||
'type' => 'select',
|
||||
'label' => $langs->trans('AccountancyClosureStep3NewFiscalPeriod'),
|
||||
'values' => $fiscal_period_arr,
|
||||
'default' => isset($next_active_fiscal_period) ? $next_active_fiscal_period['id'] : '',
|
||||
);
|
||||
$form_question['date_start'] = array(
|
||||
'name' => 'date_start',
|
||||
'type' => 'date',
|
||||
'label' => $langs->trans('DateStart'),
|
||||
'value' => dol_time_plus_duree($current_fiscal_period['date_end'], -1, 'm')
|
||||
);
|
||||
$form_question['date_end'] = array(
|
||||
'name' => 'date_end',
|
||||
'type' => 'date',
|
||||
'label' => $langs->trans('DateEnd'),
|
||||
'value' => $current_fiscal_period['date_end']
|
||||
);
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("DescClosure").'</span><br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
$y = $year_current;
|
||||
if (!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) {
|
||||
$buttonvalidate = '<a class="butAction" name="button_validate_movements" href="'.$_SERVER["PHP_SELF"].'?action=validate_movements&year='.$year_start.'">'.$langs->trans("ValidateMovements").'</a>';
|
||||
} else {
|
||||
$buttonvalidate = '';
|
||||
}
|
||||
|
||||
print_barre_liste($langs->trans("OverviewOfMovementsNotValidated"), '', '', '', '', '', '', -1, '', '', 0, $buttonvalidate, '', 0, 1, 0);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
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;
|
||||
$formconfirm = $form->formconfirm(
|
||||
$_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $current_fiscal_period['id'],
|
||||
$langs->trans('AccountancyClosureAccountingReversal'),
|
||||
$langs->trans('AccountancyClosureConfirmAccountingReversal'),
|
||||
'confirm_step_3',
|
||||
$form_question,
|
||||
'',
|
||||
1,
|
||||
300
|
||||
);
|
||||
}
|
||||
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
|
||||
}
|
||||
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
|
||||
|
||||
if (getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) {
|
||||
$sql = "SELECT COUNT(b.rowid) as detail,";
|
||||
// Call Hook formConfirm
|
||||
$parameters = array('formConfirm' => $formconfirm, 'fiscal_periods' => $fiscal_periods, 'last_fiscal_period' => $last_fiscal_period, 'current_fiscal_period' => $current_fiscal_period, 'next_fiscal_period' => $next_fiscal_period);
|
||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) {
|
||||
$formconfirm .= $hookmanager->resPrint;
|
||||
} elseif ($reshook > 0) {
|
||||
$formconfirm = $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
// Print form confirm
|
||||
print $formconfirm;
|
||||
|
||||
$fiscal_period_nav_text = $langs->trans("FiscalPeriod");
|
||||
|
||||
$fiscal_period_nav_text .= ' <a href="' . (isset($last_fiscal_period) ? $_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $last_fiscal_period['id'] : '#" class="disabled') . '">' . img_previous() . '</a>';
|
||||
$fiscal_period_nav_text .= ' <a href="' . (isset($next_fiscal_period) ? $_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $next_fiscal_period['id'] : '#" class="disabled') . '">' . img_next() . '</a>';
|
||||
if (!empty($current_fiscal_period)) {
|
||||
$fiscal_period_nav_text .= $current_fiscal_period['label'].' (' . (isset($current_fiscal_period) ? dol_print_date($current_fiscal_period['date_start'], 'day') . ' - ' . dol_print_date($current_fiscal_period['date_end'], 'day') . ')' : '');
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("Closure") . " - " . $fiscal_period_nav_text, '', 'title_accountancy');
|
||||
|
||||
if (empty($current_fiscal_period)) {
|
||||
print $langs->trans('ErrorNoFiscalPeriodActiveFound');
|
||||
}
|
||||
|
||||
if (isset($current_fiscal_period)) {
|
||||
// Step 1
|
||||
$head = array();
|
||||
$head[0][0] = DOL_URL_ROOT . '/accountancy/closure/index.php?fiscal_period_id=' . $current_fiscal_period['id'];
|
||||
$head[0][1] = $langs->trans("AccountancyClosureStep1");
|
||||
$head[0][2] = 'step1';
|
||||
print dol_get_fiche_head($head, 'step1', '', -1, 'title_accountancy');
|
||||
|
||||
print '<span class="opacitymedium">' . $langs->trans("AccountancyClosureStep1Desc") . '</span><br>';
|
||||
|
||||
$count_by_month = $object->getCountByMonthForFiscalPeriod($current_fiscal_period['date_start'], $current_fiscal_period['date_end']);
|
||||
if (!is_array($count_by_month)) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
if (empty($count_by_month['total'])) {
|
||||
$buttonvalidate = '<a class="butActionRefused classfortooltip" href="#">' . $langs->trans("ValidateMovements") . '</a>';
|
||||
} else {
|
||||
$buttonvalidate = '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=step_1&fiscal_period_id=' . $current_fiscal_period['id'] . '">' . $langs->trans("ValidateMovements") . '</a>';
|
||||
}
|
||||
print_barre_liste($langs->trans("OverviewOfMovementsNotValidated"), '', '', '', '', '', '', -1, '', '', 0, $buttonvalidate, '', 0, 1, 0);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
$nb_years = is_array($count_by_month['list']) ? count($count_by_month['list']) : 0;
|
||||
if ($nb_years > 1) {
|
||||
print '<td class="right">' . $langs->trans("Year") . '</td>';
|
||||
}
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + getDolGlobalInt('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).",";
|
||||
print '<td class="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
$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
|
||||
// lines not inside an existing fiscal period
|
||||
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."accounting_fiscalyear as af";
|
||||
$sql .= " WHERE b.doc_date >= af.date_start AND (b.doc_date <= af.date_end or af.date_end IS NULL)";
|
||||
$sql .= " AND af.statut = ".((int) Fiscalyear::STATUS_CLOSED);
|
||||
$sql .= ")";
|
||||
} else {
|
||||
// Analyse closed record using the unitary flag/date on each record
|
||||
$sql = "SELECT COUNT(b.rowid) as detail,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
print '<td class="right"><b>' . $langs->trans("Total") . '</b></td>';
|
||||
print '</tr>';
|
||||
|
||||
if (is_array($count_by_month['list'])) {
|
||||
foreach ($count_by_month['list'] as $info) {
|
||||
print '<tr class="oddeven">';
|
||||
if ($nb_years > 1) {
|
||||
print '<td class="right">' . $info['year'] . '</td>';
|
||||
}
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
print '<td class="right">' . ((int) $info['count'][$i]) . '</td>';
|
||||
}
|
||||
print '<td class="right"><b>' . $info['total'] . '</b></td></tr>';
|
||||
}
|
||||
$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
|
||||
$sql .= " AND date_validated IS NULL";
|
||||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
// Step 2
|
||||
$head = array();
|
||||
$head[0][0] = DOL_URL_ROOT . '/accountancy/closure/index.php?fiscal_period_id=' . $current_fiscal_period['id'];
|
||||
$head[0][1] = $langs->trans("AccountancyClosureStep2");
|
||||
$head[0][2] = 'step2';
|
||||
print dol_get_fiche_head($head, 'step2', '', -1, 'title_accountancy');
|
||||
|
||||
// print '<span class="opacitymedium">' . $langs->trans("AccountancyClosureStep2Desc") . '</span><br>';
|
||||
|
||||
if (empty($count_by_month['total']) && empty($current_fiscal_period['status'])) {
|
||||
$button = '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=step_2&fiscal_period_id=' . $current_fiscal_period['id'] . '">' . $langs->trans("AccountancyClosureClose") . '</a>';
|
||||
} else {
|
||||
$button = '<a class="butActionRefused classfortooltip" href="#">' . $langs->trans("AccountancyClosureClose") . '</a>';
|
||||
}
|
||||
print_barre_liste('', '', '', '', '', '', '', -1, '', '', 0, $button, '', 0, 1, 0);
|
||||
|
||||
// Step 3
|
||||
$head = array();
|
||||
$head[0][0] = DOL_URL_ROOT . '/accountancy/closure/index.php?fiscal_period_id=' . $current_fiscal_period['id'];
|
||||
$head[0][1] = $langs->trans("AccountancyClosureStep3");
|
||||
$head[0][2] = 'step3';
|
||||
print dol_get_fiche_head($head, 'step3', '', -1, 'title_accountancy');
|
||||
|
||||
// print '<span class="opacitymedium">' . $langs->trans("AccountancyClosureStep3Desc") . '</span><br>';
|
||||
|
||||
if (empty($current_fiscal_period['status'])) {
|
||||
$button = '<a class="butActionRefused classfortooltip" href="#">' . $langs->trans("AccountancyClosureAccountingReversal") . '</a>';
|
||||
} else {
|
||||
$button = '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=step_3&fiscal_period_id=' . $current_fiscal_period['id'] . '">' . $langs->trans("AccountancyClosureAccountingReversal") . '</a>';
|
||||
}
|
||||
print_barre_liste('', '', '', '', '', '', '', -1, '', '', 0, $button, '', 0, 1, 0);
|
||||
}
|
||||
|
||||
dol_syslog('htdocs/accountancy/closure/index.php', LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
print '<tr class="oddeven">';
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
print '<td class="right">'.$row[$i].'</td>';
|
||||
}
|
||||
print '<td class="right"><b>'.$row[13].'</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@@ -53,7 +53,7 @@ if (!$user->hasRight('accounting', 'bind', 'write')) {
|
||||
|
||||
$accountingAccount = new AccountingAccount($db);
|
||||
|
||||
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
$month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
if (GETPOST("year", 'int')) {
|
||||
$year_start = GETPOST("year", 'int');
|
||||
} else {
|
||||
@@ -165,7 +165,7 @@ if ($action == 'validatehistory') {
|
||||
$sql .= " AND l.product_type <= 2";
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
|
||||
if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
$sql .= " AND f.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'";
|
||||
}
|
||||
if ($validatemonth && $validateyear) {
|
||||
$sql .= dolSqlDateFilter('f.datef', 0, $validatemonth, $validateyear);
|
||||
@@ -288,7 +288,7 @@ if ($action == 'validatehistory') {
|
||||
$db->rollback();
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
|
||||
if ($nbbindfailed) {
|
||||
setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings');
|
||||
}
|
||||
@@ -329,7 +329,7 @@ print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="minwidth100">'.$langs->trans("Account").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -337,7 +337,7 @@ for ($i = 1; $i <= 12; $i++) {
|
||||
if ($cursormonth > 12) {
|
||||
$cursormonth -= 12;
|
||||
}
|
||||
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$cursoryear = ($cursormonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y;
|
||||
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
|
||||
|
||||
print '<td width="60" class="right">';
|
||||
@@ -357,7 +357,7 @@ print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>'
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number')." AS codecomptable,";
|
||||
$sql .= " ".$db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label')." AS intitule,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -371,7 +371,7 @@ $sql .= " WHERE f.datef >= '".$db->idate($search_date_start)."'";
|
||||
$sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
|
||||
// Define begin binding date
|
||||
if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
$sql .= " AND f.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'";
|
||||
}
|
||||
$sql .= " AND f.fk_statut > 0";
|
||||
$sql .= " AND fd.product_type <= 2";
|
||||
@@ -405,27 +405,27 @@ if ($resql) {
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
$startmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1);
|
||||
$startmonth = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
if ($startmonth > 12) {
|
||||
$startmonth -= 12;
|
||||
}
|
||||
$startyear = ($startmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$endmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + 11;
|
||||
$startyear = ($startmonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y;
|
||||
$endmonth = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) + 11;
|
||||
if ($endmonth > 12) {
|
||||
$endmonth -= 12;
|
||||
}
|
||||
$endyear = ($endmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$endyear = ($endmonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y;
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_date_startday=1&search_date_startmonth='.((int) $startmonth).'&search_date_startyear='.((int) $startyear).'&search_date_endday=&search_date_endmonth='.((int) $endmonth).'&search_date_endyear='.((int) $endyear), $langs->transnoentitiesnoconv("ToBind"));
|
||||
} else {
|
||||
print $row[1];
|
||||
}
|
||||
print '</td>';
|
||||
for ($i = 2; $i <= 13; $i++) {
|
||||
$cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2);
|
||||
$cursormonth = (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) + $i - 2);
|
||||
if ($cursormonth > 12) {
|
||||
$cursormonth -= 12;
|
||||
}
|
||||
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$cursoryear = ($cursormonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y;
|
||||
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
|
||||
|
||||
print '<td class="right nowraponall amount">';
|
||||
@@ -466,7 +466,7 @@ print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="minwidth100">'.$langs->trans("Account").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -474,7 +474,7 @@ for ($i = 1; $i <= 12; $i++) {
|
||||
if ($cursormonth > 12) {
|
||||
$cursormonth -= 12;
|
||||
}
|
||||
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$cursoryear = ($cursormonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y;
|
||||
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
|
||||
|
||||
print '<td width="60" class="right">';
|
||||
@@ -494,7 +494,7 @@ print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>'
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number')." AS codecomptable,";
|
||||
$sql .= " ".$db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label')." AS intitule,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -508,7 +508,7 @@ $sql .= " WHERE f.datef >= '".$db->idate($search_date_start)."'";
|
||||
$sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
|
||||
// Define begin binding date
|
||||
if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
$sql .= " AND f.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'";
|
||||
}
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.fk_statut > 0";
|
||||
@@ -551,11 +551,11 @@ if ($resql) {
|
||||
print '</td>';
|
||||
|
||||
for ($i = 2; $i <= 13; $i++) {
|
||||
$cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2);
|
||||
$cursormonth = (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) + $i - 2);
|
||||
if ($cursormonth > 12) {
|
||||
$cursormonth -= 12;
|
||||
}
|
||||
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$cursoryear = ($cursormonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y;
|
||||
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
|
||||
|
||||
print '<td class="right nowraponall amount">';
|
||||
@@ -590,7 +590,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td lass="left">'.$langs->trans("TotalVente").'</td>';
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -600,7 +600,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
|
||||
|
||||
$sql = "SELECT '".$db->escape($langs->trans("TotalVente"))."' AS total,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -613,7 +613,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
|
||||
$sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
|
||||
// Define begin binding date
|
||||
if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
$sql .= " AND f.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'";
|
||||
}
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.fk_statut > 0";
|
||||
@@ -650,7 +650,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("TotalMarge").'</td>';
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -662,35 +662,47 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
|
||||
// With old situation invoice setup
|
||||
$sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j,
|
||||
" (".$db->ifsql("fd.total_ht < 0",
|
||||
$sql .= " SUM(".$db->ifsql(
|
||||
"MONTH(f.datef)=".$j,
|
||||
" (".$db->ifsql(
|
||||
"fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent !
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").")",
|
||||
0).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))"
|
||||
).")",
|
||||
0
|
||||
).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("fd.total_ht < 0",
|
||||
$sql .= " SUM(".$db->ifsql(
|
||||
"fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent !
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").") as total";
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))"
|
||||
).") as total";
|
||||
} else {
|
||||
$sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j,
|
||||
" (".$db->ifsql("fd.total_ht < 0",
|
||||
$sql .= " SUM(".$db->ifsql(
|
||||
"MONTH(f.datef)=".$j,
|
||||
" (".$db->ifsql(
|
||||
"fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty)))",
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty))").")",
|
||||
0).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty))"
|
||||
).")",
|
||||
0
|
||||
).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("fd.total_ht < 0",
|
||||
$sql .= " SUM(".$db->ifsql(
|
||||
"fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty)))",
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty))").") as total";
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty))"
|
||||
).") as total";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
|
||||
@@ -698,7 +710,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
|
||||
$sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
|
||||
// Define begin binding date
|
||||
if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
$sql .= " AND f.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'";
|
||||
}
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.fk_statut > 0";
|
||||
|
||||
@@ -65,7 +65,7 @@ $search_country = GETPOST('search_country', 'alpha');
|
||||
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
@@ -79,7 +79,7 @@ if (!$sortfield) {
|
||||
$sortfield = "f.datef, f.ref, fd.rowid";
|
||||
}
|
||||
if (!$sortorder) {
|
||||
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
|
||||
if (getDolGlobalInt('ACCOUNTING_LIST_SORT_VENTILATION_DONE') > 0) {
|
||||
$sortorder = "DESC";
|
||||
} else {
|
||||
$sortorder = "ASC";
|
||||
@@ -400,10 +400,10 @@ if ($result) {
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@@ -506,7 +506,7 @@ if ($result) {
|
||||
|
||||
print '<td class="tdoverflowonsmartphone small">';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description, 1));
|
||||
$trunclength = !getDolGlobalString('ACCOUNTING_LENGTH_DESCRIPTION') ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
$trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION', 32);
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
|
||||
print '</td>';
|
||||
|
||||
|
||||
@@ -76,11 +76,11 @@ $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||
|
||||
// Define begin binding date
|
||||
if (empty($search_date_start) && getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$search_date_start = $db->idate($conf->global->ACCOUNTING_DATE_START_BINDING);
|
||||
$search_date_start = $db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'));
|
||||
}
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
@@ -94,7 +94,7 @@ if (!$sortfield) {
|
||||
$sortfield = "f.datef, f.ref, l.rowid";
|
||||
}
|
||||
if (!$sortorder) {
|
||||
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
|
||||
if (getDolGlobalInt('ACCOUNTING_LIST_SORT_VENTILATION_TODO') > 0) {
|
||||
$sortorder = "DESC";
|
||||
} else {
|
||||
$sortorder = "ASC";
|
||||
@@ -126,7 +126,8 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||
$massaction = '';
|
||||
@@ -490,10 +491,10 @@ if ($result) {
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@@ -659,7 +660,7 @@ if ($result) {
|
||||
// Description of line
|
||||
print '<td class="tdoverflowonsmartphone small">';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facture_static_det->desc, 1));
|
||||
$trunclength = !getDolGlobalString('ACCOUNTING_LENGTH_DESCRIPTION') ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
$trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION', 32);
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $facture_static_det->desc);
|
||||
print '</td>';
|
||||
|
||||
@@ -694,7 +695,7 @@ if ($result) {
|
||||
if ($product_static->tva_tx !== $facture_static_det->tva_tx && price2num($product_static->tva_tx) && price2num($facture_static_det->tva_tx)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
|
||||
$code_vat_differ = 'warning bold';
|
||||
}
|
||||
print '<td class="right'.($code_vat_differ?' '.$code_vat_differ:'').'">';
|
||||
print '<td class="right'.($code_vat_differ ? ' '.$code_vat_differ : '').'">';
|
||||
print vatrate($facture_static_det->tva_tx.($facture_static_det->vat_src_code ? ' ('.$facture_static_det->vat_src_code.')' : ''));
|
||||
print '</td>';
|
||||
|
||||
@@ -714,7 +715,8 @@ if ($result) {
|
||||
print '<td class="small">';
|
||||
// First show default account for any products
|
||||
$s = '1. '.(($facture_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
|
||||
$shelp = ''; $ttype = 'help';
|
||||
$shelp = '';
|
||||
$ttype = 'help';
|
||||
if ($suggestedaccountingaccountbydefaultfor == 'eec') {
|
||||
$shelp .= $langs->trans("SaleEEC");
|
||||
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') {
|
||||
@@ -731,7 +733,8 @@ if ($result) {
|
||||
if ($product_static->id > 0) {
|
||||
print '<br>';
|
||||
$s = '2. '.(($facture_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
|
||||
$shelp = ''; $ttype = 'help';
|
||||
$shelp = '';
|
||||
$ttype = 'help';
|
||||
if ($suggestedaccountingaccountfor == 'eec') {
|
||||
$shelp = $langs->trans("SaleEEC");
|
||||
} elseif ($suggestedaccountingaccountfor == 'eecwithvat') {
|
||||
|
||||
@@ -36,7 +36,7 @@ $langs->loadLangs(array("compta", "bills", "other", "accountancy"));
|
||||
$validatemonth = GETPOST('validatemonth', 'int');
|
||||
$validateyear = GETPOST('validateyear', 'int');
|
||||
|
||||
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
$month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
if (GETPOST("year", 'int')) {
|
||||
$year_start = GETPOST("year", 'int');
|
||||
} else {
|
||||
@@ -166,7 +166,7 @@ if ($action == 'validatehistory') {
|
||||
$db->rollback();
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
|
||||
if ($nbbindfailed) {
|
||||
setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings');
|
||||
}
|
||||
@@ -204,7 +204,7 @@ print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="minwidth100">'.$langs->trans("Account").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -212,7 +212,7 @@ for ($i = 1; $i <= 12; $i++) {
|
||||
if ($cursormonth > 12) {
|
||||
$cursormonth -= 12;
|
||||
}
|
||||
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$cursoryear = ($cursormonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y;
|
||||
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
|
||||
|
||||
print '<td width="60" class="right">';
|
||||
@@ -233,7 +233,7 @@ print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>'
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number')." AS codecomptable,";
|
||||
$sql .= " ".$db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label')." AS intitule,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -247,7 +247,7 @@ $sql .= " WHERE er.date_debut >= '".$db->idate($search_date_start)."'";
|
||||
$sql .= " AND er.date_debut <= '".$db->idate($search_date_end)."'";
|
||||
// Define begin binding date
|
||||
if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$sql .= " AND er.date_debut >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
$sql .= " AND er.date_debut >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'";
|
||||
}
|
||||
$sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.")";
|
||||
$sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy
|
||||
@@ -271,27 +271,27 @@ if ($resql) {
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
$startmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1);
|
||||
$startmonth = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
if ($startmonth > 12) {
|
||||
$startmonth -= 12;
|
||||
}
|
||||
$startyear = ($startmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$endmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + 11;
|
||||
$startyear = ($startmonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y;
|
||||
$endmonth = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) + 11;
|
||||
if ($endmonth > 12) {
|
||||
$endmonth -= 12;
|
||||
}
|
||||
$endyear = ($endmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$endyear = ($endmonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y;
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_date_startday=1&search_date_startmonth='.((int) $startmonth).'&search_date_startyear='.((int) $startyear).'&search_date_endday=&search_date_endmonth='.((int) $endmonth).'&search_date_endyear='.((int) $endyear), $langs->transnoentitiesnoconv("ToBind"));
|
||||
} else {
|
||||
print $row[1];
|
||||
}
|
||||
print '</td>';
|
||||
for ($i = 2; $i <= 13; $i++) {
|
||||
$cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2);
|
||||
$cursormonth = (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) + $i - 2);
|
||||
if ($cursormonth > 12) {
|
||||
$cursormonth -= 12;
|
||||
}
|
||||
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$cursoryear = ($cursormonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y;
|
||||
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
|
||||
|
||||
print '<td class="right nowraponall amount">';
|
||||
@@ -333,7 +333,7 @@ print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="minwidth100">'.$langs->trans("Account").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -344,7 +344,7 @@ print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>'
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number')." AS codecomptable,";
|
||||
$sql .= " ".$db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label')." AS intitule,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -358,7 +358,7 @@ $sql .= " WHERE er.date_debut >= '".$db->idate($search_date_start)."'";
|
||||
$sql .= " AND er.date_debut <= '".$db->idate($search_date_end)."'";
|
||||
// Define begin binding date
|
||||
if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$sql .= " AND er.date_debut >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
$sql .= " AND er.date_debut >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'";
|
||||
}
|
||||
$sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.")";
|
||||
$sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy
|
||||
@@ -421,7 +421,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="left">'.$langs->trans("Total").'</td>';
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -431,7 +431,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
|
||||
|
||||
$sql = "SELECT '".$db->escape($langs->trans("TotalExpenseReport"))."' AS label,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -444,7 +444,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
|
||||
$sql .= " AND er.date_debut <= '".$db->idate($search_date_end)."'";
|
||||
// Define begin binding date
|
||||
if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$sql .= " AND er.date_debut >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
$sql .= " AND er.date_debut >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'";
|
||||
}
|
||||
$sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.")";
|
||||
$sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy
|
||||
|
||||
@@ -59,7 +59,7 @@ $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_s
|
||||
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
@@ -73,7 +73,7 @@ if (!$sortfield) {
|
||||
$sortfield = "erd.date, erd.rowid";
|
||||
}
|
||||
if (!$sortorder) {
|
||||
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
|
||||
if (getDolGlobalInt('ACCOUNTING_LIST_SORT_VENTILATION_DONE') > 0) {
|
||||
$sortorder = "DESC";
|
||||
} else {
|
||||
$sortorder = "ASC";
|
||||
@@ -326,10 +326,10 @@ if ($result) {
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@@ -414,7 +414,7 @@ if ($result) {
|
||||
// Fees description -- Can be null
|
||||
print '<td>';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments, 1));
|
||||
$trunclength = !getDolGlobalString('ACCOUNTING_LENGTH_DESCRIPTION') ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
$trunclength = getDolGlobalString('ACCOUNTING_LENGTH_DESCRIPTION', 32);
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
|
||||
print '</td>';
|
||||
|
||||
|
||||
@@ -69,11 +69,11 @@ $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_en
|
||||
|
||||
// Define begin binding date
|
||||
if (empty($search_date_start) && getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$search_date_start = $db->idate($conf->global->ACCOUNTING_DATE_START_BINDING);
|
||||
$search_date_start = $db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'));
|
||||
}
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
@@ -87,7 +87,7 @@ if (!$sortfield) {
|
||||
$sortfield = "erd.date, erd.rowid";
|
||||
}
|
||||
if (!$sortorder) {
|
||||
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
|
||||
if (getDolGlobalInt('ACCOUNTING_LIST_SORT_VENTILATION_TODO') > 0) {
|
||||
$sortorder = "DESC";
|
||||
} else {
|
||||
$sortorder = "ASC";
|
||||
@@ -119,7 +119,8 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||
$massaction = '';
|
||||
@@ -395,10 +396,10 @@ if ($result) {
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@@ -482,13 +483,13 @@ if ($result) {
|
||||
|
||||
// Fees label
|
||||
print '<td>';
|
||||
print ($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code)));
|
||||
print($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code)));
|
||||
print '</td>';
|
||||
|
||||
// Fees description -- Can be null
|
||||
print '<td>';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments, 1));
|
||||
$trunclength = !getDolGlobalString('ACCOUNTING_LENGTH_DESCRIPTION') ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
$trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION', 32);
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
|
||||
print '</td>';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2016-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2016-2023 Alexandre Spangaro <aspangaro@easya.solutions>
|
||||
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -40,14 +40,6 @@ $hookmanager->initHooks(array('accountancyindex'));
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
/*
|
||||
if (!isModEnabled('accounting')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
*/
|
||||
if (!isModEnabled('comptabilite') && !isModEnabled('accounting') && !isModEnabled('asset') && !isModEnabled('intracommreport')) {
|
||||
accessforbidden();
|
||||
}
|
||||
@@ -55,6 +47,8 @@ if (!$user->hasRight('compta', 'resultat', 'lire') && !$user->hasRight('accounti
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$pcgver = getDolGlobalInt('CHARTOFACCOUNTS');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@@ -92,7 +86,7 @@ if (isModEnabled('accounting')) {
|
||||
$showtutorial = '';
|
||||
|
||||
if (!$helpisexpanded) {
|
||||
$showtutorial = '<div align="right"><a href="#" id="show_hide">';
|
||||
$showtutorial = '<div class="right"><a href="#" id="show_hide">';
|
||||
$showtutorial .= img_picto('', 'chevron-down');
|
||||
$showtutorial .= ' '.$langs->trans("ShowTutorial");
|
||||
$showtutorial .= '</a></div>';
|
||||
@@ -120,25 +114,45 @@ if (isModEnabled('accounting')) {
|
||||
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
|
||||
if ($user->hasRight('accounting', 'chartofaccount')) {
|
||||
print '<br>';
|
||||
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
|
||||
print load_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
|
||||
print '<hr>';
|
||||
print "<br>\n";
|
||||
|
||||
// STEPS
|
||||
$step++;
|
||||
$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);
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong></a>', $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
$step++;
|
||||
$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);
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php?search_country_id='.$mysoc->country_id.'" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong></a>', $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
$step++;
|
||||
$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);
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong></a>', $s);
|
||||
print $s;
|
||||
if ($pcgver > 0) {
|
||||
$pcgversion = '';
|
||||
$pcglabel = '';
|
||||
|
||||
$sql = "SELECT a.rowid, a.pcg_version, a.label, a.active";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_system as a";
|
||||
$sql .= " WHERE a.rowid = ".((int) $pcgver);
|
||||
|
||||
$resqlchart = $db->query($sql);
|
||||
if ($resqlchart) {
|
||||
$obj = $db->fetch_object($resqlchart);
|
||||
if ($obj) {
|
||||
$pcgversion = $obj->pcg_version;
|
||||
$pcglabel = $obj->label;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
print ' <span class="opacitymedium">('.$langs->trans("CurrentChartOfAccount").': '.$pcgversion.')</span>';
|
||||
}
|
||||
print "<br>\n";
|
||||
|
||||
print "<br>\n";
|
||||
@@ -146,27 +160,35 @@ if (isModEnabled('accounting')) {
|
||||
print "<br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') {
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescFiscalPeriod", $step, '{s}');
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/fiscalyear.php" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("FiscalPeriod").'</strong></a>', $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
}
|
||||
|
||||
$step++;
|
||||
$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);
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong></a>', $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
$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);
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php" target="setupaccountancy"><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>';
|
||||
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong></a>';
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, '{s}');
|
||||
$s = str_replace('{s}', $textlink, $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
|
||||
if (isModEnabled('tax')) {
|
||||
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
|
||||
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
|
||||
$s = str_replace('{s}', $textlink, $s);
|
||||
@@ -183,7 +205,7 @@ if (isModEnabled('accounting')) {
|
||||
|
||||
$step++;
|
||||
$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);
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong></a>', $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
|
||||
@@ -202,20 +224,20 @@ if (isModEnabled('accounting')) {
|
||||
|
||||
$step++;
|
||||
$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);
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/customer/index.php" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").'</strong></a>', $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
$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);
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/supplier/index.php" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong></a>', $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
|
||||
if (isModEnabled('expensereport') || isModEnabled('deplacement')) {
|
||||
$step++;
|
||||
$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);
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong></a>', $s);
|
||||
print $s;
|
||||
print "<br>\n";
|
||||
}
|
||||
@@ -228,8 +250,14 @@ if (isModEnabled('accounting')) {
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step))."<br>\n";
|
||||
print $s;
|
||||
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescClosePeriod", chr(64 + $step))."<br>\n";
|
||||
print $s;
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2022 Open-DSI <support@open-dsi.fr>
|
||||
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@easya.solutions>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2017-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
@@ -104,10 +104,16 @@ $error = 0;
|
||||
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||
|
||||
if (empty($date_startmonth) || empty($date_endmonth)) {
|
||||
if (empty($date_startmonth)) {
|
||||
// Period by default on transfer
|
||||
$dates = getDefaultDatesForTransfer();
|
||||
$date_start = $dates['date_start'];
|
||||
$pastmonthyear = $dates['pastmonthyear'];
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
}
|
||||
if (empty($date_endmonth)) {
|
||||
// Period by default on transfer
|
||||
$dates = getDefaultDatesForTransfer();
|
||||
$date_end = $dates['date_end'];
|
||||
$pastmonthyear = $dates['pastmonthyear'];
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
@@ -277,7 +283,7 @@ if ($result) {
|
||||
);
|
||||
|
||||
// Variable bookkeeping ($obj->rowid is Bank Id)
|
||||
$tabpay[$obj->rowid]["date"] = $obj->do;
|
||||
$tabpay[$obj->rowid]["date"] = $db->jdate($obj->do);
|
||||
$tabpay[$obj->rowid]["type_payment"] = $obj->fk_type; // CHQ, VIR, LIQ, CB, ...
|
||||
$tabpay[$obj->rowid]["ref"] = $obj->label; // By default. Not unique. May be changed later
|
||||
$tabpay[$obj->rowid]["fk_bank"] = $obj->rowid;
|
||||
@@ -306,16 +312,30 @@ if ($result) {
|
||||
|
||||
// get_url may return -1 which is not traversable
|
||||
if (is_array($links) && count($links) > 0) {
|
||||
// Test if entry is for a social contribution, salary or expense report.
|
||||
// In such a case, we will ignore the bank url line for user
|
||||
$is_sc = false;
|
||||
$is_salary = false;
|
||||
$is_expensereport = false;
|
||||
foreach ($links as $v) {
|
||||
if ($v['type'] == 'sc') {
|
||||
$is_sc = true;
|
||||
break;
|
||||
}
|
||||
if ($v['type'] == 'payment_salary') {
|
||||
$is_salary = true;
|
||||
break;
|
||||
}
|
||||
if ($v['type'] == 'payment_expensereport') {
|
||||
$is_expensereport = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Now loop on each link of record in bank (code similar to bankentries_list.php)
|
||||
foreach ($links as $key => $val) {
|
||||
if ($links[$key]['type'] == 'user' && !$is_sc) continue;
|
||||
if ($links[$key]['type'] == 'user' && !$is_sc && !$is_salary && !$is_expensereport) {
|
||||
continue;
|
||||
}
|
||||
if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various'))) {
|
||||
// So we excluded 'company' and 'user' here. We want only payment lines
|
||||
|
||||
@@ -363,6 +383,7 @@ if ($result) {
|
||||
$userstatic->firstname = $tabuser[$obj->rowid]['firstname'];
|
||||
$userstatic->lastname = $tabuser[$obj->rowid]['lastname'];
|
||||
$userstatic->statut = $tabuser[$obj->rowid]['status'];
|
||||
$userstatic->status = $tabuser[$obj->rowid]['status'];
|
||||
$userstatic->accountancy_code = $tabuser[$obj->rowid]['accountancy_code'];
|
||||
if ($userstatic->id > 0) {
|
||||
$tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, 'accountancy', 0);
|
||||
@@ -436,7 +457,7 @@ if ($result) {
|
||||
|
||||
// This part of code is no more required. it is here to solve case where a link were missing (ith v14.0.0) and keep writing in accountancy complete.
|
||||
// Note: A better way to fix this is to delete payment of salary and recreate it, or to fix the bookkeeping table manually after.
|
||||
if (getDolGlobalString('ACCOUNTANCY_AUTOFIX_MISSING_LINK_TO_USEr_ON_SALARY_BANK_PAYMENT')) {
|
||||
if (getDolGlobalString('ACCOUNTANCY_AUTOFIX_MISSING_LINK_TO_USER_ON_SALARY_BANK_PAYMENT')) {
|
||||
$tmpsalary = new Salary($db);
|
||||
$tmpsalary->fetch($paymentsalstatic->id);
|
||||
$tmpsalary->fetch_user($tmpsalary->fk_user);
|
||||
@@ -586,20 +607,20 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
$now = dol_now();
|
||||
|
||||
$accountingaccountcustomer = new AccountingAccount($db);
|
||||
$accountingaccountcustomer->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
|
||||
$accountingaccountcustomer->fetch(null, getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'), true);
|
||||
|
||||
$accountingaccountsupplier = new AccountingAccount($db);
|
||||
$accountingaccountsupplier->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true);
|
||||
$accountingaccountsupplier->fetch(null, getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'), true);
|
||||
|
||||
$accountingaccountpayment = new AccountingAccount($db);
|
||||
$accountingaccountpayment->fetch(null, $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT, true);
|
||||
$accountingaccountpayment->fetch(null, getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'), true);
|
||||
|
||||
$accountingaccountsuspense = new AccountingAccount($db);
|
||||
$accountingaccountsuspense->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE, true);
|
||||
$accountingaccountsuspense->fetch(null, getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE'), true);
|
||||
|
||||
$error = 0;
|
||||
foreach ($tabpay as $key => $val) { // $key is rowid into llx_bank
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
$date = dol_print_date($val["date"], 'day');
|
||||
|
||||
$ref = getSourceDocRef($val, $tabtype[$key]);
|
||||
|
||||
@@ -715,23 +736,23 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
$lettering = true;
|
||||
$bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||
$bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER');
|
||||
$bookkeeping->label_compte = $accountingaccountcustomer->label;
|
||||
} elseif ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
|
||||
$lettering = true;
|
||||
$bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||
$bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER');
|
||||
$bookkeeping->label_compte = $accountingaccountsupplier->label;
|
||||
} elseif ($tabtype[$key] == 'payment_expensereport') {
|
||||
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
||||
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
$bookkeeping->numero_compte = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT');
|
||||
$bookkeeping->label_compte = $accountingaccountpayment->label;
|
||||
} elseif ($tabtype[$key] == 'payment_salary') {
|
||||
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
||||
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
$bookkeeping->numero_compte = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT');
|
||||
$bookkeeping->label_compte = $accountingaccountpayment->label;
|
||||
} elseif (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
|
||||
$bookkeeping->subledger_account = '';
|
||||
@@ -780,7 +801,7 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
// Temporary account
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE;
|
||||
$bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE');
|
||||
$bookkeeping->label_compte = $accountingaccountsuspense->label;
|
||||
}
|
||||
}
|
||||
@@ -928,7 +949,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
print "\n";
|
||||
|
||||
foreach ($tabpay as $key => $val) {
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
$date = dol_print_date($val["date"], 'day');
|
||||
|
||||
$ref = getSourceDocRef($val, $tabtype[$key]);
|
||||
|
||||
@@ -1065,14 +1086,33 @@ if (empty($action) || $action == 'view') {
|
||||
|
||||
$desc = '';
|
||||
|
||||
// Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
|
||||
if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') {
|
||||
// Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
|
||||
// Fiscal period test
|
||||
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj->nb == 0) {
|
||||
print '<br><div class="warning">'.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined");
|
||||
$desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}');
|
||||
$desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'</strong>', $desc);
|
||||
print $desc;
|
||||
print '</div>';
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Bank test
|
||||
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."bank_account WHERE entity = ".((int) $conf->entity)." AND fk_accountancy_journal IS NULL AND clos=0";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj->nb > 0) {
|
||||
print '<br><div class="warning">'.img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount");
|
||||
$desc = ' : '.$langs->trans("AccountancyAreaDescBank", 9, '{link}');
|
||||
$desc = ' : '.$langs->trans("AccountancyAreaDescBank", 6, '{link}');
|
||||
$desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("BankAccounts").'</strong>', $desc);
|
||||
print $desc;
|
||||
print '</div>';
|
||||
@@ -1086,7 +1126,7 @@ if (empty($action) || $action == 'view') {
|
||||
if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == '-1'
|
||||
|| getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == '-1'
|
||||
|| getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == "" || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1') {
|
||||
print ($desc ? '' : '<br>').'<div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
print($desc ? '' : '<br>').'<div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
$desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}');
|
||||
$desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>', $desc);
|
||||
print $desc;
|
||||
@@ -1094,7 +1134,7 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
|
||||
|
||||
print '<div class="tabsAction tabsActionNoBottom centerimp">';
|
||||
print '<br><div class="tabsAction tabsActionNoBottom centerimp">';
|
||||
|
||||
if (getDolGlobalString('ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL') && $in_bookkeeping == 'notyet') {
|
||||
print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
|
||||
@@ -1152,7 +1192,7 @@ if (empty($action) || $action == 'view') {
|
||||
$r = '';
|
||||
|
||||
foreach ($tabpay as $key => $val) { // $key is rowid in llx_bank
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
$date = dol_print_date($val["date"], 'day');
|
||||
|
||||
$ref = getSourceDocRef($val, $tabtype[$key]);
|
||||
|
||||
@@ -1265,7 +1305,7 @@ if (empty($action) || $action == 'view') {
|
||||
if (!getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE') || getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE') == '-1') {
|
||||
$accounttoshow = '<span class="error small">'.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').'</span>';
|
||||
} else {
|
||||
$accounttoshow = '<span class="warning small">'.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).'</span>'; // We will use a waiting account
|
||||
$accounttoshow = '<span class="warning small">'.$langs->trans('UnknownAccountForThirdparty', length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE'))).'</span>'; // We will use a waiting account
|
||||
}
|
||||
} else {
|
||||
// We will refuse writing
|
||||
@@ -1356,18 +1396,13 @@ if (empty($action) || $action == 'view') {
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("WaitAccountNotDefined").'</span>';
|
||||
}
|
||||
else */ print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
|
||||
else */
|
||||
print length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE'));
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
/*if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined')
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("WaitAccountNotDefined").'</span>';
|
||||
}
|
||||
else print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
|
||||
*/
|
||||
print "</td>";
|
||||
print "<td>".$reflabel."</td>";
|
||||
print "<td>".dol_escape_htmltag($reflabel)."</td>";
|
||||
print '<td class="center">'.$val["type_payment"]."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
|
||||
@@ -90,10 +90,16 @@ $journal_label = $accountingjournalstatic->label;
|
||||
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||
|
||||
if (empty($date_startmonth) || empty($date_endmonth)) {
|
||||
if (empty($date_startmonth)) {
|
||||
// Period by default on transfer
|
||||
$dates = getDefaultDatesForTransfer();
|
||||
$date_start = $dates['date_start'];
|
||||
$pastmonthyear = $dates['pastmonthyear'];
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
}
|
||||
if (empty($date_endmonth)) {
|
||||
// Period by default on transfer
|
||||
$dates = getDefaultDatesForTransfer();
|
||||
$date_end = $dates['date_end'];
|
||||
$pastmonthyear = $dates['pastmonthyear'];
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
@@ -127,7 +133,7 @@ if ($date_start && $date_end) {
|
||||
}
|
||||
// Define begin binding date
|
||||
if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$sql .= " AND er.date_debut >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
$sql .= " AND er.date_debut >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'";
|
||||
}
|
||||
// Already in bookkeeping or not
|
||||
if ($in_bookkeeping == 'already') {
|
||||
@@ -156,8 +162,8 @@ if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
// Variables
|
||||
$account_salary = (getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT')) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined';
|
||||
$account_vat = (getDolGlobalString('ACCOUNTING_VAT_BUY_ACCOUNT')) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined';
|
||||
$account_salary = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT', 'NotDefined');
|
||||
$account_vat = getDolGlobalString('ACCOUNTING_VAT_BUY_ACCOUNT', 'NotDefined');
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
@@ -241,7 +247,7 @@ if ($action == 'writebookkeeping' && !$error) {
|
||||
$error = 0;
|
||||
|
||||
$accountingaccountexpense = new AccountingAccount($db);
|
||||
$accountingaccountexpense->fetch(null, $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT, true);
|
||||
$accountingaccountexpense->fetch(null, getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'), true);
|
||||
|
||||
foreach ($taber as $key => $val) { // Loop on each expense report
|
||||
$errorforline = 0;
|
||||
@@ -273,7 +279,7 @@ if ($action == 'writebookkeeping' && !$error) {
|
||||
$bookkeeping->subledger_account = $tabuser[$key]['user_accountancy_code'];
|
||||
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
||||
|
||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
$bookkeeping->numero_compte = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT');
|
||||
$bookkeeping->label_compte = $accountingaccountexpense->label;
|
||||
|
||||
$bookkeeping->label_operation = $tabuser[$key]['name'];
|
||||
@@ -482,7 +488,7 @@ $userstatic = new User($db);
|
||||
|
||||
// Export
|
||||
if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 !
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$sep = getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV');
|
||||
|
||||
$filename = 'journal';
|
||||
$type_export = 'journal';
|
||||
@@ -564,6 +570,25 @@ if (empty($action) || $action == 'view') {
|
||||
|
||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') {
|
||||
// Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
|
||||
// Fiscal period test
|
||||
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj->nb == 0) {
|
||||
print '<br><div class="warning">'.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined");
|
||||
$desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}');
|
||||
$desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'</strong>', $desc);
|
||||
print $desc;
|
||||
print '</div>';
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Button to write into Ledger
|
||||
if (!getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1') {
|
||||
print '<br><div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
@@ -572,7 +597,7 @@ if (empty($action) || $action == 'view') {
|
||||
print $desc;
|
||||
print '</div>';
|
||||
}
|
||||
print '<div class="tabsAction tabsActionNoBottom centerimp">';
|
||||
print '<br><div class="tabsAction tabsActionNoBottom centerimp">';
|
||||
|
||||
if (getDolGlobalString('ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL') && $in_bookkeeping == 'notyet') {
|
||||
print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
|
||||
@@ -701,7 +726,7 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td>".$expensereportstatic->getNomUrl(1)."</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT);
|
||||
$accountoshow = length_accountg(getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'));
|
||||
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||
print '<span class="error">'.$langs->trans("MainAccountForUsersNotDefined").'</span>';
|
||||
} else {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@easya.solutions>
|
||||
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
@@ -92,10 +92,16 @@ $journal_label = $accountingjournalstatic->label;
|
||||
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||
|
||||
if (empty($date_startmonth) || empty($date_endmonth)) {
|
||||
if (empty($date_startmonth)) {
|
||||
// Period by default on transfer
|
||||
$dates = getDefaultDatesForTransfer();
|
||||
$date_start = $dates['date_start'];
|
||||
$pastmonthyear = $dates['pastmonthyear'];
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
}
|
||||
if (empty($date_endmonth)) {
|
||||
// Period by default on transfer
|
||||
$dates = getDefaultDatesForTransfer();
|
||||
$date_end = $dates['date_end'];
|
||||
$pastmonthyear = $dates['pastmonthyear'];
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
@@ -216,7 +222,7 @@ if ($result) {
|
||||
$vatdata = $vatdata_cache[$tax_id];
|
||||
} else {
|
||||
$vatdata = getTaxesFromId($tax_id, $mysoc, $mysoc, 0);
|
||||
$vatdata_cache[$tax_id] = $vatdata;
|
||||
$vatdata_cache[$tax_id] = $vatdata;
|
||||
}
|
||||
$compta_tva = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
$compta_localtax1 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
|
||||
@@ -293,9 +299,9 @@ if ($result) {
|
||||
$tabrclocaltax2[$obj->rowid][$rcd_compta_localtax2] = 0;
|
||||
}
|
||||
|
||||
$rcvat = (double) price2num($obj->total_ttc * $obj->product_buy_vat / 100, 'MT');
|
||||
$rclocalvat1 = (double) price2num($obj->total_ttc * $obj->product_buy_localvat1 / 100, 'MT');
|
||||
$rclocalvat2 = (double) price2num($obj->total_ttc * $obj->product_buy_localvat2 / 100, 'MT');
|
||||
$rcvat = (float) price2num($obj->total_ttc * $obj->product_buy_vat / 100, 'MT');
|
||||
$rclocalvat1 = (float) price2num($obj->total_ttc * $obj->product_buy_localvat1 / 100, 'MT');
|
||||
$rclocalvat2 = (float) price2num($obj->total_ttc * $obj->product_buy_localvat2 / 100, 'MT');
|
||||
|
||||
$tabrctva[$obj->rowid][$rcd_compta_tva] += $rcvat;
|
||||
$tabrctva[$obj->rowid][$rcc_compta_tva] -= $rcvat;
|
||||
@@ -799,19 +805,19 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 !
|
||||
// Third party
|
||||
foreach ($tabttc[$key] as $k => $mt) {
|
||||
//if ($mt) {
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["refsologest"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["refsologest"].'"'.$sep;
|
||||
print '"'.mb_convert_encoding(dol_trunc($companystatic->name, 32), 'ISO-8859-1').'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.mb_convert_encoding(dol_trunc($companystatic->name, 16), 'ISO-8859-1').' - '.$val["refsuppliersologest"].' - '.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -820,19 +826,19 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 !
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
//if ($mt) {
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["refsologest"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '""'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($accountingaccount->label, 32)).'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.dol_trunc($accountingaccount->label, 32).'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["refsologest"].'"'.$sep;
|
||||
print '"'.mb_convert_encoding(dol_trunc($companystatic->name, 32), 'ISO-8859-1').'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '""'.$sep;
|
||||
print '"'.mb_convert_encoding(dol_trunc($accountingaccount->label, 32), 'ISO-8859-1').'"'.$sep;
|
||||
print '"'.mb_convert_encoding(dol_trunc($companystatic->name, 16), 'ISO-8859-1').' - '.$val["refsuppliersologest"].' - '.dol_trunc($accountingaccount->label, 32).'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -875,12 +881,12 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 !
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["refsologest"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.mb_convert_encoding(dol_trunc($companystatic->name, 32), 'ISO-8859-1').'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '""'.$sep;
|
||||
print '"'.$langs->trans("VAT").' - '.join(', ', $def_tva[$key][$k]).' %"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.$langs->trans("VAT").join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : '').'"'.$sep;
|
||||
print '"'.mb_convert_encoding(dol_trunc($companystatic->name, 16), 'ISO-8859-1').' - '.$val["refsuppliersologest"].' - '.$langs->trans("VAT").join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : '').'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
@@ -895,12 +901,12 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 !
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["refsologest"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.mb_convert_encoding(dol_trunc($companystatic->name, 32), 'ISO-8859-1').'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.$langs->trans("VAT").' NPR"'.$sep;
|
||||
print '"'.mb_convert_encoding(dol_trunc($companystatic->name, 16), 'ISO-8859-1').' - '.$val["refsuppliersologest"].' - '.$langs->trans("VAT").' NPR"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
@@ -937,6 +943,25 @@ if (empty($action) || $action == 'view') {
|
||||
|
||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') {
|
||||
// Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
|
||||
// Fiscal period test
|
||||
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj->nb == 0) {
|
||||
print '<br><div class="warning">'.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined");
|
||||
$desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}');
|
||||
$desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'</strong>', $desc);
|
||||
print $desc;
|
||||
print '</div>';
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Button to write into Ledger
|
||||
$acctSupplierNotConfigured = in_array(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'), ['','-1']);
|
||||
if ($acctSupplierNotConfigured) {
|
||||
@@ -946,7 +971,7 @@ if (empty($action) || $action == 'view') {
|
||||
print $desc;
|
||||
print '</div>';
|
||||
}
|
||||
print '<div class="tabsAction tabsActionNoBottom centerimp">';
|
||||
print '<br><div class="tabsAction tabsActionNoBottom centerimp">';
|
||||
if (getDolGlobalString('ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL') && $in_bookkeeping == 'notyet') {
|
||||
print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@easya.solutions>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
@@ -94,10 +94,16 @@ $journal_label = $accountingjournalstatic->label;
|
||||
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||
|
||||
if (empty($date_startmonth) || empty($date_endmonth)) {
|
||||
if (empty($date_startmonth)) {
|
||||
// Period by default on transfer
|
||||
$dates = getDefaultDatesForTransfer();
|
||||
$date_start = $dates['date_start'];
|
||||
$pastmonthyear = $dates['pastmonthyear'];
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
}
|
||||
if (empty($date_endmonth)) {
|
||||
// Period by default on transfer
|
||||
$dates = getDefaultDatesForTransfer();
|
||||
$date_end = $dates['date_end'];
|
||||
$pastmonthyear = $dates['pastmonthyear'];
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
@@ -219,7 +225,7 @@ if ($result) {
|
||||
$vatdata = $vatdata_cache[$tax_id];
|
||||
} else {
|
||||
$vatdata = getTaxesFromId($tax_id, $mysoc, $mysoc, 0);
|
||||
$vatdata_cache[$tax_id] = $vatdata;
|
||||
$vatdata_cache[$tax_id] = $vatdata;
|
||||
}
|
||||
$compta_tva = (!empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
$compta_localtax1 = (!empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
@@ -249,7 +255,7 @@ if ($result) {
|
||||
}
|
||||
}
|
||||
|
||||
$revenuestamp = (double) price2num($obj->revenuestamp, 'MT');
|
||||
$revenuestamp = (float) price2num($obj->revenuestamp, 'MT');
|
||||
|
||||
// Invoice lines
|
||||
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
|
||||
@@ -291,7 +297,7 @@ if ($result) {
|
||||
|
||||
// Move a part of the retained warrenty into the account of warranty
|
||||
if (getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY') && $obj->retained_warranty > 0) {
|
||||
$retained_warranty = (double) price2num($total_ttc * $obj->retained_warranty / 100, 'MT'); // Calculate the amount of warrenty for this line (using the percent value)
|
||||
$retained_warranty = (float) price2num($total_ttc * $obj->retained_warranty / 100, 'MT'); // Calculate the amount of warrenty for this line (using the percent value)
|
||||
$tabwarranty[$obj->rowid][$compta_soc] += $retained_warranty;
|
||||
$total_ttc -= $retained_warranty;
|
||||
}
|
||||
@@ -309,7 +315,7 @@ if ($result) {
|
||||
if (!empty($revenuestamp)) {
|
||||
$sqlrevenuestamp = "SELECT accountancy_code_sell FROM ".MAIN_DB_PREFIX."c_revenuestamp";
|
||||
$sqlrevenuestamp .= " WHERE fk_pays = ".((int) $mysoc->country_id);
|
||||
$sqlrevenuestamp .= " AND taux = ".((double) $revenuestamp);
|
||||
$sqlrevenuestamp .= " AND taux = ".((float) $revenuestamp);
|
||||
$sqlrevenuestamp .= " AND active = 1";
|
||||
$resqlrevenuestamp = $db->query($sqlrevenuestamp);
|
||||
|
||||
@@ -464,48 +470,50 @@ if ($action == 'writebookkeeping' && !$error) {
|
||||
|
||||
// Warranty
|
||||
if (!$errorforline) {
|
||||
foreach ($tabwarranty[$key] as $k => $mt) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->date_creation = $now;
|
||||
$bookkeeping->doc_type = 'customer_invoice';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||
if (is_array($tabwarranty[$key])) {
|
||||
foreach ($tabwarranty[$key] as $k => $mt) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->date_creation = $now;
|
||||
$bookkeeping->doc_type = 'customer_invoice';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
|
||||
$bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY');
|
||||
$bookkeeping->label_compte = $accountingaccountcustomerwarranty->label;
|
||||
$bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY');
|
||||
$bookkeeping->label_compte = $accountingaccountcustomerwarranty->label;
|
||||
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("Retainedwarranty");
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
|
||||
$bookkeeping->credit = ($mt < 0) ? -$mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $langs->transnoentities($journal_label);
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
$bookkeeping->entity = $conf->entity;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Retainedwarranty");
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
|
||||
$bookkeeping->credit = ($mt < 0) ? -$mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $langs->transnoentities($journal_label);
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
$bookkeeping->entity = $conf->entity;
|
||||
|
||||
$totaldebit += $bookkeeping->debit;
|
||||
$totalcredit += $bookkeeping->credit;
|
||||
$totaldebit += $bookkeeping->debit;
|
||||
$totalcredit += $bookkeeping->credit;
|
||||
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { // Already exists
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'alreadyjournalized';
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
} else {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'other';
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { // Already exists
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'alreadyjournalized';
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
} else {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'other';
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -704,52 +712,54 @@ if ($action == 'writebookkeeping' && !$error) {
|
||||
|
||||
// Revenue stamp
|
||||
if (!$errorforline) {
|
||||
foreach ($tabrevenuestamp[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
$accountingaccount->fetch(null, $k, true); // TODO Use a cache for label
|
||||
$label_account = $accountingaccount->label;
|
||||
if (is_array($tabrevenuestamp[$key])) {
|
||||
foreach ($tabrevenuestamp[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
$accountingaccount->fetch(null, $k, true); // TODO Use a cache for label
|
||||
$label_account = $accountingaccount->label;
|
||||
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->date_creation = $now;
|
||||
$bookkeeping->doc_type = 'customer_invoice';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->date_creation = $now;
|
||||
$bookkeeping->doc_type = 'customer_invoice';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = $label_account;
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = $label_account;
|
||||
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("RevenueStamp");
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
|
||||
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $langs->transnoentities($journal_label);
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
$bookkeeping->entity = $conf->entity;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("RevenueStamp");
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
|
||||
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
|
||||
$bookkeeping->code_journal = $journal;
|
||||
$bookkeeping->journal_label = $langs->transnoentities($journal_label);
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
$bookkeeping->entity = $conf->entity;
|
||||
|
||||
$totaldebit += $bookkeeping->debit;
|
||||
$totalcredit += $bookkeeping->credit;
|
||||
$totaldebit += $bookkeeping->debit;
|
||||
$totalcredit += $bookkeeping->credit;
|
||||
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { // Already exists
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'alreadyjournalized';
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
} else {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'other';
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { // Already exists
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'alreadyjournalized';
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
} else {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'other';
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -859,12 +869,12 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 !
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["ref"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.mb_convert_encoding(dol_trunc($companystatic->name, 32), 'ISO-8859-1').'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY')).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("Retainedwarranty").'"'.$sep;
|
||||
print '"'.mb_convert_encoding(dol_trunc($companystatic->name, 16), 'ISO-8859-1').' - '.$invoicestatic->ref.' - '.$langs->trans("Retainedwarranty").'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
@@ -875,19 +885,19 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 !
|
||||
// Third party
|
||||
foreach ($tabttc[$key] as $k => $mt) {
|
||||
//if ($mt) {
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["ref"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["ref"].'"'.$sep;
|
||||
print '"'.mb_convert_encoding(dol_trunc($companystatic->name, 32), 'ISO-8859-1').'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')).'"'.$sep;
|
||||
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.mb_convert_encoding(dol_trunc($companystatic->name, 16), 'ISO-8859-1').' - '.$invoicestatic->ref.' - '.$langs->trans("Thirdparty").'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -896,19 +906,19 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 !
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
//if ($mt) {
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["ref"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '""'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($accountingaccount->label, 32)).'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.dol_trunc($accountingaccount->label, 32).'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["ref"].'"'.$sep;
|
||||
print '"'.mb_convert_encoding(dol_trunc($companystatic->name, 32), 'ISO-8859-1').'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '""'.$sep;
|
||||
print '"'.mb_convert_encoding(dol_trunc($accountingaccount->label, 32), 'ISO-8859-1').'"'.$sep;
|
||||
print '"'.mb_convert_encoding(dol_trunc($companystatic->name, 16), 'ISO-8859-1').' - '.dol_trunc($accountingaccount->label, 32).'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
print "\n";
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -928,12 +938,12 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 !
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["ref"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.mb_convert_encoding(dol_trunc($companystatic->name, 32), 'ISO-8859-1').'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '""'.$sep;
|
||||
print '"'.$langs->trans("VAT").' - '.join(', ', $def_tva[$key][$k]).' %"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("VAT").join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : '').'"'.$sep;
|
||||
print '"'.mb_convert_encoding(dol_trunc($companystatic->name, 16), 'ISO-8859-1').' - '.$invoicestatic->ref.' - '.$langs->trans("VAT").join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : '').'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
@@ -948,12 +958,12 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 !
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
print '"'.$val["ref"].'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep;
|
||||
print '"'.mb_convert_encoding(dol_trunc($companystatic->name, 32), 'ISO-8859-1').'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
|
||||
print '""'.$sep;
|
||||
print '"'.$langs->trans("RevenueStamp").'"'.$sep;
|
||||
print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("RevenueStamp").'"'.$sep;
|
||||
print '"'.mb_convert_encoding(dol_trunc($companystatic->name, 16), 'ISO-8859-1').' - '.$invoicestatic->ref.' - '.$langs->trans("RevenueStamp").'"'.$sep;
|
||||
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
|
||||
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
|
||||
print '"'.$journal.'"';
|
||||
@@ -990,6 +1000,25 @@ if (empty($action) || $action == 'view') {
|
||||
|
||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') {
|
||||
// Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
|
||||
// Fiscal period test
|
||||
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj->nb == 0) {
|
||||
print '<br><div class="warning">'.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined");
|
||||
$desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}');
|
||||
$desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'</strong>', $desc);
|
||||
print $desc;
|
||||
print '</div>';
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Button to write into Ledger
|
||||
$acctCustomerNotConfigured = in_array(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'), ['','-1']);
|
||||
if ($acctCustomerNotConfigured) {
|
||||
@@ -999,7 +1028,7 @@ if (empty($action) || $action == 'view') {
|
||||
print $desc;
|
||||
print '</div>';
|
||||
}
|
||||
print '<div class="tabsAction tabsActionNoBottom centerimp">';
|
||||
print '<br><div class="tabsAction tabsActionNoBottom centerimp">';
|
||||
if (getDolGlobalString('ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL') && $in_bookkeeping == 'notyet') {
|
||||
print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
|
||||
}
|
||||
@@ -1121,33 +1150,35 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
|
||||
// Warranty
|
||||
foreach ($tabwarranty[$key] as $k => $mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<!-- Thirdparty warranty -->";
|
||||
print "<td>".$date."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY'));
|
||||
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||
print '<span class="error">'.$langs->trans("MainAccountForRetainedWarrantyNotDefined").'</span>';
|
||||
} else {
|
||||
print $accountoshow;
|
||||
if (is_array($tabwarranty[$key])) {
|
||||
foreach ($tabwarranty[$key] as $k => $mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<!-- Thirdparty warranty -->";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_RETAINED_WARRANTY'));
|
||||
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||
print '<span class="error">' . $langs->trans("MainAccountForRetainedWarrantyNotDefined") . '</span>';
|
||||
} else {
|
||||
print $accountoshow;
|
||||
}
|
||||
print '</td>';
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
$accountoshow = length_accounta($k);
|
||||
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||
print '<span class="error">' . $langs->trans("ThirdpartyAccountNotDefined") . '</span>';
|
||||
} else {
|
||||
print $accountoshow;
|
||||
}
|
||||
print '</td>';
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Retainedwarranty") . "</td>";
|
||||
print '<td class="right nowraponall amount">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print '<td class="right nowraponall amount">' . ($mt < 0 ? price(-$mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
print '</td>';
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
$accountoshow = length_accounta($k);
|
||||
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||
} else {
|
||||
print $accountoshow;
|
||||
}
|
||||
print '</td>';
|
||||
print "<td>".$companystatic->getNomUrl(0, 'customer', 16).' - '.$invoicestatic->ref.' - '.$langs->trans("Retainedwarranty")."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
// Third party
|
||||
@@ -1255,7 +1286,7 @@ if (empty($action) || $action == 'view') {
|
||||
//var_dump($arrayofvat[$key]); var_dump($key); var_dump($k);
|
||||
$tmpvatrate = (empty($def_tva[$key][$k]) ? (empty($arrayofvat[$key][$k]) ? '' : $arrayofvat[$key][$k]) : join(', ', $def_tva[$key][$k]));
|
||||
print ' - '.$langs->trans("Taxes").' '.$tmpvatrate.' %';
|
||||
print ($numtax ? ' - Localtax '.$numtax : '');
|
||||
print($numtax ? ' - Localtax '.$numtax : '');
|
||||
print "</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
@@ -1266,33 +1297,35 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
}
|
||||
|
||||
// Warranty
|
||||
foreach ($tabrevenuestamp[$key] as $k => $mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<!-- Thirdparty revenuestamp -->";
|
||||
print "<td>".$date."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||
print '<span class="error">'.$langs->trans("MainAccountForRevenueStampSaleNotDefined").'</span>';
|
||||
} else {
|
||||
print $accountoshow;
|
||||
// Revenue stamp
|
||||
if (is_array($tabrevenuestamp[$key])) {
|
||||
foreach ($tabrevenuestamp[$key] as $k => $mt) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<!-- Thirdparty revenuestamp -->";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
// Account
|
||||
print "<td>";
|
||||
$accountoshow = length_accountg($k);
|
||||
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||
print '<span class="error">' . $langs->trans("MainAccountForRevenueStampSaleNotDefined") . '</span>';
|
||||
} else {
|
||||
print $accountoshow;
|
||||
}
|
||||
print '</td>';
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("RevenueStamp") . "</td>";
|
||||
print '<td class="right nowraponall amount">' . ($mt < 0 ? price(-$mt) : '') . "</td>";
|
||||
print '<td class="right nowraponall amount">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
print '</td>';
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
print "<td>".$companystatic->getNomUrl(0, 'customer', 16).' - '.$invoicestatic->ref.' - '.$langs->trans("RevenueStamp")."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
|
||||
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
|
||||
if (!$i) {
|
||||
print '<tr class="oddeven"><td colspan="6"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
print '<tr class="oddeven"><td colspan="7"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2021-2022 Open-DSI <support@open-dsi.fr>
|
||||
/* Copyright (C) 2021-2023 Alexandre Spangaro <aspangaro@easya.solutions>
|
||||
*
|
||||
* 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
|
||||
@@ -61,10 +61,16 @@ $parameters = array();
|
||||
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||
|
||||
if (empty($date_startmonth) || empty($date_endmonth)) {
|
||||
if (empty($date_startmonth)) {
|
||||
// Period by default on transfer
|
||||
$dates = getDefaultDatesForTransfer();
|
||||
$date_start = $dates['date_start'];
|
||||
$pastmonthyear = $dates['pastmonthyear'];
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
}
|
||||
if (empty($date_endmonth)) {
|
||||
// Period by default on transfer
|
||||
$dates = getDefaultDatesForTransfer();
|
||||
$date_end = $dates['date_end'];
|
||||
$pastmonthyear = $dates['pastmonthyear'];
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
@@ -76,8 +82,12 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
|
||||
}
|
||||
|
||||
$data_type = 'view';
|
||||
if ($action == 'writebookkeeping') $data_type = 'bookkeeping';
|
||||
if ($action == 'exportcsv') $data_type = 'csv';
|
||||
if ($action == 'writebookkeeping') {
|
||||
$data_type = 'bookkeeping';
|
||||
}
|
||||
if ($action == 'exportcsv') {
|
||||
$data_type = 'csv';
|
||||
}
|
||||
$journal_data = $object->getData($user, $data_type, $date_start, $date_end, $in_bookkeeping);
|
||||
if (!is_array($journal_data)) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@@ -214,6 +224,25 @@ $varlink = 'id_journal=' . $id_journal;
|
||||
|
||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') {
|
||||
// Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
|
||||
// Fiscal period test
|
||||
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj->nb == 0) {
|
||||
print '<br><div class="warning">'.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined");
|
||||
$desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}');
|
||||
$desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'</strong>', $desc);
|
||||
print $desc;
|
||||
print '</div>';
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if ($object->nature == 4) { // Bank journal
|
||||
// Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
|
||||
$sql = "SELECT COUNT(rowid) as nb";
|
||||
@@ -228,7 +257,9 @@ if ($object->nature == 4) { // Bank journal
|
||||
print '<br>' . img_warning() . ' ' . $langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount");
|
||||
print ' : ' . $langs->trans("AccountancyAreaDescBank", 9, '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . "-" . $langs->transnoentitiesnoconv("BankAccounts") . '</strong>');
|
||||
}
|
||||
} else dol_print_error($db);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Button to write into Ledger
|
||||
@@ -237,7 +268,7 @@ if ($some_mandatory_steps_of_setup_were_not_done) {
|
||||
print ' : ' . $langs->trans("AccountancyAreaDescMisc", 4, '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . "-" . $langs->transnoentitiesnoconv("MenuDefaultAccounts") . '</strong>');
|
||||
print '</div>';
|
||||
}
|
||||
print '<div class="tabsAction tabsActionNoBottom centerimp">';
|
||||
print '<br><div class="tabsAction tabsActionNoBottom centerimp">';
|
||||
if (getDolGlobalString('ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL') && $in_bookkeeping == 'notyet') {
|
||||
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
}
|
||||
@@ -269,8 +300,12 @@ print '
|
||||
</script>';
|
||||
|
||||
$object_label = $langs->trans("ObjectsRef");
|
||||
if ($object->nature == 2 || $object->nature == 3) $object_label = $langs->trans("InvoiceRef");
|
||||
if ($object->nature == 5) $object_label = $langs->trans("ExpenseReportRef");
|
||||
if ($object->nature == 2 || $object->nature == 3) {
|
||||
$object_label = $langs->trans("InvoiceRef");
|
||||
}
|
||||
if ($object->nature == 5) {
|
||||
$object_label = $langs->trans("ExpenseReportRef");
|
||||
}
|
||||
|
||||
|
||||
// Show result array
|
||||
@@ -286,7 +321,9 @@ print '<td>' . $langs->trans("Piece") . ' (' . $object_label . ')</td>';
|
||||
print '<td>' . $langs->trans("AccountAccounting") . '</td>';
|
||||
print '<td>' . $langs->trans("SubledgerAccount") . '</td>';
|
||||
print '<td>' . $langs->trans("LabelOperation") . '</td>';
|
||||
if ($object->nature == 4) print '<td class="center">' . $langs->trans("PaymentMode") . '</td>'; // bank
|
||||
if ($object->nature == 4) {
|
||||
print '<td class="center">' . $langs->trans("PaymentMode") . '</td>';
|
||||
} // bank
|
||||
print '<td class="right">' . $langs->trans("AccountingDebit") . '</td>';
|
||||
print '<td class="right">' . $langs->trans("AccountingCredit") . '</td>';
|
||||
print "</tr>\n";
|
||||
@@ -301,7 +338,9 @@ if (is_array($journal_data) && !empty($journal_data)) {
|
||||
print '<td>' . $line['account_accounting'] . '</td>';
|
||||
print '<td>' . $line['subledger_account'] . '</td>';
|
||||
print '<td>' . $line['label_operation'] . '</td>';
|
||||
if ($object->nature == 4) print '<td class="center">' . $line['payment_mode'] . '</td>';
|
||||
if ($object->nature == 4) {
|
||||
print '<td class="center">' . $line['payment_mode'] . '</td>';
|
||||
}
|
||||
print '<td class="right nowraponall">' . $line['debit'] . '</td>';
|
||||
print '<td class="right nowraponall">' . $line['credit'] . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@@ -51,7 +51,7 @@ if (!$user->hasRight('accounting', 'bind', 'write')) {
|
||||
|
||||
$accountingAccount = new AccountingAccount($db);
|
||||
|
||||
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
$month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
if (GETPOST("year", 'int')) {
|
||||
$year_start = GETPOST("year", 'int');
|
||||
} else {
|
||||
@@ -163,7 +163,7 @@ if ($action == 'validatehistory') {
|
||||
$sql .= " AND l.product_type <= 2";
|
||||
$sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
|
||||
if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
$sql .= " AND f.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'";
|
||||
}
|
||||
if ($validatemonth && $validateyear) {
|
||||
$sql .= dolSqlDateFilter('f.datef', 0, $validatemonth, $validateyear);
|
||||
@@ -286,7 +286,7 @@ if ($action == 'validatehistory') {
|
||||
$db->rollback();
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs'));
|
||||
if ($nbbindfailed) {
|
||||
setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings');
|
||||
}
|
||||
@@ -322,7 +322,7 @@ print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="minwidth100">'.$langs->trans("Account").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -330,7 +330,7 @@ for ($i = 1; $i <= 12; $i++) {
|
||||
if ($cursormonth > 12) {
|
||||
$cursormonth -= 12;
|
||||
}
|
||||
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$cursoryear = ($cursormonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y;
|
||||
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
|
||||
|
||||
print '<td width="60" class="right">';
|
||||
@@ -350,7 +350,7 @@ print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>'
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number')." AS codecomptable,";
|
||||
$sql .= " ".$db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label')." AS intitule,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -364,7 +364,7 @@ $sql .= " WHERE ff.datef >= '".$db->idate($search_date_start)."'";
|
||||
$sql .= " AND ff.datef <= '".$db->idate($search_date_end)."'";
|
||||
// Define begin binding date
|
||||
if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$sql .= " AND ff.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
$sql .= " AND ff.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'";
|
||||
}
|
||||
$sql .= " AND ff.fk_statut > 0";
|
||||
$sql .= " AND ffd.product_type <= 2";
|
||||
@@ -393,27 +393,27 @@ if ($resql) {
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($row[0] == 'tobind') {
|
||||
$startmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1);
|
||||
$startmonth = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
if ($startmonth > 12) {
|
||||
$startmonth -= 12;
|
||||
}
|
||||
$startyear = ($startmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$endmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + 11;
|
||||
$startyear = ($startmonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y;
|
||||
$endmonth = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) + 11;
|
||||
if ($endmonth > 12) {
|
||||
$endmonth -= 12;
|
||||
}
|
||||
$endyear = ($endmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$endyear = ($endmonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y;
|
||||
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_date_startday=1&search_date_startmonth='.((int) $startmonth).'&search_date_startyear='.((int) $startyear).'&search_date_endday=&search_date_endmonth='.((int) $endmonth).'&search_date_endyear='.((int) $endyear), $langs->transnoentitiesnoconv("ToBind"));
|
||||
} else {
|
||||
print $row[1];
|
||||
}
|
||||
print '</td>';
|
||||
for ($i = 2; $i <= 13; $i++) {
|
||||
$cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2);
|
||||
$cursormonth = (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) + $i - 2);
|
||||
if ($cursormonth > 12) {
|
||||
$cursormonth -= 12;
|
||||
}
|
||||
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$cursoryear = ($cursormonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y;
|
||||
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
|
||||
|
||||
print '<td class="right nowraponall amount">';
|
||||
@@ -454,7 +454,7 @@ print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="minwidth100">'.$langs->trans("Account").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -462,7 +462,7 @@ for ($i = 1; $i <= 12; $i++) {
|
||||
if ($cursormonth > 12) {
|
||||
$cursormonth -= 12;
|
||||
}
|
||||
$cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y;
|
||||
$cursoryear = ($cursormonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y;
|
||||
$tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt');
|
||||
|
||||
print '<td width="60" class="right">';
|
||||
@@ -482,7 +482,7 @@ print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>'
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number')." AS codecomptable,";
|
||||
$sql .= " ".$db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label')." AS intitule,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -496,7 +496,7 @@ $sql .= " WHERE ff.datef >= '".$db->idate($search_date_start)."'";
|
||||
$sql .= " AND ff.datef <= '".$db->idate($search_date_end)."'";
|
||||
// Define begin binding date
|
||||
if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$sql .= " AND ff.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
$sql .= " AND ff.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'";
|
||||
}
|
||||
$sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
|
||||
$sql .= " AND ff.fk_statut > 0";
|
||||
@@ -566,7 +566,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Total").'</td>';
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -576,7 +576,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
|
||||
|
||||
$sql = "SELECT '".$db->escape($langs->trans("CAHTF"))."' AS label,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
$j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
@@ -589,7 +589,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
|
||||
$sql .= " AND ff.datef <= '".$db->idate($search_date_end)."'";
|
||||
// Define begin binding date
|
||||
if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$sql .= " AND ff.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
$sql .= " AND ff.datef >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'";
|
||||
}
|
||||
$sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
|
||||
$sql .= " AND ff.fk_statut > 0";
|
||||
|
||||
@@ -67,7 +67,7 @@ $search_country = GETPOST('search_country', 'alpha');
|
||||
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
@@ -81,7 +81,7 @@ if (!$sortfield) {
|
||||
$sortfield = "f.datef, f.ref, l.rowid";
|
||||
}
|
||||
if (!$sortorder) {
|
||||
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
|
||||
if (getDolGlobalInt('ACCOUNTING_LIST_SORT_VENTILATION_DONE') > 0) {
|
||||
$sortorder = "DESC";
|
||||
} else {
|
||||
$sortorder = "ASC";
|
||||
@@ -411,10 +411,10 @@ if ($result) {
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@@ -536,7 +536,7 @@ if ($result) {
|
||||
|
||||
print '<td class="tdoverflowonsmartphone small">';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description, 1));
|
||||
$trunclength = !getDolGlobalString('ACCOUNTING_LENGTH_DESCRIPTION') ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
$trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION', 32);
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
|
||||
print '</td>';
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ $search_country = GETPOST('search_country', 'alpha');
|
||||
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit);
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
@@ -91,7 +91,7 @@ if (!$sortfield) {
|
||||
$sortfield = "f.datef, f.ref, l.rowid";
|
||||
}
|
||||
if (!$sortorder) {
|
||||
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
|
||||
if (getDolGlobalInt('ACCOUNTING_LIST_SORT_VENTILATION_TODO') > 0) {
|
||||
$sortorder = "DESC";
|
||||
} else {
|
||||
$sortorder = "ASC";
|
||||
@@ -119,7 +119,7 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
|
||||
|
||||
// Define begin binding date
|
||||
if (empty($search_date_start) && getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) {
|
||||
$search_date_start = $db->idate($conf->global->ACCOUNTING_DATE_START_BINDING);
|
||||
$search_date_start = $db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'));
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,8 @@ if (empty($search_date_start) && getDolGlobalString('ACCOUNTING_DATE_START_BINDI
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||
$massaction = '';
|
||||
@@ -499,10 +500,10 @@ if ($result) {
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print '<div class="nowrapfordate">';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@@ -686,7 +687,7 @@ if ($result) {
|
||||
// Description of line
|
||||
print '<td class="tdoverflowonsmartphone small">';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facturefourn_static_det->desc, 1));
|
||||
$trunclength = !getDolGlobalString('ACCOUNTING_LENGTH_DESCRIPTION') ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
$trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION', 32);
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $facturefourn_static_det->desc);
|
||||
print '</td>';
|
||||
|
||||
@@ -699,7 +700,7 @@ if ($result) {
|
||||
//if ($objp->vat_tx_l != $objp->vat_tx_p && price2num($objp->vat_tx_p) && price2num($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
|
||||
// $code_vat_differ = 'warning bold';
|
||||
//}
|
||||
print '<td class="right'.($code_vat_differ?' '.$code_vat_differ:'').'">';
|
||||
print '<td class="right'.($code_vat_differ ? ' '.$code_vat_differ : '').'">';
|
||||
print vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''), false, 0, 0, 1);
|
||||
print '</td>';
|
||||
|
||||
@@ -718,7 +719,8 @@ if ($result) {
|
||||
// Found accounts
|
||||
print '<td class="small">';
|
||||
$s = '1. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
|
||||
$shelp = ''; $ttype = 'help';
|
||||
$shelp = '';
|
||||
$ttype = 'help';
|
||||
if ($suggestedaccountingaccountbydefaultfor == 'eec') {
|
||||
$shelp .= $langs->trans("SaleEEC");
|
||||
} elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') {
|
||||
@@ -734,7 +736,8 @@ if ($result) {
|
||||
if ($product_static->id > 0) {
|
||||
print '<br>';
|
||||
$s = '2. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
|
||||
$shelp = ''; $ttype = 'help';
|
||||
$shelp = '';
|
||||
$ttype = 'help';
|
||||
if ($suggestedaccountingaccountfor == 'eec') {
|
||||
$shelp = $langs->trans("SaleEEC");
|
||||
} elseif ($suggestedaccountingaccountfor == 'eecwithvat') {
|
||||
|
||||
@@ -53,7 +53,7 @@ if (($accountancyexport->getFormatCode($formatexportset) == 'fec' || $accountanc
|
||||
}
|
||||
$datetouseforfilename = $search_date_end;
|
||||
$tmparray = dol_getdate($datetouseforfilename);
|
||||
$fiscalmonth = !getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START;
|
||||
$fiscalmonth = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
|
||||
// Define end of month to use
|
||||
if ($tmparray['mon'] < $fiscalmonth || $fiscalmonth == 1) {
|
||||
$tmparray['mon'] = $fiscalmonth == 1 ? 12 : $fiscalmonth - 1;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user