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 290ef468085..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'; 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/skeleton_list.php b/dev/skeletons/skeleton_list.php index bbe67d68df5..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') { @@ -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"; @@ -379,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); @@ -387,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)) { @@ -403,6 +432,7 @@ if ($resql) $tmpkey='options_'.$key; print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); print ''; + if (! $i) $totalarray['nbfield']++; } } } @@ -416,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'])) @@ -423,6 +454,7 @@ if ($resql) print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour'); print ''; + if (! $i) $totalarray['nbfield']++; } // Status /* @@ -431,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/card.php b/htdocs/accountancy/admin/card.php index 04d538b1b31..f1f1218f554 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -216,12 +216,8 @@ if ($action == 'create') { $head = accounting_prepare_head($object); // Edit mode - if ($action == 'update') { - $soc = new Societe($db); - if ($object->socid) { - $soc->fetch($object->socid); - } - + if ($action == 'update') + { dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr'); print '
' . "\n"; 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/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/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/modules.php b/htdocs/admin/modules.php index e948bb67cd0..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('Origin') . ': '.$form->selectarray('search_nature', array('standard'=>$langs->transnoentitiesnoconv("Core"), '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) @@ -498,11 +702,11 @@ if ($mode != 'marketplace') { 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 ''.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp"').''; + 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 ''.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp"').''; + 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/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/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 3406876e54e..4cd38a693b6 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1451,8 +1451,8 @@ class Categorie extends CommonObject if (file_exists($originImage)) { - // Cree fichier en taille vignette - $this->add_thumb($originImage); + // Create thumbs + $this->addThumbs($originImage); } } } @@ -1478,7 +1478,7 @@ class Categorie extends CommonObject $handle=opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle)) != false) + while (($file = readdir($handle)) !== false) { if (dol_is_file($dir.$file) && preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$dir.$file)) { diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index f3a84eed5d5..783326c1e4f 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -79,7 +79,7 @@ if ($action == 'confirm_delete' && $_GET["file"] && $confirm == 'yes' && $user-> if ($action == 'addthumb' && $_GET["file"]) { - $object->add_thumb($upload_dir."/".$_GET["file"]); + $object->addThumbs($upload_dir."/".$_GET["file"]); } diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 29f29a7e8cd..62798371a58 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1090,17 +1090,22 @@ if ($id > 0) // Thirdparty - Contact if ($conf->societe->enabled) { - print ''.$langs->trans("ActionOnCompany").''; + print ''.$langs->trans("ActionOnCompany").''; print ''; + print '
'; $events=array(); - $events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); - print $form->select_company($object->socid,'socid','',1,1,0,$events); - print ''; + $events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); + print $form->select_company($object->socid, 'socid', '', 'SelectThirdParty', 1, 0, $events, 0); + print '
'; + print ''; // Contact - print ''.$langs->trans("Contact").''; + print ''.$langs->trans("Contact").''; + print '
'; $form->select_contacts($object->socid, $object->contactid, 'contactid', 1, '', '', 0, 'minwidth200'); - print ''; + print '
'; + print ''; + print ''; } // Project @@ -1108,10 +1113,10 @@ if ($id > 0) { $formproject=new FormProjets($db); - $langs->load("project"); + $langs->load("projects"); - print ''.$langs->trans("Project").''; - $numprojet=$formproject->select_projects($object->socid,$object->fk_project,'projectid'); + print ''.$langs->trans("Project").''; + $numprojet=$formproject->select_projects($object->socid, $object->fk_project, 'projectid'); if ($numprojet==0) { print '   '.$langs->trans("AddProject").''; @@ -1120,7 +1125,7 @@ if ($id > 0) } // Priority - print ''.$langs->trans("Priority").''; + print ''.$langs->trans("Priority").''; print ''; print ''; @@ -1136,7 +1141,7 @@ if ($id > 0) print ''.$langs->trans("Description").''; // Editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('note',$object->note,'',240,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90); + $doleditor=new DolEditor('note',$object->note,'',200,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90); $doleditor->Create(); print ''; @@ -1281,7 +1286,7 @@ if ($id > 0) // Third party - Contact if ($conf->societe->enabled) { - print ''.$langs->trans("ActionOnCompany").''.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None")); + print ''.$langs->trans("ActionOnCompany").''.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None")); if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL') { if ($object->thirdparty->fetch($object->thirdparty->id)) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 3988a986f67..62b251ac01d 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -124,6 +124,14 @@ if (empty($reshook)) if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } + // customer preferred shipping method + if ($action == 'setshippingmethod' && $user->rights->societe->creer) + { + $object->fetch($id); + $result = $object->setShippingMethod(GETPOST('shipping_method_id','int')); + if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); + } + // assujetissement a la TVA if ($action == 'setassujtva' && $user->rights->societe->creer) { @@ -239,8 +247,8 @@ if ($id > 0) if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''.$langs->trans("Prefix").''; - print ($object->prefix_comm?$object->prefix_comm:' '); - print ''; + print ($object->prefix_comm?$object->prefix_comm:' '); + print ''; } if ($object->client) @@ -431,6 +439,27 @@ if ($id > 0) print '
'; } + // Preferred shipping Method + if (! empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD)) { + print ''; + print ''; + print '
'; + print $langs->trans('SendingMethod'); + print ''; + if (($action != 'editshipping') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; + print ''; + if ($action == 'editshipping') + { + $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->shipping_method_id,'shipping_method_id'); + } + else + { + $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->shipping_method_id,'none'); + } + print ""; + print ''; + } + // Categories if (!empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) { print '' . $langs->trans( "Categories" ) . ''; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 0da36deedb3..dea894a0258 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1320,6 +1320,9 @@ if ($action == 'create') print $soc->getNomUrl(1); print ''; print ''; + if (! empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && ! empty($soc->shipping_method_id)) { + $shipping_method_id = $soc->shipping_method_id; + } } else { print ''; print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 1); @@ -2421,10 +2424,7 @@ if ($action == 'create') $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; - if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set - { - $formmail->trackid='pro'.$object->id; - } + $formmail->trackid='pro'.$object->id; if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set { include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 3769ce35d45..a83600072d4 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -547,7 +547,7 @@ class Propal extends CommonObject if (! empty($fk_parent_line)) $this->line_order(true,'DESC'); // Mise a jour informations denormalisees au niveau de la propale meme - $result=$this->update_price(1,'auto'); // This method is designed to add line from user input so total calculation must be done using 'auto' mode. + $result=$this->update_price(1,'auto',0,$mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode. if ($result > 0) { $this->db->commit(); @@ -2037,9 +2037,10 @@ class Propal extends CommonObject */ function classer_facturee() { + global $user; dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); - return $this->classifyBilled(); + return $this->classifyBilled($user); } /** @@ -2841,8 +2842,8 @@ class Propal extends CommonObject /** * Retrieve an array of propal lines - * - * @return int <0 if ko, >0 if ok + * + * @return int >0 if OK, <0 if KO */ function getLinesArray() { diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index ea0e1ce2de2..ac22565ff15 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -59,7 +59,7 @@ $search_societe=GETPOST('search_societe','alpha'); $search_montant_ht=GETPOST('search_montant_ht','alpha'); $search_montant_vat=GETPOST('search_montant_vat','alpha'); $search_montant_ttc=GETPOST('search_montant_ttc','alpha'); -$search_author=GETPOST('search_author','alpha'); +$search_login=GETPOST('search_login','alpha'); $search_product_category=GETPOST('search_product_category','int'); $search_town=GETPOST('search_town','alpha'); $search_zip=GETPOST('search_zip','alpha'); @@ -90,9 +90,6 @@ if (! $sortorder) $sortorder='DESC'; // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $contextpage='proposallist'; -// Nombre de ligne pour choix de produit/service predefinis -$NBLINES=4; - // Security check $module='propal'; $dbtable=''; @@ -106,6 +103,7 @@ if (! empty($socid)) } $result = restrictedArea($user, $module, $objectid, $dbtable); +$diroutputmassaction=$conf->propal->dir_output . '/temp/massgeneration/'.$user->id; // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('propallist')); @@ -129,11 +127,11 @@ if (empty($user->socid)) $fieldstosearchall["p.note_private"]="NotePrivate"; $checkedtypetiers=0; $arrayfields=array( 'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), - 'p.ref_customer'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1), + 'p.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1), 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), 's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1), 's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1), - 'state.nom'=>array('label'=>$langs->trans("State"), 'checked'=>0), + 'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0), 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0), 'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers), 'p.date'=>array('label'=>$langs->trans("Date"), 'checked'=>1), @@ -160,6 +158,8 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab * Actions */ +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction')) { $massaction=''; } $parameters=array('socid'=>$socid); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks @@ -179,7 +179,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $search_montant_ht=''; $search_montant_vat=''; $search_montant_ttc=''; - $search_author=''; + $search_login=''; $search_product_category=''; $search_town=''; $search_zip=""; @@ -196,6 +196,25 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP } if ($object_statut != '') $viewstatut=$object_statut; +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++; + } + + + + +} @@ -259,7 +278,7 @@ if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdp if ($search_ref) $sql .= natural_search('p.ref', $search_ref); if ($search_refcustomer) $sql .= natural_search('p.ref_client', $search_refcustomer); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); -if ($search_author) $sql.= " AND u.login LIKE '%".$db->escape(trim($search_author))."%'"; +if ($search_login) $sql.= " AND u.login LIKE '%".$db->escape(trim($search_login))."%'"; if ($search_montant_ht != '') $sql.= natural_search("p.total_ht", $search_montant_ht, 1); if ($search_montant_vat != '') $sql.= natural_search("p.tva", $search_montant_vat, 1); if ($search_montant_ttc != '') $sql.= natural_search("p.total", $search_montant_ttc, 1); @@ -344,7 +363,7 @@ if ($result) if ($search_user > 0) $param.='&search_user='.$search_user; if ($search_sale > 0) $param.='&search_sale='.$search_sale; if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht; - if ($search_author) $param.='&search_author='.$search_author; + if ($search_login) $param.='&search_login='.$search_login; if ($search_town) $param.='&search_town='.$search_town; if ($optioncss != '') $param.='&optioncss='.$optioncss; // Add $param from extra fields @@ -355,6 +374,8 @@ if ($result) if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); } + //$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"))); + // Lignes des champs de filtre print ''; if ($optioncss != '') print ''; @@ -417,20 +438,20 @@ if ($result) print ''."\n"; print ''; - if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['p.ref_customer']['checked'])) print_liste_field_titre($langs->trans('RefCustomer'),$_SERVER["PHP_SELF"],'p.ref_client','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($langs->trans('ThirdParty'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($langs->trans('Town'),$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($langs->trans('Zip'),$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($langs->trans("ThirdPartyType"),$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['p.date']['checked'])) print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'p.datep','',$param, 'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['p.fin_validite']['checked'])) print_liste_field_titre($langs->trans('DateEndPropalShort'),$_SERVER["PHP_SELF"],'dfv','',$param, 'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($langs->trans('AmountTTC'),$_SERVER["PHP_SELF"],'p.total_ttc','',$param, 'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($langs->trans('AmountVAT'),$_SERVER["PHP_SELF"],'p.total_vat','',$param, 'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['p.ref_client']['checked'])) print_liste_field_titre($arrayfields['p.ref_client']['label'],$_SERVER["PHP_SELF"],'p.ref_client','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.date']['checked'])) print_liste_field_titre($arrayfields['p.date']['label'],$_SERVER["PHP_SELF"],'p.datep','',$param, 'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.fin_validite']['checked'])) print_liste_field_titre($arrayfields['p.fin_validite']['label'],$_SERVER["PHP_SELF"],'dfv','',$param, 'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'],$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'],$_SERVER["PHP_SELF"],'p.tva','',$param, 'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'],$_SERVER["PHP_SELF"],'p.total','',$param, 'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'],$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -447,9 +468,9 @@ if ($result) $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['p.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.fk_statut","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'],$_SERVER["PHP_SELF"],"p.fk_statut","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; @@ -460,7 +481,7 @@ if ($result) print ''; print ''; } - if (! empty($arrayfields['p.ref_customer']['checked'])) + if (! empty($arrayfields['p.ref_client']['checked'])) { print ''; } // Action column - print ''; print "\n"; + $now = dol_now(); $i=0; $var=true; $totalarray=array(); while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); - $now = dol_now(); $var=!$var; print ''; @@ -638,7 +659,7 @@ if ($result) if (! $i) $totalarray['nbfield']++; } - if (! empty($arrayfields['p.ref_customer']['checked'])) + if (! empty($arrayfields['p.ref_client']['checked'])) { // Customer ref print ''; + print ''; print ''; @@ -1993,7 +1993,7 @@ if ($action == 'create' && $user->rights->commande->creer) if ($action == 'editthirdparty') { $form->form_thirdparty($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, 'socid','client>0'); } else { - print '  ' . $soc->getNomUrl(1, 'compta'); + print $soc->getNomUrl(1, 'compta'); } print ''; @@ -2672,10 +2672,7 @@ if ($action == 'create' && $user->rights->commande->creer) $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; - if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set - { - $formmail->trackid='ord'.$object->id; - } + $formmail->trackid='ord'.$object->id; if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set { include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; diff --git a/htdocs/commande/class/api_commande.class.php b/htdocs/commande/class/api_commande.class.php index f0f346ecdb2..8ed6de4dda2 100644 --- a/htdocs/commande/class/api_commande.class.php +++ b/htdocs/commande/class/api_commande.class.php @@ -202,7 +202,7 @@ class CommandeApi extends DolibarrApi * * @url POST order/ * - * @return int ID of commande + * @return string ID of commande */ function post($request_data = NULL) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 6e9e988daa0..ae7c18ac077 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2420,9 +2420,10 @@ class Commande extends CommonOrder /** * Classify the order as invoiced * - * @return int <0 if ko, >0 if ok + * @param User $user Object user making the change + * @return int <0 if KO, >0 if OK */ - function classifyBilled() + function classifyBilled(User $user) { global $conf, $user, $langs; $error = 0; @@ -2476,9 +2477,10 @@ class Commande extends CommonOrder */ function classer_facturee() { + global $user; dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); - return $this->classifyBilled(); + return $this->classifyBilled($user); } @@ -3301,86 +3303,6 @@ class Commande extends CommonOrder function getLinesArray() { return $this->fetch_lines(); - /* - $lines = array(); - - $sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.price, l.qty, l.tva_tx, '; - $sql.= ' l.fk_remise_except, l.remise_percent, l.subprice, l.info_bits, l.rang, l.special_code, l.fk_parent_line,'; - $sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht, l.localtax1_tx, l.localtax2_tx,'; - $sql.= ' l.date_start, l.date_end,'; - $sql.= ' l.fk_unit,'; - $sql.= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,'; - $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, '; - $sql.= ' p.description as product_desc, p.stock as stock_reel,'; - $sql.= ' p.entity'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid'; - $sql.= ' WHERE l.fk_commande = '.$this->id; - $sql.= ' ORDER BY l.rang ASC, l.rowid'; - - $resql = $this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - - $this->lines[$i] = new OrderLine($this->db); - $this->lines[$i]->id = $obj->rowid; - $this->lines[$i]->label = $obj->custom_label; - $this->lines[$i]->description = $obj->description; - $this->lines[$i]->fk_product = $obj->fk_product; - $this->lines[$i]->ref = $obj->ref; - $this->lines[$i]->entity = $obj->entity; // Product entity - $this->lines[$i]->product_label = $obj->product_label; - $this->lines[$i]->product_desc = $obj->product_desc; - $this->lines[$i]->fk_product_type = $obj->fk_product_type; - $this->lines[$i]->product_type = $obj->product_type; - $this->lines[$i]->qty = $obj->qty; - $this->lines[$i]->subprice = $obj->subprice; - $this->lines[$i]->fk_remise_except = $obj->fk_remise_except; - $this->lines[$i]->remise_percent = $obj->remise_percent; - $this->lines[$i]->tva_tx = $obj->tva_tx; - $this->lines[$i]->info_bits = $obj->info_bits; - $this->lines[$i]->total_ht = $obj->total_ht; - $this->lines[$i]->total_tva = $obj->total_tva; - $this->lines[$i]->total_ttc = $obj->total_ttc; - $this->lines[$i]->fk_parent_line = $obj->fk_parent_line; - $this->lines[$i]->special_code = $obj->special_code; - $this->lines[$i]->stock = $obj->stock_reel; - $this->lines[$i]->rang = $obj->rang; - $this->lines[$i]->date_start = $this->db->jdate($obj->date_start); - $this->lines[$i]->date_end = $this->db->jdate($obj->date_end); - $this->lines[$i]->fk_fournprice = $obj->fk_fournprice; - $marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->lines[$i]->fk_fournprice, $obj->pa_ht); - $this->lines[$i]->pa_ht = $marginInfos[0]; - $this->lines[$i]->marge_tx = $marginInfos[1]; - $this->lines[$i]->marque_tx = $marginInfos[2]; - $this->lines[$i]->fk_unit = $obj->fk_unit; - - // Multicurrency - $this->lines[$i]->fk_multicurrency = $obj->fk_multicurrency; - $this->lines[$i]->multicurrency_code = $obj->multicurrency_code; - $this->lines[$i]->multicurrency_subprice = $obj->multicurrency_subprice; - $this->lines[$i]->multicurrency_total_ht = $obj->multicurrency_total_ht; - $this->lines[$i]->multicurrency_total_tva = $obj->multicurrency_total_tva; - $this->lines[$i]->multicurrency_total_ttc = $obj->multicurrency_total_ttc; - - $i++; - } - - $this->db->free($resql); - - return 1; - } - else - { - $this->error=$this->db->error(); - return -1; - }*/ } /** diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index c72e040e61c..93d46c05997 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -155,7 +155,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Ref - print '"; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 91a602c31a6..7aa1dc481e9 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -34,12 +34,15 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; -require_once DOL_DOCUMENT_ROOT .'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $langs->load('orders'); +$langs->load('sendings'); $langs->load('deliveries'); $langs->load('companies'); $langs->load('compta'); @@ -55,6 +58,11 @@ $search_product_category=GETPOST('search_product_category','int'); $search_ref=GETPOST('search_ref','alpha')!=''?GETPOST('search_ref','alpha'):GETPOST('sref','alpha'); $search_ref_customer=GETPOST('search_ref_customer','alpha'); $search_company=GETPOST('search_company','alpha'); +$search_town=GETPOST('search_town','alpha'); +$search_zip=GETPOST('search_zip','alpha'); +$search_state=trim(GETPOST("search_state")); +$search_country=GETPOST("search_country",'int'); +$search_type_thirdparty=GETPOST("search_type_thirdparty",'int'); $sall=GETPOST('sall'); $socid=GETPOST('socid','int'); $search_user=GETPOST('search_user','int'); @@ -68,6 +76,8 @@ $id = (GETPOST('orderid')?GETPOST('orderid'):GETPOST('id','int')); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'commande', $id,''); +$diroutputmassaction=$conf->commande->dir_output . '/temp/massgeneration/'.$user->id; + $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -79,10 +89,18 @@ $pagenext = $page + 1; if (! $sortfield) $sortfield='c.ref'; if (! $sortorder) $sortorder='DESC'; +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$contextpage='orderlist'; + $viewstatut=GETPOST('viewstatut'); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('orderlist')); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('commande'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); // List of fields to search into when doing a "search in all" $fieldstosearchall = array( @@ -94,24 +112,47 @@ $fieldstosearchall = array( ); if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate"; +$checkedtypetiers=0; $arrayfields=array( + 'c.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), + 'c.ref_client'=>array('label'=>$langs->trans("RefCustomerOrder"), 'checked'=>1), + 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), + 's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1), + 's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1), + 'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0), + 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0), + 'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers), + 'c.date_commande'=>array('label'=>$langs->trans("OrderDateShort"), 'checked'=>1), + 'c.date_delivery'=>array('label'=>$langs->trans("DateDeliveryPlanned"), 'checked'=>1, 'enabled'=>empty($conf->global->ORDER_DISABLE_DELIVERY_DATE)), + 'c.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 'c.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), + 'c.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), + 'e.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) ); // Extra fields -/* - if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) - { - foreach($extrafields->attribute_label as $key => $val) - { - $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); - } - } - */ +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) + { + $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); + } +} + /* * Actions */ +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction')) { $massaction=''; } + +$parameters=array('socid'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + // 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 { @@ -122,7 +163,15 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $search_ref=''; $search_ref_customer=''; $search_company=''; + $search_town=''; + $search_zip=""; + $search_state=""; + $search_type=''; + $search_country=''; + $search_type_thirdparty=''; $search_total_ht=''; + $search_total_vat=''; + $search_total_ttc=''; $orderyear=''; $ordermonth=''; $orderday=''; @@ -131,11 +180,27 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $deliveryyear=''; $viewstatut=''; $billed=''; + $search_array_options=array(); } -$parameters=array('socid'=>$socid); -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hook -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +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++; + } + +} + + /* @@ -148,16 +213,31 @@ $form = new Form($db); $formother = new FormOther($db); $formfile = new FormFile($db); $companystatic = new Societe($db); +$formcompany=new FormCompany($db); $help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; llxHeader('',$langs->trans("Orders"),$help_url); $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; -$sql.= ' s.nom as name, s.rowid as socid, s.client, s.code_client, c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,'; -$sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed'; +$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; +$sql.= " typent.code as typent_code,"; +$sql.= " state.code_departement as state_code, state.nom as state_name,"; +$sql.= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,'; +$sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,'; +$sql.= ' c.date_creation as date_creation, c.tms as date_update'; +// Add fields from extrafields +foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s'; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; $sql.= ', '.MAIN_DB_PREFIX.'commande as c'; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields as ef on (c.rowid = ef.fk_object)"; if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON c.rowid=pd.fk_commande'; if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product'; // We'll need this table joined to the select in order to filter by sale @@ -224,11 +304,35 @@ else if ($deliveryyear > 0) { $sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_get_first_day($deliveryyear,1,false))."' AND '".$db->idate(dol_get_last_day($deliveryyear,12,false))."'"; } -if (!empty($search_company)) $sql .= natural_search('s.nom', $search_company); -if (!empty($search_ref_customer)) $sql.= natural_search('c.ref_client', $search_ref_customer); +if ($search_town) $sql.= natural_search('s.town', $search_town); +if ($search_zip) $sql.= natural_search("s.zip",$search_zip); +if ($search_state) $sql.= natural_search("state.nom",$search_state); +if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; +if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; +if ($search_company) $sql .= natural_search('s.nom', $search_company); +if ($search_ref_customer) $sql.= natural_search('c.ref_client', $search_ref_customer); if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1); + +// Add where from extra fields +foreach ($search_array_options as $key => $val) +{ + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $typ=$extrafields->attribute_type[$tmpkey]; + $mode=0; + 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); + } +} +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; + $sql.= $db->order($sortfield,$sortorder); $nbtotalofrecords = 0; @@ -271,6 +375,8 @@ if ($resql) if ($viewstatut == -3) $title.=' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled)?'':$langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill'); + $num = $db->num_rows($resql); + $param=''; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($socid > 0) $param.='&socid='.$socid; @@ -288,13 +394,21 @@ if ($resql) if ($search_sale > 0) $param.='&search_sale='.$search_sale; if ($search_total_ht != '') $param.='&search_total_ht='.$search_total_ht; if ($optioncss != '') $param.='&optioncss='.$optioncss; - - $num = $db->num_rows($resql); + // Add $param from extra fields + foreach ($search_array_options as $key => $val) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); + } + + //$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"))); // Lignes des champs de filtre print ''; if ($optioncss != '') print ''; print ''; + print ''; print ''; print ''; print ''; @@ -348,38 +462,105 @@ if ($resql) print ''; } - print '
'; print ''; @@ -587,20 +608,20 @@ if ($result) print ''; + print ''; $searchpitco=$form->showFilterAndCheckAddButtons(0); print $searchpitco; print '
'; @@ -649,11 +670,12 @@ if ($result) $url = DOL_URL_ROOT.'/comm/card.php?socid='.$obj->rowid; - // Company $companystatic->id=$obj->rowid; $companystatic->name=$obj->name; $companystatic->client=$obj->client; $companystatic->code_client=$obj->code_client; + + // Thirdparty if (! empty($arrayfields['s.nom']['checked'])) { print ''; @@ -754,6 +776,7 @@ if ($result) $userstatic->id=$obj->fk_user_author; $userstatic->login=$obj->login; + // Author if (! empty($arrayfields['u.login']['checked'])) { diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 2c93f874baa..33895c2ac54 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -178,7 +178,7 @@ if (! $mesg) $px2->draw($filenameamount,$fileurlamount); } -$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear, $filter); +$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); $fileurl_avg=''; if (!$user->rights->societe->client->voir || $user->societe_id) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index f2d2e24d269..9b5c29f55db 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -466,7 +466,7 @@ if (empty($reshook)) else if ($action == 'classifybilled' && $user->rights->commande->creer) { - $ret=$object->classifyBilled(); + $ret=$object->classifyBilled($user); if ($ret < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -1953,7 +1953,7 @@ if ($action == 'create' && $user->rights->commande->creer) $linkback = '' . $langs->trans("BackToList") . ''; // Ref - print '
' . $langs->trans('Ref') . '
' . $langs->trans('Ref') . ''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print '
'.$langs->trans("Ref").''; + print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print "
'; + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + + print '
'."\n"; + print ''; - print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'c.ref','',$param,'width="25%"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('RefCustomerOrder'),$_SERVER["PHP_SELF"],'c.ref_client','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('ThirdParty'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('OrderDate'),$_SERVER["PHP_SELF"],'c.date_commande','',$param, 'align="center"',$sortfield,$sortorder); - if (empty($conf->global->ORDER_DISABLE_DELIVERY_DATE)) print_liste_field_titre($langs->trans('DeliveryDate'),$_SERVER["PHP_SELF"],'c.date_livraison','',$param, 'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder); - $parameters=array(); + if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'],$_SERVER["PHP_SELF"],'c.ref','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['c.ref_client']['checked'])) print_liste_field_titre($arrayfields['c.ref_client']['label'],$_SERVER["PHP_SELF"],'c.ref_client','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['c.date_commande']['checked'])) print_liste_field_titre($arrayfields['c.date_commande']['label'],$_SERVER["PHP_SELF"],'c.date_commande','',$param, 'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['c.date_delivery']['checked'])) print_liste_field_titre($arrayfields['c.date_delivery']['label'],$_SERVER["PHP_SELF"],'c.date_livraison','',$param, 'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['c.total_ht']['checked'])) print_liste_field_titre($arrayfields['c.total_ht']['label'],$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['c.tva']['checked'])) print_liste_field_titre($arrayfields['c.tva']['label'],$_SERVER["PHP_SELF"],'c.total_vat','',$param, 'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['c.total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.total_ttc']['label'],$_SERVER["PHP_SELF"],'c.total_ttc','',$param, 'align="right"',$sortfield,$sortorder); + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + } + } + } + // Hook fields + $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'c.fk_statut','',$param,'align="right"',$sortfield,$sortorder); - if (empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) print_liste_field_titre($langs->trans('Billed'),$_SERVER["PHP_SELF"],'c.facture','',$param,'align="center"',$sortfield,$sortorder,''); - print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'',$param,'',$sortfield,$sortorder,'maxwidthsearch '); + if (! empty($arrayfields['c.datec']['checked'])) print_liste_field_titre($arrayfields['c.datec']['label'],$_SERVER["PHP_SELF"],"c.date_creation","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['c.tms']['checked'])) print_liste_field_titre($arrayfields['c.tms']['label'],$_SERVER["PHP_SELF"],"c.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['c.fk_statut']['checked'])) print_liste_field_titre($arrayfields['c.fk_statut']['label'],$_SERVER["PHP_SELF"],"c.fk_statut","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['c.facture']['checked'])) print_liste_field_titre($arrayfields['c.facture']['label'],$_SERVER["PHP_SELF"],'c.facture','',$param,'align="center"',$sortfield,$sortorder,''); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print ''; print ''; - print ''; - print ''; - print ''; - print ''; - if (empty($conf->global->ORDER_DISABLE_DELIVERY_DATE)) + // Ref + if (! empty($arrayfields['c.ref']['checked'])) + { + print ''; + } + // Ref customer + if (! empty($arrayfields['c.ref_client']['checked'])) + { + print ''; + } + // Thirpdarty + if (! empty($arrayfields['s.nom']['checked'])) + { + print ''; + } + // Town + if (! empty($arrayfields['s.town']['checked'])) print ''; + // Zip + if (! empty($arrayfields['s.zip']['checked'])) print ''; + // State + if (! empty($arrayfields['state.nom']['checked'])) + { + print ''; + } + // Country + if (! empty($arrayfields['country.code_iso']['checked'])) + { + print ''; + } + // Company type + if (! empty($arrayfields['typent.code']['checked'])) + { + print ''; + } + // Date order + if (! empty($arrayfields['c.date_commande']['checked'])) + { + print ''; + } + if (! empty($arrayfields['c.date_delivery']['checked'])) { print ''; } - print ''; - print ''; - if (empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) + if (! empty($arrayfields['c.total_ht']['checked'])) { - print ''; + } + if (! empty($arrayfields['c.total_vat']['checked'])) + { + // Amount + print ''; + } + if (! empty($arrayfields['c.total_ttc']['checked'])) + { + // Amount + print ''; + } + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + $typeofextrafield=$extrafields->attribute_type[$key]; + print ''; + } + } + } + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (! empty($arrayfields['c.datec']['checked'])) + { + print ''; } - print ''; - print "\n"; + // Date modification + if (! empty($arrayfields['c.tms']['checked'])) + { + print ''; + } + // Status + if (! empty($arrayfields['c.fk_statut']['checked'])) + { + print ''; + } + // Status + if (! empty($arrayfields['c.facture']['checked'])) + { + print ''; + } + // Action column + print ''; + + print "\n"; - $var=true; $total=0; $subtotal=0; $productstat_cache=array(); - $i=0; $generic_commande = new Commande($db); $generic_product = new Product($db); + + $i=0; + $var=true; + $totalarray=array(); while ($i < min($num,$limit)) { - $objp = $db->fetch_object($resql); + $obj = $db->fetch_object($resql); $var=!$var; print ''; - print ''; - + // Ref customer - print ''; - - // Company - $companystatic->id=$objp->socid; - $companystatic->code_client = $objp->code_client; - $companystatic->name=$objp->name; - $companystatic->client=$objp->client; - print ''; + if (! $i) $totalarray['nbfield']++; } - print ''; - // Order date - print ''; + $companystatic->id=$obj->socid; + $companystatic->code_client = $obj->code_client; + $companystatic->name=$obj->name; + $companystatic->client=$obj->client; - // Delivery date - print ''; - - // Amount HT - print ''; - - // Statut - print ''; - - // Billed - if (empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) print ''; + // Third party + if (! empty($arrayfields['s.nom']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Town + if (! empty($arrayfields['s.town']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Zip + if (! empty($arrayfields['s.zip']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // State + if (! empty($arrayfields['state.nom']['checked'])) + { + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + // Country + if (! empty($arrayfields['country.code_iso']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Type ent + if (! empty($arrayfields['typent.code']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Order date + if (! empty($arrayfields['c.date_commande']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Plannned date of delivery + if (! empty($arrayfields['c.date_delivery']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Amount HT + if (! empty($arrayfields['c.total_ht']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield']; + $totalarray['totalht'] += $obj->total_ht; + } + // Amount VAT + if (! empty($arrayfields['c.total_vat']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield']; + $totalarray['totalvat'] += $obj->total_vat; + } + // Amount TTC + if (! empty($arrayfields['c.total_ttc']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; + $totalarray['totalttc'] += $obj->total_ttc; + } + + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + print 'getAlignFlag($key); + if ($align) print ' align="'.$align.'"'; + print '>'; + $tmpkey='options_'.$key; + print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); + print ''; + if (! $i) $totalarray['nbfield']++; + } + } + } + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (! empty($arrayfields['c.datec']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Date modification + if (! empty($arrayfields['c.tms']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Status + if (! empty($arrayfields['c.fk_statut']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Billed + if (! empty($arrayfields['c.facture']['checked'])) + { + print ''; + } + + // Action column + print ''; + if (! $i) $totalarray['nbfield']++; - print ''; - print ''; - $total+=$objp->total_ht; - $subtotal+=$objp->total_ht; + $total+=$obj->total_ht; + $subtotal+=$obj->total_ht; $i++; } - if (! empty($conf->global->MAIN_SHOW_TOTAL_FOR_LIMITED_LIST)) + // Show total line + if (isset($totalarray['totalhtfield'])) { - $var=!$var; - print ''; - print ''; - // Total HT - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if ($i == 1) + { + if ($num < $limit) print ''; + else print ''; + } + elseif ($totalarray['totalhtfield'] == $i) print ''; + elseif ($totalarray['totalvatfield'] == $i) print ''; + elseif ($totalarray['totalttcfield'] == $i) print ''; + else print ''; + } + print ''; + } + $db->free($resql); + + $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); + $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($orderyear?$orderyear:-1,'orderyear',1, 20, 5); - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print $form->select_country($search_country,'search_country','',0,'maxwidth100'); + print ''; + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); + print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($orderyear?$orderyear:-1,'orderyear',1, 20, 5); + print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; @@ -387,266 +568,473 @@ if ($resql) $formother->select_year($deliveryyear?$deliveryyear:-1,'deliveryyear',1, 20, 5); print ''; - print ''; - print ''; - $liststatus=array( - '0'=>$langs->trans("StatusOrderDraftShort"), - '1'=>$langs->trans("StatusOrderValidated"), - '2'=>$langs->trans("StatusOrderSentShort"), - '3'=>$langs->trans("StatusOrderDelivered"), - '-1'=>$langs->trans("StatusOrderCanceledShort") - ); - print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4); - print ''; - print $form->selectyesno('billed', $billed, 1, 0, 1); + // Amount + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + 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 ''; print ''; - $searchpitco=$form->showFilterAndCheckAddButtons(0); - print $searchpitco; - print '
'; + print ''; + $liststatus=array( + '0'=>$langs->trans("StatusOrderDraftShort"), + '1'=>$langs->trans("StatusOrderValidated"), + '2'=>$langs->trans("StatusOrderSentShort"), + '3'=>$langs->trans("StatusOrderDelivered"), + '-1'=>$langs->trans("StatusOrderCanceledShort") + ); + print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4); + print ''; + print $form->selectyesno('billed', $billed, 1, 0, 1); + print ''; + $searchpitco=$form->showFilterAndCheckAddButtons(0); + print $searchpitco; + print '
'; - $generic_commande->id=$objp->rowid; - $generic_commande->ref=$objp->ref; - $generic_commande->statut = $objp->fk_statut; - $generic_commande->date_commande = $db->jdate($objp->date_commande); - $generic_commande->date_livraison = $db->jdate($objp->date_delivery); - $generic_commande->ref_client = $objp->ref_client; - $generic_commande->total_ht = $objp->total_ht; - $generic_commande->total_tva = $objp->total_tva; - $generic_commande->total_ttc = $objp->total_ttc; - $generic_commande->lines=array(); - $generic_commande->getLinesArray(); - print ''; - print ''; - - // Show shippable Icon (create subloop, so may be slow) - if ($conf->stock->enabled) + if (! empty($arrayfields['c.ref']['checked'])) { - $langs->load("stocks"); - if (($objp->fk_statut > 0) && ($objp->fk_statut < 3)) + print ''; + if (! $i) $totalarray['nbfield']++; } - - // Warning late icon - print ''; - - print ''; - print '
'; - print $generic_commande->getNomUrl(1,($viewstatut != 2?0:$objp->fk_statut)); - print ''; + $generic_commande->id=$obj->rowid; + $generic_commande->ref=$obj->ref; + $generic_commande->statut = $obj->fk_statut; + $generic_commande->date_commande = $db->jdate($obj->date_commande); + $generic_commande->date_livraison = $db->jdate($obj->date_delivery); + $generic_commande->ref_client = $obj->ref_client; + $generic_commande->total_ht = $obj->total_ht; + $generic_commande->total_tva = $obj->total_tva; + $generic_commande->total_ttc = $obj->total_ttc; + $generic_commande->lines=array(); + $generic_commande->getLinesArray(); + + print ''; + print ''; + + // Show shippable Icon (create subloop, so may be slow) + if ($conf->stock->enabled) { - $notshippable=0; - $warning = 0; - $text_info=''; - $text_warning=''; - $nbprod=0; - - $numlines = count($generic_commande->lines); // Loop on each line of order - for ($lig=0; $lig < $numlines; $lig++) + $langs->load("stocks"); + if (($obj->fk_statut > 0) && ($obj->fk_statut < 3)) { - if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) // If line is a product and not a service + $notshippable=0; + $warning = 0; + $text_info=''; + $text_warning=''; + $nbprod=0; + + $numlines = count($generic_commande->lines); // Loop on each line of order + for ($lig=0; $lig < $numlines; $lig++) { - $nbprod++; // order contains real products - $generic_product->id = $generic_commande->lines[$lig]->fk_product; - if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) { - $generic_product->load_stock(); - $generic_product->load_virtual_stock(); - $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel; - $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique; - } else { - $generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel']; - $generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique; - } - - if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) // Default code is when this option is not set, setting it create strange result + if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) // If line is a product and not a service { - $text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 25); - $text_info .= ' - '.$langs->trans("Stock").': '.$generic_product->stock_reel; - $text_info .= ' - '.$langs->trans("VirtualStock").': '.$generic_product->stock_theorique; - $text_info .= '
'; + $nbprod++; // order contains real products + $generic_product->id = $generic_commande->lines[$lig]->fk_product; + if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) { + $generic_product->load_stock(); + $generic_product->load_virtual_stock(); + $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel; + $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique; + } else { + $generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel']; + $generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique; + } - if ($generic_commande->lines[$lig]->qty > $generic_product->stock_reel) + if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) // Default code is when this option is not set, setting it create strange result { - $notshippable++; - } - } - else { // Detailed code, looks bugged - // stock order and stock order_supplier - $stock_order=0; - $stock_order_supplier=0; - if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) // What about other options ? - { - if (! empty($conf->commande->enabled)) + $text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 25); + $text_info .= ' - '.$langs->trans("Stock").': '.$generic_product->stock_reel; + $text_info .= ' - '.$langs->trans("VirtualStock").': '.$generic_product->stock_theorique; + $text_info .= '
'; + + if ($generic_commande->lines[$lig]->qty > $generic_product->stock_reel) { - if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'])) { - $generic_product->load_stats_commande(0,'1,2'); - $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty']; - } else { - $generic_product->stats_commande['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer']; - } - $stock_order=$generic_product->stats_commande['qty']; - } - if (! empty($conf->fournisseur->enabled)) - { - if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'])) { - $generic_product->load_stats_commande_fournisseur(0,'3'); - $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty']; - } else { - $generic_product->stats_commande_fournisseur['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier']; - } - $stock_order_supplier=$generic_product->stats_commande_fournisseur['qty']; + $notshippable++; } } - $text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 25); - $text_stock_reel = $generic_product->stock_reel.'/'.$stock_order; - if ($stock_order > $generic_product->stock_reel && ! ($generic_product->stock_reel < $generic_commande->lines[$lig]->qty)) { - $warning++; - $text_warning.=''.$langs->trans('Available').' : '.$text_stock_reel.''; - } - if ($generic_product->stock_reel < $generic_commande->lines[$lig]->qty) { - $notshippable++; - $text_info.=''.$langs->trans('Available').' : '.$text_stock_reel.''; - } else { - $text_info.=''.$langs->trans('Available').' : '.$text_stock_reel.''; - } - if (! empty($conf->fournisseur->enabled)) { - $text_info.= ' '.$langs->trans('SupplierOrder').' : '.$stock_order_supplier.'
'; - } else { - $text_info.= '
'; + else { // Detailed code, looks bugged + // stock order and stock order_supplier + $stock_order=0; + $stock_order_supplier=0; + if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) // What about other options ? + { + if (! empty($conf->commande->enabled)) + { + if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'])) { + $generic_product->load_stats_commande(0,'1,2'); + $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty']; + } else { + $generic_product->stats_commande['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer']; + } + $stock_order=$generic_product->stats_commande['qty']; + } + if (! empty($conf->fournisseur->enabled)) + { + if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'])) { + $generic_product->load_stats_commande_fournisseur(0,'3'); + $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty']; + } else { + $generic_product->stats_commande_fournisseur['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier']; + } + $stock_order_supplier=$generic_product->stats_commande_fournisseur['qty']; + } + } + $text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 25); + $text_stock_reel = $generic_product->stock_reel.'/'.$stock_order; + if ($stock_order > $generic_product->stock_reel && ! ($generic_product->stock_reel < $generic_commande->lines[$lig]->qty)) { + $warning++; + $text_warning.=''.$langs->trans('Available').' : '.$text_stock_reel.''; + } + if ($generic_product->stock_reel < $generic_commande->lines[$lig]->qty) { + $notshippable++; + $text_info.=''.$langs->trans('Available').' : '.$text_stock_reel.''; + } else { + $text_info.=''.$langs->trans('Available').' : '.$text_stock_reel.''; + } + if (! empty($conf->fournisseur->enabled)) { + $text_info.= ' '.$langs->trans('SupplierOrder').' : '.$stock_order_supplier.'
'; + } else { + $text_info.= '
'; + } } } } + if ($notshippable==0) { + $text_icon = img_picto('', 'object_sending'); + $text_info = $langs->trans('Shippable').'
'.$text_info; + } else { + $text_icon = img_picto('', 'error'); + $text_info = $langs->trans('NonShippable').'
'.$text_info; + } } - if ($notshippable==0) { - $text_icon = img_picto('', 'object_sending'); - $text_info = $langs->trans('Shippable').'
'.$text_info; - } else { - $text_icon = img_picto('', 'error'); - $text_info = $langs->trans('NonShippable').'
'.$text_info; + + print ''; } - - print ''; + + // Warning late icon + print ''; + + print ''; + print '
'; + print $generic_commande->getNomUrl(1,($viewstatut != 2?0:$obj->fk_statut)); + print ''; + if ($nbprod) + { + print $form->textwithtooltip('',$text_info,2,1,$text_icon,'',2); } + if ($warning) { + print $form->textwithtooltip('', $langs->trans('NotEnoughForAllOrders').'
'.$text_warning, 2, 1, img_picto('', 'error'),'',2); + } + print '
'; - if ($nbprod) - { - print $form->textwithtooltip('',$text_info,2,1,$text_icon,'',2); - } - if ($warning) { - print $form->textwithtooltip('', $langs->trans('NotEnoughForAllOrders').'
'.$text_warning, 2, 1, img_picto('', 'error'),'',2); - } - print '
'; + if ($generic_commande->hasDelay()) { + print img_picto($langs->trans("Late").' : '.$generic_commande->showDelay(), "warning"); + } + if(!empty($obj->note_private)) + { + print ' '; + print ''.img_picto($langs->trans("ViewPrivateNote"),'object_generic').''; + print ''; + } + print ''; + $filename=dol_sanitizeFileName($obj->ref); + $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); + $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; + print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir); + print '
'; + + print '
'; - if ($generic_commande->hasDelay()) { - print img_picto($langs->trans("Late").' : '.$generic_commande->showDelay(), "warning"); - } - if(!empty($objp->note_private)) - { - print ' '; - print ''.img_picto($langs->trans("ViewPrivateNote"),'object_generic').''; - print ''; - } - print ''; - $filename=dol_sanitizeFileName($objp->ref); - $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref); - $urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid; - print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir); - print '
'; - - print '
'.$objp->ref_client.''; - print $companystatic->getNomUrl(1,'customer'); - - // If module invoices enabled and user with invoice creation permissions - if (! empty($conf->facture->enabled) && ! empty($conf->global->ORDER_BILLING_ALL_CUSTOMER)) + if (! empty($arrayfields['c.ref_client']['checked'])) { - if ($user->rights->facture->creer) - { - if (($objp->fk_statut > 0 && $objp->fk_statut < 3) || ($objp->fk_statut == 3 && $objp->billed == 0)) - { - print ' '; - print img_picto($langs->trans("CreateInvoiceForThisCustomer").' : '.$companystatic->name, 'object_bill', 'hideonsmartphone').''; - } - } + print ''.$obj->ref_client.''; - print dol_print_date($db->jdate($objp->date_commande), 'day'); - print ''; - print dol_print_date($db->jdate($objp->date_delivery), 'day'); - print ''.price($objp->total_ht).''.$generic_commande->LibStatut($objp->fk_statut, $objp->billed, 5, 1).''.yn($objp->billed).''; + print $companystatic->getNomUrl(1,'customer'); + + // If module invoices enabled and user with invoice creation permissions + if (! empty($conf->facture->enabled) && ! empty($conf->global->ORDER_BILLING_ALL_CUSTOMER)) + { + if ($user->rights->facture->creer) + { + if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) + { + print ' '; + print img_picto($langs->trans("CreateInvoiceForThisCustomer").' : '.$companystatic->name, 'object_bill', 'hideonsmartphone').''; + } + } + } + print ''; + print $obj->town; + print ''; + print $obj->zip; + print '".$obj->state_name."'; + $tmparray=getCountry($obj->fk_pays,'all'); + print $tmparray['label']; + print ''; + if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1); + print $typenArray[$obj->typent_code]; + print ''; + print dol_print_date($db->jdate($obj->date_commande), 'day'); + print ''; + print dol_print_date($db->jdate($obj->date_delivery), 'day'); + print ''.price($obj->total_ht)."'.price($obj->total_vat)."'.price($obj->total_ttc)."'; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour'); + print ''.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).''.yn($obj->billed).'
'.$langs->trans('TotalHT').''.price($total).'
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price($totalarray['totalht']).''.price($totalarray['totalvat']).''.price($totalarray['totalttc']).'
'; print '
'."\n"; print '
'.img_help(1,'').' '.$langs->trans("ToBillSeveralOrderSelectCustomer", $langs->transnoentitiesnoconv("CreateInvoiceForThisCustomer")).'
'; - - $db->free($resql); } else { diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index ebb9bedca2c..bcbe3ea408e 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -220,7 +220,7 @@ if (($action == 'create' || $action == 'add') && !$error) { if ($closeOrders) { - $objectsrc->classifyBilled(); + $objectsrc->classifyBilled($user); $objectsrc->setStatut(3); } $lines = $objectsrc->lines; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index c155531c286..f4962bd2cf1 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -276,7 +276,7 @@ if ($action == 'create') print ''; // Ref - print ''; + print ''; print ''; // Label @@ -360,7 +360,7 @@ if ($action == 'create') print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'ref).'" maxlength="12">
'; // Sold - print ''; + print ''; print ''; print ''; @@ -382,7 +382,7 @@ if ($action == 'create') print '
'.$langs->trans("InitialBankBalance").'
'.$langs->trans("InitialBankBalance").'solde)).'">
'.$langs->trans("Date").'
'; // If bank account - print ''; + print ''; print ''; print ''; @@ -482,14 +482,14 @@ if ($action == 'create') { if (! empty($conf->accounting->enabled)) { - print ''; + print ''; print ''; } else { - print ''; + print ''; print ''; } } @@ -497,14 +497,14 @@ if ($action == 'create') { if (! empty($conf->accounting->enabled)) { - print ''; + print ''; print ''; } else { - print ''; + print ''; print ''; } } @@ -566,7 +566,7 @@ else $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''; + print ''; print ''; @@ -646,7 +646,7 @@ else { print '
'.$langs->trans("BankName").'
'.$langs->trans("BankName").'
'.$langs->trans("AccountancyCode").'
'.$langs->trans("AccountancyCode").''; print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1); print '
'.$langs->trans("AccountancyCode").'
'.$langs->trans("AccountancyCode").'account_number).'">
'.$langs->trans("AccountancyCode").'
'.$langs->trans("AccountancyCode").''; print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1); print '
'.$langs->trans("AccountancyCode").'
'.$langs->trans("AccountancyCode").'account_number).'">
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; print $form->showrefnav($account, 'ref', $linkback, 1, 'ref'); print '
'; - print ''; + print ''; print ''; // Show fields of bank account @@ -754,7 +754,7 @@ else print '
'.$langs->trans("BankName").'
'.$langs->trans("BankName").''.$account->bank.'
'; // Accountancy code - print ''; + print ''; print ''; // Accountancy journal @@ -831,7 +831,7 @@ else print '
'.$langs->trans("AccountancyCode").'
'.$langs->trans("AccountancyCode").''.length_accountg($account->account_number).'
'; // Ref - print ''; + print ''; print ''; // Label @@ -932,7 +932,7 @@ else print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'ref).'">
'; // If bank account - print ''; + print ''; print ''; print ''; @@ -1030,14 +1030,14 @@ else print '
'.$langs->trans("BankName").'
'.$langs->trans("BankName").'
'; // Accountancy code - $tdextra = ''; + $tdextra = ' class="titlefieldcreate"'; if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) { - $tdextra = ' class="fieldrequired"'; + $tdextra = ' class="fieldrequired titlefieldcreate"'; } print ''.$langs->trans("AccountancyCode").''; - print '
'; + print ''; if (!empty($conf->accounting->enabled)) { print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1); } else { diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php index 3b6957df40f..7320ce85f91 100644 --- a/htdocs/compta/bank/document.php +++ b/htdocs/compta/bank/document.php @@ -92,18 +92,10 @@ if ($_POST["sendit"] && !empty($conf->global->MAIN_UPLOAD_DOC)) { $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']), 0, 0, $_FILES['userfile']['error']); if (is_numeric($resupload) && $resupload > 0) { - if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) - == 1) { - // Create small thumbs for image (Ratio is near 16/9) - // Used on logon for example - $imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], - $maxwidthsmall, $maxheightsmall, '_small', $quality, - "thumbs"); - // Create mini thumbs for image (Ratio is near 16/9) - // Used on menu or for setup page for example - $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], - $maxwidthmini, $maxheightmini, '_mini', $quality, - "thumbs"); + if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1) + { + // Create thumbs + $object->addThumbs($upload_dir . "/" . $_FILES['userfile']['name']); } $mesg = '
' . $langs->trans("FileTransferComplete") . '
'; } @@ -172,14 +164,14 @@ if ($id > 0 || !empty($ref)) { $totalsize+=$file['size']; } - + $linkback = ''.$langs->trans("BackToList").''; + print ''; - // Ref // Ref print ''; print ''; // Label diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index dd15c3a0990..00498b870a7 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1963,7 +1963,7 @@ if ($action == 'create') $objectsrc->fetch_thirdparty(); $projectid = (! empty($projectid) ? $projectid : $objectsrc->fk_project); - $ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : ''); + $ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : (! empty($objectsrc->ref_customer) ? $objectsrc->ref_customer:'')); $ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : ''); // only if socid not filled else it's allready done upper @@ -4141,10 +4141,7 @@ else if ($id > 0 || ! empty($ref)) $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; - if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set - { - $formmail->trackid='inv'.$object->id; - } + $formmail->trackid='inv'.$object->id; if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set { include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index a6b6ddf212c..4d216a80264 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3681,92 +3681,6 @@ class Facture extends CommonInvoice function getLinesArray() { return $this->fetch_lines(); - /* - $sql = 'SELECT l.rowid, l.label as custom_label, l.description, l.fk_product, l.product_type, l.qty, l.tva_tx,'; - $sql.= ' l.fk_remise_except, l.localtax1_tx, l.localtax2_tx,'; - $sql .= ' l.situation_percent, l.fk_prev_id,'; - $sql.= ' l.remise_percent, l.subprice, l.info_bits, l.rang, l.special_code, l.fk_parent_line,'; - $sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,'; - $sql.= ' l.date_start, l.date_end,'; - $sql.= ' l.fk_unit,'; - $sql.= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,'; - $sql.= ' p.ref as product_ref, p.fk_product_type, p.label as product_label,'; - $sql.= ' p.description as product_desc,'; - $sql.= ' p.entity'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid'; - $sql.= ' WHERE l.fk_facture = '.$this->id; - $sql.= ' ORDER BY l.rang ASC, l.rowid'; - - dol_syslog(get_class($this).'::getLinesArray',LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - - $this->lines[$i] = new FactureLigne($this->db); - $this->lines[$i]->id = $obj->rowid; - $this->lines[$i]->label = $obj->custom_label; // deprecated - $this->lines[$i]->description = $obj->description; - $this->lines[$i]->fk_product = $obj->fk_product; - $this->lines[$i]->ref = $obj->product_ref; - $this->lines[$i]->product_ref = $obj->product_ref; - $this->lines[$i]->product_label = $obj->product_label; - $this->lines[$i]->product_desc = $obj->product_desc; - $this->lines[$i]->fk_product_type = $obj->fk_product_type; - $this->lines[$i]->product_type = $obj->product_type; - $this->lines[$i]->entity = $obj->entity; // Product entity - $this->lines[$i]->qty = $obj->qty; - $this->lines[$i]->subprice = $obj->subprice; - $this->lines[$i]->fk_remise_except = $obj->fk_remise_except; - $this->lines[$i]->remise_percent = $obj->remise_percent; - $this->lines[$i]->tva_tx = $obj->tva_tx; - $this->lines[$i]->info_bits = $obj->info_bits; - $this->lines[$i]->total_ht = $obj->total_ht; - $this->lines[$i]->total_tva = $obj->total_tva; - $this->lines[$i]->total_ttc = $obj->total_ttc; - $this->lines[$i]->localtax1_tx = $obj->localtax1_tx; - $this->lines[$i]->localtax2_tx = $obj->localtax2_tx; - $this->lines[$i]->localtax1_type = $obj->localtax1_type; - $this->lines[$i]->localtax2_type = $obj->localtax2_type; - $this->lines[$i]->fk_parent_line = $obj->fk_parent_line; - $this->lines[$i]->situation_percent = $obj->situation_percent; - $this->lines[$i]->fk_prev_id = $obj->fk_prev_id; - $this->lines[$i]->special_code = $obj->special_code; - $this->lines[$i]->rang = $obj->rang; - $this->lines[$i]->date_start = $this->db->jdate($obj->date_start); - $this->lines[$i]->date_end = $this->db->jdate($obj->date_end); - $this->lines[$i]->fk_fournprice = $obj->fk_fournprice; - $marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->lines[$i]->fk_fournprice, $obj->pa_ht); - $this->lines[$i]->pa_ht = $marginInfos[0]; - $this->lines[$i]->marge_tx = $marginInfos[1]; - $this->lines[$i]->marque_tx = $marginInfos[2]; - $this->lines[$i]->fk_unit = $obj->fk_unit; - - // Multicurrency - $this->lines[$i]->fk_multicurrency = $obj->fk_multicurrency; - $this->lines[$i]->multicurrency_code = $obj->multicurrency_code; - $this->lines[$i]->multicurrency_subprice = $obj->multicurrency_subprice; - $this->lines[$i]->multicurrency_total_ht = $obj->multicurrency_total_ht; - $this->lines[$i]->multicurrency_total_tva = $obj->multicurrency_total_tva; - $this->lines[$i]->multicurrency_total_ttc = $obj->multicurrency_total_ttc; - - $i++; - } - $this->db->free($resql); - - return 1; - } - else - { - $this->error=$this->db->error(); - return -1; - }*/ } /** diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index d227d127f69..64813c56f1d 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -35,6 +35,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; @@ -42,11 +43,9 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; -if (! empty($conf->projet->enabled)) -{ - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -} +if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $langs->load('bills'); $langs->load('companies'); @@ -70,9 +69,15 @@ $search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','al $search_refcustomer=GETPOST('search_refcustomer','alpha'); $search_societe=GETPOST('search_societe','alpha'); $search_montant_ht=GETPOST('search_montant_ht','alpha'); +$search_montant_vat=GETPOST('search_montant_vat','alpha'); $search_montant_ttc=GETPOST('search_montant_ttc','alpha'); $search_status=GETPOST('search_status','int'); $search_paymentmode=GETPOST('search_paymentmode','int'); +$search_town=GETPOST('search_town','alpha'); +$search_zip=GETPOST('search_zip','alpha'); +$search_state=trim(GETPOST("search_state")); +$search_country=GETPOST("search_country",'int'); +$search_type_thirdparty=GETPOST("search_type_thirdparty",'int'); $option = GETPOST('option'); if ($option == 'late') $filter = 'paye:0'; @@ -80,9 +85,7 @@ $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -if ($page == -1) { - $page = 0; -} +if ($page == -1) { $page = 0; } $offset = $limit * $page; if (! $sortorder && ! empty($conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER) && $search_status == 1) $sortorder=$conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER; if (! $sortorder) $sortorder='DESC'; @@ -90,6 +93,9 @@ if (! $sortfield) $sortfield='f.datef'; $pageprev = $page - 1; $pagenext = $page + 1; +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$contextpage='invoicelist'; + $search_user = GETPOST('search_user','int'); $search_sale = GETPOST('search_sale','int'); $day = GETPOST('day','int'); @@ -106,15 +112,19 @@ $fieldid = (! empty($ref)?'facnumber':'rowid'); if (! empty($user->societe_id)) $socid=$user->societe_id; $result = restrictedArea($user, 'facture', $id,'','','fk_soc',$fieldid); -$diroutputpdf=$conf->facture->dir_output . '/unpaid/temp'; -if (! $user->rights->societe->client->voir || $socid) $diroutputpdf.='/private/'.$user->id; // If user has no permission to see all, output dir is specific to user +$diroutputmassaction=$conf->facture->dir_output . '/temp/massgeneration/'.$user->id; $object=new Facture($db); +$now=dol_now(); + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('invoicelist')); +$extrafields = new ExtraFields($db); -$now=dol_now(); +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('facture'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); // List of fields to search into when doing a "search in all" $fieldstosearchall = array( @@ -126,6 +136,36 @@ $fieldstosearchall = array( ); if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate"; +$checkedtypetiers=0; +$arrayfields=array( + 'f.facnumber'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), + 'f.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1), + 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), + 's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1), + 's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1), + 'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0), + 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0), + 'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers), + 'f.date'=>array('label'=>$langs->trans("DateInvoice"), 'checked'=>1), + 'f.date_lim_reglement'=>array('label'=>$langs->trans("DateDue"), 'checked'=>1), + 'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1), + 'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), + 'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0), + 'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0), + 'am'=>array('label'=>$langs->trans("Received"), 'checked'=>0), + 'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), + 'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), + 'f.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), +); +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) + { + $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); + } +} + /* * Actions @@ -133,10 +173,45 @@ if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate"; if (GETPOST('cancel')) { $action='list'; $massaction=''; } if (! GETPOST('confirmmassaction')) { $massaction=''; } - + $parameters=array('socid'=>$socid); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + +// Do we click on purge search criteria ? +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +{ + $search_user=''; + $search_sale=''; + $search_product_category=''; + $search_ref=''; + $search_refcustomer=''; + $search_societe=''; + $search_montant_ht=''; + $search_montant_vat=''; + $search_montant_ttc=''; + $search_status=''; + $search_paymentmode=''; + $search_town=''; + $search_zip=""; + $search_state=""; + $search_type=''; + $search_country=''; + $search_type_thirdparty=''; + $day=''; + $year=''; + $month=''; + $toselect=''; + $option=''; + $filter=''; + $day_lim=''; + $year_lim=''; + $month_lim=''; + $search_array_options=array(); +} + if (empty($reshook)) { // Mass actions. Controls on number of lines checked @@ -498,7 +573,7 @@ if (empty($reshook)) } // Create output dir if not exists - dol_mkdir($diroutputpdf); + dol_mkdir($diroutputmassaction); // Save merged file $filename=strtolower(dol_sanitizeFileName($langs->transnoentities("Invoices"))); @@ -512,7 +587,7 @@ if (empty($reshook)) if ($pagecount) { $now=dol_now(); - $file=$diroutputpdf.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; + $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; $pdf->Output($file,'F'); if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); @@ -532,7 +607,7 @@ if (empty($reshook)) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $langs->load("other"); - $upload_dir = $diroutputpdf; + $upload_dir = $diroutputmassaction; $file = $upload_dir . '/' . GETPOST('file'); $ret=dol_delete_file($file); if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs'); @@ -542,30 +617,6 @@ if (empty($reshook)) } -// Do we click on purge search criteria ? -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers -{ - $search_user=''; - $search_sale=''; - $search_product_category=''; - $search_ref=''; - $search_refcustomer=''; - $search_societe=''; - $search_montant_ht=''; - $search_montant_ttc=''; - $search_status=''; - $search_paymentmode=''; - $day=''; - $year=''; - $month=''; - $toselect=''; - $option=''; - $filter=''; - $day_lim=''; - $year_lim=''; - $month_lim=''; -} - /* @@ -579,16 +630,30 @@ $formother = new FormOther($db); $formfile = new FormFile($db); $bankaccountstatic=new Account($db); $facturestatic=new Facture($db); +$formcompany=new FormCompany($db); $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; -$sql.= ' f.rowid as facid, f.facnumber, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_tva, f.total_ttc,'; +$sql.= ' f.rowid as facid, f.facnumber, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,'; $sql.= ' f.datef as df, f.date_lim_reglement as datelimite,'; $sql.= ' f.paye as paye, f.fk_statut,'; -$sql.= ' s.nom as name, s.rowid as socid, s.code_client, s.client '; +$sql.= ' f.datec as date_creation, f.tms as date_update,'; +$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; +$sql.= " typent.code as typent_code,"; +$sql.= " state.code_departement as state_code, state.nom as state_name"; if (! $sall) $sql.= ', SUM(pf.amount) as am'; // To be able to sort on status +// Add fields from extrafields +foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s'; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; $sql.= ', '.MAIN_DB_PREFIX.'facture as f'; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_extrafields as ef on (f.rowid = ef.fk_object)"; if (! $sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid'; else $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as fd ON fd.fk_facture = f.rowid'; if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as pd ON f.rowid=pd.fk_facture'; @@ -622,7 +687,14 @@ if ($filtre) if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref); if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); +if ($search_town) $sql.= natural_search('s.town', $search_town); +if ($search_zip) $sql.= natural_search("s.zip",$search_zip); +if ($search_state) $sql.= natural_search("state.nom",$search_state); +if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; +if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; +if ($search_company) $sql .= natural_search('s.nom', $search_company); if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1); +if ($search_montant_vat != '') $sql.= natural_search('f.total', $search_montant_vat, 1); if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); if ($search_status != '' && $search_status >= 0) $sql.= " AND f.fk_statut = ".$db->escape($search_status); if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode.""; @@ -659,17 +731,37 @@ if ($search_user > 0) { $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".$search_user; } +// Add where from extra fields +foreach ($search_array_options as $key => $val) +{ + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $typ=$extrafields->attribute_type[$tmpkey]; + $mode=0; + 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); + } +} +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; + if (! $sall) { $sql.= ' GROUP BY f.rowid, f.facnumber, ref_client, f.type, f.note_private, f.note_public, f.increment, f.total, f.tva, f.total_ttc,'; $sql.= ' f.datef, f.date_lim_reglement,'; $sql.= ' f.paye, f.fk_statut,'; - $sql.= ' s.nom, s.rowid, s.code_client, s.client'; + $sql.= ' f.datec, f.tms,'; + $sql.= ' s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.code_client, s.client'; } else { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } + $sql.= ' ORDER BY '; $listfield=explode(',',$sortfield); foreach ($listfield as $key => $value) $sql.= $listfield[$key].' '.$sortorder.','; @@ -713,11 +805,20 @@ if ($resql) if ($search_user > 0) $param.='&search_user=' .$search_user; if ($search_product_category > 0) $param.='$search_product_category=' .$search_product_category; if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht; + if ($search_montant_vat != '') $param.='&search_montant_vat='.$search_montant_vat; if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc; if ($search_status != '') $param.='&search_status='.$search_status; if ($search_paymentmode > 0) $param.='search_paymentmode='.$search_paymentmode; if ($show_files) $param.='&show_files=' .$show_files; - $param.=(! empty($option)?"&option=".$option:""); + if ($option) $param.="&option=".$option; + if ($optioncss != '') $param.='&optioncss='.$optioncss; + // Add $param from extra fields + foreach ($search_array_options as $key => $val) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); + } $massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"))); @@ -875,188 +976,471 @@ if ($resql) print ''; } - print '
' . $langs->trans("Ref") . ''; - print $form->showrefnav($object, 'ref', '', 1, 'ref'); + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref'); print '
'; + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + + print '
'."\n"; print ''; - print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'f.facnumber','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('RefCustomer'),$_SERVER["PHP_SELF"],'f.ref_client','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'f.datef','',$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateDue"),$_SERVER['PHP_SELF'],"f.date_lim_reglement",'',$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('ThirdParty'),$_SERVER['PHP_SELF'],'s.nom','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PaymentModeShort"),$_SERVER["PHP_SELF"],"f.fk_mode_reglement","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans('AmountHT'),$_SERVER['PHP_SELF'],'f.total','',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Taxes'),$_SERVER['PHP_SELF'],'f.tva','',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('AmountTTC'),$_SERVER['PHP_SELF'],'f.total_ttc','',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Received'),$_SERVER['PHP_SELF'],'am','',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_statut,paye,am','',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); + if (! empty($arrayfields['f.facnumber']['checked'])) print_liste_field_titre($arrayfields['f.facnumber']['label'],$_SERVER['PHP_SELF'],'f.facnumber','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['f.ref_client']['checked'])) print_liste_field_titre($arrayfields['f.ref_client']['label'],$_SERVER["PHP_SELF"],'f.ref_client','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['f.date']['checked'])) print_liste_field_titre($arrayfields['f.date']['label'],$_SERVER['PHP_SELF'],'f.datef','',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['f.date_lim_reglement']['checked'])) print_liste_field_titre($arrayfields['f.date_lim_reglement']['label'],$_SERVER['PHP_SELF'],"f.date_lim_reglement",'',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER['PHP_SELF'],'s.nom','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'],$_SERVER["PHP_SELF"],"f.fk_mode_reglement","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['f.total_ht']['checked'])) print_liste_field_titre($arrayfields['f.total_ht']['label'],$_SERVER['PHP_SELF'],'f.total','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'],$_SERVER['PHP_SELF'],'f.tva','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'],$_SERVER['PHP_SELF'],'f.total_ttc','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['am']['checked'])) print_liste_field_titre($arrayfields['am']['label'],$_SERVER['PHP_SELF'],'am','',$param,'align="right"',$sortfield,$sortorder); + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + } + } + } + // Hook fields + $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['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'],$_SERVER["PHP_SELF"],"f.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'],$_SERVER["PHP_SELF"],"f.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'],$_SERVER["PHP_SELF"],"fk_statut,paye,am","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; // Filters lines print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + } + // Ref customer + if (! empty($arrayfields['f.ref_client']['checked'])) + { + print ''; + } + // Date invoice + if (! empty($arrayfields['f.date']['checked'])) + { + print ''; + } + // Date due + if (! empty($arrayfields['f.date_lim_reglement']['checked'])) + { + print ''; + } + // Thirpdarty + if (! empty($arrayfields['s.nom']['checked'])) + { + print ''; + } + // Town + if (! empty($arrayfields['s.town']['checked'])) print ''; + // Zip + if (! empty($arrayfields['s.zip']['checked'])) print ''; + // State + if (! empty($arrayfields['state.nom']['checked'])) + { + print ''; + } + // Country + if (! empty($arrayfields['country.code_iso']['checked'])) + { + print ''; + } + // Company type + if (! empty($arrayfields['typent.code']['checked'])) + { + print ''; + } + // Payment mode + if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) + { + print ''; + } + if (! empty($arrayfields['f.total_ht']['checked'])) + { + // Amount + print ''; + } + if (! empty($arrayfields['f.total_vat']['checked'])) + { + // Amount + print ''; + } + if (! empty($arrayfields['f.total_ttc']['checked'])) + { + // Amount + print ''; + } + if (! empty($arrayfields['am']['checked'])) + { + print ''; + } + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + $typeofextrafield=$extrafields->attribute_type[$key]; + print ''; + } + } + } + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (! empty($arrayfields['f.datec']['checked'])) + { + print ''; + } + // Date modification + if (! empty($arrayfields['f.tms']['checked'])) + { + print ''; + } + // Status + if (! empty($arrayfields['f.fk_statut']['checked'])) + { + print ''; + } + // Action column + print ''; print "\n"; if ($num > 0) { + $i=0; $var=true; - $total_ht=0; - $total_tva=0; - $total_ttc=0; - $totalrecu=0; - + $totalarray=array(); while ($i < min($num,$limit)) { - $objp = $db->fetch_object($resql); + $obj = $db->fetch_object($resql); $var=!$var; - $datelimit=$db->jdate($objp->datelimite); + $datelimit=$db->jdate($obj->datelimite); print ''; - print '\n"; - + if (! empty($arrayfields['f.facnumber']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + } + // Customer ref - print ''; - + if (! empty($arrayfields['f.ref_client']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Date - print ''; - + if (! empty($arrayfields['f.date']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Date limit - print ''; - - print ''; - + if (! empty($arrayfields['f.date_lim_reglement']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Third party + if (! empty($arrayfields['s.nom']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Town + if (! empty($arrayfields['s.town']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Zip + if (! empty($arrayfields['s.zip']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // State + if (! empty($arrayfields['state.nom']['checked'])) + { + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + // Country + if (! empty($arrayfields['country.code_iso']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Type ent + if (! empty($arrayfields['typent.code']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Payment mode - print ''; + if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + // Amount HT + if (! empty($arrayfields['f.total_ht']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield']; + $totalarray['totalht'] += $obj->total_ht; + } + // Amount VAT + if (! empty($arrayfields['f.total_vat']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield']; + $totalarray['totalvat'] += $obj->total_vat; + } + // Amount TTC + if (! empty($arrayfields['f.total_ttc']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; + $totalarray['totalttc'] += $obj->total_ttc; + } + + if (! empty($arrayfields['am']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalamfield']=$totalarray['nbfield']; + $totalarray['totalam'] += $paiement; + } - print ''; - - print ''; - - print ''; - - print ''; - + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + print 'getAlignFlag($key); + if ($align) print ' align="'.$align.'"'; + print '>'; + $tmpkey='options_'.$key; + print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); + print ''; + if (! $i) $totalarray['nbfield']++; + } + } + } + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (! empty($arrayfields['f.datec']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Date modification + if (! empty($arrayfields['f.tms']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } // Status - print '"; - - // Checkbox + if (! empty($arrayfields['f.fk_statut']['checked'])) + { + print '"; + if (! $i) $totalarray['nbfield']++; + } + + // Action column print '' ; - + if (in_array($obj->facid, $arrayofselected)) $selected=1; + print ''; + print '' ; + if (! $i) $totalarray['nbfield']++; + print "\n"; - $total_ht+=$objp->total_ht; - $total_tva+=$objp->total_tva; - $total_ttc+=$objp->total_ttc; - $totalrecu+=$paiement; + $i++; } - if (($offset + $num) <= $limit) - { - // Print total - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } + // Show total line + if (isset($totalarray['totalhtfield'])) + { + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if ($i == 1) + { + if ($num < $limit) print ''; + else print ''; + } + elseif ($totalarray['totalhtfield'] == $i) print ''; + elseif ($totalarray['totalvatfield'] == $i) print ''; + elseif ($totalarray['totalttcfield'] == $i) print ''; + elseif ($totalarray['totalamfield'] == $i) print ''; + else print ''; + } + print ''; + + } } - print "
'; - print ''; - print ''; - print ''; - print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($year?$year:-1,'year',1, 20, 5); - print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($year_lim?$year_lim:-1,'year_lim',1, 20, 5); - print '
'.$langs->trans("Late"); - print '
'; - $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 0, 1, 10); - print ''; - $liststatus=array('0'=>$langs->trans("BillShortStatusDraft"), '1'=>$langs->trans("BillShortStatusNotPaid"), '2'=>$langs->trans("BillShortStatusPaid"), '3'=>$langs->trans("BillShortStatusCanceled")); - print $form->selectarray('search_status', $liststatus, $search_status, 1); - print ''; - $searchpitco=$form->showFilterAndCheckAddButtons(1, 'checkforselect', 1); - print $searchpitco; + // Ref + if (! empty($arrayfields['f.facnumber']['checked'])) + { + print ''; + print ''; + print ''; + print ''; + print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($year?$year:-1,'year',1, 20, 5); + print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($year_lim?$year_lim:-1,'year_lim',1, 20, 5); + print '
'.$langs->trans("Late"); + print '
'; + print ''; + print ''; + print $form->select_country($search_country,'search_country','',0,'maxwidth100'); + print ''; + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); + print ''; + $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 0, 1, 10); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + 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 ''; + print ''; + print ''; + $liststatus=array('0'=>$langs->trans("BillShortStatusDraft"), '1'=>$langs->trans("BillShortStatusNotPaid"), '2'=>$langs->trans("BillShortStatusPaid"), '3'=>$langs->trans("BillShortStatusCanceled")); + print $form->selectarray('search_status', $liststatus, $search_status, 1); + print ''; + $searchpitco=$form->showFilterAndCheckAddButtons(1, 'checkforselect', 1); + print $searchpitco; print '
'; - - $facturestatic->id=$objp->facid; - $facturestatic->ref=$objp->facnumber; - $facturestatic->type=$objp->type; - $facturestatic->statut=$objp->fk_statut; - $facturestatic->date_lim_reglement=$db->jdate($objp->datelimite); - $notetoshow=dol_string_nohtmltag(($user->societe_id>0?$objp->note_public:$objp->note_private),1); - $paiement = $facturestatic->getSommePaiement(); - - print ''; - - print ''; - - print ''; - print ''; - print '
'; - print $facturestatic->getNomUrl(1,'',200,0,$notetoshow); - print $objp->increment; - print ''; - if (! empty($objp->note_private)) - { - print ' '; - print ''.img_picto($langs->trans("ViewPrivateNote"),'object_generic').''; - print ''; - } - $filename=dol_sanitizeFileName($objp->facnumber); - $filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($objp->facnumber); - $urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->facid; - print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); - print '
'; - - print "
'; + + $facturestatic->id=$obj->facid; + $facturestatic->ref=$obj->facnumber; + $facturestatic->type=$obj->type; + $facturestatic->statut=$obj->fk_statut; + $facturestatic->date_lim_reglement=$db->jdate($obj->datelimite); + $notetoshow=dol_string_nohtmltag(($user->societe_id>0?$obj->note_public:$obj->note_private),1); + $paiement = $facturestatic->getSommePaiement(); + + print ''; + + print ''; + + print ''; + print ''; + print '
'; + print $facturestatic->getNomUrl(1,'',200,0,$notetoshow); + print $obj->increment; + print ''; + if (! empty($obj->note_private)) + { + print ' '; + print ''.img_picto($langs->trans("ViewPrivateNote"),'object_generic').''; + print ''; + } + $filename=dol_sanitizeFileName($obj->facnumber); + $filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->facnumber); + $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->facid; + print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); + print '
'; + + print "
'; - print $objp->ref_client; - print ''; + print $obj->ref_client; + print ''; - print dol_print_date($db->jdate($objp->df),'day'); - print ''; + print dol_print_date($db->jdate($obj->df),'day'); + print ''.dol_print_date($datelimit,'day'); - if ($facturestatic->hasDelay()) - { - print img_warning($langs->trans('Late')); - } - print ''; - $thirdparty=new Societe($db); - $thirdparty->id=$objp->socid; - $thirdparty->name=$objp->name; - $thirdparty->client=$objp->client; - $thirdparty->code_client=$objp->code_client; - print $thirdparty->getNomUrl(1,'customer'); - print ''.dol_print_date($datelimit,'day'); + if ($facturestatic->hasDelay()) + { + print img_warning($langs->trans('Late')); + } + print ''; + $thirdparty=new Societe($db); + $thirdparty->id=$obj->socid; + $thirdparty->name=$obj->name; + $thirdparty->client=$obj->client; + $thirdparty->code_client=$obj->code_client; + print $thirdparty->getNomUrl(1,'customer'); + print ''; + print $obj->town; + print ''; + print $obj->zip; + print '".$obj->state_name."'; + $tmparray=getCountry($obj->fk_pays,'all'); + print $tmparray['label']; + print ''; + if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1); + print $typenArray[$obj->typent_code]; + print ''; - $form->form_modes_reglement($_SERVER['PHP_SELF'], $objp->fk_mode_reglement, 'none', '', -1); - print ''; + $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1); + print ''.price($obj->total_ht)."'.price($obj->total_vat)."'.price($obj->total_ttc)."'.(! empty($paiement)?price($paiement,0,$langs):' ').''.price($objp->total_ht,0,$langs).''.price($objp->total_tva,0,$langs).''.price($objp->total_ttc,0,$langs).''.(! empty($paiement)?price($paiement,0,$langs):' ').''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour'); + print ''; - print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$paiement,$objp->type); - print "'; + print $facturestatic->LibStatut($obj->paye,$obj->fk_statut,5,$paiement,$obj->type); + print "'; $selected=0; - if (in_array($objp->facid, $arrayofselected)) $selected=1; - print ''; - print '
'.$langs->trans('Total').''.price($total_ht,0,$langs).''.price($total_tva,0,$langs).''.price($total_ttc,0,$langs).''.price($totalrecu,0,$langs).'
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price($totalarray['totalht']).''.price($totalarray['totalvat']).''.price($totalarray['totalttc']).''.price($totalarray['totalam']).'
\n"; - print "\n"; $db->free($resql); + + $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); + $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + print "
\n"; + + print "\n"; if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { @@ -1066,7 +1450,7 @@ if ($resql) $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource.=str_replace('&','&',$param); - $filedir=$diroutputpdf; + $filedir=$diroutputmassaction; $genallowed=$user->rights->facture->lire; $delallowed=$user->rights->facture->lire; @@ -1074,7 +1458,7 @@ if ($resql) $paramwithoutshowfiles=preg_replace('/show_files=1&?/','',$param); $title=$langs->trans("MassFilesArea").' ('.$langs->trans("Hide").')'; - $formfile->show_documents('massfilesarea','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); + print $formfile->showdocuments('massfilesarea','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); } else { diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 372f9e2340a..1493ba1b99a 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -213,7 +213,6 @@ if ($resql) } else { - $var=!$var; print ""; print ''.$langs->trans("None").""; print ''; diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 9dd841e0add..4c65b467554 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -151,7 +151,7 @@ if ($id > 0) if (GETPOST('error','alpha')!='') { - print '
'.$bon->ReadError(GETPOST('error','alpha')).'
'; + print '
'.$bon->getErrorString(GETPOST('error','alpha')).'
'; } /*if ($action == 'credite') diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 2043516564c..3c3a7d14ca0 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -245,16 +245,18 @@ class BonPrelevement extends CommonObject } /** - * Read errors + * Return error string * - * @param int $error id of error - * @return array Array of errors + * @param int $error Id of error + * @return string Error string */ - function ReadError($error) + function getErrorString($error) { + global $langs; + $errors = array(); - $errors[1027] = "Date invalide"; + $errors[1027] = $langs->trans("DateInvalid"); return $errors[abs($error)]; } diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index cc67393d679..5dbeeb951dd 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -314,13 +314,9 @@ if (empty($reshook)) else { $object->photo = dol_sanitizeFileName($_FILES['photo']['name']); - // 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/contact/perso.php b/htdocs/contact/perso.php index dc5db9445bb..da70bc3e007 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -87,13 +87,8 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact } 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/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 395e484075d..8f3c87725fa 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -8,7 +8,7 @@ * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García - * Copyright (C) 2015 Ferran Marcet + * Copyright (C) 2015-2016 Ferran Marcet * * 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 @@ -1514,7 +1514,7 @@ class Contrat extends CommonObject // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. $localtaxes_type=getLocalTaxesFromRate($tvatx, 0, $this->societe, $mysoc); - $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. + $tvatx = preg_replace('/\s*\(.*\)/','',$tvatx); // Remove code into vatrate. $tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtax1tx, $localtax2tx, 0, $price_base_type, $info_bits, 1, $mysoc, $localtaxes_type); $total_ht = $tabprice[0]; diff --git a/htdocs/core/ajax/contacts.php b/htdocs/core/ajax/contacts.php index c0cd9ecfd70..c3788a8baeb 100644 --- a/htdocs/core/ajax/contacts.php +++ b/htdocs/core/ajax/contacts.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2012 Regis Houssin + * Copyright (C) 2016 Laurent Destailleur * * 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 diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index ffefbd80120..b4ea22d59eb 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -34,6 +34,8 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); $res=@include '../../main.inc.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; +//global $hookmanager; +$hookmanager->initHooks(array('searchform')); $search_boxvalue=GETPOST('q'); @@ -115,7 +117,7 @@ if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFO } -/* Do we really need this. We already have a select for users, and we should be able to filter into user list on employee flag +/* Do we really need this. We already have a select for users, and we should be able to filter into user list on employee flag if (! empty($conf->hrm->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_EMPLOYEE) && $user->rights->hrm->employee->read) { $langs->load("hrm"); @@ -124,9 +126,7 @@ if (! empty($conf->hrm->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_EMPLO */ // Execute hook addSearchEntry -$hookmanager->initHooks(array('searchform','leftblock')); - -$parameters=array(); +$parameters=array('search_boxvalue'=>$search_boxvalue); $reshook=$hookmanager->executeHooks('addSearchEntry',$parameters); if (empty($reshook)) { @@ -135,7 +135,6 @@ if (empty($reshook)) else $arrayresult=$hookmanager->resArray; - print json_encode($arrayresult); if (is_object($db)) $db->close(); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 059ce7e5e25..7de64135245 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1733,10 +1733,10 @@ abstract class CommonObject * Save a new position (field rang) for details lines. * You can choose to set position for lines with already a position or lines without any position defined. * - * @param boolean $renum true to renum all already ordered lines, false to renum only not already ordered lines. - * @param string $rowidorder ASC or DESC - * @param boolean $fk_parent_line Table with fk_parent_line field or not - * @return void + * @param boolean $renum True to renum all already ordered lines, false to renum only not already ordered lines. + * @param string $rowidorder ASC or DESC + * @param boolean $fk_parent_line Table with fk_parent_line field or not + * @return int <0 if KO, >0 if OK */ function line_order($renum=false, $rowidorder='ASC', $fk_parent_line=true) { @@ -1813,6 +1813,7 @@ abstract class CommonObject dol_print_error($this->db); } } + return 1; } /** @@ -2154,9 +2155,9 @@ abstract class CommonObject * Must be called at end of methods addline or updateline. * * @param int $exclspec >0 = Exclude special product (product_type=9) - * @param string $roundingadjust 'none'=Do nothing, 'auto'=Use default method (MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND if defined, or '0'), '0'=Force use total of rounding, '1'=Force use rounding of total + * @param string $roundingadjust 'none'=Do nothing, 'auto'=Use default method (MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND if defined, or '0'), '0'=Force mode total of rounding, '1'=Force mode rounding of total * @param int $nodatabaseupdate 1=Do not update database. Update only properties of object. - * @param Societe $seller If roundingadjust is '0' or '1', it means we recalculate total for lines before calculating total for object and for this, we need seller object. + * @param Societe $seller If roundingadjust is '0' or '1' or maybe 'auto', it means we recalculate total for lines before calculating total for object and for this, we need seller object. * @return int <0 if KO, >0 if OK */ function update_price($exclspec=0,$roundingadjust='none',$nodatabaseupdate=0,$seller=null) @@ -3004,7 +3005,7 @@ abstract class CommonObject /** * Set extra parameters * - * @return void + * @return int <0 if KO, >0 if OK */ function setExtraParameters() { @@ -3091,7 +3092,7 @@ abstract class CommonObject { $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; $sql.= " SET fk_incoterms = ".($id_incoterm > 0 ? $id_incoterm : "null"); - $sql.= ", location_incoterms = '".($id_incoterm > 0 ? $this->db->escape($location) : "null")."'"; + $sql.= ", location_incoterms = ".($id_incoterm > 0 ? "'".$this->db->escape($location)."'" : "null"); $sql.= " WHERE rowid = " . $this->id; dol_syslog(get_class($this).'::setIncoterms', LOG_DEBUG); $resql=$this->db->query($sql); @@ -3272,18 +3273,18 @@ abstract class CommonObject if ($inputalsopricewithtax) print ''.$langs->trans('PriceUTTC').''; // Qty - print ''.$langs->trans('Qty').''; + print ''.$langs->trans('Qty').''; if($conf->global->PRODUCT_USE_UNITS) { - print ''.$langs->trans('Unit').''; + print ''.$langs->trans('Unit').''; } // Reduction short - print ''.$langs->trans('ReductionShort').''; + print ''.$langs->trans('ReductionShort').''; if ($this->situation_cycle_ref) { - print '' . $langs->trans('Progress') . ''; + print '' . $langs->trans('Progress') . ''; } if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id)) @@ -3300,10 +3301,10 @@ abstract class CommonObject } // Total HT - print ''.$langs->trans('TotalHTShort').''; + print ''.$langs->trans('TotalHTShort').''; // Multicurrency - if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('TotalHTShortCurrency').''; + if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('TotalHTShortCurrency').''; print ''; // No width to allow autodim @@ -3910,7 +3911,7 @@ abstract class CommonObject * @param string $file Path file in UTF8 to original file to create thumbs from. * @return void */ - function add_thumb($file) + function addThumbs($file) { global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini, $quality; @@ -3942,15 +3943,15 @@ abstract class CommonObject * 3) If not but a constant $conf->global->OBJECTELEMENT_FIELDNAME is set, we return it (It is better to use the dedicated table). * 4) Return value found into database (TODO No yet implemented) * - * @param string $fieldname Name of field - * @param string $alternatevalue Alternate value to use - * @return string Default value + * @param string $fieldname Name of field + * @param string $alternatevalue Alternate value to use + * @return string|string[] Default value (can be an array if the GETPOST return an array) **/ function getDefaultCreateValueFor($fieldname, $alternatevalue=null) { global $conf, $_POST; - // If param is has been posted with use this value first. + // If param here has been posted, we use this value first. if (isset($_POST[$fieldname])) return GETPOST($fieldname, 2); if (isset($alternatevalue)) return $alternatevalue; @@ -4391,7 +4392,7 @@ abstract class CommonObject * @param DoliDB $db Database handler * @param int $origin_id Old thirdparty id (the thirdparty to delete) * @param int $dest_id New thirdparty id (the thirdparty that will received element of the other) - * @param array $tables Tables that need to be changed + * @param string[] $tables Tables that need to be changed * @return bool */ public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 35c3b3909ef..8564a18822e 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -138,7 +138,7 @@ class DolEditor /** * Output edit area inside the HTML stream. - * Output depends on this->tool (fckeditor, ckeditor, texatrea, ...) + * Output depends on this->tool (fckeditor, ckeditor, textarea, ...) * * @param int $noprint 1=Return HTML string instead of printing it to output * @param string $morejs Add more js. For example: ".on( \'saveSnapshot\', function(e) { alert(\'ee\'); });" diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index a38b034747b..e25709fd303 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -219,7 +219,7 @@ class FileUpload } /** - * Enter description here ... + * getFileObject * * @param string $file_name Filename * @return stdClass|NULL @@ -247,7 +247,7 @@ class FileUpload } /** - * Enter description here ... + * getFileObjects * * @return void */ @@ -257,11 +257,11 @@ class FileUpload } /** - * Create thumbs + * Create thumbs of a file uploaded. Only the "mini" thumb is generated. * * @param string $file_name Filename * @param string $options is array('max_width', 'max_height') - * @return void + * @return boolean */ protected function createScaledImage($file_name, $options) { @@ -277,9 +277,8 @@ class FileUpload return false; } - $res=vignette($file_path,$maxwidthmini,$maxheightmini,'_mini'); + $res=vignette($file_path,$maxwidthmini,$maxheightmini,'_mini'); // We don't use ->addThumbs here because there is no object and we don't need all thumbs, only the "mini". - //return $success; if (preg_match('/error/i',$res)) return false; return true; } @@ -296,7 +295,7 @@ class FileUpload * @param string $file File * @param string $error Error * @param string $index Index - * @return unknown|string + * @return boolean True if OK, False if KO */ protected function validate($uploaded_file, $file, $error, $index) { @@ -376,12 +375,12 @@ class FileUpload } /** - * Enter description here ... + * trimFileName * - * @param unknown_type $name Filename - * @param unknown_type $type ??? - * @param unknown_type $index ??? - * @return void + * @param string $name Filename + * @param string $type ??? + * @param string $index ??? + * @return string */ protected function trimFileName($name, $type, $index) { @@ -405,43 +404,7 @@ class FileUpload } /** - * Enter description here ... - * - * @param unknown_type $file_path ??? - * @return int Success or not - */ - protected function orientImage($file_path) - { - $exif = @exif_read_data($file_path); - if ($exif === false) { - return false; - } - $orientation = intval(@$exif['Orientation']); - if (!in_array($orientation, array(3, 6, 8))) { - return false; - } - $image = @imagecreatefromjpeg($file_path); - switch ($orientation) { - case 3: - $image = @imagerotate($image, 180, 0); - break; - case 6: - $image = @imagerotate($image, 270, 0); - break; - case 8: - $image = @imagerotate($image, 90, 0); - break; - default: - return false; - } - $success = imagejpeg($image, $file_path); - // Free up memory (imagedestroy does not delete files): - @imagedestroy($image); - return $success; - } - - /** - * Enter description here ... + * handleFileUpload * * @param string $uploaded_file Uploade file * @param string $name Name diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index df24b5a36ca..f92056893b6 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -64,7 +64,7 @@ class HookManager * class found into file /mymodule/class/actions_mymodule.class.php (if module has declared the context as a managed context). * Then when a hook executeHooks('aMethod'...) is called, the method aMethod found into class will be executed. * - * @param array $arraycontext Array list of searched hooks tab/features. For example: 'thirdpartycard' (for hook methods into page card thirdparty), 'thirdpartydao' (for hook methods into Societe), ... + * @param string[] $arraycontext Array list of searched hooks tab/features. For example: 'thirdpartycard' (for hook methods into page card thirdparty), 'thirdpartydao' (for hook methods into Societe), ... * @return int Always 1 */ function initHooks($arraycontext) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1e60fb11377..082f362458b 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -169,7 +169,8 @@ class Form else if (preg_match('/^(numeric|amount)/',$typeofdata)) { $tmp=explode(':',$typeofdata); - $ret.=''; + $valuetoshow=price2num($editvalue?$editvalue:$value); + $ret.=''; } else if (preg_match('/^text/',$typeofdata) || preg_match('/^note/',$typeofdata)) { @@ -1344,7 +1345,7 @@ class Form * @param int $maxlength Maximum length of string into list (0=no limit) * @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status * @param string $morefilter Add more filters into sql request - * @param string $show_every 0=default list, 1=add also a value "Everybody" at beginning of list + * @param integer $show_every 0=default list, 1=add also a value "Everybody" at beginning of list * @param string $enableonlytext If option $enableonly is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty. * @param string $morecss More css * @param int $noactive Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on). @@ -2095,7 +2096,8 @@ class Form $sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration, p.fk_product_type,"; $sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,"; - $sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.fk_soc, s.nom as name"; + $sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.fk_soc, s.nom as name,"; + $sql.= " pfp.supplier_reputation"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; if ($socid) $sql.= " AND pfp.fk_soc = ".$socid; @@ -2234,6 +2236,15 @@ class Form $opt .= " - ".dol_trunc($objp->name,8); $outval.=" - ".dol_trunc($objp->name,8); } + if ($objp->supplier_reputation) + { + //TODO dictionnary + $reputations=array(''=>$langs->trans('Standard'),'FAVORITE'=>$langs->trans('Favorite'),'NOTTHGOOD'=>$langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER'=>$langs->trans('DoNotOrderThisProductToThisSupplier')); + + $opt .= " - ".$reputations[$objp->supplier_reputation]; + $outval.=" - ".$reputations[$objp->supplier_reputation]; + } + } else { @@ -2277,7 +2288,7 @@ class Form * * @param int $productid Id of product * @param string $htmlname Name of HTML field - * @return void + * @return string|null */ function select_product_fourn_price($productid,$htmlname='productfournpriceid') { @@ -2389,7 +2400,7 @@ class Form * @param int $socid Id of company * @param string $htmlname Name of HTML field * @param int $showempty Add an empty field - * @return void + * @return integer|null */ function select_address($selected, $socid, $htmlname='address_id',$showempty=0) { @@ -3640,7 +3651,7 @@ class Form * @param int $displayhour Display hour selector * @param int $displaymin Display minutes selector * @param int $nooutput 1=No print output, return string - * @return void + * @return string * @see select_date */ function form_date($page, $selected, $htmlname, $displayhour=0, $displaymin=0, $nooutput=0) @@ -4137,11 +4148,18 @@ class Form $return=''; - // Define defaultnpr and defaultttx + // Define defaultnpr, defaultttx and defaultcode $defaultnpr=($info_bits & 0x01); $defaultnpr=(preg_match('/\*/',$selectedrate) ? 1 : $defaultnpr); $defaulttx=str_replace('*','',$selectedrate); - + $defaultcode=''; + if (preg_match('/\s*\((.*)\)/', $defaulttx, $reg)) + { + $defaultcode=$reg[1]; + $defaulttx=preg_replace('/\s*\(.*\)/','',$defaulttx); + } + //var_dump($defaulttx.'-'.$defaultnpr.'-'.$defaultcode); + // Check parameters if (is_object($societe_vendeuse) && ! $societe_vendeuse->country_code) { @@ -4237,9 +4255,13 @@ class Form $return.= $rate['nprtva'] ? '*': ''; if ($addcode && $rate['code']) $return.=' ('.$rate['code'].')'; $return.= '"'; - if ($rate['txtva'] == $defaulttx && $rate['nprtva'] == $defaultnpr) + if ($defaultcode) { - $return.= ' selected'; + if ($defaultcode == $rate['code']) $return.= ' selected'; + } + elseif ($rate['txtva'] == $defaulttx && $rate['nprtva'] == $defaultnpr) + { + $return.= ' selected'; } $return.= '>'.vatrate($rate['libtva']); //$return.=($rate['code']?' '.$rate['code']:''); @@ -4280,7 +4302,7 @@ class Form * @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59 * @param string $addplusone Add a link "+1 hour". Value must be name of another select_date field. * @param datetime $adddateof Add a link "Date of invoice" using the following date. - * @return mixed Nothing or string if nooutput is 1 + * @return string|null Nothing or string if nooutput is 1 * @see form_date */ function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $nooutput=0, $disabled=0, $fullday='', $addplusone='', $adddateof='') @@ -4563,9 +4585,9 @@ class Form * @param int $iSecond Default preselected duration (number of seconds or '') * @param int $disabled Disable the combo box * @param string $typehour If 'select' then input hour and input min is a combo, if 'text' input hour is in text and input min is a combo - * @param string $minunderhours If 1, show minutes selection under the hours + * @param integer $minunderhours If 1, show minutes selection under the hours * @param int $nooutput Do not output html string but return it - * @return void + * @return string|null */ function select_duration($prefix, $iSecond='', $disabled=0, $typehour='select', $minunderhours=0, $nooutput=0) { @@ -4747,7 +4769,7 @@ class Form * @param string $morecss Add more class to css styles * @param int $callurlonselect If set to 1, some code is added so an url return by the ajax is called when value is selected. * @param string $placeholder String to use as placeholder - * @param string $acceptdelayedhtml 1 if caller request to have html delayed content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) + * @param integer $acceptdelayedhtml 1 if caller request to have html delayed content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) * @return string HTML select string */ static function selectArrayAjax($htmlname, $url, $id='', $moreparam='', $moreparamtourl='', $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='', $acceptdelayedhtml=0) diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 0316fb461cf..7194f1f5da6 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -52,8 +52,8 @@ class FormActions * @param string $selected Preselected value (-1..100) * @param int $canedit 1=can edit, 0=read only * @param string $htmlname Name of html prefix for html fields (selectX and valX) - * @param string $showempty Show an empty line if select is used - * @param string $onlyselect 0=Standard, 1=Hide percent of completion and force usage of a select list, 2=Same than 1 and add "Incomplete (Todo+Running) + * @param integer $showempty Show an empty line if select is used + * @param integer $onlyselect 0=Standard, 1=Hide percent of completion and force usage of a select list, 2=Same than 1 and add "Incomplete (Todo+Running) * @return void */ function form_select_status_action($formname,$selected,$canedit=1,$htmlname='complete',$showempty=0,$onlyselect=0) @@ -136,7 +136,7 @@ class FormActions if (empty($onlyselect)) { print ' =0)?'':' disabled').'>'; - print '%'; + print '%'; } } else @@ -153,9 +153,10 @@ class FormActions * @param string $typeelement 'invoice','propal','order','invoice_supplier','order_supplier','fichinter' * @param int $socid socid of user * @param int $forceshowtitle Show title even if there is no actions to show + * @param string $morecss More css on table * @return int <0 if KO, >=0 if OK */ - function showactions($object,$typeelement,$socid=0,$forceshowtitle=0) + function showactions($object,$typeelement,$socid=0,$forceshowtitle=0,$morecss='listactions') { global $langs,$conf,$user; global $bc; @@ -182,7 +183,7 @@ class FormActions print load_fiche_titre($title,'',''); $total = 0; $var=true; - print ''; + print '
'; print ''; print ''; print ''; @@ -245,7 +246,7 @@ class FormActions * @param string $selected Type pre-selected (can be 'manual', 'auto' or 'AC_xxx') * @param string $htmlname Name of select field * @param string $excludetype A type to exclude ('systemauto', 'system', '') - * @param string $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type + * @param integer $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type * @param int $hideinfohelp 1=Do not show info help, 0=Show, -1=Show+Add info to tell how to set default value * @param int $multiselect 1=Allow multiselect of action type * @return void diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 565acd828b2..579e83a744c 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -64,9 +64,9 @@ class FormFile * @param int $size Length of input file area * @param Object $object Object to use (when attachment is done on an element) * @param string $options Add an option column - * @param boolean $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option). 2 should never be used. + * @param integer $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option). 2 should never be used. * @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__' - * @param string $linkfiles 1=Also add form to link files, 0=Do not show form to link files + * @param integer $linkfiles 1=Also add form to link files, 0=Do not show form to link files * @param string $htmlname Name and id of HTML form * @return int <0 if KO, >0 if OK */ @@ -227,16 +227,17 @@ class FormFile * @param int $genallowed Generation is allowed (1/0 or array of formats) * @param int $delallowed Remove is allowed (1/0) * @param string $modelselected Model to preselect by default - * @param string $allowgenifempty Show warning if no model activated - * @param string $forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined) + * @param integer $allowgenifempty Show warning if no model activated + * @param integer $forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined) * @param int $iconPDF Show only PDF icon with link (1/0) * @param int $maxfilenamelength Max length for filename shown - * @param string $noform Do not output html form tags + * @param integer $noform Do not output html form tags * @param string $param More param on http links * @param string $title Title to show on top of form * @param string $buttonlabel Label on submit button * @param string $codelang Default language code to use on lang combo box if multilang is enabled * @return int <0 if KO, number of shown files if OK + * @deprecated Use print xxx->showdocuments() instead. */ function show_documents($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='') { @@ -256,11 +257,11 @@ class FormFile * @param int $genallowed Generation is allowed (1/0 or array list of templates) * @param int $delallowed Remove is allowed (1/0) * @param string $modelselected Model to preselect by default - * @param string $allowgenifempty Allow generation even if list of template ($genallowed) is empty (show however a warning) - * @param string $forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined) + * @param integer $allowgenifempty Allow generation even if list of template ($genallowed) is empty (show however a warning) + * @param integer $forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined) * @param int $iconPDF Deprecated, see getDocumentsLink * @param int $maxfilenamelength Max length for filename shown - * @param string $noform Do not output html form tags + * @param integer $noform Do not output html form tags * @param string $param More param on http links * @param string $title Title to show on top of form * @param string $buttonlabel Label on submit button @@ -274,7 +275,7 @@ class FormFile if (0 !== $iconPDF) { dol_syslog(__METHOD__ . ": passing iconPDF parameter is deprecated", LOG_WARNING); } - + global $langs, $conf, $user, $hookmanager; global $form, $bc; @@ -286,7 +287,7 @@ class FormFile if (! empty($iconPDF)) { return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir); } - + $printer=0; if (in_array($modulepart,array('facture','supplier_proposal','propal','proposal','order','commande','expedition', 'commande_fournisseur'))) // The direct print feature is implemented only for such elements { @@ -502,10 +503,12 @@ class FormFile $out.= ''; + $addcolumforpicto=($delallowed || $printer || $morepicto); + $out.= ''; + $out.= ajax_combobox('model'); } else { - $out.= ''; + $out.= '
'.$langs->trans("Files").'
'; } // Language code (if multilang) - $out.= ''; // Button - $addcolumforpicto=($delallowed || $printer || $morepicto); - $out.= '
'.$langs->trans('Ref').''.$langs->trans('Action').'
'; + // Model if (! empty($modellist)) { - $out.= ''; $out.= ''.$langs->trans('Model').' '; if (is_array($modellist) && count($modellist) == 1) // If there is only one element { @@ -513,17 +516,14 @@ class FormFile $modelselected=$arraykeys[0]; } $out.= $form->selectarray('model', $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', ''); - $out.= ''; - $out.= $langs->trans("Files"); - $out.= ''; if (($allowgenifempty || (is_array($modellist) && count($modellist) > 0)) && $conf->global->MAIN_MULTILANGS && ! $forcenomultilang && (! empty($modellist) || $showempty)) { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; @@ -537,12 +537,9 @@ class FormFile { $out.= ' '; } - $out.= ''; - $genbutton = ''; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 9d540a37bb6..a23078a0e12 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -170,7 +170,7 @@ class FormMail extends Form /** * Remove a file from the list of attached files (stored in SECTION array) * - * @param string $keytodelete Key in file array + * @param string $keytodelete Key in file array (0, 1, 2, ...) * @return void */ function remove_attached_files($keytodelete) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 93ffb57930e..b784577bce3 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -384,7 +384,7 @@ class SMTPs /** * Attempt mail server authentication for a secure connection * - * @return mixed $_retVal Boolean indicating success or failure of authentication + * @return boolean|null $_retVal Boolean indicating success or failure of authentication */ function _server_authenticate() { @@ -441,7 +441,7 @@ class SMTPs * * @param boolean $_bolTestMsg whether to run this method in 'Test' mode. * @param boolean $_bolDebug whether to log all communication between this Class and the Mail Server. - * @return mixed void + * @return boolean|null void * $_strMsg If this is run in 'Test' mode, the actual message structure will be returned */ function sendMsg($_bolTestMsg = false, $_bolDebug = false) @@ -541,7 +541,7 @@ class SMTPs * defined. * * @param mixed $_strConfigPath path to config file or VOID - * @return void + * @return boolean */ function setConfig($_strConfigPath = null) { @@ -615,7 +615,7 @@ class SMTPs * Path to the sendmail execuable * * @param string $_path Path to the sendmail execuable - * @return void + * @return boolean * */ function setMailPath($_path) @@ -1020,8 +1020,8 @@ class SMTPs /** * Returns an array of addresses for a specific type; TO, CC or BCC * - * @param mixed $_which Which collection of adresses to return - * @return array Array of emaill address + * @param string $_which Which collection of adresses to return + * @return string|false Array of emaill address */ function get_email_list($_which = null) { @@ -1071,7 +1071,7 @@ class SMTPs /** * TO Address[es] inwhich to send mail to * - * @param mixed $_addrTo TO Address[es] inwhich to send mail to + * @param string $_addrTo TO Address[es] inwhich to send mail to * @return void */ function setTO($_addrTo) @@ -1456,7 +1456,7 @@ class SMTPs * - [2] Private * - [3] Company Confidential * - * @param string $_value Message Sensitivity + * @param integer $_value Message Sensitivity * @return void */ function setSensitivity($_value = 0) @@ -1491,7 +1491,7 @@ class SMTPs * - [4] 'Low' * - [5] 'Lowest' * - * @param string $_value Message Priority + * @param integer $_value Message Priority * @return void */ function setPriority ( $_value = 3 ) @@ -1511,7 +1511,7 @@ class SMTPs * - [4] 'Low' * - [5] 'Lowest' * - * @return void + * @return string */ function getPriority() { @@ -1534,7 +1534,7 @@ class SMTPs /** * Gets flag which determines whether to calculate message MD5 checksum. * - * @return string Message Priority + * @return boolean Message Priority */ function getMD5flag() { @@ -1558,7 +1558,7 @@ class SMTPs /** * Retrieves the Message X-Header Content * - * @return string $_msgContent Message X-Header Content + * @return string[] $_msgContent Message X-Header Content */ function getXheader() { @@ -1632,7 +1632,7 @@ class SMTPs * @param string $_strSend String to send * @param string $_returnCode Return code * @param string $CRLF CRLF - * @return boolean True or false + * @return boolean|null True or false */ function socket_send_str( $_strSend, $_returnCode = null, $CRLF = "\r\n" ) { diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 68d7ab672db..2b9f2dedf8a 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -1271,158 +1271,6 @@ class DoliDBSqlite3 extends DoliDB } } - /** - * Cette fonction est l'equivalent de la fonction MONTH de MySql. - * - * @param string $date Date - * @return string - */ - public static function dbMONTH($date) - { - return date('n', strtotime($date)); - } - - /** - * calcule du numéro de semaine - * - * @param string $date Date - * @param int $mode Mode - * @return string - */ - public static function dbWEEK($date, $mode = 0) - { - $arr = date_parse($date); - $calc_year = 0; - return self::calc_week($arr['year'], $arr['month'], $arr['day'], self::week_mode($mode), $calc_year); - } - - /** - * db_CURDATE - * - * @return string - */ - public static function dbCURDATE() { - return date('Y-m-d'); - } - - /** - * db_CURTIME - * - * @return string - */ - public static function dbCURTIME() { - return date('H:i:s'); - } - - /** - * dbWEEKDAY - * - * @param int $date Date - * @return double - */ - public static function dbWEEKDAY($date) { - $arr = date_parse($date); - return self::calc_weekday(self::calc_daynr($arr['year'], $arr['month'], $arr['day']), 0); - - } - - /** - * Cette fonction est l'equivelent de la fonction date_format de MySQL. - * @staticvar string $mysql_replacement Les symboles formatage a remplacer - * - * @param string $date la date dans un format ISO - * @param string $format la chaine de formatage - * @return string La date formatee. - */ - public static function dbdateformat($date, $format) - { - static $mysql_replacement; - if (! isset($mysql_replacement)) { - $mysql_replacement = array( - '%' => '%', - 'a' => 'D', - 'b' => 'M', - 'c' => 'n', - 'D' => 'jS', - 'd' => 'd', - 'e' => 'j', - 'f' => 'u', - 'H' => 'H', - 'h' => 'h', - 'I' => 'h', - 'i' => 'i', - 'k' => 'H', - 'l' => 'g', - 'M' => 'F', - 'm' => 'm', - 'p' => 'A', - 'r' => 'h:i:s A', - 'S' => 's', - 's' => 's', - 'T' => 'H:i:s', - 'W' => 'l', - 'w' => 'w', - 'Y' => 'Y', - 'y' => 'y', - ); - } - - $fmt = ''; - $lg = strlen($format); - $state = 0; - $timestamp = strtotime($date); - $yday = date('z', $timestamp); - $month = (integer) date("n", $timestamp); - $year = (integer) date("Y", $timestamp); - $day = (integer) date("d", $timestamp); - for($idx = 0; $idx < $lg; ++$idx) { - $char = $format[$idx]; - if ($state == 0) { - if ($char == '%') { - $state = 1; - } else { - $fmt .= $char; - } - } - elseif ($state == 1) { - if (array_key_exists($char, $mysql_replacement)) { - $fmt .= $mysql_replacement[$char]; - } else { - $calc_year = 0; - switch ($char) { - case 'j': // day of the year 001 - $char = sprintf("%03d", $yday+1); - break; - case 'U': // mode 0: semaine 0 = premiere semaine complète qui commence un dimanche - $char = sprintf("%02d", self::calc_week($year, $month, $day, 4, $calc_year)); - break; - case 'u': // mode 1: semaine 0 = première semaine de 4 jours. Début le dimanche - $char = sprintf("%02d", self::calc_week($year, $month, $day, 1, $calc_year)); - break; - case 'V': // mode 2: semaine 1 = premiere semaine complète qui commence un dimanche - $char = sprintf("%02d", self::calc_week($year, $month, $day, 6, $calc_year)); - break; - case 'v': // mode 3: semaine 1 = premiere semaine de 4 jours. Début le lundi - $char = sprintf("%02d", self::calc_week($year, $month, $day, 3, $calc_year)); - break; - case 'X': - self::calc_week($year, $month, $day, 6, $calc_year); - $char = sprintf("%04d", $calc_year); - break; - case 'x': - self::calc_week($year, $month, $day, 3, $calc_year); - $char = sprintf("%04d", $calc_year); - break; - } - $fmt .= $char; - } - $state = 0; - } - } - return date($fmt, strtotime($date)); - } - - /** * calc_daynr * @@ -1467,20 +1315,6 @@ class DoliDBSqlite3 extends DoliDB return (($year & 3) == 0 && ($year%100 || ($year%400 == 0 && $year)) ? 366 : 365); } - /** - * week_mode - * - * @param string $mode Mode - * @return integer Week format - */ - private static function week_mode($mode) { - $week_format= ($mode & 7); - if (!($week_format & self::WEEK_MONDAY_FIRST)) { - $week_format^= self::WEEK_FIRST_WEEKDAY; - } - return $week_format; - } - /** * calc_week * diff --git a/htdocs/core/filemanagerdol/connectors/php/io.php b/htdocs/core/filemanagerdol/connectors/php/io.php index 966efd0f0af..72aea0e0eb0 100644 --- a/htdocs/core/filemanagerdol/connectors/php/io.php +++ b/htdocs/core/filemanagerdol/connectors/php/io.php @@ -21,6 +21,14 @@ * * This is the File Manager Connector for PHP. */ + +/** + * CombinePaths + * + * @param string $sBasePath sBasePath + * @param string $sFolder sFolder + * @return string Combined path + */ function CombinePaths( $sBasePath, $sFolder ) { return RemoveFromEnd($sBasePath, '/') . '/' . RemoveFromStart($sFolder, '/'); @@ -45,8 +53,8 @@ function GetResourceTypePath($resourceType, $sCommand) /** * GetResourceTypeDirectory * - * @param unknown_type $resourceType Resource type - * @param unknown_type $sCommand Command + * @param string $resourceType Resource type + * @param string $sCommand Command * @return string */ function GetResourceTypeDirectory($resourceType, $sCommand) @@ -99,7 +107,7 @@ function RemoveExtension($fileName) * @param string $resourceType Resource type * @param string $folderPath Folder * @param string $sCommand Command - * @return void + * @return string */ function ServerMapFolder($resourceType, $folderPath, $sCommand) { @@ -380,6 +388,14 @@ EOF; // DOL_CHANGE // This is the function that sends the results of the uploading process to CKE. +/** + * SendCKEditorResults + * + * @param string $callback callback + * @param string $sFileUrl sFileUrl + * @param string $customMsg customMsg + * @return void + */ function SendCKEditorResults ($callback, $sFileUrl, $customMsg = '') { echo '