diff --git a/.travis.yml b/.travis.yml index a19b8647deb..74d951bf7bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -266,7 +266,7 @@ script: - | echo "Upgrading Dolibarr" # Ensure we catch errors - set -e + set +e cd htdocs/install php upgrade.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360.log php upgrade2.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360-2.log @@ -289,9 +289,9 @@ script: - | echo "Unit testing" - # Ensure we catch errors. Set this to +e if you want to go to this end to see log file. + # Ensure we catch errors. Set this to +e if you want to go to the end to see log file. set -e - phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php + #phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php set +e - | diff --git a/COPYRIGHT b/COPYRIGHT index 6c2dab9444a..406b936becc 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -14,7 +14,7 @@ Component Version License GPL Compatible PHP libraries: AdoDb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package) ChromePHP 4.1.0 Apache Software License 2.0 Yes Return server log to chrome browser console -CKEditor 4.5.6 LGPL-2.1+ Yes Editor WYSIWYG +CKEditor 4.5.8 LGPL-2.1+ Yes Editor WYSIWYG EvalMath 1.0 BSD Yes Safe math expressions evaluation Escpos-php MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers FPDI 1.5.2 Apache Software License 2.0 Yes PDF templates management diff --git a/ChangeLog b/ChangeLog index a83fc453a65..ec9b5d50ba0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,7 +24,12 @@ Dolibarr 4.0 should be compatible with PHP 7 but more feedbacks are still expect Following changes may create regression for some external modules, but were necessary to make Dolibarr better: +- Function log() of class CommandeFournisseur has been removed. Using it is no more required. - Method select_type_comptes_financiers() has been renamed into selectTypeOfBankAccount() +- File '/core/tpl/document_actions_pre_headers.tpl.php' were renamed into '/core/actions_linkedfiles.inc.php'. +So if you included it into your module, change your code like this to be compatible with all version: + $res=@include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; + if (! $res) include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; @@ -712,6 +717,23 @@ Dolibarr better: - Function get_exdir require now 6 parameters. This is to prepare a future feature. +***** ChangeLog for 3.7.4 compared to 3.7.3 ***** +FIX: #3694 +FIX: #4239 +FIX: #4291 Correctly filter external calendar GETPOSTs +FIX: #4341 +FIX: #4414 Supplier invoices use FAC_FORCE_DATE_VALIDATION client invoices property +FIX: #4440 Wrong price is filled by Product::fetch into multiprices arrays +FIX: add missing global def for ttc column +FIX: Contrat card don't consider user permissions to show active/unactive service button +FIX: CVE CVE-2015-8685 +FIX: Email templates not compatible with Multicompany +Fix: for avoid division by 0 +FIX: ISSUE #4506 : make working the PROPAL_CLONE_ON_CREATE_PAGE hidden constant +FIX: $outputlangs is not defined (dolibarr 3.7, 3.8, 3.9) +FIX: sql injection even when code is on several lines +FIX: The third dashboard don't consider user permissions + ***** ChangeLog for 3.7.3 compared to 3.7.2 ***** FIX: #3734 Do not show empty links of deleted source objects in stock movement list FIX: #3890 Expected transactions bank account page, shows negative numbers diff --git a/composer.lock b/composer.lock index 2ccd1f616a5..43a9f1d2d7c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "4a06567f53c5f081f9c961a0b3093da3", - "content-hash": "265061f1a1056df2e8c5184841993d0f", + "hash": "c2b53c577364dbe3a56137043081b511", + "content-hash": "8f7a86cfbc13f45e13b73c49531818cb", "packages": [ { "name": "ccampbell/chromephp", @@ -56,12 +56,12 @@ "source": { "type": "git", "url": "https://github.com/ckeditor/ckeditor-releases.git", - "reference": "c1cefe7341e6910a1e6cb2f3f024bbdaf6cd1d4d" + "reference": "e3eb254641c4c349ffc19e49bd4a1a6831b5b6d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ckeditor/ckeditor-releases/zipball/c1cefe7341e6910a1e6cb2f3f024bbdaf6cd1d4d", - "reference": "c1cefe7341e6910a1e6cb2f3f024bbdaf6cd1d4d", + "url": "https://api.github.com/repos/ckeditor/ckeditor-releases/zipball/e3eb254641c4c349ffc19e49bd4a1a6831b5b6d0", + "reference": "e3eb254641c4c349ffc19e49bd4a1a6831b5b6d0", "shasum": "" }, "type": "library", @@ -73,7 +73,7 @@ ], "authors": [ { - "name": "CKSource - Frederico Knabben", + "name": "CKSource", "homepage": "http://cksource.com" } ], @@ -89,7 +89,7 @@ "text", "wysiwyg" ], - "time": "2015-12-09 15:49:34" + "time": "2016-03-31 16:19:25" }, { "name": "mike42/escpos-php", @@ -97,12 +97,12 @@ "source": { "type": "git", "url": "https://github.com/mike42/escpos-php.git", - "reference": "63648d03d47b81e8f6c1020ac92f051a3f3b5793" + "reference": "96f05cbf460f5b67c2184ee4e91aedfbcedeb788" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mike42/escpos-php/zipball/63648d03d47b81e8f6c1020ac92f051a3f3b5793", - "reference": "63648d03d47b81e8f6c1020ac92f051a3f3b5793", + "url": "https://api.github.com/repos/mike42/escpos-php/zipball/96f05cbf460f5b67c2184ee4e91aedfbcedeb788", + "reference": "96f05cbf460f5b67c2184ee4e91aedfbcedeb788", "shasum": "" }, "require": { @@ -112,6 +112,11 @@ "phpunit/phpunit": "4.5.*" }, "type": "library", + "autoload": { + "psr-4": { + "Mike42\\": "src/Mike42" + } + }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" @@ -147,7 +152,7 @@ "print", "receipt" ], - "time": "2015-12-04 10:23:55" + "time": "2016-03-27 23:08:27" }, { "name": "mobiledetect/mobiledetectlib", @@ -398,1119 +403,7 @@ "time": "2015-09-12 10:08:34" } ], - "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", - "shasum": "" - }, - "require": { - "php": ">=5.3,<8.0-DEV" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2015-06-14 21:17:01" - }, - { - "name": "myclabs/deep-copy", - "version": "1.5.0", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "e3abefcd7f106677fd352cd7c187d6c969aa9ddc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/e3abefcd7f106677fd352cd7c187d6c969aa9ddc", - "reference": "e3abefcd7f106677fd352cd7c187d6c969aa9ddc", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "doctrine/collections": "1.*", - "phpunit/phpunit": "~4.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "homepage": "https://github.com/myclabs/DeepCopy", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "time": "2015-11-07 22:20:37" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "suggest": { - "dflydev/markdown": "~1.0", - "erusev/parsedown": "~1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "phpDocumentor": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" - } - ], - "time": "2015-02-03 12:10:50" - }, - { - "name": "phpspec/prophecy", - "version": "v1.5.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7", - "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "phpdocumentor/reflection-docblock": "~2.0", - "sebastian/comparator": "~1.1" - }, - "require-dev": { - "phpspec/phpspec": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "psr-0": { - "Prophecy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2015-08-13 10:07:40" - }, - { - "name": "phpunit/php-code-coverage", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f7bb5cddf4ffe113eeb737b05241adb947b43f9d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f7bb5cddf4ffe113eeb737b05241adb947b43f9d", - "reference": "f7bb5cddf4ffe113eeb737b05241adb947b43f9d", - "shasum": "" - }, - "require": { - "php": ">=5.6", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0" - }, - "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~5" - }, - "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2015-11-12 21:08:20" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.4.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2015-06-21 13:08:43" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21 13:50:34" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.7", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2015-06-21 08:01:12" - }, - { - "name": "phpunit/php-token-stream", - "version": "1.4.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2015-09-15 10:49:45" - }, - { - "name": "phpunit/phpunit", - "version": "5.1.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c047ff05d2279404af9a7e89e2a7151c32c88022" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c047ff05d2279404af9a7e89e2a7151c32c88022", - "reference": "c047ff05d2279404af9a7e89e2a7151c32c88022", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "myclabs/deep-copy": "~1.3", - "php": ">=5.6", - "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "~3.0", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": ">=1.0.6", - "phpunit/phpunit-mock-objects": ">=3.0.5", - "sebastian/comparator": "~1.1", - "sebastian/diff": "~1.2", - "sebastian/environment": "~1.3", - "sebastian/exporter": "~1.2", - "sebastian/global-state": "~1.0", - "sebastian/resource-operations": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.1|~3.0" - }, - "suggest": { - "phpunit/php-invoker": "~1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2015-12-10 07:54:54" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "3.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "49bc700750196c04dd6bc2c4c99cb632b893836b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/49bc700750196c04dd6bc2c4c99cb632b893836b", - "reference": "49bc700750196c04dd6bc2c4c99cb632b893836b", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": ">=5.6", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" - }, - "require-dev": { - "phpunit/phpunit": "~5" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2015-12-08 08:47:06" - }, - { - "name": "sebastian/comparator", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2015-07-26 15:48:44" - }, - { - "name": "sebastian/diff", - "version": "1.4.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2015-12-08 07:14:41" - }, - { - "name": "sebastian/environment", - "version": "1.3.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "6e7133793a8e5a5714a551a8324337374be209df" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e7133793a8e5a5714a551a8324337374be209df", - "reference": "6e7133793a8e5a5714a551a8324337374be209df", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2015-12-02 08:37:27" - }, - { - "name": "sebastian/exporter", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2015-06-21 07:55:53" - }, - { - "name": "sebastian/global-state", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2015-10-12 03:26:01" - }, - { - "name": "sebastian/recursion-context", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-11-11 19:50:13" - }, - { - "name": "sebastian/resource-operations", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "shasum": "" - }, - "require": { - "php": ">=5.6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28 20:34:47" - }, - { - "name": "sebastian/version", - "version": "1.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "shasum": "" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" - }, - { - "name": "squizlabs/php_codesniffer", - "version": "2.4.0", - "source": { - "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "32a879f4f35019d78d568db2885d7779ca084a33" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/32a879f4f35019d78d568db2885d7779ca084a33", - "reference": "32a879f4f35019d78d568db2885d7779ca084a33", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.1.2" - }, - "bin": [ - "scripts/phpcs", - "scripts/phpcbf" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "CodeSniffer.php", - "CodeSniffer/CLI.php", - "CodeSniffer/Exception.php", - "CodeSniffer/File.php", - "CodeSniffer/Fixer.php", - "CodeSniffer/Report.php", - "CodeSniffer/Reporting.php", - "CodeSniffer/Sniff.php", - "CodeSniffer/Tokens.php", - "CodeSniffer/Reports/", - "CodeSniffer/Tokenizers/", - "CodeSniffer/DocGenerators/", - "CodeSniffer/Standards/AbstractPatternSniff.php", - "CodeSniffer/Standards/AbstractScopeSniff.php", - "CodeSniffer/Standards/AbstractVariableSniff.php", - "CodeSniffer/Standards/IncorrectPatternException.php", - "CodeSniffer/Standards/Generic/Sniffs/", - "CodeSniffer/Standards/MySource/Sniffs/", - "CodeSniffer/Standards/PEAR/Sniffs/", - "CodeSniffer/Standards/PSR1/Sniffs/", - "CodeSniffer/Standards/PSR2/Sniffs/", - "CodeSniffer/Standards/Squiz/Sniffs/", - "CodeSniffer/Standards/Zend/Sniffs/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "lead" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "http://www.squizlabs.com/php-codesniffer", - "keywords": [ - "phpcs", - "standards" - ], - "time": "2015-11-23 21:30:59" - }, - { - "name": "symfony/yaml", - "version": "v3.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "177a015cb0e19ff4a49e0e2e2c5fc1c1bee07002" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/177a015cb0e19ff4a49e0e2e2c5fc1c1bee07002", - "reference": "177a015cb0e19ff4a49e0e2e2c5fc1c1bee07002", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2015-11-30 12:36:17" - } - ], + "packages-dev": [], "aliases": [], "minimum-stability": "stable", "stability-flags": { diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index c5487f67273..d666aa02165 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -40,6 +40,11 @@ with: TCPDF: ------ +* 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); + * Removed all fonts except dejavusans* (used by greek, arab, persan, romanian, turkish), freemono* (russian), @@ -62,12 +67,6 @@ In htdocs/includes/tcpdf/tcpdf.php * Renamed getmypid into dol_getmypid(). -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); - - TCPDI: ------ diff --git a/dev/fixdosfiles.sh b/dev/fixdosfiles.sh index f770e28537d..ae04977d624 100755 --- a/dev/fixdosfiles.sh +++ b/dev/fixdosfiles.sh @@ -17,16 +17,16 @@ fi # To detec if [ "x$1" = "xlist" ] then - find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF + find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF # find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'htdocs\/includes' | grep CRLF fi # To convert if [ "x$1" = "xfix" ] then - for fic in `find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' ` + for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' ` do echo "Fix file $fic" - dos2unix $fic + dos2unix "$fic" done; fi diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index 36cb8c624a4..7fa7aae9756 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -50,25 +50,26 @@ class modMyModule extends DolibarrModules // Key text used to identify module (for permissions, menus, etc...) $this->rights_class = 'mymodule'; - // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' - // It is used to group modules in module setup page + // Family can be 'crm','financial','hr','projects','products','ecm','technic','interface','other' + // It is used to group modules by family in module setup page $this->family = "other"; // Module position in the family $this->module_position = 500; // Gives the possibility to the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) - $this->familyinfo = array('myownfamily' => array('position' => '001', 'label' => $langs->trans("MyOwnFamily"))); + //$this->familyinfo = array('myownfamily' => array('position' => '001', 'label' => $langs->trans("MyOwnFamily"))); // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "Description of module MyModule"; + $this->descriptionlong = "A very lon description. Can be a full HTML content"; + $this->editor_name = 'Editor name'; + $this->editor_url = 'http://www.dolibarr.org'; - // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' $this->version = '1.0'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) - $this->special = 0; // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index 2321b76aac8..78f17dc1a63 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -43,7 +43,9 @@ if (! $res && file_exists("../../../dolibarr/htdocs/main.inc.php")) $res=@includ if (! $res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only if (! $res) die("Include of main fails"); // Change this following line to use the correct relative path from htdocs -include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'); +require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'); +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; dol_include_once('/mymodule/class/skeleton_class.class.php'); // Load traductions files requiredby by page @@ -124,6 +126,9 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab * Put here all code to do according to value of "action" parameter ********************************************************************/ +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction')) { $massaction=''; } + $parameters=array(); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -142,6 +147,19 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPO if (empty($reshook)) { + // Mass actions. Controls on number of lines checked + $maxformassaction=1000; + if (! empty($massaction) && count($toselect) < 1) + { + $error++; + setEventMessages($langs->trans("NoLineChecked"), null, "warnings"); + } + if (! $error && count($toselect) > $maxformassaction) + { + setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors'); + $error++; + } + // Action to delete if ($action == 'confirm_delete') { @@ -217,7 +235,7 @@ foreach ($search_array_options as $key => $val) $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; $mode=0; - if (in_array($typ, array('int'))) $mode=1; // Search on a numeric + if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) { $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); @@ -266,6 +284,7 @@ if ($resql) if ($optioncss != '') print ''; print ''; print ''; + print ''; print ''; print ''; @@ -297,8 +316,8 @@ if ($resql) // Fields title print ''; - if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($langs->trans('field1'),$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($langs->trans('field2'),$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($arrayfields['t.field1']['label'],$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($arrayfields['t.field2']['label'],$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -315,8 +334,8 @@ if ($resql) $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'],$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'],$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); //if (! empty($arrayfields['t.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"t.status","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print ''."\n"; @@ -335,12 +354,15 @@ if ($resql) $align=$extrafields->getAlignFlag($key); $typeofextrafield=$extrafields->attribute_type[$key]; print ''; - if (in_array($typeofextrafield, array('varchar', 'int', 'select'))) - { - $crit=$val; - $tmpkey=preg_replace('/search_options_/','',$key); - print ''; - } + if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select'))) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $searchclass=''; + if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; + if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; + print ''; + } print ''; } } @@ -376,7 +398,9 @@ if ($resql) print ''."\n"; - $i = 0; + $i=0; + $var=true; + $totalarray=array(); while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); @@ -384,8 +408,16 @@ if ($resql) { // You can use here results print ''; - if (! empty($arrayfields['t.field1']['checked'])) print ''.$obj->field1.''; - if (! empty($arrayfields['t.field2']['checked'])) print ''.$obj->field2.''; + if (! empty($arrayfields['t.field1']['checked'])) + { + print ''.$obj->field1.''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['t.field2']['checked'])) + { + print ''.$obj->field2.''; + if (! $i) $totalarray['nbfield']++; + } // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -400,6 +432,7 @@ if ($resql) $tmpkey='options_'.$key; print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); print ''; + if (! $i) $totalarray['nbfield']++; } } } @@ -413,6 +446,7 @@ if ($resql) print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); print ''; + if (! $i) $totalarray['nbfield']++; } // Date modification if (! empty($arrayfields['t.tms']['checked'])) @@ -420,6 +454,7 @@ if ($resql) print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour'); print ''; + if (! $i) $totalarray['nbfield']++; } // Status /* @@ -428,9 +463,12 @@ if ($resql) $userstatic->statut=$obj->statut; print ''.$userstatic->getLibStatut(3).''; }*/ + // Action column print ''; - print ''; + if (! $i) $totalarray['nbfield']++; + + print ''; } $i++; } diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 3f251e0090b..70f191f3679 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -161,11 +161,11 @@ if ($result) { print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ' '; print ''; print ''; @@ -190,7 +190,7 @@ if ($result) { print '' . $accountstatic->getNomUrl(1) . ''; print '' . $obj->label . ''; - if ($obj->account_parent) + if (! empty($obj->account_parent)) { $accountparent->id = $obj->rowid2; $accountparent->label = $obj->label2; diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 7810ad4f3ef..f1f1218f554 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -1,6 +1,6 @@ - - * Copyright (C) 2013-2015 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -18,9 +18,9 @@ */ /** - * \file htdocs/accountancy/admin/card.php - * \ingroup Accounting Expert - * \brief Card accounting account + * \file htdocs/accountancy/admin/card.php + * \ingroup Advanced accountancy + * \brief Card of accounting account */ require '../../main.inc.php'; @@ -28,6 +28,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; $error = 0; @@ -45,7 +46,7 @@ $cancel = GETPOST('cancel'); if (! $user->admin) accessforbidden(); -$accounting = new AccountingAccount($db); +$object = new AccountingAccount($db); // Action if ($action == 'add') { @@ -55,16 +56,25 @@ if ($action == 'add') { dol_syslog('accountancy/admin/card.php:: $sql=' . $sql); $result = $db->query($sql); $obj = $db->fetch_object($result); + + // Clean code + $account_number = clean_account(GETPOST('account_number')); // Accounting account without zero on the right + if (GETPOST('account_category') <= 0) { + $account_parent = ''; + } else { + $account_parent = GETPOST('account_category','int'); + } - $accounting->fk_pcg_version = $obj->pcg_version; - $accounting->pcg_type = GETPOST('pcg_type'); - $accounting->pcg_subtype = GETPOST('pcg_subtype'); - $accounting->account_number = GETPOST('account_number'); - $accounting->account_parent = GETPOST('account_parent', 'int'); - $accounting->label = GETPOST('label', 'alpha'); - $accounting->active = 1; + $object->fk_pcg_version = $obj->pcg_version; + $object->pcg_type = GETPOST('pcg_type'); + $object->pcg_subtype = GETPOST('pcg_subtype'); + $object->account_number = $account_number; + $object->account_parent = $account_parent; + $object->account_category = GETPOST('account_category'); + $object->label = GETPOST('label', 'alpha'); + $object->active = 1; - $res = $accounting->create($user); + $res = $object->create($user); if ($res == 0) { } else { @@ -81,22 +91,31 @@ if ($action == 'add') { Header("Location: account.php"); } else if ($action == 'edit') { if (! GETPOST('cancel', 'alpha')) { - $result = $accounting->fetch($id); + $result = $object->fetch($id); $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS; dol_syslog('accountancy/admin/card.php:: $sql=' . $sql); $result2 = $db->query($sql); $obj = $db->fetch_object($result2); + + // Clean code + $account_number = clean_account(GETPOST('account_number')); // Accounting account without zero on the right + if (GETPOST('account_category') <= 0) { + $account_parent = ''; + } else { + $account_parent = GETPOST('account_category','int'); + } + + $object->fk_pcg_version = $obj->pcg_version; + $object->pcg_type = GETPOST('pcg_type'); + $object->pcg_subtype = GETPOST('pcg_subtype'); + $object->account_number = $account_number; + $object->account_parent = $account_parent; + $object->account_category = GETPOST('account_category'); + $object->label = GETPOST('label', 'alpha'); - $accounting->fk_pcg_version = $obj->pcg_version; - $accounting->pcg_type = GETPOST('pcg_type'); - $accounting->pcg_subtype = GETPOST('pcg_subtype'); - $accounting->account_number = GETPOST('account_number'); - $accounting->account_parent = GETPOST('account_parent', 'int'); - $accounting->label = GETPOST('label', 'alpha'); - - $result = $accounting->update($user); + $result = $object->update($user); if ($result > 0) { header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); @@ -109,10 +128,10 @@ if ($action == 'add') { exit(); } } else if ($action == 'delete') { - $result = $accounting->fetch($id); + $result = $object->fetch($id); - if (! empty($accounting->id)) { - $result = $accounting->delete($user); + if (! empty($object->id)) { + $result = $object->delete($user); if ($result > 0) { Header("Location: account.php"); @@ -120,7 +139,7 @@ if ($action == 'add') { } if ($result < 0) { - setEventMessages($accounting->error, $accounting->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -131,7 +150,9 @@ llxheader('', $langs->trans('AccountAccounting')); $form = new Form($db); $htmlacc = new FormVentilation($db); +$formaccounting = new FormAccounting($db); +// Create mode if ($action == 'create') { print load_fiche_titre($langs->trans('NewAccount')); @@ -142,22 +163,37 @@ if ($action == 'create') { dol_fiche_head(); print ''; - + + // Account number print ''; - print ''; + print ''; + + // Label print ''; - print ''; + print ''; + + // Account parent print ''; print ''; + + // Category + print ''; + print ''; + + // Chart of accounts type print ''; print ''; + + // Chart of acounts subtype print ''; print ''; print '
' . $langs->trans("AccountNumber") . '
' . $langs->trans("Label") . '
' . $langs->trans("Accountparent") . ''; - print $htmlacc->select_account($accounting->account_parent, 'account_parent', 1); + print $htmlacc->select_account($object->account_parent, 'account_parent', 1); print '
' . $langs->trans("AccountingCategory") . ''; + $formaccounting->select_accounting_category($object->account_category, 'account_category', 1); + print '
' . $langs->trans("Pcgtype") . ''; - print $htmlacc->select_pcgtype($accounting->pcg_type, 'pcg_type'); + print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type'); print '
' . $langs->trans("Pcgsubtype") . ''; - print $htmlacc->select_pcgsubtype($accounting->pcg_subtype, 'pcg_subtype'); + print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype'); print '
'; @@ -172,20 +208,16 @@ if ($action == 'create') { print ''; } else if ($id) { - $rowid = $id; - $account = $accounting->fetch($rowid); + $result = $object->fetch($id); - if ($account > 0) { + if ($result > 0) { dol_htmloutput_mesg($mesg); - $head = accounting_prepare_head($accounting); + $head = accounting_prepare_head($object); - if ($action == 'update') { - $soc = new Societe($db); - if ($object->socid) { - $soc->fetch($object->socid); - } - + // Edit mode + if ($action == 'update') + { dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr'); print '
' . "\n"; @@ -195,21 +227,36 @@ if ($action == 'create') { print ''; + // Account number print ''; - print ''; + print ''; + + // Label print ''; - print ''; + print ''; + + // Account parent print ''; print ''; + + // Category + print ''; + print ''; + + // Chart of accounts type print ''; print ''; + + // Chart of accounts subtype print ''; print ''; print '
' . $langs->trans("AccountNumber") . '
' . $langs->trans("Label") . '
' . $langs->trans("Accountparent") . ''; - print $htmlacc->select_account($accounting->account_parent, 'account_parent', 1); + print $htmlacc->select_account($object->account_parent, 'account_parent', 1); print '
'.$langs->trans("AccountingCategory").''; + $formaccounting->select_accounting_category($object->account_category, 'account_category', 1); + print '
' . $langs->trans("Pcgtype") . ''; - print $htmlacc->select_pcgtype($accounting->pcg_type, 'pcg_type'); + print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type'); print '
' . $langs->trans("Pcgsubtype") . ''; - print $htmlacc->select_pcgsubtype($accounting->pcg_subtype, 'pcg_subtype'); + print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype'); print '
'; @@ -224,6 +271,8 @@ if ($action == 'create') { print '
'; } else { + + // View mode $linkback = '' . $langs->trans("BackToChartofaccounts") . ''; dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr'); @@ -232,29 +281,37 @@ if ($action == 'create') { // Account number print '' . $langs->trans("AccountNumber") . ''; - print '' . $accounting->account_number . ''; + print '' . $object->account_number . ''; print '' . $linkback . ''; - + + // Label print '' . $langs->trans("Label") . ''; - print '' . $accounting->label . ''; - + print '' . $object->label . ''; + + // Account parent $accp = new AccountingAccount($db); - if (! empty($accounting->account_parent)) { - $accp->fetch($accounting->account_parent, ''); + if (! empty($object->account_parent)) { + $accp->fetch($object->account_parent, ''); } print '' . $langs->trans("Accountparent") . ''; print '' . $accp->account_number . ' - ' . $accp->label . ''; - + + // Category + print "".$langs->trans("AccountingCategory")."".$object->account_category_label.""; + + // Chart of accounts type print '' . $langs->trans("Pcgtype") . ''; - print '' . $accounting->pcg_type . ''; - + print '' . $object->pcg_type . ''; + + // Chart of accounts subtype print '' . $langs->trans("Pcgsubtype") . ''; - print '' . $accounting->pcg_subtype . ''; - + print '' . $object->pcg_subtype . ''; + + // Active print '' . $langs->trans("Activated") . ''; print ''; - if (empty($accounting->active)) { + if (empty($object->active)) { print img_picto($langs->trans("Disabled"), 'switch_off'); } else { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -267,7 +324,7 @@ if ($action == 'create') { dol_fiche_end(); /* - * Barre d'actions + * Actions buttons */ print '
'; diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 3e4b69d6624..5038c93fc82 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -1,7 +1,7 @@ - * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2015 Alexandre Spangaro +/* Copyright (C) 2016 Olivier Geffroy + * Copyright (C) 2016 Florian Henry + * Copyright (C) 2016 Alexandre Spangaro * * 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 @@ -19,9 +19,9 @@ */ /** - * \file htdocs/accountancy/bookkeeping/balance.php - * \ingroup Accounting Expert - * \brief Balance of book keeping + * \file htdocs/accountancy/bookkeeping/balance.php + * \ingroup Advanced accountancy + * \brief Balance of book keeping */ require '../../main.inc.php'; @@ -137,7 +137,6 @@ else { /* * List */ - $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter); @@ -150,13 +149,12 @@ else { if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - - print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords); - + + print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result); + print '
'; print '
' . "\n"; print '
'; - print '
'; print '
'; @@ -169,6 +167,7 @@ else { print ''; print ''; print_liste_field_titre($langs->trans("Numerocompte"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); @@ -176,11 +175,11 @@ else { print "\n"; print ''; - print ''; @@ -203,23 +202,28 @@ else { foreach ( $object->lines as $line ) { $var = ! $var; - + $link = ''; $total_debit += $line->debit; $total_credit += $line->credit; - + $description = $object->get_compte_desc($line->numero_compte); // Search description of the account + if(empty($description)){ + $link = '' . img_edit_add() .''; + } print ""; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print "\n"; } print ''; print ''; + print ''; print ''; diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 8b03b552073..eae0b26d950 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -69,7 +69,6 @@ class AccountancyExport $this->db = &$db; $this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $this->end_line = "\n"; - return 1; } /** @@ -277,7 +276,7 @@ class AccountancyExport /** * * @param unknown $str data - * @param unknown $size data + * @param integer $size data */ public static function trunc($str, $size) { diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index df45f027259..d01fda8fee9 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2015 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Ari Elbaz (elarifr) @@ -20,9 +20,9 @@ */ /** - * \file htdocs/accountancy/class/accountingaccount.class.php - * \ingroup Accounting Expert - * \brief Fichier de la classe des comptes comptable + * \file htdocs/accountancy/class/accountingaccount.class.php + * \ingroup Accounting Expert + * \brief Fichier de la classe des comptes comptable */ /** @@ -41,6 +41,7 @@ class AccountingAccount extends CommonObject var $pcg_subtype; var $account_number; var $account_parent; + var $account_category; var $label; var $fk_user_author; var $fk_user_modif; @@ -58,25 +59,29 @@ class AccountingAccount extends CommonObject /** * Load record in memory * - * @param int $rowid Id - * @param string $account_number Account number - * @param int $limittocurentchart 1=Do not load record if it is into another accounting system - * @return int <0 if KO, >0 if OK + * @param int $rowid Id + * @param string $account_number Account number + * @param int $limittocurrentchart 1=Do not load record if it is into another accounting system + * @return int <0 if KO, >0 if OK */ - function fetch($rowid = null, $account_number = null, $limittocurentchart = 0) { + function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0) { global $conf; if ($rowid || $account_number) { - $sql = "SELECT rowid, datec, tms, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, fk_user_author, fk_user_modif, active"; - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account WHERE"; + $sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.pcg_subtype, a.account_number, a.account_parent, a.label, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active"; + $sql .= ", ca.label as category_label"; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as a"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as ca ON a.fk_accounting_category = ca.rowid"; + $sql .= " WHERE"; if ($rowid) { - $sql .= " rowid = '" . $rowid . "'"; + $sql .= " a.rowid = '" . $rowid . "'"; } elseif ($account_number) { - $sql .= " account_number = '" . $account_number . "'"; + $sql .= " a.account_number = '" . $account_number . "'"; } - if (! empty($limittocurentchart)) { - $sql .= ' AND fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; + if (! empty($limittocurrentchart)) { + $sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; } + dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -93,6 +98,8 @@ class AccountingAccount extends CommonObject $this->account_number = $obj->account_number; $this->account_parent = $obj->account_parent; $this->label = $obj->label; + $this->account_category = $obj->fk_accounting_category; + $this->account_category_label = $obj->category_label; $this->fk_user_author = $obj->fk_user_author; $this->fk_user_modif = $obj->fk_user_modif; $this->active = $obj->active; @@ -134,6 +141,8 @@ class AccountingAccount extends CommonObject $this->account_parent = trim($this->account_parent); if (isset($this->label)) $this->label = trim($this->label); + if (isset($this->account_category)) + $this->account_category = trim($this->account_category); if (isset($this->fk_user_author)) $this->fk_user_author = trim($this->fk_user_author); if (isset($this->active)) @@ -153,6 +162,7 @@ class AccountingAccount extends CommonObject $sql .= ", account_number"; $sql .= ", account_parent"; $sql .= ", label"; + $sql .= ", fk_accounting_category"; $sql .= ", fk_user_author"; $sql .= ", active"; @@ -166,6 +176,7 @@ class AccountingAccount extends CommonObject $sql .= ", " . (! isset($this->account_number) ? 'NULL' : "'" . $this->account_number . "'"); $sql .= ", " . (! isset($this->account_parent) ? 'NULL' : "'" . $this->db->escape($this->account_parent) . "'"); $sql .= ", " . (! isset($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'"); + $sql .= ", " . (! isset($this->account_category) ? 'NULL' : "'" . $this->db->escape($this->account_category) . "'"); $sql .= ", " . $user->id; $sql .= ", " . (! isset($this->active) ? 'NULL' : "'" . $this->db->escape($this->active) . "'"); @@ -226,6 +237,7 @@ class AccountingAccount extends CommonObject $sql .= " , account_number = '" . $this->account_number . "'"; $sql .= " , account_parent = '" . $this->account_parent . "'"; $sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "null"); + $sql .= " , fk_accounting_category = '" . $this->account_category . "'"; $sql .= " , fk_user_modif = " . $user->id; $sql .= " , active = '" . $this->active . "'"; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 4a0ebbe8988..14bc6c32487 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2015-2016 Florian Henry + * Copyright (C) 2015-2016 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * * This program is free software; you can redistribute it and/or modify @@ -1207,6 +1207,48 @@ class BookKeeping extends CommonObject return - 1; } } + + /** + * Description of accounting account + * + * @param string $account Accounting account + * @return string + */ + function get_compte_desc($account = null) + { + global $conf; + $pcgver = $conf->global->CHARTOFACCOUNTS; + + $sql = "SELECT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version, cat.label as category"; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa "; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; + $sql .= " AND aa.account_number = '" . $account . "'"; + $sql .= " AND asy.rowid = " . $pcgver; + $sql .= " AND aa.active = 1"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid"; + + dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $obj = ''; + if ($this->db->num_rows($resql)) { + $obj = $this->db->fetch_object($resql); + } + + if(empty($obj->category)){ + return $obj->label; + }else{ + return $obj->label.' ('.$obj->category.')'; + + } + } else { + $this->error = "Error " . $this->db->lasterror(); + dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); + + return -1; + } + } + } /** diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index f995b2684ee..c32846ae22e 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -52,8 +52,9 @@ require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php'; $langs->load("companies"); $langs->load("other"); $langs->load("compta"); -$langs->load("bank"); +$langs->load("banks"); $langs->load('bills'); +$langs->load('donations'); $langs->load("accountancy"); $id_bank_account = GETPOST('id_account', 'int'); @@ -130,11 +131,12 @@ if ($result) { $num = $db->num_rows($result); // Variables - $cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef")); - $cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef")); - $accountancy_account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef")); - $accountancy_account_pay_vat = (! empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : $langs->trans("CodeNotDef")); - $accountancy_account_pay_donation = (! empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : $langs->trans("CodeNotDef")); + $account_supplier = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef")); + $account_customer = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef")); + $account_employee = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef")); + $account_pay_vat = (! empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : $langs->trans("CodeNotDef")); + $account_pay_donation = (! empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : $langs->trans("CodeNotDef")); + $account_transfer = (! empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : $langs->trans("CodeNotDef")); $tabpay = array (); $tabbq = array (); @@ -154,11 +156,9 @@ if ($result) { // Controls $compta_bank = $obj->account_number; if ($obj->label == '(SupplierInvoicePayment)') - $compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $cptfour); + $compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $account_supplier); if ($obj->label == '(CustomerInvoicePayment)') - $compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $cptcli); - if ($obj->typeop == '(BankTransfert)') - $compta_soc = $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH; + $compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer); // Variable bookkeeping $tabpay[$obj->rowid]["date"] = $obj->do; @@ -226,25 +226,23 @@ if ($result) { $paymentdonstatic->id = $links[$key]['url_id']; $paymentdonstatic->fk_donation = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("PaymentDonation"); - $tabtp[$obj->rowid][$accountancy_account_pay_donation] += $obj->amount; + $tabtp[$obj->rowid][$account_pay_donation] += $obj->amount; } else if ($links[$key]['type'] == 'payment_vat') { $paymentvatstatic->id = $links[$key]['url_id']; $paymentvatstatic->ref = $links[$key]['url_id']; + $paymentvatstatic->label = $links[$key]['label']; $tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("PaymentVat"); - $tabtp[$obj->rowid][$accountancy_account_pay_vat] += $obj->amount; + $tabtp[$obj->rowid][$account_pay_vat] += $obj->amount; } else if ($links[$key]['type'] == 'payment_salary') { $paymentsalstatic->id = $links[$key]['url_id']; $paymentsalstatic->ref = $links[$key]['url_id']; $paymentsalstatic->label = $links[$key]['label']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2); - $tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount; + $tabtp[$obj->rowid][$account_employee ] += $obj->amount; } else if ($links[$key]['type'] == 'banktransfert') { - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); - $tabtp[$obj->rowid][$cpttva] += $obj->amount; + $tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("BankTransfer"); + $tabtp[$obj->rowid][$account_transfer] += $obj->amount; } - /*else { - $tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount; - }*/ } } @@ -588,24 +586,30 @@ else { foreach ( $tabpay as $key => $val ) { $date = dol_print_date($db->jdate($val["date"]), 'day'); - if ($val["lib"] == '(SupplierInvoicePayment)') { - $reflabel = $langs->trans('SupplierInvoicePayment'); + $reflabel = $val["ref"]; + if ($reflabel == '(SupplierInvoicePayment)') { + $reflabel = $langs->trans('Supplier'); } - if ($val["lib"] == '(CustomerInvoicePayment)') { - $reflabel = $langs->trans('CustomerInvoicePayment'); + if ($reflabel == '(CustomerInvoicePayment)') { + $reflabel = $langs->trans('Customer'); + } + if ($reflabel == '(SocialContributionPayment)') { + $reflabel = $langs->trans('SocialContribution'); + } + if ($reflabel == '(DonationPayment)') { + $reflabel = $langs->trans('Donation'); } // Bank foreach ( $tabbq[$key] as $k => $mt ) { print ""; print ""; - print ""; + print ""; print ""; - // print ""; if ($val['soclib'] == '') { - print ""; + print ""; } else { - print ""; + print ""; } print ""; print ""; @@ -619,19 +623,9 @@ else { if ($k != 'type') { print ""; print ""; - print ""; - // print ""; - if (length_accounta($k) == '') { - print ""; - } else { + print ""; print ""; - } - // print ""; - if ($val['soclib'] == '') { - print ""; - } else { - print ""; - } + print ""; print ""; print ""; print ""; @@ -642,14 +636,9 @@ else { foreach ( $tabbq[$key] as $k => $mt ) { print ""; print ""; - print ""; + print ""; print ""; - // print ""; - if ($val['soclib'] == '') { - print ""; - } else { - print ""; - } + print ""; print ""; print ""; print ""; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 82811598188..62309dc222e 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -4,7 +4,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013-2015 Alexandre Spangaro - * Copyright (C) 2013-2014 Olivier Geffroy + * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -123,7 +123,7 @@ if ($result) { $i = 0; while ( $i < $num ) { $obj = $db->fetch_object($result); - // contrôles + // contrôles $compta_soc = (! empty($obj->code_compta_fournisseur)) ? $obj->code_compta_fournisseur : $cptfour; $compta_prod = $obj->compte; if (empty($compta_prod)) { @@ -164,6 +164,19 @@ if ($action == 'writebookkeeping') { $error = 0; foreach ( $tabfac as $key => $val ) { + + $invoicestatic->id = $key; + $invoicestatic->ref = $val["ref"]; + $invoicestatic->ref = $val["refsologest"]; + $invoicestatic->refsupplier = $val["refsuppliersologest"]; + $invoicestatic->type = $val["type"]; + $invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32)); + + $companystatic->id = $tabcompany[$key]['id']; + $companystatic->name = $tabcompany[$key]['name']; + $companystatic->client = $tabcompany[$key]['code_client']; + + foreach ( $tabttc[$key] as $k => $mt ) { // get compte id and label @@ -175,7 +188,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_facturefourndet"]; $bookkeeping->code_tiers = $tabcompany[$key]['code_fournisseur']; - $bookkeeping->label_compte = $tabcompany[$key]['name']; + $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("Code_tiers"); $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt >= 0) ? 'C' : 'D'; @@ -193,6 +206,8 @@ if ($action == 'writebookkeeping') { // Product / Service foreach ( $tabht[$key] as $k => $mt ) { + $accountingaccount = new AccountingAccount($db); + $accountingaccount->fetch(null, $k); if ($mt) { // get compte id and label $accountingaccount = new AccountingAccount($db); @@ -205,7 +220,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_facturefourndet"]; $bookkeeping->code_tiers = ''; - $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)). ' - ' . $invoicestatic->refsupplier . ' - ' . utf8_decode($accountingaccount->label); $bookkeeping->numero_compte = $k; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; @@ -236,7 +251,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_facturefourndet"]; $bookkeeping->code_tiers = ''; - $bookkeeping->label_compte = $langs->trans("VAT"); + $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->refsupplier .' - '. $langs->trans("VAT"); $bookkeeping->numero_compte = $k; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; @@ -248,7 +263,7 @@ if ($action == 'writebookkeeping') { $result = $bookkeeping->create($user); if ($result < 0) { $error ++; - setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } } @@ -517,5 +532,4 @@ if ($action == 'export_csv') { // End of page llxFooter(); } - $db->close(); diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 670875ec52b..a88d60b8376 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -7,7 +7,7 @@ * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2013-2016 Olivier Geffroy - * Copyright (C) 2014 Raphaël Doursenaud + * Copyright (C) 2014 Raphaël Doursenaud * * 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 @@ -24,9 +24,9 @@ */ /** - * \file htdocs/accountancy/journal/sellsjournal.php - * \ingroup Advanced accountancy - * \brief Page with sells journal + * \file htdocs/accountancy/journal/sellsjournal.php + * \ingroup Advanced accountancy + * \brief Page with sells journal */ require '../../main.inc.php'; @@ -142,15 +142,14 @@ if ($result) { // Situation invoices handling $line = new FactureLigne($db); - $line->fetch($obj->fdid); // id of line - $prev_progress = 0; + $line->fetch($obj->rowid); + $prev_progress = $line->get_prev_progress(); if ($obj->type == Facture::TYPE_SITUATION) { - // Avoid divide by 0 + // Avoid divide by 0 if ($obj->situation_percent == 0) { $situation_ratio = 0; } else { - $prev_progress = $line->get_prev_progress($obj->rowid); // id of invoice - $situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent; + $situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent; } } else { $situation_ratio = 1; @@ -194,6 +193,14 @@ if ($action == 'writebookkeeping') { $error = 0; foreach ( $tabfac as $key => $val ) { + $companystatic->id = $tabcompany[$key]['id']; + $companystatic->name = $tabcompany[$key]['name']; + $companystatic->client = $tabcompany[$key]['code_client']; + +$invoicestatic->id = $key; + $invoicestatic->ref = $val["ref"]; + + foreach ( $tabttc[$key] as $k => $mt ) { $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; @@ -204,7 +211,8 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = $val["fk_facturedet"]; $bookkeeping->code_tiers = $tabcompany[$key]['code_client']; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; - $bookkeeping->label_compte = $tabcompany[$key]['name']; + //$bookkeeping->label_compte = $tabcompany[$key]['name']; + $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers"); $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt >= 0) ? $mt : 0; @@ -234,7 +242,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = $val["fk_facturedet"]; $bookkeeping->code_tiers = ''; $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)). ' - ' . $invoicestatic->ref . ' - ' . utf8_decode($accountingaccount->label); $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt < 0) ? $mt : 0; @@ -264,7 +272,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = $val["fk_facturedet"]; $bookkeeping->code_tiers = ''; $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = $langs->trans("VAT"); + $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref .' - '. $langs->trans("VAT"); $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt < 0) ? $mt : 0; @@ -275,7 +283,7 @@ if ($action == 'writebookkeeping') { $result = $bookkeeping->create($user); if ($result < 0) { $error ++; - setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } } @@ -305,6 +313,9 @@ if ($action == 'export_csv') { $companystatic->name = $tabcompany[$key]['name']; $companystatic->client = $tabcompany[$key]['code_client']; +$invoicestatic->id = $key; + $invoicestatic->ref = $val["ref"]; + $date = dol_print_date($db->jdate($val["date"]), '%d%m%Y'); foreach ( $tabttc[$key] as $k => $mt ) { @@ -314,7 +325,8 @@ if ($action == 'export_csv') { print length_accounta(html_entity_decode($k)) . $sep; print ($mt < 0 ? 'C' : 'D') . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep; - print utf8_decode($companystatic->name) . $sep; + print utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . $sep; + //print utf8_decode($companystatic->name) . $sep; print $val["ref"]; print "\n"; } @@ -329,7 +341,8 @@ if ($action == 'export_csv') { print $sep; print ($mt < 0 ? 'D' : 'C') . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep; - print dol_trunc($accountingaccount_static->label, 32) . $sep; + print utf8_decode(dol_trunc($companystatic->name,16)). ' - ' . $invoicestatic->ref . ' - ' . utf8_decode ( utf8_decode ( $accountingaccount_static->label)) . $sep; + //print dol_trunc($accountingaccount_static->label, 32) . $sep; print $val["ref"]; print "\n"; } @@ -344,7 +357,8 @@ if ($action == 'export_csv') { print $sep; print ($mt < 0 ? 'D' : 'C') . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep; - print $langs->trans("VAT") . $sep; + print utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref .' - '. $langs->trans("VAT") . $sep; + //print $langs->trans("VAT") . $sep; print $val["ref"]; print "\n"; } @@ -356,6 +370,9 @@ if ($action == 'export_csv') { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; $companystatic->client = $tabcompany[$key]['code_client']; + + $invoicestatic->id = $key; + $invoicestatic->ref = $val["ref"]; $date = dol_print_date($db->jdate($val["date"]), 'day'); @@ -363,7 +380,7 @@ if ($action == 'export_csv') { print '"' . $date . '"' . $sep; print '"' . $val["ref"] . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; - print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $companystatic->ref_client . ' - ' . $langs->trans("Code_tiers") . '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep; //print '"' . utf8_decode($companystatic->name) . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; @@ -393,7 +410,7 @@ if ($action == 'export_csv') { print '"' . $date . '"' . $sep; print '"' . $val["ref"] . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; - print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - '. $langs->trans("VAT") . '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref .' - '. $langs->trans("VAT") . '"' . $sep; //print '"' . $langs->trans("VAT") . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"'; @@ -481,7 +498,7 @@ if ($action == 'export_csv') { print ""; + print ""; print ""; print ""; } @@ -498,7 +515,7 @@ if ($action == 'export_csv') { print ""; print ""; //print ""; - print ""; + print ""; print ""; print ""; print ""; @@ -512,7 +529,7 @@ if ($action == 'export_csv') { print ""; print ""; print ""; - print ""; + print ""; //print ""; print ""; print ""; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index f17ca46299f..e8c5749088a 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -356,13 +356,8 @@ if (empty($reshook)) } else { - // Create small thumbs for company (Ratio is near 16/9) - // Used on logon for example - $imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality); - - // Create mini thumbs for company (Ratio is near 16/9) - // Used on menu or for setup page for example - $imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality); + // Create thumbs + $object->addThumbs($newfile); } } } diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index af98d7162da..71f41d84e00 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2002 Rodolphe Quiedeville * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2009 Regis Houssin + * Copyright (C) 2016 Charlie Benke * * 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 @@ -35,10 +36,14 @@ class AdherentType extends CommonObject public $table_element = 'adherent_type'; public $element = 'adherent_type'; + var $id; + var $ref; var $libelle; - var $cotisation; // Soumis a la cotisation - var $vote; // droit de vote - var $mail_valid; //mail envoye lors de la validation + var $cotisation; // Soumis a la cotisation + var $note; + var $vote; // droit de vote + var $mail_valid; //mail envoye lors de la validation + var $statut; /** @@ -110,7 +115,7 @@ class AdherentType extends CommonObject $sql.= "note = '".$this->db->escape($this->note)."',"; $sql.= "vote = '".$this->vote."',"; $sql.= "mail_valid = '".$this->db->escape($this->mail_valid)."'"; - $sql .= " WHERE rowid = $this->id"; + $sql .= " WHERE rowid =".$this->id; $result = $this->db->query($sql); if ($result) @@ -164,7 +169,7 @@ class AdherentType extends CommonObject return 1; } else - { + { return 0; } } @@ -223,7 +228,7 @@ class AdherentType extends CommonObject { global $conf,$langs; - $projets = array(); + $adherenttypes = array(); $sql = "SELECT rowid, libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type"; @@ -241,7 +246,7 @@ class AdherentType extends CommonObject { $obj = $this->db->fetch_object($resql); - $projets[$obj->rowid] = $langs->trans($obj->libelle); + $adherenttypes[$obj->rowid] = $langs->trans($obj->libelle); $i++; } } @@ -250,8 +255,7 @@ class AdherentType extends CommonObject { print $this->db->error(); } - - return $projets; + return $adherenttypes; } @@ -308,7 +312,7 @@ class AdherentType extends CommonObject function getMailOnSubscription() { global $conf; - + // mail_subscription not defined so never used if (! empty($this->mail_subscription) && trim(dol_htmlentitiesbr_decode($this->mail_subscription))) // Property not yet defined { return $this->mail_subscription; @@ -327,7 +331,7 @@ class AdherentType extends CommonObject function getMailOnResiliate() { global $conf; - + // NOTE mail_resiliate not defined so never used if (! empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) // Property not yet defined { return $this->mail_resiliate; diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 4dd5fd9bf64..0e19cd6331c 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -76,7 +76,7 @@ $upload_dir = $conf->adherent->dir_output . "/" . get_exdir($object->id,2,0,1,$o * Actions */ -include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index f46b6d0268c..bae064bef34 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -200,7 +200,10 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''; print ''; print ''; - print ''; + if ($user->rights->adherent->configurer) + print ''; + else + print ''; print ""; $i++; } diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index e15987b69cb..8a5c60c8483 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -1,6 +1,6 @@ - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2016 Juanjo Menent * Copyright (C) 2013-2014 Philippe Grand * Copyright (C) 2015 Jean-François Ferry * @@ -46,24 +46,6 @@ $action = GETPOST('action','alpha'); * Actions */ -if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT') -{ - $freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT'); // No alpha here, we want exact string - - $res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); - - if (! $res > 0) $error++; - - if (! $error) - { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} - //Order display of bank account if ($action == 'setbankorder') { @@ -89,58 +71,13 @@ $form=new Form($db); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("BankSetupModule"),$linkback,'title_setup'); - -print ''; -print ''; -print ''; - $head = bank_admin_prepare_head(null); dol_fiche_head($head, 'general', $langs->trans("BankSetupModule"), 0, 'account'); -print '
'; + print ''; print $langs->trans('From'); print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, ''); print '
'; - print $langs->trans('To'); + print $langs->trans('to'); print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, ''); print '
' . length_accountg($line->numero_compte) . '' . price($line->debit) . '' . price($line->credit) . '' . price($line->credit - $line->debit) . ''; + print '' . $description . '' . number_format($line->debit, 2, ',', ' ') . '' . number_format($line->credit, 2, ',', ' ') . '' . number_format($line->credit - $line->debit, 2, ',', ' ') . '' . $link; print '
'; print price($total_debit); print '
" . $date . "" . $reflabel . "" . $ref . "" . length_accountg($k) . "" . $langs->trans('Bank') . "" . $langs->trans('Bank') . " - " . $val["ref"] . "" . $bank_code_journal->label . " - " . $val["ref"] . "" . $langs->trans("Bank") . " - " . $val['soclib'] . "" . $bank_code_journal->label . " - " . $val['soclib'] . "" . $val["type_payment"] . "" . ($mt >= 0 ? price($mt) : '') . "
" . $date . "" . $val["soclib"] . "" . length_accounta($k) . "" . length_accounta($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) . "" . $ref . "" . length_accounta($k) . "" . $langs->trans('ThirdParty') . " (" . $val['soclib'] . ")" . $langs->trans('ThirdParty') . " - " . $val["ref"] . "" . $langs->trans("ThirdParty") . ' - ' . $val['soclib'] . "" . $reflabel . ' ' . $val['soclib'] . "" . $val["type_payment"] . "" . ($mt < 0 ? price(- $mt) : '') . "" . ($mt >= 0 ? price($mt) : '') . "
" . $date . "" . $reflabel . "" . $ref . "" . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . "" . $langs->trans('ThirdParty') . "" . $langs->trans('ThirdParty') . " - " . $val["ref"] . "" . $langs->trans("ThirdParty") . ' - ' . $val['soclib'] . "" . $reflabel . " " . ($mt < 0 ? price(- $mt) : '') . "" . ($mt >= 0 ? price($mt) : '') . "" . length_accounta($k); //print "" . $langs->trans("ThirdParty"); //print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')'; - print "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref_client . ' - ' . $langs->trans("Code_tiers"). "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers"). "" . ($mt >= 0 ? price($mt) : '') . "" . ($mt < 0 ? price(- $mt) : '') . "" . $invoicestatic->getNomUrl(1) . "" . length_accountg($k) . "" . $accountingaccount->label . "" . $companystatic->getNomUrl(0, 'customer', 16). ' - ' . $invoicestatic->ref_client . ' - ' . utf8_decode ( utf8_decode ( $accountingaccount->label)) . "" . $companystatic->getNomUrl(0, 'customer', 16). ' - ' . $invoicestatic->ref . ' - ' . utf8_decode ( utf8_decode ( $accountingaccount->label)) . "" . ($mt < 0 ? price(- $mt) : '') . "" . ($mt >= 0 ? price($mt) : '') . "
" . $date . "" . $invoicestatic->getNomUrl(1) . "" . length_accountg($k) . "" . $companystatic->getNomUrl(0, 'customer', 16). ' - ' . $invoicestatic->ref_client .' - '. $langs->trans("VAT") . "" . $companystatic->getNomUrl(0, 'customer', 16). ' - ' . $invoicestatic->ref .' - '. $langs->trans("VAT") . "" . $langs->trans("VAT") . "" . ($mt < 0 ? price(- $mt) : '') . "" . ($mt >= 0 ? price($mt) : '') . "'.dol_escape_htmltag($objp->libelle).''.yn($objp->cotisation).''.yn($objp->vote).'rowid.'">'.img_edit().'rowid.'">'.img_edit().' 
'; -print ''; -print ''; -print ''; -print ''; -print "\n"; $var=true; $var=! $var; -print '\n"; -print '
'.$langs->trans("Parameters").'  
'; -print $langs->trans("FreeLegalTextOnChequeReceipts").' ('.$langs->trans("AddCRIfTooLong").')
'; -$variablename='BANK_CHEQUERECEIPT_FREE_TEXT'; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) -{ - print ''; -} -else -{ - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details'); - print $doleditor->Create(); -} -print '
'; -print ''; -print "
'; -print "
"; - -/* -$var=!$var; -print ""; -print ''; -print ""; -print ''; -print $langs->trans("WatermarkOnDraftChequeReceipt").'
'; -print ''; -print ''; -print ''; -print "\n"; -print ''; -*/ - - //Show bank account order print load_fiche_titre($langs->trans("BankOrderShow")); @@ -202,8 +139,6 @@ print ''."\n"; dol_fiche_end(); -print ''; - llxFooter(); $db->close(); diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php new file mode 100644 index 00000000000..f319692f27d --- /dev/null +++ b/htdocs/admin/chequereceipts.php @@ -0,0 +1,287 @@ + + * Copyright (C) 2010-2016 Juanjo Menent + * Copyright (C) 2013-2014 Philippe Grand + * Copyright (C) 2015 Jean-François Ferry + * + * 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 . + */ + + +/** + * \file htdocs/admin/bank.php + * \ingroup bank + * \brief Page to setup the bank module + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; + +$langs->load("admin"); +$langs->load("companies"); +$langs->load("bills"); +$langs->load("other"); +$langs->load("banks"); + +if (!$user->admin) + accessforbidden(); + +$action = GETPOST('action','alpha'); +$value = GETPOST('value','alpha'); + + +if (empty($conf->global->CHEQUERECEIPTS_ADDON)) $conf->global->CHEQUERECEIPTS_ADDON = 'mod_chequereceipts_mint.php'; + + + +/* + * Actions + */ + +if ($action == 'updateMask') +{ + $maskconstchequereceipts=GETPOST('maskconstchequereceipts','alpha'); + $maskchequereceipts=GETPOST('maskchequereceipts','alpha'); + if ($maskconstchequereceipts) $res = dolibarr_set_const($db,$maskconstchequereceipts,$maskchequereceipts,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + +if ($action == 'setmod') +{ + dolibarr_set_const($db, "CHEQUERECEIPTS_ADDON",$value,'chaine',0,'',$conf->entity); +} + +if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT') +{ + $freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT'); // No alpha here, we want exact string + + $res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + +/* + * view + */ + +$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); +llxHeader("",$langs->trans("BankSetupModule")); + +$form=new Form($db); + +$linkback=''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("BankSetupModule"),$linkback,'title_setup'); + +$head = bank_admin_prepare_head(null); +dol_fiche_head($head, 'checkreceipts', $langs->trans("BankSetupModule"), 0, 'account'); + +/* + * Numbering module + */ + +print load_fiche_titre($langs->trans("ChequeReceiptsNumberingModule"), '', ''); + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''."\n"; + +clearstatcache(); + +foreach ($dirmodels as $reldir) +{ + $dir = dol_buildpath($reldir."core/modules/cheque/"); + if (is_dir($dir)) + { + $handle = opendir($dir); + if (is_resource($handle)) + { + $var=true; + + while (($file = readdir($handle))!==false) + { + if (! is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')) + { + $filebis = $file; + $name = substr($file, 4, dol_strlen($file) -16); + $classname = preg_replace('/\.php$/','',$file); + // For compatibility + if (! is_file($dir.$filebis)) + { + $filebis = $file."/".$file.".modules.php"; + $classname = "mod_chequereceipt_".$file; + } + // Check if there is a filter on country + preg_match('/\-(.*)_(.*)$/',$classname,$reg); + if (! empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue; + + $classname = preg_replace('/\-.*$/','',$classname); + if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php') + { + // Charging the numbering class + require_once $dir.$filebis; + + $module = new $classname($db); + + // Show modules according to features level + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; + + if ($module->isEnabled()) + { + $var = !$var; + print ''; + + // Show example of numbering module + print ''."\n"; + + print ''; + + $chequereceipts=new RemiseCheque($db); + $chequereceipts->initAsSpecimen(); + + // Example + $htmltooltip=''; + $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; + $nextval=$module->getNextValue($mysoc,$chequereceipts); + if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval + $htmltooltip.=$langs->trans("NextValue").': '; + if ($nextval) { + if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured') + $nextval = $langs->trans($nextval); + $htmltooltip.=$nextval.'
'; + } else { + $htmltooltip.=$langs->trans($module->error).'
'; + } + } + + print ''; + + print "\n"; + + } + } + } + } + closedir($handle); + } + } +} + +print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'; + print (empty($module->name)?$name:$module->name); + print "\n"; + + print $module->info(); + + print ''; + $tmp=$module->getExample(); + if (preg_match('/^Error/',$tmp)) print '
'.$langs->trans($tmp).'
'; + elseif ($tmp=='NotConfigured') print $langs->trans($tmp); + else print $tmp; + print '
'; + if ($conf->global->CHEQUERECEIPTS_ADDON == $file || $conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file) + { + print img_picto($langs->trans("Activated"),'switch_on'); + } + else + { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + } + print ''; + print $form->textwithpicto('',$htmltooltip,1,0); + + if ($conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file) // If module is the one used, we show existing errors + { + if (! empty($module->error)) dol_htmloutput_mesg($module->error,'','error',1); + } + + print '
'; + +print '
'; + + +/* + * Other options + * + */ +print load_fiche_titre($langs->trans("OtherOptions"),'',''); + +print '
'; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; +$var=true; + +$var=! $var; + +print '\n"; +print '
'.$langs->trans("Parameters").'  
'; +print $langs->trans("FreeLegalTextOnChequeReceipts").' ('.$langs->trans("AddCRIfTooLong").')
'; +$variablename='BANK_CHEQUERECEIPT_FREE_TEXT'; +if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) +{ + print ''; +} +else +{ + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details'); + print $doleditor->Create(); +} +print '
'; +print ''; +print "
'; +print "
"; + +print ''."\n"; + +dol_fiche_end(); + +print '
'; + +llxFooter(); + +$db->close(); diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 849916222dd..c9e07677512 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -98,12 +98,14 @@ if ( ($action == 'update' && empty($_POST["cancel"])) // Create thumbs of logo (Note that PDF use original file and not thumbs) if ($isimage > 0) { - // Create small thumbs for company (Ratio is near 16/9) + // Create thumbs + //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get... + // Used on logon for example $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality); - if (preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg)) + if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg)) { - $imgThumbSmall = $reg[1]; + $imgThumbSmall = $reg[1]; // Save only basename dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity); } else dol_syslog($imgThumbSmall); @@ -111,9 +113,9 @@ if ( ($action == 'update' && empty($_POST["cancel"])) // Create mini thumbs for company (Ratio is near 16/9) // Used on menu or for setup page for example $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality); - if (preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg)) + if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg)) { - $imgThumbMini = $reg[1]; + $imgThumbMini = $reg[1]; // Save only basename dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity); } else dol_syslog($imgThumbMini); @@ -203,12 +205,14 @@ if ($action == 'addthumb') // Create thumbs of logo if ($isimage > 0) { - // Create small thumbs for company (Ratio is near 16/9) + // Create thumbs + //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get... + // Used on logon for example $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthsmall, $maxheightsmall, '_small',$quality); if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg)) { - $imgThumbSmall = $reg[1]; + $imgThumbSmall = $reg[1]; // Save only basename dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity); } else dol_syslog($imgThumbSmall); @@ -218,7 +222,7 @@ if ($action == 'addthumb') $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthmini, $maxheightmini, '_mini',$quality); if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg)) { - $imgThumbMini = $reg[1]; + $imgThumbMini = $reg[1]; // Save only basename dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity); } else dol_syslog($imgThumbMini); diff --git a/htdocs/admin/confexped.php b/htdocs/admin/confexped.php index 85682960df9..bf4a09c0ada 100644 --- a/htdocs/admin/confexped.php +++ b/htdocs/admin/confexped.php @@ -131,7 +131,10 @@ print ''; // Bon de livraison activation/desactivation $var=!$var; print ''; -print ''.$langs->trans("DeliveriesOrderAbility").''; +print ''; +print $langs->trans("DeliveriesOrderAbility"); +print '
'.info_admin($langs->trans("NoNeedForDeliveryReceipts"), 0, 1); +print ''; print ''; print ''; print ''; @@ -151,7 +154,5 @@ print ''; print '
'; -print info_admin($langs->trans("NoNeedForDeliveryReceipts")); - llxFooter(); $db->close(); diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 8ee8b791303..f904c7f6cf0 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -8,7 +8,7 @@ * Copyright (C) 2011 Remy Younes * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2011-2015 Alexandre Spangaro + * Copyright (C) 2011-2016 Alexandre Spangaro * Copyright (C) 2015 Ferran Marcet * Copyright (C) 2016 Raphaël Doursenaud * @@ -46,6 +46,8 @@ $langs->load("admin"); $langs->load("companies"); $langs->load("resource"); $langs->load("holiday"); +$langs->load("accountancy"); +$langs->load("hrm"); $action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view'; $confirm=GETPOST('confirm','alpha'); @@ -78,7 +80,7 @@ $hookmanager->initHooks(array('admin')); // Put here declaration of dictionaries properties // Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this. -$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,25,0,26); +$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,25,0,26,0,31,32,0); // Name of SQL tables of dictionaries $tabname=array(); @@ -112,6 +114,10 @@ $tabname[27]= MAIN_DB_PREFIX."c_stcomm"; $tabname[28]= MAIN_DB_PREFIX."c_holiday_types"; $tabname[29]= MAIN_DB_PREFIX."c_lead_status"; $tabname[30]= MAIN_DB_PREFIX."c_format_cards"; +$tabname[31]= MAIN_DB_PREFIX."accounting_system"; +$tabname[32]= MAIN_DB_PREFIX."c_accounting_category"; +$tabname[33]= MAIN_DB_PREFIX."c_hrm_department"; +$tabname[34]= MAIN_DB_PREFIX."c_hrm_function"; // Dictionary labels $tablib=array(); @@ -145,6 +151,10 @@ $tablib[27]= "DictionaryProspectStatus"; $tablib[28]= "DictionaryHolidayTypes"; $tablib[29]= "DictionaryOpportunityStatus"; $tablib[30]= "DictionaryFormatCards"; +$tablib[31]= "DictionaryAccountancysystem"; +$tablib[32]= "DictionaryAccountancyCategory"; +$tablib[33]= "DictionaryDepartment"; +$tablib[34]= "DictionaryFunction"; // Requests to extract data $tabsql=array(); @@ -172,12 +182,16 @@ $tabsql[21]= "SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX $tabsql[22]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason"; $tabsql[23]= "SELECT t.rowid as rowid, t.taux, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid"; $tabsql[24]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource"; -$tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content, active FROM ".MAIN_DB_PREFIX."c_email_templates"; +$tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content, active FROM ".MAIN_DB_PREFIX."c_email_templates WHERE entity IN (".getEntity('email_template',1).")"; $tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units"; $tabsql[27]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_stcomm"; -$tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newByMonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid"; +$tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid"; $tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status"; $tabsql[30]= "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards"; +$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, c.code as country_code, c.label as country, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_pays=c.rowid and c.active=1"; +$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1"; +$tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department"; +$tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function"; // Criteria to sort dictionaries $tabsqlsort=array(); @@ -211,6 +225,10 @@ $tabsqlsort[27]="code ASC"; $tabsqlsort[28]="country ASC, code ASC"; $tabsqlsort[29]="position ASC"; $tabsqlsort[30]="code ASC"; +$tabsqlsort[31]="pcg_version ASC"; +$tabsqlsort[32]="code ASC, label ASC"; +$tabsqlsort[33]="code ASC"; +$tabsqlsort[34]="code ASC"; // Nom des champs en resultat de select pour affichage du dictionnaire $tabfield=array(); @@ -241,9 +259,13 @@ $tabfield[24]= "code,label"; $tabfield[25]= "label,type_template,position,topic,content"; $tabfield[26]= "code,label,short_label"; $tabfield[27]= "code,libelle"; -$tabfield[28]= "code,label,affect,delay,newByMonth,country_id,country"; +$tabfield[28]= "code,label,affect,delay,newbymonth,country_id,country"; $tabfield[29]= "code,label,percent,position"; $tabfield[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; +$tabfield[31]= "pcg_version,country_id,country,label"; +$tabfield[32]= "code,label,range,position,country_id,country"; +$tabfield[33]= "code,label"; +$tabfield[34]= "code,label"; // Nom des champs d'edition pour modification d'un enregistrement $tabfieldvalue=array(); @@ -274,9 +296,13 @@ $tabfieldvalue[24]= "code,label"; $tabfieldvalue[25]= "label,type_template,position,topic,content"; $tabfieldvalue[26]= "code,label,short_label"; $tabfieldvalue[27]= "code,libelle"; -$tabfieldvalue[28]= "code,label,affect,delay,newByMonth,country"; +$tabfieldvalue[28]= "code,label,affect,delay,newbymonth,country"; $tabfieldvalue[29]= "code,label,percent,position"; $tabfieldvalue[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; +$tabfieldvalue[31]= "pcg_version,country,label"; +$tabfieldvalue[32]= "code,label,range_account,position,country"; +$tabfieldvalue[33]= "code,label"; +$tabfieldvalue[34]= "code,label"; // Nom des champs dans la table pour insertion d'un enregistrement $tabfieldinsert=array(); @@ -304,12 +330,16 @@ $tabfieldinsert[21]= "code,label"; $tabfieldinsert[22]= "code,label"; $tabfieldinsert[23]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldinsert[24]= "code,label"; -$tabfieldinsert[25]= "label,type_template,position,topic,content"; +$tabfieldinsert[25]= "label,type_template,private,position,topic,content,entity"; $tabfieldinsert[26]= "code,label,short_label"; $tabfieldinsert[27]= "code,libelle"; -$tabfieldinsert[28]= "code,label,affect,delay,newByMonth,fk_country"; +$tabfieldinsert[28]= "code,label,affect,delay,newbymonth,fk_country"; $tabfieldinsert[29]= "code,label,percent,position"; $tabfieldinsert[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; +$tabfieldinsert[31]= "pcg_version,fk_pays,label"; +$tabfieldinsert[32]= "code,label,range_account,position,fk_country"; +$tabfieldinsert[33]= "code,label"; +$tabfieldinsert[34]= "code,label"; // Nom du rowid si le champ n'est pas de type autoincrement // Example: "" if id field is "rowid" and has autoincrement on @@ -345,6 +375,10 @@ $tabrowid[27]= "id"; $tabrowid[28]= ""; $tabrowid[29]= ""; $tabrowid[30]= ""; +$tabrowid[31]= ""; +$tabrowid[32]= ""; +$tabrowid[33]= "rowid"; +$tabrowid[34]= "rowid"; // Condition to show dictionary in setup page $tabcond=array(); @@ -378,6 +412,10 @@ $tabcond[27]= ! empty($conf->societe->enabled); $tabcond[28]= ! empty($conf->holiday->enabled); $tabcond[29]= ! empty($conf->projet->enabled); $tabcond[30]= ! empty($conf->label->enabled); +$tabcond[31]= ! empty($conf->accounting->enabled); +$tabcond[32]= ! empty($conf->accounting->enabled); +$tabcond[33]= ! empty($conf->hrm->enabled); +$tabcond[34]= ! empty($conf->hrm->enabled); // List of help for fields $tabhelp=array(); @@ -408,9 +446,13 @@ $tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[25] = array('topic'=>$langs->trans('SeeSubstitutionVars'),'content'=>$langs->trans('SeeSubstitutionVars'),'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList")); $tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode")); -$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"),'delay'=>$langs->trans("MinimumNoticePeriod"), 'newByMonth'=>$langs->trans("NbAddedAutomatically")); +$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"),'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically")); $tabhelp[29] = array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList")); $tabhelp[30] = array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->trans("LabelName"), 'paper_size'=>$langs->trans("LabelPaperSize")); +$tabhelp[31] = array('pcg_version'=>$langs->trans("EnterAnyCode")); +$tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode")); +$tabhelp[33] = array('code'=>$langs->trans("EnterAnyCode")); +$tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode")); // List of check for fields (NOT USED YET) $tabfieldcheck=array(); @@ -444,6 +486,10 @@ $tabfieldcheck[27] = array(); $tabfieldcheck[28] = array(); $tabfieldcheck[29] = array(); $tabfieldcheck[30] = array(); +$tabfieldcheck[31] = array(); +$tabfieldcheck[32] = array(); +$tabfieldcheck[33] = array(); +$tabfieldcheck[34] = array(); // Complete all arrays with entries found into modules complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck); @@ -534,7 +580,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $ok=1; foreach ($listfield as $f => $value) { - if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory + if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp','DictionaryAccountancysystem','DictionaryAccountancyCategory'))) continue; // For some pages, country is not mandatory if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue; if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue; @@ -952,6 +998,7 @@ if ($id) if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); } if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); } if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } + if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); } if ($id == 2) // Special cas for state page { @@ -1119,6 +1166,7 @@ if ($id) if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); } if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); } if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } + if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); } // Affiche nom du champ if ($showfield) @@ -1341,8 +1389,10 @@ if ($id) $valuetoshow = length_accountg($valuetoshow); } + $class='tddict'; + if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto'; // Show value for field - if ($showfield) print ''.$valuetoshow.''; + if ($showfield) print ''.$valuetoshow.''; } } @@ -1642,13 +1692,13 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') else { print ''; - $size=''; + $size=''; $class=''; if ($fieldlist[$field]=='code') $size='size="8" '; if ($fieldlist[$field]=='position') $size='size="4" '; - if ($fieldlist[$field]=='libelle') $size='size="32" '; - if ($fieldlist[$field]=='tracking') $size='size="92" '; + if ($fieldlist[$field]=='libelle') $size='centpercent'; + if ($fieldlist[$field]=='tracking') $class='centpercent'; if ($fieldlist[$field]=='sortorder') $size='size="2" '; - print ''; + print ''; print ''; } } diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index b3f1d7a5d51..1b7c67e40f9 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -262,11 +262,11 @@ if ($action == 'setforcedate') } } -if ($action == 'set_FAC_AUTO_FILLJS') +if ($action == 'set_INVOICE_AUTO_FILLJS') { - $freetext = GETPOST('FAC_AUTO_FILLJS'); // No alpha here, we want exact string + $freetext = GETPOST('INVOICE_AUTO_FILLJS'); // No alpha here, we want exact string - $res = dolibarr_set_const($db, "FAC_AUTO_FILLJS",$freetext,'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db, "INVOICE_AUTO_FILLJS",$freetext,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; @@ -754,11 +754,11 @@ print ''; $var=! $var; print '
'; print ''; -print ''; +print ''; print ''; print $langs->trans("JSOnPaimentBill"); print ''; -print $form->selectyesno("FAC_AUTO_FILLJS",$conf->global->FAC_AUTO_FILLJS,1); +print $form->selectyesno("INVOICE_AUTO_FILLJS",$conf->global->INVOICE_AUTO_FILLJS,1); print ''; print ''; print "\n"; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 8cc02613f6c..f4e3d704121 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -41,6 +41,7 @@ $page_y=GETPOST('page_y','int'); $search_keyword=GETPOST('search_keyword','alpha'); $search_status=GETPOST('search_status','alpha'); $search_nature=GETPOST('search_nature','alpha'); +$search_version=GETPOST('search_version','alpha'); if (! $user->admin) accessforbidden(); @@ -64,8 +65,9 @@ $familyinfo=array( $param=''; if ($search_keyword) $param.='&search_keyword='.urlencode($search_keyword); -if ($search_status) $param.='&search_status='.urlencode($search_status); -if ($search_nature) $param.='&search_nature='.urlencode($search_nature); +if ($search_status) $param.='&search_status='.urlencode($search_status); +if ($search_nature) $param.='&search_nature='.urlencode($search_nature); +if ($search_version) $param.='&search_version='.urlencode($search_version); @@ -94,6 +96,7 @@ if (GETPOST('buttonreset')) $search_keyword=''; $search_status=''; $search_nature=''; + $search_version=''; } @@ -109,6 +112,7 @@ $_SESSION["mode"]=$mode; $help_url='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; llxHeader('',$langs->trans("Setup"),$help_url); +$arrayofnatures=array('core'=>$langs->transnoentitiesnoconv("Core"), 'external'=>$langs->transnoentitiesnoconv("External").' - '.$langs->trans("AllPublishers")); // Search modules dirs $modulesdir = dolGetModulesDirs(); @@ -170,11 +174,30 @@ foreach ($modulesdir as $dir) if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified=0; if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified=0; if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) $modulequalified=0; - // We discard modules according to property disabled - if (! empty($objMod->hidden)) $modulequalified=false; + // We discard modules according to property disabled + if (! empty($objMod->hidden)) $modulequalified=0; + + if ($modulequalified > 0) + { + $publisher=dol_escape_htmltag($objMod->getPublisher()); + $external=($objMod->isCoreOrExternalModule() == 'external'); + if ($external) + { + if ($publisher) + { + $arrayofnatures['external_'.$publisher]=$langs->trans("External").' - '.$publisher; + } + else + { + $arrayofnatures['external_']=$langs->trans("External").' - '.$langs->trans("UnknownPublishers"); + } + } + ksort($arrayofnatures); + } + // Define array $categ with categ with at least one qualified module - if ($modulequalified) + if ($modulequalified > 0) { $modules[$i] = $objMod; $filename[$i]= $modName; @@ -199,6 +222,7 @@ foreach ($modulesdir as $dir) $orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number $dirmod[$i] = $dir; + //print $i.'-'.$dirmod[$i].'
'; // Set categ[$i] $specialstring = isset($specialtostring[$special])?$specialtostring[$special]:'unknown'; if ($objMod->version == 'development' || $objMod->version == 'experimental') $specialstring='expdev'; @@ -254,15 +278,15 @@ if ($mode==='expdev') print $langs->trans("ModuleFamilyExperimental")."
$h = 0; $categidx='common'; // Main -if (! empty($categ[$categidx])) -{ +//if (! empty($categ[$categidx])) +//{ $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; $head[$h][1] = $langs->trans("AvailableModules"); $head[$h][2] = 'common'; $h++; -} +//} -$categidx='expdev'; +/*$categidx='expdev'; if (! empty($categ[$categidx])) { $categidx='expdev'; @@ -270,7 +294,7 @@ if (! empty($categ[$categidx])) $head[$h][1] = $form->textwithpicto($langs->trans("ModuleFamilyExperimental"), $langs->trans('DoNotUseInProduction'), 1, 'warning', '', 0, 3); $head[$h][2] = 'expdev'; $h++; -} +}*/ $categidx='marketplace'; $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; @@ -299,10 +323,20 @@ if ($mode != 'marketplace') $moreforfilter.= $langs->trans('Keyword') . ': '; $moreforfilter.= '
'; $moreforfilter.='
'; - $moreforfilter.= $langs->trans('Status') . ': '.$form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, 1); + $moreforfilter.= $langs->trans('Origin') . ': '.$form->selectarray('search_nature', $arrayofnatures, $search_nature, 1); $moreforfilter.= '
'; + if (! empty($conf->global->MAIN_FEATURES_LEVEL)) + { + $array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable")); + if ($conf->global->MAIN_FEATURES_LEVEL < 0) $array_version['deprecated']=$langs->trans("Deprecated"); + if ($conf->global->MAIN_FEATURES_LEVEL > 0) $array_version['experimental']=$langs->trans("Experimental"); + if ($conf->global->MAIN_FEATURES_LEVEL > 1) $array_version['development']=$langs->trans("Development"); + $moreforfilter.='
'; + $moreforfilter.= $langs->trans('Version') . ': '.$form->selectarray('search_version', $array_version, $search_version, 1); + $moreforfilter.= '
'; + } $moreforfilter.='
'; - $moreforfilter.= $langs->trans('Nature') . ': '.$form->selectarray('search_nature', array('standard'=>$langs->transnoentitiesnoconv("Standard"), 'external'=>$langs->transnoentitiesnoconv("External")), $search_nature, 1); + $moreforfilter.= $langs->trans('Status') . ': '.$form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, 1); $moreforfilter.= '
'; $moreforfilter.=' '; $moreforfilter.='
'; @@ -337,7 +371,8 @@ if ($mode != 'marketplace') $modName = $filename[$key]; $objMod = $modules[$key]; - + $dirofmodule = $dirmod[$key]; + $special = $objMod->special; //print $objMod->name." - ".$key." - ".$objMod->special.' - '.$objMod->version."
"; @@ -358,6 +393,8 @@ if ($mode != 'marketplace') $moduledesc=$objMod->getDesc(); $moduledesclong=$objMod->getDescLong(); $moduleauthor=$objMod->getPublisher(); + + // We discard showing according to filters if ($search_keyword) { $qualified=0; @@ -375,8 +412,22 @@ if ($mode != 'marketplace') } if ($search_nature) { - if ($search_nature == 'external' && $objMod->isCoreOrExternalModule() != 'external') continue; - if ($search_nature == 'standard' && $objMod->isCoreOrExternalModule() == 'external') continue; + if (preg_match('/^external/',$search_nature) && $objMod->isCoreOrExternalModule() != 'external') continue; + if (preg_match('/^external_(.*)$/',$search_nature, $reg)) + { + //print $reg[1].'-'.dol_escape_htmltag($objMod->getPublisher()); + $publisher=dol_escape_htmltag($objMod->getPublisher()); + if ($reg[1] && $reg[1] != $publisher) continue; + if (! $reg[1] && ! empty($publisher)) continue; + } + if ($search_nature == 'core' && $objMod->isCoreOrExternalModule() == 'external') continue; + } + if ($search_version) + { + if (($objMod->version == 'development' || $objMod->version == 'experimental' || preg_match('/deprecated/', $objMod->version)) && $search_version == 'stable') continue; + if ($objMod->version != 'development' && ($search_version == 'development')) continue; + if ($objMod->version != 'experimental' && ($search_version == 'experimental')) continue; + if (! preg_match('/deprecated/', $objMod->version) && ($search_version == 'deprecated')) continue; } // Load all lang files of module @@ -394,7 +445,7 @@ if ($mode != 'marketplace') if ($familykey!=$oldfamily) { print ''."\n"; - print ''; + print ''; $familytext=empty($familyinfo[$familykey]['label'])?$familykey:$familyinfo[$familykey]['label']; print $familytext; print "\n"; @@ -442,18 +493,171 @@ if ($mode != 'marketplace') print nl2br($objMod->getDesc()); print "\n"; - // Version - print ''; - $version=$objMod->getVersion(); - $dirofmodule=$dirmod[$key]; + // Help + print ''; + $text=''; + if ($objMod->getDescLong()) $text.=$objMod->getDesc().'
'.$objMod->getDescLong().'
'; + else $text.=$objMod->getDesc().'
'; + + $textexternal=''; if ($objMod->isCoreOrExternalModule() == 'external') { - $text=$langs->trans("ExternalModule",$dirofmodule); - if (! empty($objMod->editor_name) && $objMod->editor_name != 'dolibarr') $text.=' - '.$objMod->editor_name; - if (! empty($objMod->editor_web) && $objMod->editor_web != 'www.dolibarr.org') $text.=' - '.$objMod->editor_web; - print $form->textwithpicto($version, $text, 1, 'help'); + $textexternal.='
'.$langs->trans("Origin").': '.$langs->trans("ExternalModule",$dirofmodule); + if ($objMod->editor_name != 'dolibarr') $textexternal.='
'.$langs->trans("Publisher").': '.(empty($objMod->editor_name)?$langs->trans("Unknown"):$objMod->editor_name); + if (! empty($objMod->editor_url) && ! preg_match('/dolibarr\.org/i',$objMod->editor_url)) $textexternal.='
'.$langs->trans("Url").': '.$objMod->editor_url; + $text.=$textexternal; + $text.='
'; } - else print $version; + else + { + $text.='
'.$langs->trans("Origin").': '.$langs->trans("Core").'
'; + } + $text.='
'.$langs->trans("AddRemoveTabs").': '; + if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs)) + { + $i=0; + foreach($objMod->tabs as $val) + { + $tmp=explode(':',$val,3); + $text.=($i?', ':'').$tmp[0].':'.$tmp[1]; + $i++; + } + } + else $text.=$langs->trans("No"); + + $text.='
'.$langs->trans("AddDictionaries").': '; + if (isset($objMod->dictionaries) && isset($objMod->dictionaries['tablib']) && is_array($objMod->dictionaries['tablib']) && count($objMod->dictionaries['tablib'])) + { + $i=0; + foreach($objMod->dictionaries['tablib'] as $val) + { + $text.=($i?', ':'').$val; + $i++; + } + } + else $text.=$langs->trans("No"); + + $text.='
'.$langs->trans("AddBoxes").': '; + if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes)) + { + $i=0; + foreach($objMod->boxes as $val) + { + $text.=($i?', ':'').($val['file']?$val['file']:$val[0]); + $i++; + } + } + else $text.=$langs->trans("No"); + + $text.='
'.$langs->trans("AddModels").': '; + if (isset($objMod->module_parts) && isset($objMod->module_parts['models']) && $objMod->module_parts['models']) + { + $text.=$langs->trans("Yes"); + } + else $text.=$langs->trans("No"); + + $text.='
'.$langs->trans("AddSubstitutions").': '; + if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions']) + { + $text.=$langs->trans("Yes"); + } + else $text.=$langs->trans("No"); + + $text.='
'.$langs->trans("AddSheduledJobs").': '; + if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs)) + { + $i=0; + foreach($objMod->cronjobs as $val) + { + $text.=($i?', ':'').($val['label']); + $i++; + } + } + else $text.=$langs->trans("No"); + + $text.='
'.$langs->trans("AddTriggers").': '; + if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers']) + { + $text.=$langs->trans("Yes"); + } + else $text.=$langs->trans("No"); + + $text.='
'.$langs->trans("AddHooks").': '; + if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks'])) + { + $i=0; + foreach($objMod->module_parts['hooks'] as $val) + { + $text.=($i?', ':'').($val); + $i++; + } + } + else $text.=$langs->trans("No"); + + $text.='
'.$langs->trans("AddPermissions").': '; + if (isset($objMod->rights) && is_array($objMod->rights) && count($objMod->rights)) + { + $i=0; + foreach($objMod->rights as $val) + { + $text.=($i?', ':'').($val[1]); + $i++; + } + } + else $text.=$langs->trans("No"); + + $text.='
'.$langs->trans("AddMenus").': '; + if (isset($objMod->menu) && is_array($objMod->menu) && $objMod->menu) + { + $text.=$langs->trans("Yes"); + } + else $text.=$langs->trans("No"); + + $text.='
'.$langs->trans("AddExportProfiles").': '; + if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label)) + { + $i=0; + foreach($objMod->export_label as $val) + { + $text.=($i?', ':'').($val); + $i++; + } + } + else $text.=$langs->trans("No"); + + $text.='
'.$langs->trans("AddImportProfiles").': '; + if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label)) + { + $i=0; + foreach($objMod->import_label as $val) + { + $text.=($i?', ':'').($val); + $i++; + } + } + else $text.=$langs->trans("No"); + + $text.='
'.$langs->trans("AddOtherPagesOrServices").': '; + $text.=$langs->trans("DetectionNotPossible"); + + print $form->textwithpicto('', $text, 1, 'help', 'minheight20'); + + // Picto warning + $version=$objMod->getVersion(0); + $versiontrans=$objMod->getVersion(1); + if (preg_match('/development/i', $version)) print img_warning($langs->trans("Development"), 'style="float: right"'); + if (preg_match('/experimental/i', $version)) print img_warning($langs->trans("Experimental"), 'style="float: right"'); + if (preg_match('/deprecated/i', $version)) print img_warning($langs->trans("Deprecated"), 'style="float: right"'); + + // Picto external + if ($textexternal) print img_picto($langs->trans("ExternalModule",$dirofmodule), 'external', 'style="float: right"'); + + + print ''; + + // Version + print ''; + print $versiontrans; print "\n"; // Activate/Disable and Setup (2 columns) @@ -484,25 +688,25 @@ if ($mode != 'marketplace') { if (is_array($objMod->config_page_url)) { - print ' '; + print ''; $i=0; foreach ($objMod->config_page_url as $page) { $urlpage=$page; if ($i++) { - print ''.img_picto(ucfirst($page),"setup").' '; + print ''.img_picto(ucfirst($page),"setup").''; // print ''.ucfirst($page).' '; } else { if (preg_match('/^([^@]+)@([^@]+)$/i',$urlpage,$regs)) { - print ''.img_picto($langs->trans("Setup"),"setup").' '; + print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''; } else { - print ''.img_picto($langs->trans("Setup"),"setup").' '; + print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''; } } } @@ -510,16 +714,16 @@ if ($mode != 'marketplace') } else if (preg_match('/^([^@]+)@([^@]+)$/i',$objMod->config_page_url,$regs)) { - print ''.img_picto($langs->trans("Setup"),"setup").''; + print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''; } else { - print ''.img_picto($langs->trans("Setup"),"setup").''; + print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''; } } else { - print " "; + print ''.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp" style="padding-right: 6px"').''; } } @@ -542,7 +746,7 @@ if ($mode != 'marketplace') print "\n"; } print "\n"; - print " "; + print ''.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp" style="padding-right: 6px"').''; } print "\n"; diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index 1213a9b2238..d3c421e31ec 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -114,9 +114,8 @@ llxHeader('',$langs->trans("Files"),$wikihelp); print load_fiche_titre($langs->trans("SecuritySetup"),'','title_setup'); -//print $langs->trans("FilesDesc")."
\n"; -//print "
\n"; - +print $langs->trans("SecurityFilesDesc")."
\n"; +print "
\n"; print ''; diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 224ca245734..b827fe88737 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -25,6 +25,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/utils.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; $langs->load("admin"); @@ -111,175 +112,34 @@ $outputdir = $conf->admin->dir_output.'/backup'; $result=dol_mkdir($outputdir); +$utils = new Utils($db); + + // MYSQL if ($what == 'mysql') { + $cmddump=GETPOST("mysqldump"); // Do not sanitize here with 'alpha', will be sanitize later by escapeshellarg if ($cmddump) { dolibarr_set_const($db, 'SYSTEMTOOLS_MYSQLDUMP', $cmddump,'chaine',0,'',$conf->entity); } - $outputfile = $outputdir.'/'.$file; - // for compression format, we add extension - $compression=GETPOST('compression') ? GETPOST('compression','alpha') : 'none'; - if ($compression == 'gz') $outputfile.='.gz'; - if ($compression == 'bz') $outputfile.='.bz2'; - $outputerror = $outputfile.'.err'; - dol_mkdir($conf->admin->dir_output.'/backup'); - - // Parameteres execution - $command=$cmddump; - if (preg_match("/\s/",$command)) $command=escapeshellarg($command); // Use quotes on command - - //$param=escapeshellarg($dolibarr_main_db_name)." -h ".escapeshellarg($dolibarr_main_db_host)." -u ".escapeshellarg($dolibarr_main_db_user)." -p".escapeshellarg($dolibarr_main_db_pass); - $param=$dolibarr_main_db_name." -h ".$dolibarr_main_db_host; - $param.=" -u ".$dolibarr_main_db_user; - if (! empty($dolibarr_main_db_port)) $param.=" -P ".$dolibarr_main_db_port; - if (! GETPOST("use_transaction")) $param.=" -l --single-transaction"; - if (GETPOST("disable_fk")) $param.=" -K"; - if (GETPOST("sql_compat") && GETPOST("sql_compat") != 'NONE') $param.=" --compatible=".escapeshellarg(GETPOST("sql_compat","alpha")); - if (GETPOST("drop_database")) $param.=" --add-drop-database"; - if (GETPOST("sql_structure")) - { - if (GETPOST("drop")) $param.=" --add-drop-table=TRUE"; - else $param.=" --add-drop-table=FALSE"; - } - else - { - $param.=" -t"; - } - if (GETPOST("disable-add-locks")) $param.=" --add-locks=FALSE"; - if (GETPOST("sql_data")) - { - $param.=" --tables"; - if (GETPOST("showcolumns")) $param.=" -c"; - if (GETPOST("extended_ins")) $param.=" -e"; - else $param.=" --skip-extended-insert"; - if (GETPOST("delayed")) $param.=" --delayed-insert"; - if (GETPOST("sql_ignore")) $param.=" --insert-ignore"; - if (GETPOST("hexforbinary")) $param.=" --hex-blob"; - } - else - { - $param.=" -d"; // No row information (no data) - } - $param.=" --default-character-set=utf8"; // We always save output into utf8 charset - $paramcrypted=$param; - $paramclear=$param; - if (! empty($dolibarr_main_db_pass)) - { - $paramcrypted.=' -p"'.preg_replace('/./i','*',$dolibarr_main_db_pass).'"'; - $paramclear.=' -p"'.str_replace(array('"','`'),array('\"','\`'),$dolibarr_main_db_pass).'"'; - } - - $_SESSION["commandbackuplastdone"]=$command." ".$paramcrypted; - $_SESSION["commandbackuptorun"]=""; - /* - print ''.$langs->trans("RunCommandSummary").':
'."\n"; - print '
'."\n"; - print '
'; - - //print $paramclear; - - // Now run command and show result - print ''.$langs->trans("BackupResult").': '; - */ - - $errormsg=''; - - // Debut appel methode execution - $fullcommandcrypted=$command." ".$paramcrypted." 2>&1"; - $fullcommandclear=$command." ".$paramclear." 2>&1"; - if ($compression == 'none') $handle = fopen($outputfile, 'w'); - if ($compression == 'gz') $handle = gzopen($outputfile, 'w'); - if ($compression == 'bz') $handle = bzopen($outputfile, 'w'); - - if ($handle) - { - $ok=0; - dol_syslog("Run command ".$fullcommandcrypted); - $handlein = popen($fullcommandclear, 'r'); - $i=0; - while (!feof($handlein)) - { - $i++; // output line number - $read = fgets($handlein); - if ($i == 1 && preg_match('/'.preg_quote('Warning: Using a password').'/i', $read)) continue; - fwrite($handle,$read); - if (preg_match('/'.preg_quote('-- Dump completed').'/i',$read)) $ok=1; - elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i',$read)) $ok=1; - } - pclose($handlein); - - if ($compression == 'none') fclose($handle); - if ($compression == 'gz') gzclose($handle); - if ($compression == 'bz') bzclose($handle); - - if (! empty($conf->global->MAIN_UMASK)) - @chmod($outputfile, octdec($conf->global->MAIN_UMASK)); - } - else - { - $langs->load("errors"); - dol_syslog("Failed to open file ".$outputfile,LOG_ERR); - $errormsg=$langs->trans("ErrorFailedToWriteInDir"); - } - - // Get errorstring - if ($compression == 'none') $handle = fopen($outputfile, 'r'); - if ($compression == 'gz') $handle = gzopen($outputfile, 'r'); - if ($compression == 'bz') $handle = bzopen($outputfile, 'r'); - if ($handle) - { - // Get 2048 first chars of error message. - $errormsg = fgets($handle,2048); - // Close file - if ($compression == 'none') fclose($handle); - if ($compression == 'gz') gzclose($handle); - if ($compression == 'bz') bzclose($handle); - if ($ok && preg_match('/^-- MySql/i',$errormsg)) $errormsg=''; // Pas erreur - else - { - // Renommer fichier sortie en fichier erreur - //print "$outputfile -> $outputerror"; - @dol_delete_file($outputerror,1); - @rename($outputfile,$outputerror); - // Si safe_mode on et command hors du parametre exec, on a un fichier out vide donc errormsg vide - if (! $errormsg) - { - $langs->load("errors"); - $errormsg=$langs->trans("ErrorFailedToRunExternalCommand"); - } - } - } - // Fin execution commande + $utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file); + + $errormsg=$utils->error; + $_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone']; + $_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun']; } +// MYSQL NO BIN if ($what == 'mysqlnobin') { - $outputfile = $outputdir.'/'.$file; - $outputfiletemp = $outputfile.'-TMP.sql'; - // for compression format, we add extension - $compression=GETPOST('compression') ? GETPOST('compression','alpha') : 'none'; - if ($compression == 'gz') $outputfile.='.gz'; - if ($compression == 'bz') $outputfile.='.bz2'; - $outputerror = $outputfile.'.err'; - dol_mkdir($conf->admin->dir_output.'/backup'); + $utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file); - if ($compression == 'gz' or $compression == 'bz') - { - backup_tables($outputfiletemp); - dol_compress_file($outputfiletemp, $outputfile, $compression); - unlink($outputfiletemp); - } - else - { - backup_tables($outputfile); - } - - $_SESSION["commandbackuplastdone"]=""; - $_SESSION["commandbackuptorun"]=""; + $errormsg=$utils->error; + $_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone']; + $_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun']; } // POSTGRESQL @@ -291,65 +151,13 @@ if ($what == 'postgresql') dolibarr_set_const($db, 'SYSTEMTOOLS_POSTGRESQLDUMP', $cmddump,'chaine',0,'',$conf->entity); } - $outputfile = $outputdir.'/'.$file; - // for compression format, we add extension - $compression=GETPOST('compression') ? GETPOST('compression','alpha') : 'none'; - if ($compression == 'gz') $outputfile.='.gz'; - if ($compression == 'bz') $outputfile.='.bz2'; - $outputerror = $outputfile.'.err'; - dol_mkdir($conf->admin->dir_output.'/backup'); + $utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file); + + $errormsg=$utils->error; + $_SESSION["commandbackuplastdone"]=$utils->result['commandbackuplastdone']; + $_SESSION["commandbackuptorun"]=$utils->result['commandbackuptorun']; - // Parameteres execution - $command=$cmddump; - if (preg_match("/\s/",$command)) $command=escapeshellarg($command); // Use quotes on command - - //$param=escapeshellarg($dolibarr_main_db_name)." -h ".escapeshellarg($dolibarr_main_db_host)." -u ".escapeshellarg($dolibarr_main_db_user)." -p".escapeshellarg($dolibarr_main_db_pass); - //$param="-F c"; - $param="-F p"; - $param.=" --no-tablespaces --inserts -h ".$dolibarr_main_db_host; - $param.=" -U ".$dolibarr_main_db_user; - if (! empty($dolibarr_main_db_port)) $param.=" -p ".$dolibarr_main_db_port; - if (GETPOST("sql_compat") && GETPOST("sql_compat") == 'ANSI') $param.=" --disable-dollar-quoting"; - if (GETPOST("drop_database")) $param.=" -c -C"; - if (GETPOST("sql_structure")) - { - if (GETPOST("drop")) $param.=" --add-drop-table"; - if (! GETPOST("sql_data")) $param.=" -s"; - } - if (GETPOST("sql_data")) - { - if (! GETPOST("sql_structure")) $param.=" -a"; - if (GETPOST("showcolumns")) $param.=" -c"; - } - $param.=' -f "'.$outputfile.'"'; - //if ($compression == 'none') - if ($compression == 'gz') $param.=' -Z 9'; - //if ($compression == 'bz') - $paramcrypted=$param; - $paramclear=$param; - /*if (! empty($dolibarr_main_db_pass)) - { - $paramcrypted.=" -W".preg_replace('/./i','*',$dolibarr_main_db_pass); - $paramclear.=" -W".$dolibarr_main_db_pass; - }*/ - $paramcrypted.=" -w ".$dolibarr_main_db_name; - $paramclear.=" -w ".$dolibarr_main_db_name; - - $_SESSION["commandbackuplastdone"]=""; - $_SESSION["commandbackuptorun"]=$command." ".$paramcrypted; - /*print $langs->trans("RunCommandSummaryToLaunch").':
'."\n"; - print '
'."\n"; - - print '
'; - - - // Now show to ask to run command - print $langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser",$dolibarr_main_db_user,$dolibarr_main_db_user); - - print '
'; - print '
';*/ - - $what=''; + $what=''; // Clear to show message to run command } diff --git a/htdocs/admin/tools/index.php b/htdocs/admin/tools/index.php index 9b08054beac..8da041d05da 100644 --- a/htdocs/admin/tools/index.php +++ b/htdocs/admin/tools/index.php @@ -40,7 +40,7 @@ $form = new Form($db); $title=$langs->trans("SystemToolsArea"); if (GETPOST('leftmenu') == 'admintools') $title=$langs->trans("ModulesSystemTools"); -llxHeader(array(),$title); +llxHeader('', $title); print load_fiche_titre($title,'','title_setup'); diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 4ba759a66fa..e05ec712eeb 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -61,11 +61,13 @@ $search_user = GETPOST("search_user"); $search_desc = GETPOST("search_desc"); $search_ua = GETPOST("search_ua"); -$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); -$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); +if (!isset($_REQUEST["date_startmonth"]) || $_REQUEST["date_startmonth"] > 0) $date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); +else $date_start=-1; +if (!isset($_REQUEST["date_endmonth"]) || $_REQUEST["date_endmonth"] > 0) $date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); +else $date_end=-1; // checks:if date_start>date_end then date_end=date_start + 24 hours -if ($date_start > $date_end) $date_end=$date_start+86400; +if ($date_start > 0 && $date_end > 0 && $date_start > $date_end) $date_end=$date_start+86400; $now = dol_now(); $nowarray = dol_getdate($now); @@ -94,6 +96,18 @@ if (empty($date_end)) $now=dol_now(); +// Purge search criteria +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $date_start=-1; + $date_end=-1; + $search_code=''; + $search_ip=''; + $search_user=''; + $search_desc=''; + $search_ua=''; +} + // Purge audit events if ($action == 'confirm_purge' && $confirm == 'yes' && $user->admin) { @@ -152,12 +166,13 @@ $sql.= " u.login"; $sql.= " FROM ".MAIN_DB_PREFIX."events as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user"; $sql.= " WHERE e.entity IN (".getEntity('actioncomm', 1).")"; -$sql.= " AND e.dateevent >= '".$db->idate($date_start)."' AND e.dateevent <= '".$db->idate($date_end)."'"; -if ($search_code) { $usefilter++; $sql.=" AND e.type LIKE '%".$db->escape($search_code)."%'"; } -if ($search_ip) { $usefilter++; $sql.=" AND e.ip LIKE '%".$db->escape($search_ip)."%'"; } -if ($search_user) { $usefilter++; $sql.=" AND u.login LIKE '%".$db->escape($search_user)."%'"; } -if ($search_desc) { $usefilter++; $sql.=" AND e.description LIKE '%".$db->escape($search_desc)."%'"; } -if ($search_ua) { $usefilter++; $sql.=" AND e.user_agent LIKE '%".$db->escape($search_ua)."%'"; } +if ($date_start > 0) $sql.= " AND e.dateevent >= '".$db->idate($date_start)."'"; +if ($date_end > 0) $sql.= " AND e.dateevent <= '".$db->idate($date_end)."'"; +if ($search_code) { $usefilter++; $sql.=natural_search("e.type", $search_code, 0); } +if ($search_ip) { $usefilter++; $sql.=natural_search("e.ip", $search_ip, 0); } +if ($search_user) { $usefilter++; $sql.=natural_search("u.login", $search_user, 0); } +if ($search_desc) { $usefilter++; $sql.=natural_search("e.description", $search_desc, 0); } +if ($search_ua) { $usefilter++; $sql.=natural_search("e.user_agent", $search_ua, 0); } $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($conf->liste_limit+1, $offset); //print $sql; @@ -169,13 +184,18 @@ if ($result) $param=''; if ($search_code) $param.='&search_code='.$search_code; - if ($search_ip) $param.='&search_ip='.$search_ip; + if ($search_ip) $param.='&search_ip='.$search_ip; if ($search_user) $param.='&search_user='.$search_user; if ($search_desc) $param.='&search_desc='.$search_desc; - if ($search_ua) $param.='&search_ua='.$search_ua; + if ($search_ua) $param.='&search_ua='.$search_ua; - $langs->load('withdrawals'); - print_barre_liste($langs->trans("ListOfSecurityEvents").' : '.$num.' '.strtolower($langs->trans("Lines")), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, 0, 'setup'); + $langs->load('withdrawals'); + if ($num) + { + $center=''.$langs->trans("Purge").''; + } + + print_barre_liste($langs->trans("ListOfSecurityEvents").' ('.$num.')', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, 0, 'setup'); if ($action == 'purge') { @@ -218,7 +238,8 @@ if ($result) print ''; print ''; - print ''; + $searchpitco=$form->showFilterAndCheckAddButtons(0); + print $searchpitco; print ''; print "\n"; @@ -284,13 +305,6 @@ if ($result) } print ""; $db->free($result); - - if ($num) - { - print '
'; - print ''.$langs->trans("Purge").''; - print '
'; - } } else { diff --git a/htdocs/admin/tools/update.php b/htdocs/admin/tools/update.php index cb4890f77f1..45b20588121 100644 --- a/htdocs/admin/tools/update.php +++ b/htdocs/admin/tools/update.php @@ -40,8 +40,8 @@ if (GETPOST('msg','alpha')) { $urldolibarr='http://www.dolibarr.org/downloads/'; -$urldolibarrmodules='http://www.dolistore.com/'; -$urldolibarrthemes='http://www.dolistore.com/'; +$urldolibarrmodules='https://www.dolistore.com/'; +$urldolibarrthemes='https://www.dolistore.com/'; $dolibarrroot=preg_replace('/([\\/]+)$/i','',DOL_DOCUMENT_ROOT); $dolibarrroot=preg_replace('/([^\\/]+)$/i','',$dolibarrroot); $dolibarrdataroot=preg_replace('/([\\/]+)$/i','',DOL_DATA_ROOT); diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index d3252a4fc9b..f5c5970e9b3 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -23,6 +23,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; $langs->load("companies"); $langs->load("products"); @@ -107,6 +108,8 @@ if ($action == 'delete') * View */ +$formadmin = new FormAdmin($db); + $wikihelp='EN:Setup|FR:Paramétrage|ES:Configuración'; llxHeader('',$langs->trans("Setup"),$wikihelp); @@ -146,7 +149,10 @@ print "\n"; $var=false; print "\n"; -print ''."\n"; +print ''; +print $formadmin->select_language(GETPOST('langcode'),'langcode',0,null,1,0,0,'',1); +//print ''; +print ''."\n"; print ''; print ''; print ''; diff --git a/htdocs/cashdesk/affContenu.php b/htdocs/cashdesk/affContenu.php index 3f27d19c7f3..280f2b81908 100644 --- a/htdocs/cashdesk/affContenu.php +++ b/htdocs/cashdesk/affContenu.php @@ -59,7 +59,7 @@ exit;*/ print '
'; print '
'; -$page=GETPOST('menu','alpha'); +$page=GETPOST('menutpl','alpha'); if (empty($page)) $page='facturation'; if (in_array( diff --git a/htdocs/cashdesk/affIndex.php b/htdocs/cashdesk/affIndex.php index bfc49044bf8..9235748e37c 100644 --- a/htdocs/cashdesk/affIndex.php +++ b/htdocs/cashdesk/affIndex.php @@ -42,7 +42,7 @@ $langs->load("cashdesk"); */ //header("Content-type: text/html; charset=UTF-8"); -header("Content-type: text/html; charset=".$conf->file->character_set_client); +//header("Content-type: text/html; charset=".$conf->file->character_set_client); $arrayofjs=array(); $arrayofcss=array('/cashdesk/css/style.css'); diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index fd67bf9e2ae..240b32e34db 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -99,31 +99,24 @@ class Facturation $product = new Product($db); $product->fetch($this->id); - $sql = "SELECT taux"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_tva"; - $sql.= " WHERE rowid = ".$this->tva(); - - dol_syslog("ajoutArticle", LOG_DEBUG); - $resql = $db->query($sql); - - if ($resql) - { - $obj = $db->fetch_object($resql); - $vat_rate=$obj->taux; - //var_dump($vat_rate);exit; - } - else - { - dol_print_error($db); - } - + + $vatrowid = $this->tva(); + + $tmp = getTaxesFromId($vatrowid); + $vat_rate = $tmp['rate']; + $vat_npr = $tmp['npr']; + + $localtaxarray = getLocalTaxesFromRate($vatrowid, 0, $societe, $mysoc, 1); + // Define part of HT, VAT, TTC - $resultarray=calcul_price_total($this->qte,$this->prix(),$this->remisePercent(),$vat_rate,0,0,0,'HT',0,$product->type,$mysoc); + $resultarray=calcul_price_total($this->qte, $this->prix(), $this->remisePercent(), $vat_rate, -1, -1, 0, 'HT', $use_npr, $product->type, $mysoc, $localtaxarray); // Calcul du total ht sans remise $total_ht = $resultarray[0]; $total_vat = $resultarray[1]; $total_ttc = $resultarray[2]; + $total_localtax1 = $resultarray[9]; + $total_localtax2 = $resultarray[10]; // Calcul du montant de la remise if ($this->remisePercent()) @@ -143,7 +136,7 @@ class Facturation $newcartarray[$i]['label']=$product->label; $newcartarray[$i]['price']=$product->price; $newcartarray[$i]['price_ttc']=$product->price_ttc; - + if (! empty($conf->global->PRODUIT_MULTIPRICES)) { if (isset($product->multiprices[$societe->price_level])) @@ -160,6 +153,9 @@ class Facturation $newcartarray[$i]['remise']=price2num($montant_remise_ht); $newcartarray[$i]['total_ht']=price2num($total_ht,'MT'); $newcartarray[$i]['total_ttc']=price2num($total_ttc,'MT'); + $newcartarray[$i]['total_vat']=price2num($total_vat, 'MT'); + $newcartarray[$i]['total_localtax1']=price2num($total_localtax1, 'MT'); + $newcartarray[$i]['total_localtax2']=price2num($total_localtax2, 'MT'); $_SESSION['poscart']=$newcartarray; $this->raz(); @@ -213,12 +209,18 @@ class Facturation // Total HT $remise = $tab[$i]['remise']; $total_ht += ($tab[$i]['total_ht']); + $total_vat += ($tab[$i]['total_vat']); $total_ttc += ($tab[$i]['total_ttc']); + $total_localtax1 += ($tab[$i]['total_localtax1']); + $total_localtax2 += ($tab[$i]['total_localtax2']); } $this->prix_total_ttc = $total_ttc; $this->prix_total_ht = $total_ht; - + $this->prix_total_vat = $total_vat; + $this->prix_total_localtax1 = $total_localtax1; + $this->prix_total_localtax2 = $total_localtax2; + $this->montant_tva = $total_ttc - $total_ht; //print $this->prix_total_ttc.'eeee'; exit; } @@ -442,9 +444,8 @@ class Facturation * @param int $aTva Vat * @return int Vat */ - public function tva ( $aTva=null ) + public function tva($aTva=null) { - if ( !$aTva ) { return $this->tva; @@ -467,9 +468,8 @@ class Facturation * @param string $aNumFacture Invoice ref * @return string Invoice ref */ - public function numInvoice( $aNumFacture=null ) + public function numInvoice($aNumFacture=null) { - if ( !$aNumFacture ) { return $this->num_facture; diff --git a/htdocs/cashdesk/facturation_verif.php b/htdocs/cashdesk/facturation_verif.php index 8953f7b0ccc..95a129e88a5 100644 --- a/htdocs/cashdesk/facturation_verif.php +++ b/htdocs/cashdesk/facturation_verif.php @@ -37,7 +37,7 @@ switch ( $_GET['action'] ) default: if ( $_POST['hdnSource'] != 'NULL' ) { - $sql = "SELECT p.rowid, p.ref, p.price, p.tva_tx"; + $sql = "SELECT p.rowid, p.ref, p.price, p.tva_tx, p.recuperableonly"; if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= ", ps.reel"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = ".$conf_fkentrepot; @@ -66,19 +66,23 @@ switch ( $_GET['action'] ) { $ret[$key] = $value; } + // Here $ret['tva_tx'] is vat rate of product but we want to not use the one into table but found by function + + $productid = $ret['rowid']; + $product = new Product($db); + $product->fetch($productid); - /** add Ditto for MultiPrix*/ - if (! empty($conf->global->PRODUIT_MULTIPRICES)) + $thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY']; + $societe = new Societe($db); + $societe->fetch($thirdpartyid); + + $tva_tx = get_default_tva($mysoc,$societe,$productid); + $tva_npr = get_default_npr($mysoc,$societe,$productid); + if (empty($tva_tx)) $tva_npr=0; + dol_syslog('tva_tx='.$tva_tx.'-tva_npr='.$tva_npr); + + if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($societe->price_level)) { - $thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY']; - $productid = $ret['rowid']; - - $societe = new Societe($db); - $societe->fetch($thirdpartyid); - - $product = new Product($db); - $product->fetch($productid); - if(isset($product->multiprices[$societe->price_level])) { $ret['price'] = $product->multiprices[$societe->price_level]; @@ -86,16 +90,39 @@ switch ( $_GET['action'] ) // $product->multiprices_min[$societe->price_level]; // $product->multiprices_min_ttc[$societe->price_level]; // $product->multiprices_base_type[$societe->price_level]; - $ret['tva_tx'] = $product->multiprices_tva_tx[$societe->price_level]; + if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility + { + if (isset($prod->multiprices_tva_tx[$societe->price_level])) $tva_tx=$prod->multiprices_tva_tx[$societe->price_level]; + if (isset($prod->multiprices_recuperableonly[$societe->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$societe->price_level]; + if (empty($tva_tx)) $tva_npr=0; + } } } - /** end add Ditto */ + $ret['tva_tx'] = $tva_tx; + $ret['tva_npr'] = $tva_npr; + //var_dump('tva_tx='.$ret['tva_tx'].'-tva_npr='.$ret['tva_npr'].'-'.$conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL);exit; + $obj_facturation->id($ret['rowid']); $obj_facturation->ref($ret['ref']); $obj_facturation->stock($ret['reel']); $obj_facturation->prix($ret['price']); - $obj_facturation->tva($ret['tva_tx']); + + // Use $ret['tva_tx'] / ret['tva_npr'] to find vat id + $vatrowid = null; + $sqlfindvatid = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'c_tva'; + $sqlfindvatid.= ' WHERE taux = '.$ret['tva_tx'].' AND recuperableonly = '.(int) $ret['tva_npr']; + $sqlfindvatid.= ' AND fk_pays = '.$mysoc->country_id; + $resqlfindvatid=$db->query($sqlfindvatid); + if ($resqlfindvatid) + { + $obj = $db->fetch_object($resqlfindvatid); + if ($obj) $vatrowid = $obj->rowid; + } + else dol_print_error($db); + + dol_syslog("save vatrowid=".$vatrowid); + $obj_facturation->tva($vatrowid); // Save vat it for next use // Definition du filtre pour n'afficher que le produit concerne if ( $_POST['hdnSource'] == 'LISTE' ) @@ -107,7 +134,7 @@ switch ( $_GET['action'] ) $filtre = $_POST['txtRef']; } - $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation&filtre='.$filtre; + $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation&filtre='.$filtre; } else { @@ -115,11 +142,11 @@ switch ( $_GET['action'] ) if ( $_POST['hdnSource'] == 'REF' ) { - $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation&filtre='.$_POST['txtRef']; + $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation&filtre='.$_POST['txtRef']; } else { - $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation'; + $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation'; } } } @@ -130,40 +157,38 @@ switch ( $_GET['action'] ) } else { - $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation'; + $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation'; } break; case 'ajout_article': // We have clicked on button "Add product" - //var_dump('ajout_article'); - //exit; - if (! empty($obj_facturation->id)) // A product was previously selected and stored in session, so we can add it { + dol_syslog("facturation_verif save vat ".$_POST['selTva']); $obj_facturation->qte($_POST['txtQte']); - $obj_facturation->tva($_POST['selTva']); + $obj_facturation->tva($_POST['selTva']); // Save VAT selected so we can use it for next product $obj_facturation->remisePercent($_POST['txtRemise']); $obj_facturation->ajoutArticle(); // This add an entry into $_SESSION['poscart'] // We update prixTotalTtc } - $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation'; + $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation'; break; case 'suppr_article': $obj_facturation->supprArticle($_GET['suppr_id']); - $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation'; + $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation'; break; } // We saved object obj_facturation $_SESSION['serObjFacturation'] = serialize($obj_facturation); - +//var_dump($_SESSION['serObjFacturation']); header('Location: '.$redirection); exit; diff --git a/htdocs/cashdesk/index_verif.php b/htdocs/cashdesk/index_verif.php index db80866a77f..238a73f6ef7 100644 --- a/htdocs/cashdesk/index_verif.php +++ b/htdocs/cashdesk/index_verif.php @@ -125,7 +125,7 @@ if ( $retour >= 0 ) $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] = ($bankid_cb > 0 ? $bankid_cb : ''); //var_dump($_SESSION);exit; - header('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation&id=NOUV'); + header('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation&id=NOUV'); exit; } else diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php index f9ef89e909c..ecb11c3e6ee 100644 --- a/htdocs/cashdesk/tpl/facturation1.tpl.php +++ b/htdocs/cashdesk/tpl/facturation1.tpl.php @@ -119,7 +119,7 @@ $langs->load("cashdesk"); - + @@ -128,16 +128,17 @@ $langs->load("cashdesk"); diff --git a/htdocs/cashdesk/tpl/menu.tpl.php b/htdocs/cashdesk/tpl/menu.tpl.php index ce38bb7d7e8..745ea723b49 100644 --- a/htdocs/cashdesk/tpl/menu.tpl.php +++ b/htdocs/cashdesk/tpl/menu.tpl.php @@ -62,7 +62,7 @@ $langs->load("main"); print '